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).

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.

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)

Checked with Portugal CIUS-PT Invoice (UBL), Portugal CIUS-PT Credit Note (UBL)

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)

Checked with Portugal CIUS-PT Invoice (UBL), Portugal CIUS-PT Credit Note (UBL)