Attestwire › Rule reference › BR-DEC-25
BR-DEC-25 A line allowance base amount may have at most two decimals
noun · EN 16931 · fatal · BT-137
For a sample invoice, the library reports: The allowed maximum number of decimals for the invoice line allowance base amount (BT-137) is 2, but lines[0].allowances[0].baseAmount is 10.005, which has 3.
- Business term
BT-137- Severity
fatal
The fix
Round lines[0].allowances[0].baseAmount to two decimals before assigning it (10.01 here). Use half-up rounding away from zero — this package exports round2(), which handles the cases Math.round and toFixed get wrong.
A passing value
"baseAmount": 10.01What 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-DEC-25",
"field": "BT-137",
"severity": "fatal",
"message": "The allowed maximum number of decimals for the invoice line allowance base amount (BT-137) is 2, but lines[0].allowances[0].baseAmount is 10.005, which has 3. The constraint is on the serialised value, so it is about what reaches the XML rather than about what your variable holds — and the line is where over-precision starts, since every document total downstream of it inherits the drift. 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.",
"fix": "Round lines[0].allowances[0].baseAmount to two decimals before assigning it (10.01 here). Use half-up rounding away from zero — this package exports round2(), which handles the cases Math.round and toFixed get wrong.",
"example": "\"baseAmount\": 10.01",
"xpath": "/ubl:Invoice/cac:InvoiceLine[1]/cac:AllowanceCharge[1]/cbc:BaseAmount",
"docsUrl": "https://attestwire.com/rules/BR-DEC-25"
}
xpath is always a UBL path. On a CII invoice, look for the
matching CII field instead.