VRBL-INV-HR-CIUS-1p0-22

Basic Info

Rule The Invoice Line Tax Exemption Reason or the Invoice Line Tax Exemption Reason Code 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 Exempt Tax Category IDs [VRBL-CL-HR-Exempt-TaxCategoryID] (prefixed by 'VRBL:HR:'). Not allowed values: VRBL:HR:HR:E, VRBL:HR:HR:N, VRBL:HR:HR:O, VRBL:HR:HR:POVNAK, VRBL:HR:HR:PP, VRBL:HR:HR:PPMV.
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-Exempt-TaxCategoryID
showValues = true

Implementation

(
	boolean(../cbc:TaxExemptionReason) or boolean(../cbc:TaxExemptionReasonCode)
)
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-Exempt-TaxCategoryID, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-HR-Exempt-TaxCategoryID,
				concat(
					substring($VRBL-CL-HR-Exempt-TaxCategoryID, 1, 1),
					substring-after(normalize-space(.), $VRBL-HR-CIUS-Prefix),
					substring($VRBL-CL-HR-Exempt-TaxCategoryID, 1, 1)
				)
			)
		)
	)
)