Hi Everyone
When I run the Customer Item Statistics report, some of the customers are displayed with a revenue that is far higher than it should be. After investigation, I found that the reason is, that some invoice lines that shouldn't be part of the report, are getting coupled/included with lines that should be.
This is an Ax 2012 R3 CU8 environment.
The code in the processReport method looks like this: (with my own line numbers added)
1. while (queryRun_Current.next())
2. {
3. custInvoiceJour_Current = queryRun_Current.get(tablenum(CustInvoiceJour));
4. custInvoiceTrans_Current = queryRun_Current.get(tablenum(CustInvoiceTrans));
5. itemNEqPrev = itemId != custInvoiceTrans_Current.ItemId;
6. accNEqPrev = orderAccount != custInvoiceTrans_Current.salesLine().CustAccount;
7. periodNum = ItemReportPeriodNum::Both;
8. if ( accNEqPrev || itemNEqPrev)
9. {
10. this.insertIntoTmpTable();
After investigation, I found that on line 6, though custInvoiceTrans_Current is populated, it has no InventTransId value (because it's a balance record and shouldn't even be in the report), and because it has no InventTransId value, it returns no SalesLine record, which therefore returns no orderaccount, which therefore sets the accNEqPrev value to false, which means that this record won't (after all) be included in the report. HOWEVER, The monetary value of custInvoiceTrans_Current IS still tallied up against the total. So, when a valid transaction comes along, so that accNEqPrev is true, and the record gets added to the report, the value gets added plus the amount of all the 'balance' records added to it.
It seems to me a hotfix is required. Does anyone know if there is any particular hotfix that addresses this issue? At the moment, I'm looking at
"KB 3214792 The "Customer/Item statics" report shows incorrect figures when the sales lines are deleted", and one or 2 others. But there are a few to go through. Does anyone know for sure what the correct hotfix would be?
Thanks