Index: AXimpl/Admin/STAT/Invoice/Processor.cls.xml =================================================================== diff -u -r49542 -r49545 --- AXimpl/Admin/STAT/Invoice/Processor.cls.xml (.../Processor.cls.xml) (revision 49542) +++ AXimpl/Admin/STAT/Invoice/Processor.cls.xml (.../Processor.cls.xml) (revision 49545) @@ -50,7 +50,7 @@ Kill mdProductId Kill mdKlantNr While ..InvoiceLineIterator.HasNext() { - // VOLGORDE IS: KlantNr oplopend en per KlantNr ProductId oplopend !!! + // VOLGORDE ITERATOR IS = KlantNr oplopend en per KlantNr ProductId oplopend !!! #dim Line As AXimpl.Admin.STAT.Invoice.Line = ..InvoiceLineIterator.Next() #dim KlantNr As %Integer = +Line.InvoiceAccount #dim ProductId As %Integer = ..GetAdminProductId(Line) @@ -79,7 +79,7 @@ Do ..ProcessKlantLastInfoRec(Line, KlantNr) Do ..ProcessKlantMaandRec(Line, KlantNr, Maand) If $$$Not(ProductBestaatNiet) { - Do ..ProcessKlantProductLastInfoRec(Line, KlantNr, ProductId) + Do ..ProcessKlantProductLastInfoRec(Line, KlantNr, ProductId) // Ook ProductKlantLastInfoRec Do ..ProcessKlantProductMaandRec(Line, KlantNr, ProductId, Maand) // Ook ProductMaandRec EN ProductKlantMaandRec Do ..ProcessProductLastInfoRec(Line, ProductId) } @@ -106,6 +106,8 @@ Kill ^KSTKL(KlantNr,ProductId,Maand) } ElseIf (Variatie = "ProductLastInfoRec") { Kill ^KSTPR(ProductId,0,0) + } ElseIf (Variatie = "ProductKlantLastInfoRec") { + Kill ^KSTPR(ProductId,KlantNr,0) } ElseIf (Variatie = "ProductMaandRec") { Kill ^KSTPR(ProductId,0,Maand) } ElseIf (Variatie = "ProductKlantMaandRec") { @@ -179,9 +181,11 @@ Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer,ProductId:%Integer 1 = DatumKlantProductLastInfoRec If EditNodigKlantProductLastInfoRec { Do ..KillSubscript("KlantProductLastInfoRec", KlantNr, ProductId) @@ -204,6 +207,30 @@ Set ^KSTKL(KlantNr,ProductId,0) = KlantProductLastInfoRec } } + + #dim BestaatProductKlantLastInfoRec As %Boolean = $Data(^KSTPR(ProductId,KlantNr,0)) + #dim ProductKlantLastInfoRec As %String = $Get(^KSTPR(ProductId,KlantNr,0),"") + If $$$Not(BestaatProductKlantLastInfoRec) { + Set $Piece(ProductKlantLastInfoRec,"\",1) = ConvertedInvoiceDateLine + Set $Piece(ProductKlantLastInfoRec,"\",2) = Line.LineAmount + ;Set $Piece(ProductKlantLastInfoRec,"\",3) = ..GeefVerkoopEenheid(Line) + ;Set $Piece(ProductKlantLastInfoRec,"\",4) = "EUR" + ;Set $Piece(ProductKlantLastInfoRec,"\",5) = 1 + Set ^KSTPR(ProductId,KlantNr,0) = ProductKlantLastInfoRec + } Else { + #dim DatumProductKlantLastInfoRec As %Date = ##class(TECH.DateTime).TextToDate($Piece(ProductKlantLastInfoRec,"\",1)) + #dim EditNodigProductKlantLastInfoRec As %Boolean = DatumLine >= DatumProductKlantLastInfoRec + If EditNodigProductKlantLastInfoRec { + Do ..KillSubscript("ProductKlantLastInfoRec", KlantNr, ProductId) + Set ProductKlantLastInfoRec = $Get(^KSTPR(ProductId,KlantNr,0),"") + Set $Piece(ProductKlantLastInfoRec,"\",1) = ConvertedInvoiceDateLine + Set $Piece(ProductKlantLastInfoRec,"\",2) = Line.LineAmount + ;Set $Piece(ProductKlantLastInfoRec,"\",3) = ..GeefVerkoopEenheid(Line) + ;Set $Piece(ProductKlantLastInfoRec,"\",4) = "EUR" + ;Set $Piece(ProductKlantLastInfoRec,"\",5) = 1 + Set ^KSTPR(ProductId,KlantNr,0) = ProductKlantLastInfoRec + } + } ]]>