21.02.2024, 07:35 | #1 |
Участник
|
Project intercompany invoice sales tax calculation bug in 10.0.37
Источник: http://alexvoy.blogspot.com/2024/02/...sales-tax.html
============== While Microsoft working on this issue, let me show you how you can fix it in the current code running on 10.0.37 or lower. Scenario When using the project intercompany customer invoice form in Project management and accounting module , you can create a customer invoice to bill to an intercompany customer. As the customer is intercompany, there is a legal entity (LE) associated with that customer. When posting the intercompany customer invoice, a pending vendor invoice is created in the customer’s LE with the same lines from the customer invoice. You can see calculated Sales taxes via Sales tax button Issue If you try to add more lines, it will be added with line number 1, and sales taxes won't be added with this newly added line. Note: If you delete any line here and then you add more, it works fine. This bug leads to missed taxes transactions in all TaxUncommitted, TmpTaxWorkTrans, and eventually in TaxTrans tables Fix Create an extension class with the following code [ExtensionOf(classStr(ProjIntercompanyCustomerInvoiceCreator))]final class mgcProjIntercompanyCustomerInvoiceCreator_Extension{ /// /// Creates a customer invoice. /// On top of standard we have to delete uncommitted taxes /// /// /// The CustInvoiceTable that was created. /// public CustInvoiceTable createInvoice() { // we need to increase the next line number to avoid duplicates in case when new lines added to initially created ones lineNum = this.mgcGetNextLineNum(); custInvoiceTable = next createInvoice(); // It is a bug presented in 10.0.37, which leads to missed taxes transactions in all TaxUncommitted, TmpTaxWorkTrans, and eventually in TaxTrans tables. // So, once any line added here, we have to delete all uncommitted tax records for the current invoice // because the standard form method for that is not triggered if(origTransList.elements()) { TaxUncommitted::deleteForDocumentHeader(tableNum(CustInvoiceTable), custInvoiceTable.RecId); } return custInvoiceTable; } /// /// Returns the next number for line if the invoice exists already /// /// /// The next LineNum. /// public LineNum mgcGetNextLineNum() { CustInvoiceLine mgcCustInvoiceLine; // It is a bug presented in 10.0.37, which leads to creation new lines with the same line number. // Down the road it leads to wrong sales tax amount summarizing based on the line number in custInvoiceLine.displayTaxAmount() select maxof(lineNum) from mgcCustInvoiceLine where mgcCustInvoiceLine.ParentRecId == custInvoiceTable.RecId; return mgcCustInvoiceLine.LineNum + 1; }} Источник: http://alexvoy.blogspot.com/2024/02/...sales-tax.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|