Reconcile the taxable amount and exemption reasons for Z

Warning BR-FXEXT-Z-08rev Factur-X

[BR-FXEXT-Z-08rev] - In a VAT breakdown (BG-23) where VAT category code (BT-118) is equal to “Z” ("Zero Rated"), Absolute Value of (VAT category taxable amount (BT-116) - ∑ Invoice line net amounts (BT-131) + Σ Document level allowance amounts (BT-92) - Σ Document level charge amounts (BT-99) - Σ Logistics Service fee amounts (BT-X-272)) <= 0,01 * ((Number of line net amounts (BT-131) + Number of Document level allowance amounts (BT-92) + Number of Document level charge amounts (BT-99) + Number of Logistics Service fee amounts (BT-X-272)), where the VAT category code (BT-151, BT-95, BT-102, BT-X-273) is "Zero Rated" (Z).

Recommendation: The invoice remains valid but should be corrected so that it can be processed automatically.
What is wrong

The amount in ram:BasisAmount differs by more than the allowed rounding tolerance from the amounts that match both the breakdown’s tax rate and its exemption text and code. The sum includes invoice lines with DETAIL or no status reason, as well as matching allowances, charges, and logistics service fees.

What the rule means

The taxable amount must be composed of invoice components whose category, tax rate, and exemption information match the VAT breakdown. This prevents amounts with different exemption reasons from being assigned to the same taxable amount.

Please reconcile the taxable amount and exemption reasons for `Z`

The taxable amount for Z does not match the invoice components with the same exemption details. Both the exemption text and exemption code must match the VAT breakdown for the included amounts.

What to do
  1. Compare ram:BasisAmount with the net amounts of invoice lines, allowances, charges, and logistics service fees that have the same tax rate.
  2. Check that ram:ExemptionReason and ram:ExemptionReasonCode on those components match the values in the VAT breakdown.
  3. For invoice lines, include only DETAIL or no status reason.
  4. Regenerate the invoice and validate it again.
Check in FactoorSharp
  • TaxCategoryCodes (BT-151; BT-95; BT-102; BT-118)
  • AbstractTradeAllowanceCharge.ActualAmount (Document level allowance: BT-92; Document level charge: BT-99)
  • TradeLineItem.LineTotalAmount (BT-131)
  • TradeLineItem.TaxCategoryCode (BT-151)
  • TradeLineItem.TaxType (BT-151-0)
Technical details

The test groups by ram:RateApplicablePercent and requires ram:ExemptionReason and ram:ExemptionReasonCode to match for invoice lines, document-level allowances or charges, and logistics service fees. Rounded sums are compared with ram:BasisAmount; the tolerance is 0.01 per included component.

Where the rule applies

The rule applies to each document-level VAT breakdown in ram:ApplicableTradeTax with category code Z and tax type VAT. Invoice lines, allowances, charges, and logistics service fees are matched to the breakdown’s tax rate and exemption reasons.

Context (rule/@context)
//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='Z'][upper-case(ram:TypeCode) = 'VAT']
Test expression (assert/@test)
( for $rate in xs:decimal(ram:RateApplicablePercent), $exempReasonText in normalize-space(ram:ExemptionReason), $exempReasonCode in normalize-space(ram:ExemptionReasonCode), $basisAmount in xs:decimal(ram:BasisAmount), $calculatedAmountBT131 in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/ rsm:SupplyChainTradeTransaction/ram:IncludedSupplyChainTradeLineItem[ not(ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL' ]/ram:SpecifiedLineTradeSettlement[ ram:ApplicableTradeTax/ram:CategoryCode = 'Z' and ram:ApplicableTradeTax/xs:decimal(ram:RateApplicablePercent) =$rate and normalize-space(ram:ApplicableTradeTax/ram:ExemptionReasonCode) = $exempReasonCode and normalize-space(ram:ApplicableTradeTax/ram:ExemptionReason) = $exempReasonText ]/ram:SpecifiedTradeSettlementLineMonetarySummation/xs:decimal(ram:LineTotalAmount)) * 100) div 100), $allowancesAmountBT92 in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/ rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:SpecifiedTradeAllowanceCharge[ ram:ChargeIndicator/udt:Indicator=false() and ram:CategoryTradeTax/ram:CategoryCode='Z' and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate and normalize-space(ram:CategoryTradeTax/ram:ExemptionReasonCode) = $exempReasonCode and normalize-space(ram:CategoryTradeTax/ram:ExemptionReason) = $exempReasonText ]/xs:decimal(ram:ActualAmount)) * 100) div 100), $chargesAmountBT99 in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/ rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:SpecifiedTradeAllowanceCharge[ ram:ChargeIndicator/udt:Indicator=true() and ram:CategoryTradeTax/ram:CategoryCode='Z' and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate and normalize-space(ram:CategoryTradeTax/ram:ExemptionReasonCode) = $exempReasonCode and normalize-space(ram:CategoryTradeTax/ram:ExemptionReason) = $exempReasonText ]/xs:decimal(ram:ActualAmount)) * 100) div 100), $nbLineItems in xs:decimal(count(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ ram:IncludedSupplyChainTradeLineItem[ ( not(ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL' ) and ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ram:CategoryCode = 'Z' and ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/xs:decimal(ram:RateApplicablePercent) =$rate and normalize-space(ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ ram:ExemptionReasonCode) = $exempReasonCode and normalize-space(ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/ ram:ExemptionReason) = $exempReasonText ])), $nbAllowancesOrCharges in xs:decimal(count(/rsm:CrossIndustryInvoice/ rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:SpecifiedTradeAllowanceCharge[ ram:CategoryTradeTax/ram:CategoryCode='Z' and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate and normalize-space(ram:CategoryTradeTax/ram:ExemptionReasonCode) = $exempReasonCode and normalize-space(ram:CategoryTradeTax/ram:ExemptionReason) = $exempReasonText ])), $logisticChargeAmount in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/ rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/ ram:SpecifiedLogisticsServiceCharge[ ram:AppliedTradeTax/ram:CategoryCode='Z' and ram:AppliedTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate and normalize-space(ram:AppliedTradeTax/ram:ExemptionReasonCode) = $exempReasonCode and normalize-space(ram:AppliedTradeTax/ram:ExemptionReason) = $exempReasonText ]/xs:decimal(ram:AppliedAmount)) * 100) div 100), $nblogisticCharge in xs:decimal(count(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/ ram:ApplicableHeaderTradeSettlement/ram:SpecifiedLogisticsServiceCharge[ ram:AppliedTradeTax/ram:CategoryCode='Z' and ram:AppliedTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate and normalize-space(ram:AppliedTradeTax/ram:ExemptionReasonCode) = $exempReasonCode and normalize-space(ram:AppliedTradeTax/ram:ExemptionReason) = $exempReasonText ])) return abs($basisAmount - $calculatedAmountBT131 + $allowancesAmountBT92 - $chargesAmountBT99 - $logisticChargeAmount) le 0.01 * ($nbLineItems + $nbAllowancesOrCharges + $nblogisticCharge) )