In this guide

Two invoice totals answer two different questions

A test invoice shows SAR 1,150 at the top and SAR 950 still to pay. Both can be right. ZATCA rule BR-CO-15 checks the invoice total including VAT. BR-CO-16 checks the amount due after the recorded prepaid amount and any rounding. If your data mapping fills both fields from the same number, one formula can fail even when the PDF looks correct.

Reconcile the business terms before looking at the code

Assume a test case where the source records and invoice mapping support an amount before VAT of SAR 1,000, total VAT of SAR 150, a prepaid amount of SAR 200, and no rounding. The example isolates the two amount equations. It omits other requirements for an advance-payment invoice or adjustment.

Business termValue in a consistent test case
BT-109, total before VAT1,000
BT-110, total VAT150
BT-112, total with VAT1,150
BT-113, prepaid amount200
BT-114, rounding0
BT-115, amount due950

If BT-112 is 950, BR-CO-15 compares it with 1,150, a SAR 200 difference. If BT-112 is correctly 1,150 but BT-115 also reads 1,150, BR-CO-16 compares the amount due with 950. Check the difference against the prepaid amount before blaming rounding or changing any tax fields.

Hand the system owner a checkable finding

Read these test values and the two official rules. Give me the expected amount for each rule, observed amount, difference and field to inspect. Keep the tax breakdown, prepayment treatment and production status outside the conclusion unless supported by the evidence.

Confirm the mapping for TaxInclusiveAmount and PayableAmount under LegalMonetaryTotal. Have the authorized owner regenerate a test document and rerun the ZATCA SDK. Use the severity and status from the actual validation output. The XML check does not establish production clearance or reporting.

Sources

Sources checked ·