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-100

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

Fixture ID: chargeOverPrecise · XPath: /ubl:Invoice/cac:AllowanceCharge[1]/cbc:BaseAmount

1. Why This Rule Triggers (Diagnostic Message)

The allowed maximum number of decimals for the document level charge base amount (BT-100) is 2, but charges[0].baseAmount is 100.005, which has 3. The schematron measures the digits after the decimal point in the serialised XML, so a value that merely *displays* as two decimals still fails when the underlying number carries more. A base amount is normally lifted straight out of a subtotal your own system computed, so it carries whatever precision that computation left behind. It is also the number the percentage is applied to, so an over-precise base tends to produce an over-precise amount alongside it.

2. How to Fix BR-DEC-06

Round charges[0].baseAmount to two decimals before you hand it over — 100.01 here. This package exports round2() for it, which avoids the two JavaScript traps: Math.round(1.005 * 100) / 100 gives 1.00, and (2.675).toFixed(2) gives "2.67".

3. Valid Code / Payload Example

"baseAmount": 100.01
Test & Validate XML / JSON in Live SchemaGuard Validator →