Posting Retail Statement Generates the error:
"Update for voucher XXXXX has been cancelled to avoid oversettlement. The settled customer or vendor balance for the transaction must not exceed the transaction amount."
You may run into this scenario when a POS transaction contains a sale and return on the same transaction for the same amount. The transaction subtotal will be $0.00 and there is a tax amount of .01 or -.01.
A good way to find if you have a POS transaction on your statement with a $0 subtotal and a tax amount would be to look at the RETAILTRANSACTIONTABLE where the NetAmount = 0 and the GrossAmount <> 0 (normally you will see a GrossAmount of .01 or -.01)
I would advise setting the Sales Tax Group for your store (General Ledger>>Setup>>Sales Tax>>Sales Tax Groups) to rounding by "Sales Tax Code Combination". For the Sales Tax Codes (General Ledger>>Setup>>Sales Tax>>Sales Tax Codes) set the Marginal base field to "Net amount per line". This will help going forward.
If you still receive the error, I would advise limiting your statement, by date and time, so only the transaction with the issue is included in the statement.
The following code change will allow the statement to post without the settlement. As always, try this in a test environment before running on production. Make sure no other statements are being posted manually or in a batch job or you will need to manually settle all transactions that are posted.
//toSettle = true;
totalCreditAmountCur = totalRoundAmountCur;
lastInvoiceId = transTable.invoiceId;
Once the statement is posted, change the toSettle back to true and you can manually settle the payment and invoice for the customer. You may need to create a transaction either positive or negative to bring the customer balance to 0 and settle the transaction created when the statement posted.
Thanks for the blog - this was helpful. I've come across this error when a sale has a purchase and return for the same item as well as a discount for the sale item. I tested your suggestion of setting toSettle to false and the statement posts successfully.
I'd like to make this switch permanently, but I'm concerned there may be other ramifications. Are there any consequences I should be aware of if I make this change? This almost seems as if this should be a configurable item, unless I'm misunderstanding this switch in the code.