Index: cw.mac.rou =================================================================== diff -u -r734 -r762 --- cw.mac.rou (.../cw.mac.rou) (revision 734) +++ cw.mac.rou (.../cw.mac.rou) (revision 762) @@ -4,6 +4,32 @@ #Include %occInclude #Include %Prod.Product #Include %CHUI.System + +A B C D E F G H I J K L M N=O P Q R S U V W X Y,Z +H +Type2Proforma(ORDNr) + New R,KLNr,OLNr,OrdType,OrderTotaal,Proforma + Set KLNr=$P($G(^KO1(ORDNr,"F")),D),OrdType="",OrderTotaal=0 + If KLNr { + Set OrdType=$P(^KOD(KLNr,"F",ORDNr,1),D,25) + If OrdType'="M",OrdType'="P" { + Set OLNr=100 + For { + Set OLNr=$O(^KOD(KLNr,"F",ORDNr,OLNr)) + Quit:'OLNr + Set OrderTotaal=OrderTotaal+$P(^KOD(KLNr,"F",ORDNr,OLNr),D,9) + } + } + } + If OrdType'="M",OrdType'="P" { + If OrderTotaal,'$$IsVTW^KLANT(KLNr) Quit + Set Buttons="Buttons",Buttons(1)="Annuleer",Buttons(2)="Proforma&P",Buttons(3)="+ factuur&F" + Set:OrderTotaal Buttons(2)=Buttons(2)_"*" + Set:'OrderTotaal Buttons(3)=Buttons(3)_"*" + Set Proforma=$$^vhTXTPOP("FLOWORD","TYPE2PROFORMA","",$$EXTNUM^vhDTyp(ORDNr,0,".",0),$P(^KKL(^KK1(KLNr),0),D,2),$$EXTNUM^vhDTyp(OrderTotaal,0,".T",2)) + If $L(Proforma) Set R=^KOD(KLNr,"F",ORDNr,1),$P(R,D,25)="P",$P(R,D,29)=$S(Proforma="F":"P",1:"F"),^KOD(KLNr,"F",ORDNr,1)=R + } + Quit ; blg(Document,DocNum) New BevatLanggoed