VRBL-INV-HR-CIUS-1p0-47

Basic Info

Rule When the Tax Category Rate is 0, the value of the Tax Category Code must not be contained in Tax Category IDs with Positive Tax Rate [VRBL-CL-HR-PositiveTaxRate-TaxCategoryID] (prefixed by 'VRBL:HR:'). Not allowed values: VRBL:HR:HR:PDV13, VRBL:HR:HR:PDV25, VRBL:HR:HR:PDV5.
Context /ubl:Invoice/cac:TaxTotal[cbc:TaxAmount/@currencyID = ../cbc:DocumentCurrencyCode]/cac:TaxSubtotal/cac:TaxCategory/cbc:ID
Pattern vrbl-invoice-hr-cius-1p0
Severity fatal

Used Template: CodeList

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

Implementation

(
	not(../cbc:Percent = 0)
)
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-PositiveTaxRate-TaxCategoryID, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-HR-PositiveTaxRate-TaxCategoryID,
				concat(
					substring($VRBL-CL-HR-PositiveTaxRate-TaxCategoryID, 1, 1),
					substring-after(normalize-space(.), $VRBL-HR-CIUS-Prefix),
					substring($VRBL-CL-HR-PositiveTaxRate-TaxCategoryID, 1, 1)
				)
			)
		)
	)
)