Index: AXimpl/Admin/STAT/Invoice/Processor.cls.xml =================================================================== diff -u -r49447 -r49523 --- AXimpl/Admin/STAT/Invoice/Processor.cls.xml (.../Processor.cls.xml) (revision 49447) +++ AXimpl/Admin/STAT/Invoice/Processor.cls.xml (.../Processor.cls.xml) (revision 49523) @@ -3,57 +3,176 @@ TECH.RegisteredObject + +AXimpl.Admin.STAT.Invoice.LineIterator +1 + + + +DOM.PM.ProductAPI +1 + + + +TECH.DateTime.DateTimeAPI +1 + + + +InvoiceLineIterator:AXimpl.Admin.STAT.Invoice.LineIterator,ProductApi:DOM.PM.ProductAPI,DateTimeApi:TECH.DateTime.DateTimeAPI +1 +1 +%Status +1 + + + Order By Klant of Product - Do ..ProcessKSTPR(Line, KlantNr) // Deze 2 uiteentrekken en elk een eigen query geven => Order By Klant of Product - Do ..SetLastProcessedRecord(Line.RecId) + If $$$Not(KlantNr = VorigeKlantNr) { + Do ..KillSubscripts(0, 0, 1, 0, KlantNr,, Maand) + If ($$$Not(ProductId = VorigProductId) && $$$Not(ProductBestaatNiet)) { + Do ..KillSubscripts(0, 0, 0, 1, KlantNr, ProductId, Maand) + } + } + Do ..ProcessKlantLastInfoRec(Line, KlantNr) + Do ..ProcessKlantMaandRec(Line, KlantNr, Maand) + If $$$Not(ProductBestaatNiet) { + Do ..ProcessProductLastInfoRec(Line, KlantNr, ProductId) + Do ..ProcessKlantProductMaandRec(Line, KlantNr, ProductId, Maand) + } + ;Do ..ProcessKSTPR(Line, KlantNr, ProductId, Maand) + ;Do ..SetLastProcessedRecord(Line.RecId) + Set VorigeKlantNr = KlantNr + Set VorigProductId = ProductId } } - Do ..ProcessKSPW(Line) // Deze een eigen query geven die optelling doet en pas nadien uitvoeren, als andere 2 statistieken klaar zijn + ;Do ..ProcessKSPW(Line) // Deze een eigen query geven die optelling doet en pas nadien uitvoeren, als andere 2 statistieken klaar zijn ]]> - -Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%String + +KlantLastInfo:%Boolean=0,ProductLastInfo:%Boolean=0,KlantMaandRec:%Boolean=0,KlantProductMaandRec:%Boolean=0,KlantNr:%Integer,ProductId:%Integer=0,Maand:%String="" 1 + +Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer +1 += DatumKlantLastInfoRec + If EditNodigKlantLastInfoRec { + Do ..KillSubscripts(1, 0, 0, 0, KlantNr) + Set KlantLastInfoRec = $Get(^KSTKL(KlantNr,0,0),"") + Set $Piece(KlantLastInfoRec,"\",1) = ConvertedInvoiceDateLine + Set ^KSTKL(KlantNr,0,0) = KlantLastInfoRec + } + } +]]> + + + +Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer,Maand:%String +1 + + + + +Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer,ProductId:%Integer +1 += DatumProductLastInfoRec + If EditNodigProductLastInfoRec { + Do ..KillSubscripts(0, 1, 0, 0, KlantNr, ProductId) + Set ProductLastInfoRec = $Get(^KSTKL(KlantNr,ProductId,0),"") + Set $Piece(ProductLastInfoRec,"\",1) = ConvertedInvoiceDateLine + Set $Piece(ProductLastInfoRec,"\",2) = Line.LineAmount + Set $Piece(ProductLastInfoRec,"\",3) = ..GeefVerkoopEenheid(Line) + Set $Piece(ProductLastInfoRec,"\",4) = "EUR" + ;Set $Piece(ProductLastInfoRec,"\",5) = 1 + Set ^KSTKL(KlantNr,ProductId,0) = ProductLastInfoRec + } + } +]]> + + + +Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer,ProductId:%Integer,Maand:%String +1 + + + Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%String 1 Line:AXimpl.Admin.STAT.Invoice.Line 1 @@ -119,21 +241,43 @@ ]]> - -Line:AXimpl.Admin.STAT.Invoice.Line + +Line:AXimpl.Admin.STAT.Invoice.Line,ProductId:%Integer,AantalStuks:%Integer,Omzet:%Decimal 1 %Numeric - Line:AXimpl.Admin.STAT.Invoice.Line 1 -%String +%Integer AdminProductNummer is meestal leeg en soms zelfs NULL (dan ItemId gebruiken => converten naar ProductNr) + #dim ProductId As %Integer = 0 + #dim ProductBestaat As %Boolean = $$$True + + If ((Line.AdminProductNummer = $Char(0)) || $$$Not($$$HasLength(Line.AdminProductNummer))) { + Set ProductBestaat = $$$False + } ElseIf ($$$Not(..ProductApi.BestaatProduct(Line.AdminProductNummer))) { + Set ProductBestaat = $$$False + } + + If ProductBestaat { + Set ProductId = Line.AdminProductNummer + } ElseIf (..ProductApi.BestaatIdentNr(Line.ItemId)) { + Set ProductId = ..ProductApi.GeefProductIdVoorIdentNummer(Line.ItemId) // I.g.v. Sopr voorlopig principaal gebruiken (= ItemId aangeleverd door AX) + } + + If ((ProductId = "2539") && (Line.InvoiceAccount = "01008")) { + w !,"Line.ItemId: '"_Line.ItemId_"'" + } + + Quit ProductId ]]> @@ -151,11 +295,20 @@ ]]> + +1 +%String + + + KlantNr:%String 1 %Boolean -