VRBL-INV-HU-1p0-50

Basic Info

Rule The Tax Exemption Reason Text must be provided for certain values of Tax Exemption Reason Code. When Tax Exemption Reason Text is missing the value of the Tax Exemption Reason Code must not be contained in Tax Exemption Reason (E) [VRBL-CL-HU-TaxExemptionReasonCode-E] (prefixed by 'VRBL:HU:'). Not allowed values: VRBL:HU:AAM, VRBL:HU:EAM, VRBL:HU:KBAET, VRBL:HU:KBAUK, VRBL:HU:NAM, VRBL:HU:TAM, VRBL:HU:UNKNOWN.
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
showValues = true

Implementation

(
	not(../cbc:ID = 'E') or boolean(../cbc:TaxExemptionReason)
)
or
(
	not(boolean(.))
	or
	(
		not(
			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)
				)
			)
		)
	)
)