PintLint

Rules / IBR-CO-12

IBR-CO-12 error

Sum of charges on document level = Σ Document level charge amount

Sum of charges on document level (ibt-108) = Σ Document level charge amount (ibt-099).

Fails

<cac:LegalMonetaryTotal>
  <!-- stated total doesn't match the sum of its parts -->
</cac:LegalMonetaryTotal>

Fix

Recalculate the total from the parts it's built from, rounding each part to 2 decimals first. Fix the total, not the parts.

Schematron
Context
cac:LegalMonetaryTotal
Test
xs:decimal(cbc:ChargeTotalAmount) = (round(sum(../cac:AllowanceCharge[cbc:ChargeIndicator=true()]/xs:decimal(cbc:Amount)) * 10 * 10) div 100) or (not(cbc:ChargeTotalAmount) and not(../cac:AllowanceCharge[cbc:ChargeIndicator=true()]))

Official text: Sum of charges on document level (ibt-108) = Σ Document level charge amount (ibt-099).

Official · PINT shared rules. Severity: error. Runs on UBL XML.

Check an invoice