Allowance or charge amount

Error PEPPOL-EN16931-R040 Peppol

Allowance/charge amount must equal base amount * percentage/100 if base amount and percentage exists

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

When both ram:BasisAmount and ram:CalculationPercent are present, ram:ActualAmount does not match the base amount multiplied by the percentage and divided by 100 within the permitted tolerance. If ram:ActualAmount is absent, the comparison uses 0.

What the rule means

The amount of a percentage-based allowance or charge must be arithmetically consistent with its base amount and percentage.

Please align the allowance or charge amount, base amount, and percentage

The amount of an allowance or charge does not match the calculation based on its base amount and percentage. You can correct the invoice by aligning the related values.

What to do
  1. Find the affected ram:SpecifiedTradeAllowanceCharge.
  2. Compare ram:ActualAmount with ram:BasisAmount multiplied by ram:CalculationPercent and divided by 100.
  3. Generate the invoice again and validate it.
What it looks like
✗ Triggers the message
<ram:SpecifiedTradeAllowanceCharge>
  <ram:ActualAmount>11</ram:ActualAmount>
  <ram:BasisAmount>100</ram:BasisAmount>
  <ram:CalculationPercent>10</ram:CalculationPercent>
</ram:SpecifiedTradeAllowanceCharge>
✓ Correct
<ram:SpecifiedTradeAllowanceCharge>
  <ram:ActualAmount>10</ram:ActualAmount>
  <ram:BasisAmount>100</ram:BasisAmount>
  <ram:CalculationPercent>10</ram:CalculationPercent>
</ram:SpecifiedTradeAllowanceCharge>
Technical details

If ram:BasisAmount and ram:CalculationPercent are not both present, the test passes. Otherwise, u:slack compares ram:ActualAmount (or 0 if absent) with ram:BasisAmount × ram:CalculationPercent ÷ 100, allowing for $slackValue.

Where the rule applies

The rule applies to each ram:SpecifiedTradeAllowanceCharge.

Context (rule/@context)
ram:SpecifiedTradeAllowanceCharge
Test expression (assert/@test)
not(ram:CalculationPercent and ram:BasisAmount) or u:slack( if (ram:ActualAmount) then ram:ActualAmount else 0, (xs:decimal(ram:BasisAmount) * xs:decimal(ram:CalculationPercent)) div 100, $slackValue )