BR-KSA-36: Supply end date (KSA-24) must not be before supply date (KSA-5)

Explained by Matheel from ZATCA's rule text and the condition SDK 3.4.8 executes · Updated

Warning: accepted with a warningConditional, see belowFields: KSA-24, KSA-5

Applies when cac:Delivery has both cbc:ActualDeliveryDate (KSA-5) and cbc:LatestDeliveryDate (KSA-24) as valid YYYY-MM-DD dates: the end date must be greater than or equal to the supply date. If either date is missing or not a valid YYYY-MM-DD date, this rule does not compare them.

How to fix it

Make cbc:LatestDeliveryDate the same day as or later than cbc:ActualDeliveryDate, both in YYYY-MM-DD format.

ZATCA's official text

[BR-KSA-36]-If the invoice contains a supply end date (KSA-24), then this date must be greater than or equal to the supply date (KSA-5).
Source: ZATCA SDK 3.4.8 · ZATCA KSA rules

Fails when (the condition ZATCA's SDK runs)

(exists(../cbc:ActualDeliveryDate) and normalize-space(../cbc:ActualDeliveryDate) != '') and (string-length(string(../cbc:ActualDeliveryDate)) = 10 and matches( string(../cbc:ActualDeliveryDate), '((18|19|20)[0-9]{2}[\-](0[13578]|1[02])[\-](0[1-9]|[12][0-9]|3[01]))|(18|19|20)[0-9]{2}[\-](0[469]|11)[\-](0[1-9]|[12][0-9]|30)|(18|19|20)[0-9]{2}[\-](02)[\-](0[1-9]|1[0-9]|2[0-8])|(((18|19|20)(04|08|[2468][048]|[13579][26]))|2000)[\-](02)[\-]29')) and (string-length( .) = 10 and matches( string(.), '((18|19|20)[0-9]{2}[\-](0[13578]|1[02])[\-](0[1-9]|[12][0-9]|3[01]))|(18|19|20)[0-9]{2}[\-](0[469]|11)[\-](0[1-9]|[12][0-9]|30)|(18|19|20)[0-9]{2}[\-](02)[\-](0[1-9]|1[0-9]|2[0-8])|(((18|19|20)(04|08|[2468][048]|[13579][26]))|2000)[\-](02)[\-]29') )and not(xs:date(.) >= xs:date(../cbc:ActualDeliveryDate) )

Related rules

Validate your invoice against ZATCA's rules

Paste the XML and see every error and warning. It runs in your browser; the invoice goes nowhere.

Validate an invoice or try Matheel