BR-CO-10
Sum of Invoice line net amount (BT-106) = Σ Invoice line net amount (BT-131).
Why it fails
- A line was added, removed or changed after
cbc:LineExtensionAmountincac:LegalMonetaryTotalwas calculated. - Line amounts were rounded differently from the total: each line net amount (BT-131) is rounded to two decimals first, and the total is the sum of those rounded amounts.
- Credit note lines or lines with a negative amount were left out of the sum.
How to fix it
Recalculate BT-106 as the sum of every line's cbc:LineExtensionAmount (ram:LineTotalAmount in CII), using the already rounded line amounts.
What the rule checks
As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.
cac:LegalMonetaryTotal
(xs:decimal(cbc:LineExtensionAmount) = xs:decimal(round(sum(//(cac:InvoiceLine|cac:CreditNoteLine)/xs:decimal(cbc:LineExtensionAmount)) * 10 * 10) div 100))
Checked with EN 16931 Invoice (UBL), EN 16931 Credit Note (UBL), Croatia eRačun Invoice (UBL), Croatia eRačun Credit Note (UBL)
//ram:SpecifiedTradeSettlementHeaderMonetarySummation
xs:decimal(ram:LineTotalAmount) = round(sum(../../ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount/xs:decimal(.)) * xs:decimal(100)) div xs:decimal(100)
Checked with EN 16931 Invoice (CII)
//ram:SpecifiedTradeSettlementHeaderMonetarySummation
xs:decimal(ram:LineTotalAmount) = round(xs:decimal(sum(../../ram:IncludedSupplyChainTradeLineItem/ram:SpecifiedLineTradeSettlement/ram:SpecifiedTradeSettlementLineMonetarySummation/ram:LineTotalAmount)) * xs:decimal(100)) div xs:decimal(100)
Checked with France e-invoice (CII), XRechnung 3.0 Invoice (CII)