POS Transaction with Sales Order that nets to $0.00 posting failure in statement
AX Retail R1: POS Transaction with Sales Order that nets to $0.00 posting failure in statement
Problem:
When a POS transaction contains a payment against a Sales Order and the net amount of the transaction is $0.00, the statement that contains the transaction will fail to post in Dynamics AX.
Reproducing the Error:
1. In AX Headquarters, create a Sales Order for a customer that contains one item for ($100).
2. In the POS, add this sales order to a transaction for the customer.
3. In the same POS transaction, add a Return item for the same price. Make sure that the “balance” of the transaction is $0.00 (customer owes no money).
4. Use the “Exact” button to finalize the transaction.
5. In AX Headquarters, run a P-job to pull the transaction into AX.
6. In AX Headquarters, create a new statement and use a date interval that will include the transaction you created.
7. Attempt to post the statement.
Result: The posting fails with an error: “Transactions on voucher xxx do not balance”
Resolution:
This issue is scheduled for resolution in R2 of Dynamics AX for Retail. To address the issue in R1, make the following code changes to these two methods:
\Classes\RBOStatementPost::postToCustomer()
\Classes\RBOStatementPost::postAggregatedCustomerVouchers():
Change 1: Move the “sCurrency…” line from inside the “if” and “while” block.
Old:
if (transactionPaymentTrans.AmountTendered)
totalAmountPaid += transactionPaymentTrans.AmountTendered;
else
totalAmountPaid += (transactionPaymentTrans.AmountCur * transactionPaymentTrans.ExchRate) / 100;
sCurrency = storeTable.Currency;
}
}
select sum(AmountCur)
New:
if (transactionPaymentTrans.AmountTendered)
totalAmountPaid += transactionPaymentTrans.AmountTendered;
else
totalAmountPaid += (transactionPaymentTrans.AmountCur * transactionPaymentTrans.ExchRate) / 100;
}
}
sCurrency = storeTable.Currency;
select sum(AmountCur)
Change 2: Change the following line.
Old:
if (totalAmountPaid )
New:
if ((-totalAmountPaid + tTransactionOrderInvoiceTrans.AmountCur) != 0)