Index: LEVADR.mac.rou =================================================================== diff -u -r1991 -r2041 --- LEVADR.mac.rou (.../LEVADR.mac.rou) (revision 1991) +++ LEVADR.mac.rou (.../LEVADR.mac.rou) (revision 2041) @@ -134,4 +134,19 @@ . . Set $P(AdresRec,D,19)="" Quit AdresRec ; - \ No newline at end of file + ; Is een klant opgenomen in het leveradres van een andere klant +IsKlantInAdres(KLNr,Type,Detail) + New LARec,IsKlantInAdres,KlKey,LAKey + Set Type=$G(Type),Detail=$G(Detail) + Set (KlKey,IsKlantInAdres)=0 + For Set KlKey=$O(^KKL(KlKey)) Quit:KlKey="" Do If 'Detail Quit:IsKlantInAdres + . Set LAKey="L" + . For Set LAKey=$O(^KKL(KlKey,LAKey)) Quit:$E(LAKey)'="L" Do If 'Detail Quit:IsKlantInAdres + . . Set LARec=^KKL(KlKey,LAKey) + . . Set:$P(LARec,D,12)="" $P(LARec,D,12)="L" + . . If $L(Type) Quit:$P(LARec,D,12)'=Type + . . Quit:$P(LARec,D,19)'=KLNr + . . Set:'IsKlantInAdres IsKlantInAdres=1 + . . If Detail,D_Detail_D'[(D_$P(KlKey," ",2)_D) Set Detail=Detail_D_$P(KlKey," ",2)_";"_$P(LARec,D,12) + Quit IsKlantInAdres_$S(Detail:D_$P(Detail,D,2,999),1:"") + ; \ No newline at end of file