Proxy-klasse voor een PrijsLijst vhLib.Macro,BL.Sys.FOP.Common,BL.Flow.Doc.Common,Prod.Product,BL.EC.Common 1 %RegisteredObject,%XML.Adaptor PRIJSLIJST Datum van creatie van het document %Library.String Steeds "Prijslijst" %Library.String %Library.String %Library.String %Library.String %Library.String %Library.Date %Library.String %Library.String BL.FOP.Derde.pxKlantAdres pxOrderLijn list BL.Flow.Proxy.pxPPODfields BL.Flow.Proxy.pxPrijsLijstSettings BL.FOP.Basis.pxTekstHTML BL.FOP.Basis.pxTekstHTML Aanmaken van een PrijsLijst-proxy object 1 pxPrijsLijst d ##class(BL.Flow.Proxy.pxPrijsLijst).%New().FillViaStat(1239) KLNr:%String,lbPPODKeywords:%List,Opties:pxPrijsLijstSettings %Status "_ProdType,"Controleer ^RES(HAD,PI,GENTYP en ook Res.Vertaling:DOC") . If $L($P(SortKey,"`",3)) Set ProdType=$P(SortKey,"`",3),SortKey=$G(^RES("HAD","PI","GENTYP","D",ProdType),99) ; indirectie . Set SortKey=(1000+SortKey)_ProdType . Set List=$G(^HULP(%J,"G",SortKey)) . Set:List="" List=$LB("G",ProdType) . Set $LI(List,3)=$LG(List,3)+Qty . Set $LI(List,4)=$LG(List,4)+Omzet ; reele prijs . Set $LI(List,5)=$LG(List,5)+(Qty*$P(##class(BL.Flow.Proxy.pxProductLijn).GetKlantPrijs(KLNr,PRNr,"N"),"\",14)) ; huidige prijs . Set $LI(List,6)=$LG(List,6)+(Qty*$P(##class(BL.Flow.Proxy.pxProductLijn).GetKlantPrijs(KLNr,PRNr,"S"),"\",14)) ; schaduw prijs . Set ^HULP(%J,"G",SortKey)=List Quit fvsBuildProduct d WL^vhDBG("Start BuildProduct") Set Taal=..Taal Set (SortKey,MemKlas)="" Set LenKlas=$CASE(..Settings.ToonGroepScheiding,"H":4,"G":9,"L":9,:0) For Set SortKey=$O(^HULP(%J,"P",SortKey)) Quit:SortKey="" Do . Set List=^HULP(%J,"P",SortKey) . ;d WL^vhDBG("Build Product "_SortKey_" "_$$$LCVT(List)) . ; Hoofdgroep of groep scheiding . Set NewKlas=$E(SortKey,1,LenKlas) . If NewKlas'=MemKlas Do . . If (..Settings.ToonGroepScheiding="H")||((..Settings.ToonGroepScheiding="L")&&($E(NewKlas,1,4)'=$E(MemKlas,1,4))) Do . . . Set pxLijn=##class(pxTekstLijn).BuildFromString($P(^KPHG1($E(NewKlas,1,4)_" "),"\",$S(Taal="F":2,1:1))) . . . Do ..AppendLijn(pxLijn) . . Else If (..Settings.ToonGroepScheiding="L") Do . . . Set pxLijn=##class(pxTekstLijn).BuildSeparator("") . . . Do ..AppendLijn(pxLijn) . . Else If (..Settings.ToonGroepScheiding="G") Do . . . Set pxLijn=##class(pxTekstLijn).BuildFromString($P(^KPGR1(NewHG_" "),"\",$S(Taal="F":2,1:1))) . . . Do ..AppendLijn(pxLijn) . . Set MemKlas=NewKlas . ; Product . If $LG(List)="P" Do . . Set pxLijn=##class(pxProductLijn).BuildFromPrijsLijst(KLNr,$LG(List,2),$LG(List,3),$LG(List,4),Taal,..BrutoNetto="B",..Settings) . . Do ..AppendLijn(pxLijn) Quit fvsBuildGroep #Define Groep "DOC" #Define GenTyp "GENTYP:" #Define Maatwerk "PL:MAATW:GROEP" #Define Titel "PL:MAATW:TITEL" #Define Aantal "PL:MAATW:AANTAL" #Define HPrijs "PL:MAATW:HPRIJS" #Define NPrijs "PL:MAATW:NPRIJS" #Define Single "PL:MAATW:SINGLE" #define HTMLBreak "
" ;d WL^vhDBG("Start BuildGroep") Set Taal=..Taal Set pxLijn=##class(pxTekstLijn).BuildFromString(##class(Res.Vertaling).GetVertaling($$$Groep, $$$Maatwerk,"L", Taal)) Do ..AppendLijn(pxLijn) Set (SortKey,MemKlas)="" For Set SortKey=$O(^HULP(%J,"G",SortKey)) Quit:SortKey="" Do . Set List=^HULP(%J,"G",SortKey) . Set ProdType=$LI(List,2) . Set Aantal=$LI(List,3) . ;d WL^vhDBG("Build groep "_SortKey_" "_$$$LCVT(List)) . Quit:Aantal<1 . Set HPrijs=$$FormatNumber^vhLib("#.##0,00",$LI(List,5)/Aantal)_" "_..Munt . Set NPrijs=$$FormatNumber^vhLib("#.##0,00",$LI(List,6)/Aantal)_" "_..Munt . Set ProductOms=##class(Res.Vertaling).GetVertaling($$$Groep, $$$GenTyp_ProdType,"L", Taal) ; omschrijving van Gentype . Set Tekst=##class(Res.Vertaling).GetVertaling($$$Groep, $$$Titel,"L", Taal,ProductOms) ; omschrijving plaatsen in bold . Set Tekst=Tekst_$$$HTMLBreak_##class(Res.Vertaling).GetVertaling($$$Groep, $$$HPrijs,"L", Taal,HPrijs) . Set Tekst=Tekst_$$$HTMLBreak_##class(Res.Vertaling).GetVertaling($$$Groep, $$$NPrijs,"L", Taal,NPrijs) . Set:Aantal>1 Tekst=Tekst_$$$HTMLBreak_##class(Res.Vertaling).GetVertaling($$$Groep, $$$Aantal,"L", Taal,$$FormatNumber^vhLib("#.##0",Aantal)) . Set:Aantal=1 Tekst=Tekst_$$$HTMLBreak_##class(Res.Vertaling).GetVertaling($$$Groep, $$$Single,"L", Taal) . Set Tekst=$$$Replace(Tekst," ",$C(160)) . Set pxLijn=##class(pxTekstLijn).BuildHTML(Tekst,0,1) ; zonder conversie . Do ..AppendLijn(pxLijn) Quit fvsAlgemeen(KLNr,Taal) Set blnBruto=0 ; ''($P($G(^KOD(KLNr,"F",ORDNr,1)),"\",27)) Set ..DocDatum=$$EXTDATE^vhDTyp($H) Set ..DocType="" ; PrijsLijst Set ..KlantNr=KLNr Set KLID=^KK1(KLNr) Set ..KlantNaam=$P(^KKL(KLID,0),"\",2) Set ..Munt=$P(^KKL(KLID,0),"\",11) Set ..BtwNr=##class(BL.FOP.Derde.pxAdres).BtwNrTekst($P(^KKL(KLID,0),"\",16)) Set ..BrutoNetto=$S($L(..Settings.ForceNettoBrutoPrijzen):..Settings.ForceNettoBrutoPrijzen,$P(^KKL(KLID,2),"\",5):"B",1:"N") Set ..Taal=$S($L(..Settings.ForceTaal):..Settings.ForceTaal,1:$P(^KKL(KLID,0),"\",9)) Set Taal=..Taal Set pxFAdr=##class(BL.FOP.Derde.pxKlantAdres).%New() Do pxFAdr.FillViaKLNr(KLNr,"") Set ..FactAdres=pxFAdr Do ..BuildTekst(KLNr,Taal) Quit fvsPPODfields(KLNr,Regio,Adres,SpecialPrintGroep) Quit:($G(lbPPODKeywords)=$LB()) Set Regio=##class(BL.Flow.PrijsLijst.Doc).PPODRegioConvert(Regio,.SpecialPrintGroep) Set Ref="PL"_";"_KLNr Set DocSort=1 Set EnvelopKey=$G(Adres)_";"_KLNr Set pxPPOD=##class(BL.Flow.Proxy.pxPPODfields).Create($$$ppodtPrijsLijst,Regio,Taal,KLNr,Ref," ",$G(Bijlage," "),DocSort,EnvelopKey,) Do:($LL($G(lbPPODKeywords))) pxPPOD.FillFromLB(lbPPODKeywords) Set ..PPODFIELDS=pxPPOD Quit fvsDefaultSettings Set ..Settings.VanMaand=$H-365 Set ..Settings.TotMaand=$H Set ..Settings.BeperkAfgeleide="G" Set ..Settings.ToonGroepScheiding="H" Set ..Settings.PrijsFormat="DIF" Set ..Settings.NoSa="S" Set ..Settings.TekstNa=$LB("PL:TEKST:GELDIGVANAF") Set ..Settings.TekstVoor=$LB("PL:TEKST:GELDIGVANAF") ;Set ..Settings.CallBackProduct="CF`BL.Flow.Proxy.pxPrijsLijst`Check2008" Set ..Settings.GeldigVan=+$H ;$zdh("05/09/2008",4) Set ..Settings.TekstVoor=$LB("Default Settings By WimV") _ ..Settings.TekstVoor _$LB("Default Settings By WimV") Quit ]]>
PrijsLijst SlotTekst KLNr:%String,Taal:%String ",Tekst,! . Quit:(Tekst="") . Do oTxt.Append(Tekst,0,.IsHtml) . Do oTxt.AppendEmptyTag("BR") . Do:$LL(List)'=I oTxt.AppendEmptyTag("BR") ; elke blanko lijn geeft een nieuwe paragraaf ]]> Get KLANT^STAT(...) Returns piece-delimited string 1 KLNr:%String,PRNr:%String,Begin:%String,Einde:%String,Piece:%String,Simul:%String 0 %String Result : -1 niet toegelaten, 1 = toegelaten, 0 is eventueel toegelaten afh van andere criteria 1 KLNr,PRNr,oSettings Result : -1 niet toegelaten, 1 = zeker toegelaten, 0 is eventueel toegelaten afh van andere criteria 1 KLNr,PRNr,oSettings Result : -1 niet toegelaten, 1 = zeker toegelaten, 0 is eventueel toegelaten afh van andere criteria s px=##class(BL.Flow.Proxy.pxPrijsLijstSettings).%New,px.VanMnd=$H-30 w ##class(BL.Flow.pxPrijsLijst).CheckNewImage(1239,445619, 1 KLNr,PRNr,oSettings Result : -1 niet toegelaten, 1 = zeker toegelaten, 0 is eventueel toegelaten afh van andere criteria s px=##class(BL.Flow.Proxy.pxPrijsLijstSettings).%New(),px.VanMaand=$H-30 s p=0 f s p=$o(^KPR(p)) w ##class(BL.Flow.Proxy.pxPrijsLijst).CheckNewImage(1239,p,px) 1 KLNr,PRNr,oSettings 10 Do . . Set CreatieDate=$P($ZDTH(CreatieTijdStip,3),",") . . If Date'>CreatieDate Do ; toelaten als eerste keer . . . ;r k . . . Set ImageURL=blImage.GetProductImageURL(PRNr,"FILE") ; proxy met URL van product beeld om ge-embed te worden in de PDF door FOP . . . If $L(ImageURL),'$D(%NewImageCache(ImageURL)) Do . . . . Set %NewImageCache(ImageURL)="" . . . . Set Found=0 ; toelaten . . . . ;r " found",K &sql(CLOSE CheckNewImage) Quit Found ]]> 1 KLNr,oSettings Controleer of een product mag opgenomen worden in de prijslijst van de klant Resultaat 1:Std productBeslag, xxx\yyy:GenType van afgeleidproduct, Leeg = niet opnemen KLNr,PRNr 1 0 1)&&(..Settings.BeperkAfgeleide="Z") "" ; Niet toegelaten ; Klassificatie If $LL(..Settings.BeperkKlassificaties) Do Quit:'Found "" . ; Subgroep . Set KKey=$$$PRGet($$$KlassificatieKey) . Set Found=$LF(..Settings.BeperkKlassificaties,KKey) ; Subgroep . Quit:Found . ; Groep . Set KKey=$P($G(^KLAS("K",KKey)),"\",9) . Set Found=$LF(..Settings.BeperkKlassificaties,KKey) ; Groep . Quit:Found . ; Hoofdgroep . Set KKey=$P($G(^KLAS("K",KKey)),"\",8) . Set Found=$LF(..Settings.BeperkKlassificaties,KKey) ; Hoofdgroep ; Leveranciers If $LL(..Settings.BeperkLeveranciers) Do Quit:'Found "" . Set LEVNr=$$$PRGet($$$LeveranciersNr) . Set Found=$LF(..Settings.BeperkLeveranciers,LEVNr) ; GenType If $LL(..Settings.BeperkGenTypes) Do Quit:'Found "" . S Found=NotImplemented ; not implemented Quit ProdType ]]> KLNr 1 0 steeds toegelaten ; Standaard beperking op regios If '..Settings.AlleRegios Do Quit:('Regio)||(Regio>29) -1 . Set KLID=^KK1(KLNr) . Set Regio=$P(^KKL(KLID,0),"\",20) Quit:'$$CHECK^KLANT6(KLNr,1) -1 ;non aktief of verwijderd Quit:'$L(..Settings.CallBackKlant) 1 Set oSettings=..Settings Do EXECS^vhRES(..Settings.CallBackKlant,"Result","(KLNr,oSettings)") Quit $G(Result) ]]> pxLijn:pxOrderLijn 1