Calculate the amount due correctly

Error BR-DEX-09 XRechnung

Amount due for payment (BT-115) = Invoice total amount with VAT (BT-112) - Paid amount (BT-113) + Rounding amount (BT-114) + Σ Third party payment amount (BT-DEX-002).

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

The value of cbc:PayableAmount, adjusted by the rounding amount, does not match the tax-inclusive amount minus the prepaid amount plus the third-party payment amount. The rounding amount is then added to the amount due.

What the rule means

The amount due must correctly account for the total including VAT, amounts already paid, third-party payments, and rounding. This ensures that the stated amount due matches the amount still payable.

Affected fields BT-115 BT-112 BT-113 BT-114
Please calculate the amount due correctly

The amount due in cbc:PayableAmount does not match the total, prepaid, third-party payment, and rounding amounts. You can adjust the amounts so that they reconcile.

What to do
  1. Compare the amount due with the total including VAT, minus prepaid amounts, plus third-party payments.
  2. Check the values of DuePayableAmount, GrandTotalAmount, RoundingAmount, and TotalPrepaidAmount.
  3. Account for the rounding amount when reconciling the totals.
  4. Regenerate the invoice and check it again.
Check in FactoorSharp
  • FacturXInvoice.DuePayableAmount (BT-115)
  • FacturXInvoice.GrandTotalAmount (BT-112)
  • FacturXInvoice.RoundingAmount (BT-114)
  • FacturXInvoice.TotalPrepaidAmount (BT-113)
Technical details

The XPath compares the two amounts rounded to two decimal places: cbc:PayableAmount minus the rounding amount, and cbc:TaxInclusiveAmount minus prepaid amounts plus third-party payments.

Where the rule applies

The rule applies to the totals in cac:LegalMonetaryTotal.

Context (rule/@context)
cac:LegalMonetaryTotal[$isExtension]
Test expression (assert/@test)
(round((xs:decimal(cbc:PayableAmount) - $payableroundingamount) * 10 * 10) div 100) = (round((xs:decimal(cbc:TaxInclusiveAmount) - $prepaidamount + $thirdpartyprepaidamount) * 10 * 10) div 100)