Attestwire › Rule reference › BR-CO-12
BR-CO-12 The charge total must equal the sum of document-level charges
noun · EN 16931 · fatal · BT-108
For a sample invoice, the library reports: BR-CO-12 requires BT-108 to equal Σ BT-99, the sum of the BG-21 amounts on the document. You declared 1.00 for BT-108, but the single entry in charges sum to 5.00 — a difference of -4.00 EUR.
- Business term
BT-108- Severity
fatal
The fix
Either correct the charges array so it sums to your declared figure, or drop declaredTotals.chargeTotalAmount and let the library compute it — generation always emits the computed value regardless of what you declare. Sum the *rounded* entry amounts, in that order: EN 16931 rounds each amount to two decimals and then adds.
A passing value
"declaredTotals": { "chargeTotalAmount": 5.00 }What the library returns
The full error returned by @attestwire/en16931. It includes the rule ID,
affected field and suggested correction. Developers can use this object in their application:
{
"rule": "BR-CO-12",
"field": "BT-108",
"severity": "fatal",
"message": "BR-CO-12 requires BT-108 to equal Σ BT-99, the sum of the BG-21 amounts on the document. You declared 1.00 for BT-108, but the single entry in charges sum to 5.00 — a difference of -4.00 EUR. Line level charges (BG-28) are deliberately not in this sum — they are already inside the line net amounts that make up BT-106, and counting them again here would double them into BT-109 via BR-CO-13.",
"fix": "Either correct the charges array so it sums to your declared figure, or drop declaredTotals.chargeTotalAmount and let the library compute it — generation always emits the computed value regardless of what you declare. Sum the *rounded* entry amounts, in that order: EN 16931 rounds each amount to two decimals and then adds.",
"example": "\"declaredTotals\": { \"chargeTotalAmount\": 5.00 }",
"xpath": "/ubl:Invoice/cac:LegalMonetaryTotal/cbc:ChargeTotalAmount",
"docsUrl": "https://attestwire.com/rules/BR-CO-12"
}
xpath is always a UBL path. On a CII invoice, look for the
matching CII field instead.