Prod.Product TECH.RegisteredObject %String 1 AXimpl.Admin.STAT.Invoice.LineIterator 1 vhLib.Logger 1 DOM.PM.ProductAPI 1 AX.Uitgaand.EC.DataAX.impl.Translator 1 TECH.DateTime.DateTimeAPI 1 StatistiekMaand:%Date,InvoiceLineIterator:AXimpl.Admin.STAT.Invoice.LineIterator,Logger:vhLib.Logger,ProductApi:DOM.PM.ProductAPI,DateTimeApi:TECH.DateTime.DateTimeAPI 1 1 %Status 1 Zie ...InfoRec()-methods While ..InvoiceLineIterator.HasNext() { #dim Line As AXimpl.Admin.STAT.Invoice.Line = ..InvoiceLineIterator.Next() #dim KlantNr As %Integer = +Line.InvoiceAccount #dim ProductId As %Integer = ..GetAdminProductId(Line) #dim ProductBestaatNiet As %Boolean = (ProductId = 0) If $$$Not(..IsNietMeeTeNemenKlant(KlantNr)) { Do ..ProcessKlantLastInfoRec(Line, KlantNr) If $$$Not(ProductBestaatNiet) { Do ..CorrigeerLineCost(Line,ProductId) Do ..ProcessKlantProductLastInfoRec(Line, KlantNr, ProductId) // Ook ProductKlantLastInfoRec Do ..ProcessKlantProductMaandRec(Line, KlantNr, ProductId, Maand) // Ook ProductMaandRec EN ProductKlantMaandRec Do ..ProcessProductLastInfoRec(Line, ProductId) } Do ..ProcessKlantMaandRec(Line, KlantNr, Maand) // Ook ProductMaandRec EN ProductKlantMaandRec Do ..SetLastProcessedRecord(Line.RecId) } If $$$Not(Line.Currency = "EUR") { Do ..LogCurrencyError(Line, KlantNr, ProductId) } } // Alternatieve ItemId ophalen D ##class(AXimpl.Admin.STAT.Invoice.AlternateItem).%New().FetchFromAX() ]]> Variatie:%String,KlantNr:%Integer=0,ProductId:%Integer=0,Maand:%String="" 1 Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer 1 = DatumKlantLastInfoRec If EditNodigKlantLastInfoRec { Do ..KillSubscript("KlantLastInfoRec", 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,ProductId:%Integer 1 = DatumProductLastInfoRec If EditNodigProductLastInfoRec { Do ..KillSubscript("ProductLastInfoRec",, ProductId) Set ProductLastInfoRec = $Get(^KSTPR(ProductId,0,0),"") Set $Piece(ProductLastInfoRec,"\",1) = ConvertedInvoiceDateLine Set ^KSTPR(ProductId,0,0) = ProductLastInfoRec } } ]]> Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer,ProductId:%Integer 1 = DatumKlantProductLastInfoRec If EditNodigKlantProductLastInfoRec { Do ..KillSubscript("KlantProductLastInfoRec", KlantNr, ProductId) Set KlantProductLastInfoRec = $Get(^KSTKL(KlantNr,ProductId,0),"") Set $Piece(KlantProductLastInfoRec,"\",1) = ConvertedInvoiceDateLine Set $Piece(KlantProductLastInfoRec,"\",2) = Line.SalesPrice Set $Piece(KlantProductLastInfoRec,"\",3) = VerkoopEenheid Set $Piece(KlantProductLastInfoRec,"\",4) = "EUR" Set $Piece(KlantProductLastInfoRec,"\",5) = 1 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.SalesPrice Set $Piece(ProductKlantLastInfoRec,"\",3) = VerkoopEenheid 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.SalesPrice Set $Piece(ProductKlantLastInfoRec,"\",3) = VerkoopEenheid Set $Piece(ProductKlantLastInfoRec,"\",4) = "EUR" Set $Piece(ProductKlantLastInfoRec,"\",5) = 1 Set ^KSTPR(ProductId,KlantNr,0) = ProductKlantLastInfoRec } } ]]> Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer,ProductId:%Integer,Maand:%String 1 Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer,Maand:%String 1 PriceUnit:%Integer 1 %String Line:AXimpl.Admin.STAT.Invoice.Line 1 %Integer RecId:%Integer 1 StatistiekMaand:%Date 1 %String Line:AXimpl.Admin.STAT.Invoice.Line,KlantNr:%Integer,ProductId:%Integer 1 KlantNr:%String 1 %Boolean Line:AXimpl.Admin.STAT.Invoice.Line,PRNr:%String kost=omzet { Set Line.LineCost=Line.LineAmount } Else { try { ;Set ^PVLog(+$H,Line.InvoiceAccount,Line.ItemId)="" If Line.AdminProductNummer?4.10N { Set PRNr=Line.AdminProductNummer } Else { ;Set ^PVLog(+$H,Line.InvoiceAccount,Line.ItemId)="try" Set PRNrBasis=..Translator.GeefPRNrForAdmin(Line.ItemId) Set PRNr=..Translator.GeefPRNrForAdminInclSOPR(Line.ItemId,Line.InvoiceAccount) ;If PRNrBasis'=PRNr Set ^PVLog(+$H,Line.InvoiceAccount,Line.ItemId)=PRNrBasis_"\"_PRNr } If $$$PRGet($$$GenProduct)'?.N ; Generisch moeder product -> kost=omzet { Set Line.LineCost=Line.LineAmount } Else { ;Set CifPPL=$$$PRGet($$$CifPPLEUR) ;Set Line.LineCost=+$J(CifPPL*Line.InventQty,0,4) } } catch { } } ]]>