Fixture ID: overPreciseTotals · XPath: /ubl:Invoice/cac:TaxTotal/cbc:TaxAmount
The allowed maximum number of decimals for the Invoice total VAT amount (BT-110) is 2, but you declared 285.0004, which has 4. 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. Applying a percentage produces a long decimal almost every time — 1 234.56 x 19% is 234.5664. VAT is rounded per VAT breakdown group (BR-CO-17) and the rounded group amounts are then summed, so the total should never carry more than two decimals.
BR-DEC-13Round declaredTotals.taxAmount to two decimals before assigning it (285.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.
"declaredTotals": { "taxAmount": 285.00 }