VRBL-DPA-RS-1p0-14

Basic Info

Rule If both Shipment Dispatch Estimated Dispatch Date and Shipment Estimated Delivery Period End Date are given then the Shipment Estimated Delivery Period End Date must be later or equal to the Shipment Dispatch Estimated Dispatch Date.
Context /ubl:DespatchAdvice/cac:Shipment/cac:Delivery
Pattern vrbl-despatchadvice-rs-1p0
Severity fatal

Used Template: EndDateEqualOrLaterStartDate

Parameter Value
StartDate = cac:Despatch/cbc:EstimatedDespatchDate
EndDate = cac:EstimatedDeliveryPeriod/cbc:EndDate

Implementation

not(boolean(cac:Despatch/cbc:EstimatedDespatchDate)) 
or 
not(boolean(cac:EstimatedDeliveryPeriod/cbc:EndDate))
or 
number(
	concat(
		substring(cac:EstimatedDeliveryPeriod/cbc:EndDate, 1, 4),
		substring(cac:EstimatedDeliveryPeriod/cbc:EndDate, 6, 2),
		substring(cac:EstimatedDeliveryPeriod/cbc:EndDate, 9, 2)
	)
)
>=
number(
	concat(
		substring(cac:Despatch/cbc:EstimatedDespatchDate, 1, 4),
		substring(cac:Despatch/cbc:EstimatedDespatchDate, 6, 2),
		substring(cac:Despatch/cbc:EstimatedDespatchDate, 9, 2)
	)
)