VRBL-INV-CN-1p0-22

Basic Info

Rule When the Invoiced Item Tax Rate is 0, the value of the Invoiced Item Tax Category Code must be contained in Tax Category ID (subset of UNCL5305) applicable for zero rated tax [VRBL-CL-CN-INV-TaxCategoryID-ZeroRated].
Context /ubl:Invoice/cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory/cbc:ID
Pattern vrbl-invoice-cn-1p0
Severity fatal

Used Template: CodeList

Parameter Value
probe = .
codeList = $VRBL-CL-CN-INV-TaxCategoryID-ZeroRated

Implementation

(
	not(number(../cbc:Percent)=0)
)
or
(
	not(boolean(.))
	or
	(
		(
			not(
				contains(
					normalize-space(.),
					substring($VRBL-CL-CN-INV-TaxCategoryID-ZeroRated, 1, 1)
				)
			)
			and
			contains(
				$VRBL-CL-CN-INV-TaxCategoryID-ZeroRated,
				concat(
					substring($VRBL-CL-CN-INV-TaxCategoryID-ZeroRated, 1, 1),
					normalize-space(.),
					substring($VRBL-CL-CN-INV-TaxCategoryID-ZeroRated, 1, 1)
				)
			)
		)
	)
)