Billing period end date must not precede its start date

Error BR-30 EN 16931

If both Invoice line period start date (BT-134) and Invoice line period end date (BT-135) are given then the Invoice line period end date (BT-135) shall be later or equal to the Invoice line period start date (BT-134).

Mandatory rule: As long as it is violated, the invoice is invalid and will be rejected by validators.
What is wrong

When both ram:StartDateTime and ram:EndDateTime are provided, the date in ram:EndDateTime is earlier than the date in ram:StartDateTime.

What the rule means

A billing period must be in chronological order: its end date must not be earlier than its start date.

Affected fields BT-134 BT-135
Please put the billing period start and end dates in order

The billing period end date is earlier than its start date. You can resolve this by providing the two dates in the correct order.

What to do
  1. Check the StartDateTime and EndDateTime values in the billing period.
  2. Make sure the end date is the same as or later than the start date.
  3. Check the mappings in TradeLineItem.BillingPeriodStart and TradeLineItem.BillingPeriodEnd.
  4. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:BillingSpecifiedPeriod>
  <ram:StartDateTime>
    <udt:DateTimeString format="102">20240102</udt:DateTimeString>
  </ram:StartDateTime>
  <ram:EndDateTime>
    <udt:DateTimeString format="102">20240101</udt:DateTimeString>
  </ram:EndDateTime>
</ram:BillingSpecifiedPeriod>
✓ Correct
<ram:BillingSpecifiedPeriod>
  <ram:StartDateTime>
    <udt:DateTimeString format="102">20240101</udt:DateTimeString>
  </ram:StartDateTime>
  <ram:EndDateTime>
    <udt:DateTimeString format="102">20240102</udt:DateTimeString>
  </ram:EndDateTime>
</ram:BillingSpecifiedPeriod>
Check in FactoorSharp
  • TradeLineItem.BillingPeriodStart (BT-134)
  • TradeLineItem.BillingPeriodEnd (BT-135)
Technical details

The test compares the date values in ram:EndDateTime and ram:StartDateTime when both are present; equal dates are allowed.

Where the rule applies

The rule applies to the invoice line’s billing period ram:BillingSpecifiedPeriod.

Context (rule/@context)
//ram:SpecifiedLineTradeSettlement/ram:BillingSpecifiedPeriod
Test expression (assert/@test)
(ram:EndDateTime/udt:DateTimeString[@format = '102']) >= (ram:StartDateTime/ udt:DateTimeString[@format = '102']) or not (ram:EndDateTime) or not (ram:StartDateTime)