VRBL-INV-SG-1p4-38

Basic Info

Rule An Invoice that contains Invoice Line Tax ID used for GST, Charge Tax ID used for GST or Allowance Tax ID used for GST equal to "VRBL:SG:NG" shall contain exactly one GST breakdown group Tax Subtotal with the Tax Subtotal Category ID equal to "VRBL:SG:NG".
Context /ubl:Invoice
Pattern vrbl-invoice-sg-1p4
Severity fatal

Implementation

not(
	cac:AllowanceCharge[string(cbc:ChargeIndicator = 'false')]/cac:TaxCategory[cac:TaxScheme/cbc:ID = 'GST']/cbc:ID = 'VRBL:SG:NG'
	or
	cac:AllowanceCharge[string(cbc:ChargeIndicator = 'true')]/cac:TaxCategory[cac:TaxScheme/cbc:ID = 'GST']/cbc:ID = 'VRBL:SG:NG'
	or
	cac:InvoiceLine/cac:Item/cac:ClassifiedTaxCategory[cac:TaxScheme/cbc:ID = 'GST']/cbc:ID = 'VRBL:SG:NG'
)
or
(
	cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[cac:TaxScheme/cbc:ID = 'GST']/cbc:ID = 'VRBL:SG:NG'
	and
	count(cac:TaxTotal/cac:TaxSubtotal/cac:TaxCategory[cac:TaxScheme/cbc:ID = 'GST' and cbc:ID = 'VRBL:SG:NG']) = 1
)