Rule reference

BR-CO-12 BR-CO-12 requires BT-108 to equal Σ BT-99, the sum of the BG-21 amounts on the document

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.

This rule is implemented and its error payload below is real, but the long-form write-up — normative text, worked example, divergence note — is not written yet. Everything the library knows about this rule is on this page. Ask and we will prioritise it.

Business term
BT-108
Severity
fatal

What the library returns

The exact object in result.errors when this rule fires. Generated by running @attestwire/en16931, not transcribed:

TeachingError
{
  "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 locates the element in the generated UBL document, which is where a KoSIT or Peppol validator will report the same problem.

A passing value

the shape this field expects
"declaredTotals": { "chargeTotalAmount": 5.00 }

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.

Arrived from a stack trace? The docsUrl on every error links straight here. Something wrong on this page — tell us.