Below is the xml part of calculation, as amount value is only allowed upto 2 decimal, so when placed order qty 1 then it gives 200, but when same item ordered quantity 46 then giving calculation mistake warning, how to handle such cases.
cac:LegalMonetaryTotal
<cbc:LineExtensionAmount currencyID=“SAR”>80.87</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID=“SAR”>80.87</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID=“SAR”>93.00</cbc:TaxInclusiveAmount>
<cbc:AllowanceTotalAmount currencyID=“SAR”>0.00</cbc:AllowanceTotalAmount>
<cbc:PrepaidAmount currencyID=“SAR”>0.00</cbc:PrepaidAmount>
<cbc:PayableAmount currencyID=“SAR”>93.00</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
cac:InvoiceLine
cbc:ID 1</cbc:ID>
<cbc:InvoicedQuantity unitCode=“PCE”>46.000000</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID=“SAR”>80.00</cbc:LineExtensionAmount>
cac:TaxTotal
<cbc:TaxAmount currencyID=“SAR”>12.00</cbc:TaxAmount>
<cbc:RoundingAmount currencyID=“SAR”>92.00</cbc:RoundingAmount>
</cac:TaxTotal>
cac:Item
cbc:Name شاي سادة | شاي سادة te</cbc:Name>
cac:ClassifiedTaxCategory
cbc:ID S</cbc:ID>
cbc:Percent 15.00</cbc:Percent>
cac:TaxScheme
cbc:ID VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
cac:Price
<cbc:PriceAmount currencyID=“SAR”>1.74</cbc:PriceAmount>
cac:AllowanceCharge
cbc:ChargeIndicator false</cbc:ChargeIndicator>
cbc:AllowanceChargeReason discount</cbc:AllowanceChargeReason>
<cbc:Amount currencyID=“SAR”>0.00</cbc:Amount>
</cac:AllowanceCharge>
</cac:Price>
</cac:InvoiceLine>
cac:InvoiceLine
cbc:ID 2</cbc:ID>
<cbc:InvoicedQuantity unitCode=“PCE”>1.000000</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID=“SAR”>0.87</cbc:LineExtensionAmount>
cac:TaxTotal
<cbc:TaxAmount currencyID=“SAR”>0.13</cbc:TaxAmount>
<cbc:RoundingAmount currencyID=“SAR”>1.00</cbc:RoundingAmount>
</cac:TaxTotal>
cac:Item
cbc:Name ماء 600 مل | ماء 600 ملWATER</cbc:Name>
cac:ClassifiedTaxCategory
cbc:ID S</cbc:ID>
cbc:Percent 15.00</cbc:Percent>
cac:TaxScheme
cbc:ID VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
cac:Price
<cbc:PriceAmount currencyID=“SAR”>0.87</cbc:PriceAmount>
cac:AllowanceCharge
cbc:ChargeIndicator false</cbc:ChargeIndicator>
cbc:AllowanceChargeReason discount</cbc:AllowanceChargeReason>
<cbc:Amount currencyID=“SAR”>0.00</cbc:Amount>
</cac:AllowanceCharge>
</cac:Price>
</cac:InvoiceLine>
Saleh1
February 2, 2026, 7:26pm
2
I’m having similar issue
Suppose I have an invoice with 2 items , where:
Each item price is 0.50 SAR , tax-inclusive
VAT rate = 15%
Our calculation logic (line-level rounding):
For each item:
Net price = 0.50 ÷ 1.15 = 0.43478
Rounded net price per line = 0.43
Tax per line = 0.50 − 0.43 = 0.07
So the invoice lines are:
Line 1: Net = 0.43, VAT = 0.07
Line 2: Net = 0.43, VAT = 0.07
Invoice totals based on line sums:
Total net amount = 0.43 + 0.43 = 0.86
Total VAT = 0.07 + 0.07 = 0.14
Total amount = 1.00
The problem (ZATCA warning):
ZATCA validation gives a warning/error stating that:
Invoice total net amount must equal the sum of invoice line net amounts
However, if the total net amount is recalculated from the total tax-inclusive amount :
Invoice total (tax-inclusive) = 1.00
Net total = 1.00 ÷ 1.15 = 0.86956
Rounded to two decimals = 0.87
This results in:
Invoice net total = 0.87
Sum of line net amounts = 0.86
Mismatch of 0.01 , which causes a ZATCA warning.
My question:
Given that ZATCA specifications require:
Line net amounts to be rounded to two decimals individually
Invoice totals to be consistent with line totals
What is the correct and ZATCA-compliant approach in this scenario?
Should the invoice net total be derived strictly from the sum of rounded line net amounts ?
Or should the line net amounts be adjusted to match the invoice-level calculation?
How should rounding differences (±0.01) be handled to avoid validation warnings?
Any clarification or official guidance would be greatly appreciated.
idaoud
February 3, 2026, 8:35am
3
Hi @mohammed-danish
Thanks for reaching out,
In the first InvoiceLine, you are using the following:
46.00 as InvoicedQuantity
1.74 as PriceAmount
This will lead us to the LineExtensionAmount for this Line Item as per the formula (LineExtensionAmount = Quantity PriceAmount) => (46.00 * 1.74 ), the value for LineExtensionAmount in the first Line Item should be 80.04, not 80.00
I hope the above clarification will help you to solve it. Please do not hesitate to reach out for any further clarifications.
Additionally, kindly share the exact rule code with the message to double-check it.
@Ankit.K.Tiwari Hi, your input is much appreciated.
Thanks,
Ibrahem Daoud.
idaoud
February 3, 2026, 8:37am
4
Hi @Saleh1
To provide comprehensive support as usual, kindly share the XML along with the warning code and message.
Thanks
Ibrahem Daoud.
Saleh1
February 3, 2026, 5:46pm
5
Hi @idaoud and thank you for your help
<?xml version="1.0" encoding="UTF-8"?>
<Invoice xmlns:cac=“urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2”
xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
xmlns:ext="urn:oasis:names:specification:ubl:schema:xsd:CommonExtensionComponents-2"
xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">0.13</cbc:TaxAmount>
</cac:TaxTotal>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">0.13</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="SAR">0.87</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="SAR">0.13</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID schemeID="UN/ECE 5305">S</cbc:ID>
<cbc:Percent>15</cbc:Percent>
<cac:TaxScheme>
<cbc:ID schemeID="UN/ECE 5153">VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="SAR">0.87</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="SAR">0.87</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="SAR">1</cbc:TaxInclusiveAmount>
<cbc:AllowanceTotalAmount currencyID="SAR">0</cbc:AllowanceTotalAmount>
<cbc:PrepaidAmount currencyID="SAR">0.00</cbc:PrepaidAmount>
<cbc:PayableAmount currencyID="SAR">1</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:InvoiceLine>
<cbc:ID>1</cbc:ID>
<cbc:InvoicedQuantity unitCode="PCE">1</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="SAR">0.43</cbc:LineExtensionAmount>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReasonCode>95</cbc:AllowanceChargeReasonCode>
<cbc:AllowanceChargeReason>Discount</cbc:AllowanceChargeReason>
<cbc:Amount currencyID="SAR">0</cbc:Amount>
</cac:AllowanceCharge>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">0.07</cbc:TaxAmount>
<cbc:RoundingAmount currencyID="SAR">0.5</cbc:RoundingAmount>
</cac:TaxTotal>
<cac:Item>
<cbc:Name>صنف 1</cbc:Name>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>15</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="SAR">0.434782608695652</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="PCE">1</cbc:BaseQuantity>
</cac:Price>
</cac:InvoiceLine>
<cac:InvoiceLine>
<cbc:ID>2</cbc:ID>
<cbc:InvoicedQuantity unitCode="PCE">1</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="SAR">0.43</cbc:LineExtensionAmount>
<cac:AllowanceCharge>
<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
<cbc:AllowanceChargeReasonCode>95</cbc:AllowanceChargeReasonCode>
<cbc:AllowanceChargeReason>Discount</cbc:AllowanceChargeReason>
<cbc:Amount currencyID="SAR">0</cbc:Amount>
</cac:AllowanceCharge>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="SAR">0.07</cbc:TaxAmount>
<cbc:RoundingAmount currencyID="SAR">0.5</cbc:RoundingAmount>
</cac:TaxTotal>
<cac:Item>
<cbc:Name>صنف 1</cbc:Name>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>15</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="SAR">0.434782608695652</cbc:PriceAmount>
<cbc:BaseQuantity unitCode="PCE">1</cbc:BaseQuantity>
</cac:Price>
</cac:InvoiceLine>
I got this warning
[BR-S-08]-In a VAT breakdown (BG-23) where the VAT category code (BT-118) is ’ Standard rated’ the VAT category taxable amount (BT-116) shall equal the sum of Invoice line net amounts (BT-131) minus the sum of Document level allowance amounts (BT-92) plus the sum of Document level charge amounts (BT-99) where the VAT category codes (BT-151, BT-95, BT-102) are ‘Standard Rate’.
I understand that total before task should be 0.86 but this won’t give me the total of 1 tax included since I have 2 items each price is 0.5 tax included.
Do not round the net price.
Calculate the tax at the line level based on the LineExtensionAmount before rounding it to two decimal places.
In your case:
Price Amount = 1.739
Quantity = 46
Before rounding:
LineExtensionAmount = 46 × 1.739 = 79.994
Tax Amount = 79.994 × 0.15 = 11.9991
After rounding:
LineExtensionAmount = 80.00
Tax Amount = 12.00
RoundingAmount = 92.00
However, if you were to round the price to 1.74, the result would be as follows:
LineExtensionAmount = 80.04
Tax Amount = 12.01
RoundingAmount = 92.05