BR-CO-12: Charge total must equal the sum of document-level charges

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

Error: the invoice is rejectedAll invoicesFields: BT-108, BT-99

In SDK 3.4.8 the executed check compares cac:LegalMonetaryTotal/cbc:ChargeTotalAmount (BT-108) with the sum of cbc:Amount (BT-99) of document-level cac:AllowanceCharge elements with cbc:ChargeIndicator = true, rounded to two decimals; it passes if both are absent and fails if ChargeTotalAmount is present but empty. The rule's listed test text is a copy of the allowance formula (BR-CO-11) and does not match the official message.

How to fix it

Set cbc:ChargeTotalAmount to the rounded sum of all document-level charge amounts, or omit the element entirely when there are no document-level charges (do not leave it empty).

ZATCA's official text

[BR-CO-12]-Sum of charges on document level (BT-108) = Σ Document level charge amount (BT-99).
Source: ZATCA SDK 3.4.8 · EN 16931 (CEN) rules

Fails when (the condition ZATCA's SDK runs)

not(xs:decimal(cbc:AllowanceTotalAmount) = (round(sum(../cac:AllowanceCharge[cbc:ChargeIndicator=false()]/xs:decimal(cbc:Amount)) * 10 * 10) div 100) or (not(cbc:AllowanceTotalAmount) and not(../cac:AllowanceCharge[cbc:ChargeIndicator=false()])))

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