# BR-FXEXT-O-01

Source: https://xmlvalid.com/rules/BR-FXEXT-O-01

> 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 “O” ("Not subject to VAT") shall contain in the VAT breakdown (BG-23) at least one VAT category code (BT-118) equal with “O” ("Not subject to VAT").

- Level: error
- Rule sets: Factur-X EXTENDED rules 1.09.2
- Context: `/rsm:CrossIndustryInvoice`
- Test: `(count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='O'])=0 and count(//ram:SpecifiedLineTradeSettlement[not(../ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ../ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL']/ram:ApplicableTradeTax[ram:CategoryCode='O'])=0 and count(//ram:CategoryTradeTax[ram:CategoryCode='O'])=0 and count(//ram:AppliedTradeTax[ram:CategoryCode='O'])=0) or ( count(//ram:ApplicableHeaderTradeSettlement/ram:ApplicableTradeTax[ram:CategoryCode='O'])>=1 and (exists(//ram:SpecifiedLineTradeSettlement[not(../ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode) or ../ram:AssociatedDocumentLineDocument/ram:LineStatusReasonCode = 'DETAIL']/ram:ApplicableTradeTax[ram:CategoryCode='O']) or exists(//ram:CategoryTradeTax[ram:CategoryCode='O']) or exists(//ram:AppliedTradeTax[ram:CategoryCode='O'])))`

Validate a document against these rules: https://xmlvalid.com/validate
