VRBL-INV-HU-1p0-49

Basic Info

Rule When the Invoice Line Tax ID is 'E', the value of the Invoice Line Tax Exemption Reason Code must be contained in Tax Exemption Reason (E) [VRBL-CL-HU-TaxExemptionReasonCode-E] (prefixed by 'VRBL:HU:') or be contained in Extended Tax Exemption Reason (E) [VRBL-CL-HU-TaxExemptionReasonCode-E-Extended] (prefixed by 'VRBL:HU:'). Allowed values: VRBL:HU:AAM, VRBL:HU:EAM, VRBL:HU:KBAET, VRBL:HU:KBAUK, VRBL:HU:NAM, VRBL:HU:TAM, VRBL:HU:UNKNOWN or VRBL:HU:ANTIQUES, VRBL:HU:ARTWORK, VRBL:HU:SECOND_HAND, VRBL:HU:TRAVEL_AGENCY.
Context /ubl:Invoice/cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:TaxExemptionReasonCode
Pattern vrbl-invoice-hu-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-HU-Prefix:$VRBL-CL-HU-TaxExemptionReasonCode-E or $VRBL-HU-Prefix:$VRBL-CL-HU-TaxExemptionReasonCode-E-Extended
showValues = true

Implementation

(
	not(../cbc:ID = 'E')
)
or
(
	not(boolean(.))
	or
	(
		(
			substring(normalize-space(.), 1, string-length($VRBL-HU-Prefix)) = $VRBL-HU-Prefix
			and
			not(
				contains(
					substring-after(normalize-space(.), $VRBL-HU-Prefix),
					substring($VRBL-CL-HU-TaxExemptionReasonCode-E, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-HU-TaxExemptionReasonCode-E,
				concat(
					substring($VRBL-CL-HU-TaxExemptionReasonCode-E, 1, 1),
					substring-after(normalize-space(.), $VRBL-HU-Prefix),
					substring($VRBL-CL-HU-TaxExemptionReasonCode-E, 1, 1)
				)
			)
		)
	)
	or
	(
		(
			substring(normalize-space(.), 1, string-length($VRBL-HU-Prefix)) = $VRBL-HU-Prefix
			and
			not(
				contains(
					substring-after(normalize-space(.), $VRBL-HU-Prefix),
					substring($VRBL-CL-HU-TaxExemptionReasonCode-E-Extended, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-HU-TaxExemptionReasonCode-E-Extended,
				concat(
					substring($VRBL-CL-HU-TaxExemptionReasonCode-E-Extended, 1, 1),
					substring-after(normalize-space(.), $VRBL-HU-Prefix),
					substring($VRBL-CL-HU-TaxExemptionReasonCode-E-Extended, 1, 1)
				)
			)
		)
	)
)