SchemaGuard by Ironbark Digital · EN 16931 / Peppol / XRechnung Reference
← All 294 EN 16931 / Peppol Rules & Live Validator
FATAL Official EN 16931 / Peppol / CIUS Rule BT/BG Fields: BT-109

BR-DEC-12 — E-Invoice Validation Rule & Fix

Fixture ID: overPreciseTotals · XPath: /ubl:Invoice/cac:LegalMonetaryTotal/cbc:TaxExclusiveAmount

1. Why This Rule Triggers (Diagnostic Message)

The allowed maximum number of decimals for the Invoice total amount without VAT (BT-109) is 2, but you declared 1500.001, which has 3. The rule is written against the serialised value — the schematron measures the digits after the decimal point in the XML — so a value that merely *displays* as two decimals still fails if the underlying number carries more. This total inherits its precision from BT-106; check that one too.

2. How to Fix BR-DEC-12

Round declaredTotals.taxExclusiveAmount to two decimals before assigning it (1500.00 here), using half-up rounding away from zero. This package exports round2() for exactly this, and it avoids the two JavaScript traps: Math.round(1.005 * 100) / 100 gives 1.00, and (2.675).toFixed(2) gives "2.67". Alternatively drop declaredTotals and let the library compute the totals, which it always rounds correctly.

3. Valid Code / Payload Example

"declaredTotals": { "taxExclusiveAmount": 1500.00 }
Test & Validate XML / JSON in Live SchemaGuard Validator →