VAT breakdown for category M

Error BR-FXEXT-AG-01 Factur-X

An Invoice that contains an Invoice line (BG-25) where the "Subtype of invoice line item" (BT-X-8) has the value "DETAIL" or is not specified, a Document level allowance (BG-20) or a Document level charge or tax (BG-21) or a Logistics Service Charge ( BG-X-42) where the VAT category code (BT-151, BT-95, BT-102, or BT-X-273) is “M” ("Ceuta and Mellita tax") shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with “M” ("Ceuta and Melilla tax").

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

If the VAT breakdown in ApplicableHeaderTradeSettlement contains an ApplicableTradeTax with CategoryCode M, the rule must also find a CategoryCode M in at least one of the checked ApplicableTradeTax, CategoryTradeTax or AppliedTradeTax elements. No such entry is found.

What the rule means

The code M identifies the tax category for Ceuta and Melilla. The VAT breakdown must report this category consistently with the related tax information.

Please reconcile the VAT breakdown for `M`

The VAT breakdown contains category M, but the checked tax information does not. You can make the tax information in the invoice consistent.

What to do
  1. Check tax category M in ApplicableTradeTax, CategoryTradeTax and AppliedTradeTax.
  2. Check the tax-category mapping using TaxCategoryCodes.
  3. Check whether AddApplicableTradeTax(...) represents the VAT breakdown consistently.
  4. Regenerate the invoice and validate it again.
Check in FactoorSharp
  • TaxCategoryCodes (BT-151; BT-95; BT-102; BT-118)
  • AssociatedDocument.LineStatusReasonCode (BT-X-8)
  • FacturXInvoice.AddApplicableTradeTax(basisAmount, percent, taxAmount, typeCode, categoryCode, allowanceChargeBasisAmount, exemptionReasonCode, exemptionReason, lineTotalBasisAmount) (BG-23)
  • FacturXInvoice.AnyApplicableTradeTaxes() (BG-23)
  • FacturXInvoice.GetApplicableTradeTaxes() (BG-23)
Technical details

The test passes if no CategoryCode M occurs in any of the checked areas, or if an ApplicableTradeTax with CategoryCode M at document level is accompanied by that code in at least one of the checked line or tax-group elements.

Where the rule applies

The rule applies to the VAT breakdown in ApplicableHeaderTradeSettlement and compares it with ApplicableTradeTax on invoice lines and with CategoryTradeTax and AppliedTradeTax.

Context (rule/@context)
/rsm:CrossIndustryInvoice
Test expression (assert/@test)
( count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='M'])=0 and count(//ram:SpecifiedLineTradeSettlement[ not(ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL' ]/ram:ApplicableTradeTax[ram:CategoryCode='M'])=0 and count(//ram:CategoryTradeTax[ram:CategoryCode='M'])=0 and count(//ram:AppliedTradeTax[ram:CategoryCode='M'])=0 ) or ( count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='M'])>=1 and ( exists(//ram:SpecifiedLineTradeSettlement[ not(ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL' ]/ram:ApplicableTradeTax[ram:CategoryCode='M']) or exists(//ram:CategoryTradeTax[ram:CategoryCode='M']) or exists(//ram:AppliedTradeTax[ram:CategoryCode='M']) ) )