PintLint

Rules / IBR-CO-11

IBR-CO-11 error

Sum of allowances on document level = Σ Document level allowance amount

Sum of allowances on document level (ibt-107) = Σ Document level allowance amount (ibt-092).

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:AllowanceTotalAmount) = (round(sum(../cac:AllowanceCharge[cbc:ChargeIndicator=false()]/xs:decimal(cbc:Amount)) * 10 * 10) div 100) or  (not(cbc:AllowanceTotalAmount) and not(../cac:AllowanceCharge[cbc:ChargeIndicator=false()]))

Official text: Sum of allowances on document level (ibt-107) = Σ Document level allowance amount (ibt-092).

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

Check an invoice