cAFVBP07 ; Producten : Bestellingen / Orders ; cAFVBP07 ; YZ Q ; BTEMP(GRIDID,KEUID,SW,QTD) ; Opbouw ^mtemp99 bestellingen of orders ; GRIDID: Volgnr van de grid : indien '' : volgnummer ophalen ; KEUID: Ofwel: GridId van de ^mtemp99 met geselecteerde UI1's ; Ofwel: Geselecteerd ID (begint met $$) ; SW: T : Bestellingen ; R : Orders ; S $ZT="ERR^cAFVBF01" N @$$INITVAR^cAFVBA01("GRIDID,KEUID,SW,QTD") ; ; Controle parameters BTEMPA F i="GRIDID","KEUID","SW","QTD" S @i=$g(@i) I '$L(GRIDID) S GRIDID=$$GRIDID^cAFVBF01() ; BTEMPB K ^mtemp99(GRIDID,"COMMON") S OK=GRIDID S VOLGNR=1000 ; S KEUGRIDID=$$GRIDID^cAFVBF01() ; GRIDID voor aangepast grid met 'oude' productids ; slechts 1 product ;I $E(KEUID,1,2)="$$" S PR=$P(KEUID,"$$",2),^mtemp99(KEUGRIDID,"COMMON",$$DATA^cAFVBO01("^DPR","EA","PR.A",PR,150))="" G BTEMPC ; meerdere producten geselecteerd ;I $L(KEUID),'$D(^mtemp99(KEUID,"COMMON")) G BTEMPZ ; ; omvormen 'nieuwe' productids naar 'oude' D BTMPPR^cAFVBP06(KEUID,KEUGRIDID) ; ; onderscheid maken tussen bestellingen (leveranciers) en orders (klanten) BTEMPC S DMS="LE" I SW="R" S DMS="KL" S LEKLREF=$P($$REF^cAFA10(.Q,DMS_".A"),D) I '$L(LEKLREF) G BTEMPZ S LEKLREF=$$REPL^cAFA10(LEKLREF,"UI1","UI1LEKL") ; S REF=$$REF^cAFA10(.Q,"PR") S UREF=$P(REF,D) ; ; alle (geselecteerde) producten doorlopen S UI1="" BTEMPD S UI1=$O(^mtemp99(KEUGRIDID,"COMMON",UI1)) G:'$L(UI1) BTEMPY ; ; alle T- of R-lijnen per product doorlopen S PRLIJN=SW ; T- of R-lijn BTEMPE S PRLIJN=$O(@UREF@(PRLIJN)) G:$E(PRLIJN)'=SW BTEMPD ; ; opbouwen mtemp99 K N S LIJN=@UREF@(PRLIJN) S $P(N(0),D)=$P(@UREF@(0),D) ; productcode S $P(N(0),D,2)=$S(QTD="":$P(@UREF@(0),D,2),QTD="F":$P(@UREF@(1),D,22),QTD="D":$P(@UREF@(2),D,2),QTD="E":$P(@UREF@(2),D,1)) ; product omschrijving I '$L($P(LIJN,D,2)) G BTEMPF ; geen klant of leverancier S UI1LEKL=$$SG^cAFA1(DMS,$P(LIJN,D,2),148) S $P(N(0),D,3)=$P(@LEKLREF@(0),D) ; nummer klant/leverancier S $P(N(0),D,4)=$P(^(0),D,2) ; naam klant/leverancier BTEMPF S $P(N(0),D,5)=$TR($E(PRLIJN,10,15)," ","") ; documentnummer S $P(N(3),D)=$P(LIJN,D) ; datum S $P(N(2),D)=$P(LIJN,D,5) ; Aantal S $P(N(3),D,2)=$P(LIJN,D,6) ; Lev. datum S $P(N(0),D,6)=$P(LIJN,D,7) ; Referentie document S $P(N(0),D,7)=$P($P(LIJN,D,8),"#",2) ; Referentie lijn ; M ^mtemp99(GRIDID,"COMMON",VOLGNR)=N ; S VOLGNR=VOLGNR+1 ; G BTEMPE ; BTEMPY K ^mtemp99(KEUGRIDID) ; BTEMPZ Q OK ; ZZ ; 29.08.07 - 10 u 22 * V8.09