Index: AXimpl/Admin/STAT/Invoice/Processor.cls.xml
===================================================================
diff -u -r49533 -r49539
--- AXimpl/Admin/STAT/Invoice/Processor.cls.xml (.../Processor.cls.xml) (revision 49533)
+++ AXimpl/Admin/STAT/Invoice/Processor.cls.xml (.../Processor.cls.xml) (revision 49539)
@@ -18,6 +18,13 @@
1
+
+
+
+
InvoiceLineIterator:AXimpl.Admin.STAT.Invoice.LineIterator,ProductApi:DOM.PM.ProductAPI,DateTimeApi:TECH.DateTime.DateTimeAPI
1
@@ -38,30 +45,45 @@
In ...InfoRec()-methods)
If $$$Not(KlantNr = VorigeKlantNr) {
- Do ..KillSubscripts("KlantMaandRec", KlantNr,, Maand)
+ Do ..KillSubscript("KlantMaandRec", KlantNr,, Maand)
If $$$Not(ProductBestaatNiet) {
- Do ..KillSubscripts("KlantProductMaandRec", KlantNr, ProductId, Maand)
+ Do ..KillSubscript("KlantProductMaandRec", KlantNr, ProductId, Maand)
}
}
If ($$$Not(ProductId = VorigProductId) && $$$Not(ProductBestaatNiet)) {
- Do ..KillSubscripts("KlantProductMaandRec", KlantNr, ProductId, Maand)
- // Kill ProductMaandRec KSTPR(P,0,M) => ("ProductMaandRec", ProductId, Maand)
+ Do ..KillSubscript("KlantProductMaandRec", KlantNr, ProductId, Maand)
+ If $$$Not($Data(mdProductId(ProductId))) {
+ Do ..KillSubscript("ProductMaandRec",, ProductId, Maand)
+ Set mdProductId(ProductId)=""
+ If $$$Not($Data(mdKlantNr(KlantNr))) {
+ Do ..KillSubscript("ProductKlantMaandRec", KlantNr, ProductId, Maand)
+ Set mdKlantNr(KlantNr)=""
+ }
+ }
}
+ // SETTERS
Do ..ProcessKlantLastInfoRec(Line, KlantNr)
Do ..ProcessKlantMaandRec(Line, KlantNr, Maand)
If $$$Not(ProductBestaatNiet) {
Do ..ProcessKlantProductLastInfoRec(Line, KlantNr, ProductId)
- Do ..ProcessKlantProductMaandRec(Line, KlantNr, ProductId, Maand)
+ Do ..ProcessKlantProductMaandRec(Line, KlantNr, ProductId, Maand) // Ook ProductMaandRec EN ProductKlantMaandRec
}
;Do ..SetLastProcessedRecord(Line.RecId)
+
Set VorigeKlantNr = KlantNr
Set VorigProductId = ProductId
}
@@ -70,7 +92,7 @@
]]>
-
+
Variatie:%String,KlantNr:%Integer=0,ProductId:%Integer=0,Maand:%String=""
1
@@ -101,7 +127,7 @@
#dim DatumLine As %Date = ##class(TECH.DateTime).TextToDate(ConvertedInvoiceDateLine)
#dim EditNodigKlantLastInfoRec As %Boolean = DatumLine >= DatumKlantLastInfoRec
If EditNodigKlantLastInfoRec {
- Do ..KillSubscripts("KlantLastInfo", KlantNr)
+ Do ..KillSubscript("KlantLastInfo", KlantNr)
Set KlantLastInfoRec = $Get(^KSTKL(KlantNr,0,0),"")
Set $Piece(KlantLastInfoRec,"\",1) = ConvertedInvoiceDateLine
Set ^KSTKL(KlantNr,0,0) = KlantLastInfoRec
@@ -118,7 +144,7 @@
Set $Piece(KlantMaandRec,"\",1)= $Piece(KlantMaandRec,"\",1) + Line.InventQty
Set $Piece(KlantMaandRec,"\",2)= $Piece(KlantMaandRec,"\",2) + 1
Set $Piece(KlantMaandRec,"\",3)= $Piece(KlantMaandRec,"\",3) + Line.LineAmount
- ;Set $Piece(KlantMaandRec,"\",4) = ..GeefMarge(Line)
+ ;Set $Piece(KlantMaandRec,"\",4) = ..GeefMarge() // Als laatste via $Order te verkrijgen
Set ^KSTKL(KlantNr,0,Maand) = KlantMaandRec
]]>
@@ -133,21 +159,21 @@
If $$$Not(BestaatKlantProductLastInfoRec) {
Set $Piece(KlantProductLastInfoRec,"\",1) = ConvertedInvoiceDateLine
Set $Piece(KlantProductLastInfoRec,"\",2) = Line.LineAmount
- Set $Piece(KlantProductLastInfoRec,"\",3) = ..GeefVerkoopEenheid(Line)
- Set $Piece(KlantProductLastInfoRec,"\",4) = "EUR"
+ ;Set $Piece(KlantProductLastInfoRec,"\",3) = ..GeefVerkoopEenheid(Line)
+ ;Set $Piece(KlantProductLastInfoRec,"\",4) = "EUR"
;Set $Piece(KlantProductLastInfoRec,"\",5) = 1
Set ^KSTKL(KlantNr,ProductId,0) = KlantProductLastInfoRec
} Else {
#dim DatumKlantProductLastInfoRec As %Date = ##class(TECH.DateTime).TextToDate($Piece(KlantProductLastInfoRec,"\",1))
#dim DatumLine As %Date = ##class(TECH.DateTime).TextToDate(ConvertedInvoiceDateLine)
#dim EditNodigKlantProductLastInfoRec As %Boolean = DatumLine >= DatumKlantProductLastInfoRec
If EditNodigKlantProductLastInfoRec {
- Do ..KillSubscripts("KlantProductLastInfo", KlantNr, ProductId)
+ Do ..KillSubscript("KlantProductLastInfo", KlantNr, ProductId)
Set KlantProductLastInfoRec = $Get(^KSTKL(KlantNr,ProductId,0),"")
Set $Piece(KlantProductLastInfoRec,"\",1) = ConvertedInvoiceDateLine
Set $Piece(KlantProductLastInfoRec,"\",2) = Line.LineAmount
- Set $Piece(KlantProductLastInfoRec,"\",3) = ..GeefVerkoopEenheid(Line)
- Set $Piece(KlantProductLastInfoRec,"\",4) = "EUR"
+ ;Set $Piece(KlantProductLastInfoRec,"\",3) = ..GeefVerkoopEenheid(Line)
+ ;Set $Piece(KlantProductLastInfoRec,"\",4) = "EUR"
;Set $Piece(KlantProductLastInfoRec,"\",5) = 1
Set ^KSTKL(KlantNr,ProductId,0) = KlantProductLastInfoRec
}
@@ -165,6 +191,20 @@
Set $Piece(KlantProductMaandRec,"\",3) = $Piece(KlantProductMaandRec,"\",3) + Line.LineAmount
Set $Piece(KlantProductMaandRec,"\",4) = ..GeefMargeVoorProduct(Line,ProductId,$Piece(KlantProductMaandRec,"\",1),$Piece(KlantProductMaandRec,"\",3))
Set ^KSTKL(KlantNr,ProductId,Maand) = KlantProductMaandRec
+
+ #dim ProductMaandRec As %String = $Get(^KSTPR(ProductId,0,Maand),"")
+ Set $Piece(ProductMaandRec,"\",1) = $Piece(ProductMaandRec,"\",1) + Line.InventQty
+ Set $Piece(ProductMaandRec,"\",2) = $Piece(ProductMaandRec,"\",2) + 1
+ Set $Piece(ProductMaandRec,"\",3) = $Piece(ProductMaandRec,"\",3) + Line.LineAmount
+ ;Set $Piece(ProductMaandRec,"\",4) = ..GeefMarge() // Als laatste via $Order te verkrijgen
+ Set ^KSTPR(ProductId,0,Maand) = ProductMaandRec
+
+ #dim ProductKlantMaandRec As %String = $Get(^KSTPR(ProductId,KlantNr,Maand),"")
+ Set $Piece(ProductKlantMaandRec,"\",1) = $Piece(ProductKlantMaandRec,"\",1) + Line.InventQty
+ Set $Piece(ProductKlantMaandRec,"\",2) = $Piece(ProductKlantMaandRec,"\",2) + 1
+ Set $Piece(ProductKlantMaandRec,"\",3) = $Piece(ProductKlantMaandRec,"\",3) + Line.LineAmount
+ Set $Piece(ProductKlantMaandRec,"\",4) = ..GeefMargeVoorProduct(Line,ProductId,$Piece(ProductKlantMaandRec,"\",1),$Piece(ProductKlantMaandRec,"\",3))
+ Set ^KSTPR(ProductId,KlantNr,Maand) = ProductKlantMaandRec
]]>
@@ -184,13 +224,6 @@
Set $Piece(ProductLastInfoRec,"\",5) = 1
Set ^KSTPR(AdminProductId,0,0) = ProductLastInfoRec
- #dim ProductRec As %String = $Get(^KSTPR(AdminProductId,0,PeriodeSubscript),"")
- Set $Piece(ProductRec,"\",1) = $Piece(ProductRec,"\",1)+Line.InventQty
- Set $Piece(ProductRec,"\",2) = $Piece(ProductRec,"\",2)+1
- Set $Piece(ProductRec,"\",3) = ..GeefMarge(Line)
- Set $Piece(ProductRec,"\",4) = $Piece(ProductRec,"\",4)+(Line.InventQty*Line.LineAmount)
- Set ^KSTPR(AdminProductId,0,PeriodeSubscript) = ProductRec
-
#dim ProductKlantLastInfoRec As %String = $Get(^KSTPR(AdminProductId,KlantNr,0),"")
Set $Piece(ProductKlantLastInfoRec,"\",1) = $$EXTDATE^vhLib.DataType(Line.InvoiceDate,"DD.MM.JJ")
Set $Piece(ProductKlantLastInfoRec,"\",2) = Line.LineAmount