VRBL-INV-TR-1p2-15

Basic Info

Rule When the Withholding Tax is provided, the value of the Invoice Type Code must be contained in Invoice Type Code [VRBL-CL-TR-Withholding-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-Withholding-InvoiceTypeCode

Implementation

(
	not(boolean(cac:WithholdingTaxTotal))
)
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-Withholding-InvoiceTypeCode, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-TR-Withholding-InvoiceTypeCode,
				concat(
					substring($VRBL-CL-TR-Withholding-InvoiceTypeCode, 1, 1),
					substring-after(normalize-space(cbc:InvoiceTypeCode), $VRBL-TR-Prefix),
					substring($VRBL-CL-TR-Withholding-InvoiceTypeCode, 1, 1)
				)
			)
		)
	)
)