At most one VAT category per document-level allowance or charge

Error CII-SR-471 Syntax (UBL/CII)

Each Specified Trade Allowance Charge (BG-20)(BG-21) shall contain a VAT category code (BT-95).

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

A ram:SpecifiedTradeAllowanceCharge contains more than one ram:CategoryTradeTax element.

What the rule means

A document-level allowance or charge may contain no more than one VAT category. The test does not require a VAT category to be present.

Affected fields BG-20 BG-21 BT-95
Please provide no more than one VAT category per allowance or charge

A document-level allowance or charge contains multiple VAT categories. No more than one category is allowed for this entry; a category is not required to be present.

What to do
  1. Check the number of ram:CategoryTradeTax elements in ram:SpecifiedTradeAllowanceCharge.
  2. Keep no more than one such element; it may also be omitted.
  3. Check the entry through AddTradeAllowance(...) or AddTradeCharge(...), then regenerate the invoice and check it again.
What it looks like
✗ Triggers the message
<ram:SpecifiedTradeAllowanceCharge>
  <ram:CategoryTradeTax/>
  <ram:CategoryTradeTax/>
</ram:SpecifiedTradeAllowanceCharge>
✓ Correct
<ram:SpecifiedTradeAllowanceCharge>
  <ram:CategoryTradeTax/>
</ram:SpecifiedTradeAllowanceCharge>
Check in FactoorSharp
  • TaxCategoryCodes (BT-95)
  • AbstractTradeAllowanceCharge (Document level allowance: BG-20; Document level charge: BG-21)
  • AbstractTradeAllowanceCharge.ChargeIndicator (Document level allowance: BG-20; Document level charge: BG-21)
  • FacturXInvoice.AddTradeAllowance(basisAmount, currency, actualAmount, chargePercentage, reason, taxTypeCode, taxCategoryCode, taxPercent, reasonCode) (BG-20)
  • FacturXInvoice.AddTradeCharge(basisAmount, currency, actualAmount, chargePercentage, reason, taxTypeCode, taxCategoryCode, taxPercent, reasonCode) (BG-21)
Technical details

The test counts the ram:CategoryTradeTax elements in the context and allows no more than one.

Where the rule applies

The rule applies to each document-level ram:SpecifiedTradeAllowanceCharge, whether it is an allowance or a charge.

Context (rule/@context)
//ram:SpecifiedTradeAllowanceCharge
Test expression (assert/@test)
count(ram:CategoryTradeTax) <= 1