VAT setup, calculation and rounding rules
This page explains how vat calculation works (or can work depending of options you choose) into Dolibarr.
Standard usage
Let's start with the example we will use. Imagine in invoice that contains the following lines (We also live into a country where total must be rounded with 2 decimal numbers).
Desc | Qty | Unit price | Vat rate | Tax amount | Exact price inc tax | Price inc tax on 2 decimals |
Product 1 | 1 | 1.24 | 10% | 10/100*1.24=0.124 | 1.24+0.124=1.354 | 1.24+0.12=1.36 (rounded to nearest to have price on 2 decimals) |
Product 2 | 1 | 1.24 | 10% | 10/100*1.24=0.124 | 1.24+0.124=1.354 | 1.24+0.12=1.36 (rounded to nearest to have price on 2 decimals) |
We have 2 ways to calculate the total of invoice: making a sum of rounding lines or rounding the sum of lines.
1) If we choose to make the sum of all rounded lines, we get: Total here are:
- Total without tax: 1.24 + 1.24 = 2.48
- Total tax 10%: 0.12 + 0.12 = 0.24 (we sum the rounded values of tax on each line)
- Total inc tax (we sum total without tax + total tax): 2.48 + 0.24 = 2.72
Note that if we sum rounded price inc tax on each line, we get: 1.36 + 1.36 = 2.72 (same result than previous line so we know there is no error)
2) If we choose to rounding amount that is sum of all lines, we get: Total here are:
- Total without tax: 1.24 + 1.24 = 2.48 (same than in method 1)
- Total tax 10%: (1.24 + 1.24) * 10% = 0.124 + 0.124 = 0.248 rounded to nearest to have a total on 2 decimals give 0.25 (we sum amount for each lines, calculate vat rate and after we round value on 2 decimals)
- Total inc tax (we sum total without tax + total tax): 3.73 + 0.25 + 0.25 = 4.23