BR-KSA-51: Line amount with VAT (KSA-12) = line net amount + line VAT

Explained by Matheel from ZATCA's rule text and the condition SDK 3.4.8 executes · Updated

Warning: accepted with a warningAll invoicesFields: KSA-12, BT-131, KSA-11

For each cac:InvoiceLine/cac:TaxTotal, cbc:RoundingAmount (KSA-12) must equal the line's cbc:LineExtensionAmount (BT-131) plus cbc:TaxAmount (KSA-11), compared to 2 decimal places after rounding the sum. A missing cbc:RoundingAmount also fails.

How to fix it

Set the line's cac:TaxTotal/cbc:RoundingAmount to LineExtensionAmount + TaxAmount, rounded to 2 decimals.

ZATCA's official text

[BR-KSA-51]-The line amount with VAT (KSA-12) must be Invoice line net amount (BT-131) + Line VAT amount (KSA-11).
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

not( format-number((cbc:RoundingAmount),'#.00') = format-number( (round(( (cbc:TaxAmount) + (../cbc:LineExtensionAmount) ) * 100 ) div 100), '#.00') )

Related rules

Validate your invoice against ZATCA's rules

Paste the XML and see every error and warning. It runs in your browser; the invoice goes nowhere.

Validate an invoice or try Matheel