VRBL-INV-TR-1p2-16

Basic Info

Rule When an Invoice contains a Tax Subtotal with Tax Subtotal Tax Scheme ID of 'VRBL:TR:4171', the value of the Invoice Type Code must be contained in Invoice Type Code (Tax 4171) [VRBL-CL-TR-Tax4171-InvoiceTypeCode] (prefixed by 'VRBL:TR:').
Context /ubl:Invoice
Pattern vrbl-invoice-tr-1p2
Severity fatal

Used Template: CodeList

Parameter Value
probe = cbc:InvoiceTypeCode
codeList = $VRBL-TR-Prefix:$VRBL-CL-TR-Tax4171-InvoiceTypeCode

Implementation

(
	not(boolean(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory/cac:TaxScheme/cbc:ID[text() = concat($VRBL-TR-Prefix, '4171')]))
)
or
(
	not(boolean(cbc:InvoiceTypeCode))
	or
	(
		(
			substring(normalize-space(cbc:InvoiceTypeCode), 1, string-length($VRBL-TR-Prefix)) = $VRBL-TR-Prefix
			and
			not(
				contains(
					substring-after(normalize-space(cbc:InvoiceTypeCode), $VRBL-TR-Prefix),
					substring($VRBL-CL-TR-Tax4171-InvoiceTypeCode, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-TR-Tax4171-InvoiceTypeCode,
				concat(
					substring($VRBL-CL-TR-Tax4171-InvoiceTypeCode, 1, 1),
					substring-after(normalize-space(cbc:InvoiceTypeCode), $VRBL-TR-Prefix),
					substring($VRBL-CL-TR-Tax4171-InvoiceTypeCode, 1, 1)
				)
			)
		)
	)
)