Le test regroupe les montants par ram:RateApplicablePercent et compare ram:BasisAmount aux sommes arrondies à deux décimales. L’écart admis est de 0,01 multiplié par le nombre de lignes, remises ou charges prises en compte. La condition est satisfaite si l’une des deux variantes de calcul est respectée.
Où la règle s'applique
La règle s’applique à chaque ventilation de la TVA au niveau du document dans ram:ApplicableTradeTax, avec le code de catégorie S et le type de taxe VAT. Elle compare la base imposable aux lignes de facture, remises, charges et frais logistiques correspondants.
Message d'origine du Schematron
In a VAT breakdown (BG-23), for each different value of VAT rate (BT-119) where VAT category code (BT-118) is equal to “S” ("Standard 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 "Standard Rated" (S), but only for lines where the "Subtype of invoice item" (BT-X-8) has the value "DETAIL" or is not specified, or the same rule but also taking into account the exemption reasons in Text (BT-120) and Code (BT-121) in BG-23 and the exemption reasons on each line (BT-X-96 / BT-X-97), on Document level Allowances (BT-173 / BT-174) and on Document Level Charges (BT-175 / BT-176), and on Service logistic charges (BT-X-591 / BT-X-592). One of the two rules must be followed, bearing in mind that ultimately only the second one will have to be followed.
Contexte (rule/@context)
//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='S'][upper-case(ram:TypeCode) = 'VAT']
Expression de contrôle (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 = 'S'
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),
$calculatedAmountBT131ini 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 = 'S'
and ram:ApplicableTradeTax/xs:decimal(ram:RateApplicablePercent) =$rate
]/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='S'
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),
$allowancesAmountBT92ini in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/
rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/
ram:SpecifiedTradeAllowanceCharge[
ram:ChargeIndicator/udt:Indicator=false()
and ram:CategoryTradeTax/ram:CategoryCode='S'
and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate
]/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='S'
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),
$chargesAmountBT99ini in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/
rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/
ram:SpecifiedTradeAllowanceCharge[
ram:ChargeIndicator/udt:Indicator=true()
and ram:CategoryTradeTax/ram:CategoryCode='S'
and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate
]/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 = 'S'
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
])),
$nbLineItemsini 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 = 'S'
and ram:SpecifiedLineTradeSettlement/ram:ApplicableTradeTax/xs:decimal(ram:RateApplicablePercent) =$rate
])),
$nbAllowancesOrCharges in xs:decimal(count(/rsm:CrossIndustryInvoice/
rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/
ram:SpecifiedTradeAllowanceCharge[
ram:CategoryTradeTax/ram:CategoryCode='S'
and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate
and normalize-space(ram:CategoryTradeTax/ram:ExemptionReasonCode) = $exempReasonCode
and normalize-space(ram:CategoryTradeTax/ram:ExemptionReason) = $exempReasonText
])),
$nbAllowancesOrChargesini in xs:decimal(count(/rsm:CrossIndustryInvoice/
rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/
ram:SpecifiedTradeAllowanceCharge[
ram:CategoryTradeTax/ram:CategoryCode='S'
and ram:CategoryTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate
])),
$logisticChargeAmount in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/
rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/
ram:SpecifiedLogisticsServiceCharge[
ram:AppliedTradeTax/ram:CategoryCode='S'
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),
$logisticChargeAmountini in xs:decimal(round(sum(/rsm:CrossIndustryInvoice/
rsm:SupplyChainTradeTransaction/ram:ApplicableHeaderTradeSettlement/
ram:SpecifiedLogisticsServiceCharge[
ram:AppliedTradeTax/ram:CategoryCode='S'
and ram:AppliedTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate
]/xs:decimal(ram:AppliedAmount)) * 100) div 100),
$nblogisticCharge in xs:decimal(count(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/
ram:ApplicableHeaderTradeSettlement/ram:SpecifiedLogisticsServiceCharge[
ram:AppliedTradeTax/ram:CategoryCode='S'
and ram:AppliedTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate
and normalize-space(ram:AppliedTradeTax/ram:ExemptionReasonCode) = $exempReasonCode
and normalize-space(ram:AppliedTradeTax/ram:ExemptionReason) = $exempReasonText
])),
$nblogisticChargeini in xs:decimal(count(/rsm:CrossIndustryInvoice/rsm:SupplyChainTradeTransaction/
ram:ApplicableHeaderTradeSettlement/ram:SpecifiedLogisticsServiceCharge[
ram:AppliedTradeTax/ram:CategoryCode='S'
and ram:AppliedTradeTax/xs:decimal(ram:RateApplicablePercent)=$rate
]))
return (abs($basisAmount - $calculatedAmountBT131 + $allowancesAmountBT92 - $chargesAmountBT99 - $logisticChargeAmount) le 0.01 * ($nbLineItems + $nbAllowancesOrCharges + $nblogisticCharge))
or (abs($basisAmount - $calculatedAmountBT131ini + $allowancesAmountBT92ini - $chargesAmountBT99ini - $logisticChargeAmountini) le 0.01 * ($nbLineItemsini + $nbAllowancesOrChargesini + $nblogisticChargeini))
)