Rounding issue causes BR-CO-15 violation

Hi dear ZATCA

We have a rounding issues which are caused the failures with ERROR status now. We would like to ask how to solve these (and similar) issues going forward.

The following numbers we got after calculation (not rounded)

TaxTotal.TaxAmount: 208.321956525  (208.32 in XML)
TaxExclusiveAmount: 1388.813043500 (1388.81 in XML)
TaxInclusiveAmount: 1597.135000025 (1597.14 in XML)

208.321956525 + 1388.813043500 == 1597.135000025
208.32 + 1388.81 != 1597.14

The question is: how we should handle this situation? Please note that it can happen on any other level which will end up in non-matching total/sum

According to the documentation the rounding should be applied on final value (as late as possible). We are applying rounding on final values when constructing XML. But in some cases we are getting these errors. Sometimes it is Warning (if mismatch in TaxTotal) and now it is Error (mismatch in TaxInclusiveAmount)

These are the official rounding rules:

Rules to minimize the risk of differences due to rounding as illustrated in the examples are:

  • All document level totals shall be rounded to two decimals for accounting;
  • Rounding shall be done on the final calculation results not on any intermediate results;
  • VAT category tax amount (BT-110) shall be rounded on document level and not as a summation of rounded Invoice line VAT amounts.

Error we are getting:

...
"errorMessages": [
    {
        "type": "ERROR",
        "code": "BR-CO-15",
        "category": "EN_16931",
        "message": "Invoice total amount with VAT (BT-112) ",
        "status": "ERROR"
    }
],
...

Best regards,
Sergei

Just as a follow up, now we have implemented proper rounding rules on our end and now all the calculations matches exactly how ZATCA is doing their calculations.
In the latest document it is stated that price and all it’s calculation is not rounded, but tax_percent and and resulting InvoiceLine amount is rounded to 2 decimals (according to the documents).

If someone have also some rounding issues, please follow the documentation and round on your end the same way how ZATCA rounding (what you send in XML as ZATCA will have only this data for calculations)

Best regards,
Sergei

which document?? please share the link to the document.

From the last document I have for reference,
UNit Price and Qty fields do not have any restrictions on the decimals.
the product of both these and all following amounts calculated need to be rounded to 2 decimals.

Yet, we have sometime experienced mismatches of 0.0x magnitude

additionally,

zatca doesnt round each value
for example,

Base amount 10
VAT 1.5

NET 11.5

ZATCA doesnt round base and VAT
just rounds NET amount

Dear @sergei.shishov

Thanks for reaching out,

Kindly note that, providing the XML will help us to understand the case that you are facing.

Thanks,
Ibrahem Daoud.

Dear @idaoud

Thank you for your reply. The issue have been resolved as stated in the first comment. I will try to describe the fix below for any other user facing similar difficulties.

The rounding described in the documentation is working properly. We should round calculation and use formulas. In the example which I have provided, we should use already rounded values to calculate TaxInclusiveAmount. Raw values we should use only to calculate the “first” value in the formula and then other formulas should use already rounded pre-calculated values.

In the beginning we implemented everything like storing everything unrounded and calculating based on unrounded values but when we generate XML, we were rounding (representation). It was causing the issues mentioned in the original post.

Solution: the values should be stored rounded and used in other formulas as rounded values. Example: C=A+B, E=C+D in this example A,B,D are unrounded if it is “raw” value, otherwise it will be a rounded value if it was calculated from other formula. But C will be rounded in the second formula calculation always.

Best regards,
Sergei

1 Like