SDI-00423

2.2.1.11 <PrezzoTotale> non calcolato secondo le regole definite nelle specifiche tecniche

In English A line total (PrezzoTotale, 2.2.1.11) is not the unit price after its discounts and surcharges, times the quantity, within one cent.

error: the document is invalid

Why it fails

  • Percentage discounts were added up instead of applied one after the other: the SdI applies each to the price left by the previous one.
  • The line total was rounded before multiplying, or the quantity is missing (it then counts as 1).

How to fix it

Calculate PrezzoTotale as PrezzoUnitario, minus each SC and plus each MG in turn (an amount, or a percentage of the price so far), times Quantita.

What the rule checks

As the rule set's publisher wrote it. The rule runs on every element the context matches, and fails where the test is false; the validator reports the line of that element.

Context
/p:FatturaElettronica/FatturaElettronicaBody/DatiBeniServizi/DettaglioLinee
Test
abs(it:price($unit, ScontoMaggiorazione, true()) * $quantity - $total) le 0.01 or abs(it:price($unit, ScontoMaggiorazione, false()) * $quantity - $total) le 0.01

Checked with FatturaPA 1.2.3