# DT-CIUS-PT-176

Source: https://xmlvalid.com/rules/DT-CIUS-PT-176

> An Invoice that contains Invoice lines (BG-25) with diferent VAT exemption reason codes, where the VAT category code (BT-151) is “Exempt from VAT”, shall contain exactly one VATBReakdown (BG-23) with the VAT category code (BT-118) equal to "Exempt from VAT", for each VAT exemption reason code (BT-121).

- Level: error
- Rule sets: CIUS-PT rules (Portugal, UBL) 2.1.1
- Context: `//ubl:Invoice | //cn:CreditNote`
- Test: `every $taxExemptionReasonCode in //cac:InvoiceLine[cac:Item/cac:ClassifiedTaxCategory/cbc:ID = 'E' or cac:Item/cac:ClassifiedTaxCategory/cbc:ID = 'ISE']/cac:Item/cac:AdditionalItemProperty[cbc:Name='#TAXEXEMPTIONREASONCODE@CLASSIFIEDTAXCATEGORY#']/cbc:Value satisfies ( count(//cac:TaxTotal/cac:TaxSubtotal[(cac:TaxCategory/cbc:ID='E' or cac:TaxCategory/cbc:ID='ISE') and cac:TaxCategory/cbc:TaxExemptionReasonCode = $taxExemptionReasonCode]) = 1)`

> An Invoice that contains Invoice lines (BG-25) with diferent VAT exemption reason codes, where the VAT category code (BT-151) is “Exempt from VAT”, shall contain exactly one VATBReakdown (BG-23) with the VAT category code (BT-118) equal to "Exempt from VAT", for each VAT exemption reason code (BT-121).

- Level: error
- Rule sets: CIUS-PT rules (Portugal, UBL) 2.1.1
- Context: `//ubl:Invoice | //cn:CreditNote`
- Test: `every $taxExemptionReasonCode in //cac:CreditNoteLine[cac:Item/cac:ClassifiedTaxCategory/cbc:ID = 'E' or cac:Item/cac:ClassifiedTaxCategory/cbc:ID = 'ISE']/cac:Item/cac:AdditionalItemProperty[cbc:Name='#TAXEXEMPTIONREASONCODE@CLASSIFIEDTAXCATEGORY#']/cbc:Value satisfies ( count(//cac:TaxTotal/cac:TaxSubtotal[(cac:TaxCategory/cbc:ID='E' or cac:TaxCategory/cbc:ID='ISE') and cac:TaxCategory/cbc:TaxExemptionReasonCode = $taxExemptionReasonCode]) = 1)`

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