XV-CZ-12

PayableAmount (…) must equal DifferenceTaxInclusiveAmount + PayableRoundingAmount - PaidDepositsAmount (…); paid advance payments are given as positive amounts (ISDOC 6.0.2, A.6).

error: the document is invalid

Why it fails

  • Paid advance payments (PaidDepositsAmount) are given as a negative amount. ISDOC gives them as positive amounts that are subtracted.
  • The rounding (PayableRoundingAmount) is left out of the sum, or given with the wrong sign.

How to fix it

PayableAmount = DifferenceTaxInclusiveAmount + PayableRoundingAmount - PaidDepositsAmount, with the advance payments as a positive amount.

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.

Context
/isdoc:Invoice/isdoc:LegalMonetaryTotal
Test
cz:same(cz:dec(isdoc:DifferenceTaxInclusiveAmount) + cz:dec(isdoc:PayableRoundingAmount) - cz:dec(isdoc:PaidDepositsAmount), cz:dec(isdoc:PayableAmount)) and (not(isdoc:DifferenceTaxInclusiveAmountCurr and isdoc:PaidDepositsAmountCurr and isdoc:PayableAmountCurr) or cz:same(cz:dec(isdoc:DifferenceTaxInclusiveAmountCurr) + cz:dec(isdoc:PayableRoundingAmountCurr) - cz:dec(isdoc:PaidDepositsAmountCurr), cz:dec(isdoc:PayableAmountCurr)))

Checked with ISDOC 6.0.2