At most one VAT category code per 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. The test limits the count to at most one; it does not require the element to be present.

What the rule means

The rule prevents more than one VAT category from being assigned to an allowance or charge.

Affected fields BG-20 BG-21 BT-95
Please use no more than one VAT category for each allowance or charge.

An allowance or charge contains multiple VAT categories. Remove the extra entries; this test does not require a VAT category to be present.

What to do
  1. Check the affected allowance or charge.
  2. Use no more than one VAT category in AddTradeAllowance(...) or AddTradeCharge(...).
  3. Generate the invoice again and validate 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 ram:CategoryTradeTax elements within ram:SpecifiedTradeAllowanceCharge and allows at most one.

Where the rule applies

The rule applies to each document-level ram:SpecifiedTradeAllowanceCharge, meaning an allowance or charge.

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