EWBON3 ;E'WMS Opmaken leveringsbon (EDI verwerking) [ 10/11/2002 8:54 AM ] ;Quit ; ; Ophalen van de EDI-groepen van een order GETEDIGR(ORDNr,OLUNr,MetFakt) New R,KLNr,OLNr,EDIGroep Set KLNr=$P(^KO1(ORDNr,"F"),D),OLNr=^ORD("IU",ORDNr,OLUNr),R=^KOD(KLNr,"F",ORDNr,OLNr) Set EDIGroep=$P(R,D,35) Set:$G(MetFakt) EDIGroep=EDIGroep_D_$P(R,D,36) Quit EDIGroep ; ; Kontrole of alle lijnen van een EDI-groep hetzelfde aantal hebben CHKEDIGR(CONSNr,ORDNr,BackGrnd) New R,EDIGroep,OLUNr,Faktor,PRNr,AantWMS,TxtPop,MailId,KortTxt,KLNr,KlNaam,Count,SortKey Set BackGrnd=$G(BackGrnd) If '$G(ORDNr) Do .Set ORDNr="" .For Set ORDNr=$O(^ORDW("D",CONSNr,"D",ORDNr)) Quit:ORDNr="" Do CHKEDIGR(CONSNr,ORDNr,BackGrnd) Else Do .Set KLNr=$P(^KO1(ORDNr,"F"),D),OLUNr="" .For Set OLUNr=$O(^ORDW("D",CONSNr,"D",ORDNr,OLUNr)) Quit:OLUNr="" Do ..Set EDIGroep=$$GETEDIGR(ORDNr,OLUNr,1),Faktor=$P(EDIGroep,D,2) ..Set:'Faktor Faktor=1 Set EDIGroep=$P(EDIGroep,D) ..Quit:EDIGroep="" ..Set R=^ORDW("D",CONSNr,"D",ORDNr,OLUNr),PRNr=$P(R,D),AantWMS=$P(R,D,5) ..Set SortKey=$$SORTKEY^PRODUKT(PRNr) ..Set EDIGroep($P(EDIGroep,"."),SortKey_OLUNr)=PRNr_D_AantWMS_D_(AantWMS/Faktor)_D_Faktor .Set EDIGroep="" .For Set EDIGroep=$O(EDIGroep(EDIGroep)) Quit:EDIGroep="" Do ..Set ChkEDIGr="",SortKey="" ..For Set SortKey=$O(EDIGroep(EDIGroep,SortKey)) Quit:SortKey="" Do Quit:'ChkEDIGr ...Set R=EDIGroep(EDIGroep,SortKey) ...If ChkEDIGr,$P(R,D,3)'=ChkEDIGr Set ChkEDIGr=0 Quit ...Set ChkEDIGr=$P(R,D,3) ..Set EDIGroep(EDIGroep)=ChkEDIGr .Set EDIGroep="" .For Set EDIGroep=$O(EDIGroep(EDIGroep)) Quit:EDIGroep="" Do ..Quit:EDIGroep(EDIGroep) ..Kill TxtPop ..Set Count=0,KlNaam=$P(^KKL(^KK1(KLNr),0),D,2) ..Set R="In het order "_$$EXTNUM^vhLib.DataTypes(ORDNr,0,".",0)_" van "_$E(KlNaam,1,20) ..Set Count=Count+1,TxtPop(Count)=R_$S(BackGrnd:"~",1:"") ..Set R="behoren volgende produkten tot een EDI-groep." ..Set Count=Count+1,TxtPop(Count)=R_$S(BackGrnd:"~",1:"") ..Set R="Minstens een heeft een foutief aantal." ..Set Count=Count+1,TxtPop(Count)=R_$S(BackGrnd:"~",1:"") ..Set Count=Count+1,TxtPop(Count)=$S(BackGrnd:"~",1:"&S") ..Set SortKey="" ..For Set SortKey=$O(EDIGroep(EDIGroep,SortKey)) Quit:SortKey="" Do ...Set R=EDIGroep(EDIGroep,SortKey),PRNr=$P(R,D),AantWMS=$P(R,D,2) ...Set R=^KPR(PRNr,0),KortTxt=$P(R,D),R=KortTxt_$J("",26-$L(KortTxt))_"|"_$$EXTNUM^vhLib.DataTypes(AantWMS,18,".",0) ...Set Count=Count+1,TxtPop(Count)=R_$S(BackGrnd:"~",1:"") ..Set TxtPop="TxtPop" ..If 'BackGrnd Set R=$$WILD^vhTXTPOP("","",.TxtPop) Quit ..Set MailId=$$SYSTEM^vhMAIL("KL",KLNr,"Aantal EDI-groep",3,.TxtPop,,1,1) Quit ;