BR-FREXT-G-01

The rule sets below word this rule differently; each wording is shown with its rule set.

error: the document is invalid

What the rule checks

As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.

Message

An Invoice that contains an Invoice line (BG-25) where the "Subtype of invoice line item" (EXT-FR-FE-163 / 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) where the VAT category code (BT-151, BT-95 or BT-102) is “G” ("Export outside the EU") shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with “G” ("Export outside the EU").

Context
/ubl:Invoice | /cn:CreditNote
Test
(count(cac:AllowanceCharge/cac:TaxCategory[normalize-space(cbc:ID) = 'G']) + count((cac:InvoiceLine | cac:CreditNoteLine)[not(cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID = $invoiceID) or (cac:BillingReference[cac:InvoiceDocumentReference/cbc:ID = $invoiceID]/cac:InvoiceDocumentReference/cbc:DocumentStatusCode = 'DETAIL')]/cac:Item/cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'G']) + count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'G']) = 0) or (count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[normalize-space(cbc:ID) = 'G']) >= 1 and (exists(cac:AllowanceCharge/cac:TaxCategory[normalize-space(cbc:ID) = 'G']) or exists((cac:InvoiceLine | cac:CreditNoteLine)[not(cac:BillingReference/cac:InvoiceDocumentReference/cbc:ID = $invoiceID) or (cac:BillingReference[cac:InvoiceDocumentReference/cbc:ID = $invoiceID]/cac:InvoiceDocumentReference/cbc:DocumentStatusCode = 'DETAIL')]/cac:Item/cac:ClassifiedTaxCategory[normalize-space(cbc:ID) = 'G'])))

Checked with France EXTENDED-CTC-FR (UBL)

Message

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) where the VAT category code (BT-151, BT-95 or BT-102) is “G” ("Export outside the EU") shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with “G” ("Export outside the EU").

Context
/rsm:CrossIndustryInvoice
Test
(count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='G'])=0 and count(//ram:SpecifiedLineTradeSettlement[not(../ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ../ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL']/ram:ApplicableTradeTax[ram:CategoryCode='G'])=0 and count(//ram:CategoryTradeTax[ram:CategoryCode='G'])=0) or ( count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='G'])>=1 and (exists(//ram:SpecifiedLineTradeSettlement[not(../ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ../ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL']/ram:ApplicableTradeTax[ram:CategoryCode='G']) or exists(//ram:CategoryTradeTax[ram:CategoryCode='G'])))

Checked with France EXTENDED-CTC-FR (CII)