VRBL-INV-HR-CIUS-1p0-24

Basic Info

Rule The Buyer Tax Company ID used for VAT ID must exist for certain Invoice Line Tax ID values. If it does not exist the value of the Invoice Line Tax ID must not be contained in Tax Category IDs requiring Customer VAT [VRBL-CL-HR-Customer-VAT-required-TaxCategoryID] (prefixed by 'VRBL:HR:'). Not allowed values: VRBL:HR:HR:AE, VRBL:HR:HR:E, VRBL:HR:HR:PDV13, VRBL:HR:HR:PDV25, VRBL:HR:HR:PDV5, VRBL:HR:HR:Z.
Context /ubl:Invoice/cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID
Pattern vrbl-invoice-hr-cius-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = !$VRBL-HR-CIUS-Prefix:$VRBL-CL-HR-Customer-VAT-required-TaxCategoryID
showValues = true

Implementation

(
	boolean(/ubl:Invoice/cac:AccountingCustomerParty/cac:Party/cac:PartyTaxScheme[cac:TaxScheme/cbc:ID = 'VAT']/cbc:CompanyID)
)
or
(
	not(boolean(.))
	or
	(
		not(
			substring(normalize-space(.), 1, string-length($VRBL-HR-CIUS-Prefix)) = $VRBL-HR-CIUS-Prefix
			and
			not(
				contains(
					substring-after(normalize-space(.), $VRBL-HR-CIUS-Prefix),
					substring($VRBL-CL-HR-Customer-VAT-required-TaxCategoryID, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-HR-Customer-VAT-required-TaxCategoryID,
				concat(
					substring($VRBL-CL-HR-Customer-VAT-required-TaxCategoryID, 1, 1),
					substring-after(normalize-space(.), $VRBL-HR-CIUS-Prefix),
					substring($VRBL-CL-HR-Customer-VAT-required-TaxCategoryID, 1, 1)
				)
			)
		)
	)
)