BR-KSA-36: Supply end date (KSA-24) must not be before supply date (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
- BR-KSA-15 · Standard tax invoices (388) need a supply date
- BR-KSA-35 · A supply end date (KSA-24) requires a supply date (KSA-5)
- BR-KSA-72 · Simplified summary invoices need supply start and end dates
- BR-KSA-33 · Every invoice needs an invoice counter value (ICV, KSA-16)
- BR-KSA-34 · Invoice counter value (ICV, KSA-16) must contain only digits
- BR-KSA-37 · Seller building number must be exactly 4 digits
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