Closed meaziz closed 1 week ago
Enforcing a system wide currency precision of (2) didn't solve the issue.
ITM-00013 VAT amount for 71.50 * 15% = 10.725
(540 15%) + ( 180 15%) + (216 15%) + (71.50 15%) + ( 84 * 15%) = 163.725
which when rounded should result the 163.73
So a theory is the item-wise-tax recalculates the tax amounts line by line and messes up tax_amount with the rounding each value prematurely which then when are summed creates the missing (halala).
@mhaggag appreciate your input.
Hello,
We've seen similar issues before with clients. Usually it comes down to the following settings:
System Settings
: If this is left blank, it means it's doing "Banker's Rounding (Legacy)", and this causes rounding issues especially in return invoices. This only happens if you've upgraded the instance from older versions (pre-14 I think). Please make sure this is set to "Banker's Rounding".In [1]: from frappe.utils.data import rounded
In [2]: rounded(163.725, 2, "Banker's Rounding (legacy)")
Out[2]: 163.73
In [3]: rounded(-163.725, 2, "Banker's Rounding (legacy)")
Out[3]: -163.72
In [4]: rounded(-163.725, 2, "Banker's Rounding")
Out[4]: -163.72
In [5]: rounded(163.725, 2, "Banker's Rounding")
Out[5]: 163.72
Round Tax Amount Row-wise
in Accounts Settings
: Please make sure this is enabled. When it was unchecked, we ended up with tax breakup that didn't sum up to the expected tax total.There's a third issue we've seen that is there's sometime a difference between the total in the Sales Taxes and Charges
table and the grand total. That one is fixed by frappe but not yet backported to version 15.
Thanks Appreciate your prompt response. Will enable those and monitor the result and confirm back to the thread.
Thanks 🙏 After updating to latest version and setting the mentioned configuration. Invoices seems to be CLEARED.
Will keep monitoring it.
Note Maybe these configuration should be mentioned in the documentation and maybe a general configuration check could be developed into the app .. (Just a suggestion) We can design it based on common cases observed.
Note Maybe these configuration should be mentioned in the documentation and maybe a general configuration check could be developed into the app .. (Just a suggestion) We can design it based on common cases observed.
I agree, that's a good idea. We can't require the settings to be a certain way, but we can update the Prerequisites and add a validation check in ZATCA Business Settings
to inform users whether certain settings could cause problems. @omarashrafsarhan Let's track and schedule this please.
The Invoice total is 1,091.50 Calculating the tax amount at 15% * 1,091.50 = 163.725 which is rounded to in ERPNext The Total Taxes and Charges (SAR) on ERPNext Invoice field shows 163.73163.73</cbc:TaxAmount>
and the XML
It appears to be a rounding issue when creating the tax category sum, So a theorey is that the the Tax category calculation is rounded pre maturely (probably while being created)
But, checking the item-wise tax sum it adds up 81 + 27 + 32.40 + 10.73 + 12.60 = 163.73
https://github.com/lavaloon-eg/ksa_compliance/blob/03781557a8b35e2b5ec0d1b124b167b61bb2a944/ksa_compliance/output_models/e_invoice_output_model.py#L76
Any workarounds or other paths we can explore?