Discounts and taxes are calculated per line item
Discounts and taxes are always calculated per individual line item – not based on the total sum of all items. This means: for each invoice line item, the discount is first deducted, and then the tax is calculated. Only after that are the line items added together to form the total.
Rounding differences with multiple line items or discounts
Since each line item is rounded individually, minor discrepancies in the final total may occur when there are multiple line items and/or discounts. These rounding differences are system-inherent and correct.
⚠️ In the example below, a rounding difference of 4 cents occurs in the final total. This is not an error, but the expected behavior of the per-line-item calculation.
Sample Invoice
UNIT PRICE GROSS | DISCOUNT 13 % (OR x 0,87) | DISCOUNTED AMOUNT | TAX 7 % (÷ 1.07) | NET AMOUNT PER UNIT | QTY | TOTAL NET |
|---|---|---|---|---|---|---|
4.99 € | 0.65 € / toal: 5.85 € | 4.34 € | 0.28 € (total: 2.52 €) | 4.06 | 9 pcs | 36.54 € |
8.99 € | 1.17 € | 7.82 € | 0.51 € | 7.31 € | 1 pcs | 7.31 € |
Total discount: 7.02 € | Total discount: 3.03 € | 43.85 € | ||||
+ 7 % tax total | 3.03 € | |||||
= Total brutto | 46.88 € (Δ 4 Ct.) | |||||
Tax is not calculated twice in the total
Tax is determined exclusively at the line item level. In the total, the already-calculated tax amount is simply carried over – it is not recalculated there. This ensures that no tax is applied twice in the final total.
Verification: individual purchase vs. combined purchase
As a consistency check: if a customer purchases each line item individually, the resulting values must be identical to those of a combined purchase of all items in a single order. If the results differ, a calculation error is present.
✓ This check is a useful quick validation during the development and testing of invoice calculation logic for XML and PDF invoice.