Difference between revisions of "VAT calculation and rounding rules"

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
m
Line 1: Line 1:
This page explains how vat calculation is done (or can be done depending of options you choose) into Dolibarr ERP CRM.
+
This page explains how VAT calculations are done (or can be done depending on the options chosen) in Dolibarr ERP CRM.
  
  
 
= Standard VAT and rounding rules =
 
= Standard VAT and rounding rules =
Let's start with the example we will use. Imagine an invoice that contains the following lines (We also live into a country where total must be rounded with 2 decimal numbers).
+
For an example we will use an invoice with two products, based in a country where the totals must be rounded to two decimal places.
  
 
{|class="wikitable centre" width="80%"
 
{|class="wikitable centre" width="80%"
 
|- valign="top"
 
|- valign="top"
||&nbsp;||A<br>Description||B<br>Quantity||C<br>Unit price||D<br>Vat rate||E<br>Total without tax<br>=(B*C)||F<br>Exact tax amount<br>=(D*E)||nowrap="nowrap"|G<br>Tax amount rounded<br>on 2 dec<br>=round(F)||nowrap="nowrap"|H<br>Exact price<br>inc tax<br>=(E+F)||nowrap="nowrap"|I<br>Price inc tax rounded<br>on 2 decimals<br>=(E+G)
+
||&nbsp;||A<br>Description||B<br>Quantity||C<br>Unit price||D<br>Vat rate||E<br>Total without tax<br>=(B*C)||F<br>Exact tax amount<br>=(D*E)||nowrap="nowrap"|G<br>Tax amount rounded<br>to 2 dec. places<br>=round(F)||nowrap="nowrap"|H<br>Exact price<br>inc tax<br>=(E+F)||nowrap="nowrap"|I<br>Price inc tax rounded<br>to 2 decimals<br>=(E+G)
 
|-
 
|-
 
||1||nowrap="nowrap"|Product alpha||1||1.24||10%||1.24||0.124||0.12||1.24+0.124=1.364||1.36
 
||1||nowrap="nowrap"|Product alpha||1||1.24||10%||1.24||0.124||0.12||1.24+0.124=1.364||1.36
Line 14: Line 14:
 
|}
 
|}
  
We have 2 ways to calculate the total of invoice: making a sum of rounding lines or rounding the sum of lines.
+
We have two ways to calculate the total of the invoice: summing each rounded line or summing the lines and rounding the total.
  
1) If we choose to make the sum of lines after rounding (on 2 decimals) lines, we get:
+
1) If we choose to sum the rounded lines (to 2 decimal places) lines, we get:
 
* Total without tax: 1.24(E1) + 1.24(E2) = '''2.48'''
 
* Total without tax: 1.24(E1) + 1.24(E2) = '''2.48'''
 
* Total tax 10%: 0.12(G1) + 0.12(G2) = '''0.24''' (we sum the rounded values of tax on each line)
 
* Total tax 10%: 0.12(G1) + 0.12(G2) = '''0.24''' (we sum the rounded values of tax on each line)
 
* Total inc tax (we sum total without tax + total tax): 2.48(Ex) + 0.24(Gx) = '''2.72'''
 
* Total inc tax (we sum total without tax + total tax): 2.48(Ex) + 0.24(Gx) = '''2.72'''
  
Note that if we sum rounded price inc tax on each line, we get: 1.36(I1) + 1.36(I2) = '''2.72''' (same result so we know there is no error)
+
Note that if we sum the rounded price inc. tax on each line, we get: 1.36(I1) + 1.36(I2) = '''2.72''' (the same result, so we know there is no error)
  
2) If we choose to round (on 2 decimals) amount after summing all lines, we get:
+
2) If we choose to round the amount (to 2 decimals) after summing the unrounded lines, we get:
* Total without tax: 1.24(E1) + 1.24(E2) = '''2.48''' (same than in method 1)
+
* Total without tax: 1.24(E1) + 1.24(E2) = '''2.48''' (same as method 1)
* Total tax 10%: (1.24(E1) + 1.24(E2)) * 10% = 0.124 + 0.124 = 0.248 rounded to nearest to have a total on 2 decimals give '''0.25''' (we sum amount without tax for each lines, calculate vat rate on this and after we round value on 2 decimals)
+
* Total tax 10%: (1.24(E1) + 1.24(E2)) * 10% = 0.124 + 0.124 = 0.248 rounded to nearest two decimals gives '''0.25''' (we sum the amount without tax for each lines, calculate vat rate on this and subsequently we round the value to 2 decimals)
* Total inc tax (we sum total without tax + total tax): 2.48 + 0.25 = '''2.73'''
+
* Total inc tax (we sum each line without tax and add the total tax): 2.48 + 0.25 = '''2.73'''
  
First thing we can note is that result from method 1 differs of result from method 2. Difference is only 0.01 but if you have n times the same line, difference can be higher but always lower or equal to (n-1)*0.01.
+
The first  point to note is that the result of Method 1 differs from the result of method 2 by 0.01.  If you have n times the same line, the difference can be higher but is always lower than/equal to (n-1)*0.01.
Also if you decide to round up or down instead of "to the nearest", you will have same problem (for example with a rounding down, try with a quantity of 2 on line 2 and you will have same differences between method 1 and 2). Difference will just appears with different data but will still occurs, so problem is not on how we make rounding but when.
+
Also if you decide to round up or down instead of "to the nearest", you will have same problem (for example with rounding down, try with a quantity of 2 on line 2 and you will have same differences between method 1 and 2). Difference will just appears with different data but will still occur, so the problem is not on how we make the rounding but when.
  
Second thing we can note is that if we use method 2, we must not show the column I onto invoice, otherwise to total you show on your invoice (2.73) will not be same that total you get summing total of each line (1.36+1.36=2.72). Showing column H might be better but total will still differs because total (2.73) is rounded and result of summing column H lines (1.364+1.364=2.728) will still differs.
+
The second point is that if we use method 2, we must not show the column I on the invoice, otherwise the total you show on your invoice (2.73) will not be the same as the total you get summing the totals of each line (1.36+1.36=2.72). Showing column H might be better but the total will still differ because the total (2.73) is rounded and the result of summing column H lines (1.364+1.364=2.728) will still differ.
  
 
'''So what to do ?'''
 
'''So what to do ?'''
* In some countries, calculation must always be done using method 1 for generating invoice. As this is the default calculation rule for Dolibarr, there is nothing to do.
+
* In some countries, calculations must always be done using method 1 for generating invoices. As this is the default calculation rule for Dolibarr, there is nothing to change from the default configuration..
* In other countries (very rare), calculation must always be done using method 2 for generating invoice. To avoid having total shown at the top of the invoice that differs from total of detailed line, just do not show column I on invoice. This is the case with Dolibarr default invoice templates, so that's not a problem. To enable this rule of calculation, you must use Dolibarr version 3.5+ and set constant MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND to 1 (Home - Setup - Other).
+
* In other countries (rarely), calculations must always be done using method 2 for generating invoices. To avoid having the total shown at the top of the invoice that differs from the totals of detailed lines, just do not show column I on invoice. This is the case with Dolibarr default invoice templates, so that's not a problem. To enable this rule of calculation, you must use Dolibarr version 3.5+ and add/override the constant MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND to 1 (in Home - Setup - Other).
* In most countries, the 2 methods are possible. So here, just use method 1 that will be more efficient when you will make accountancy (because, if you use method 2, total of vat on your invoice will not be sum of F, nor sum of G and this may create confusion later). If you prefer to use method 2, use Dolibarr version 3.5+ and set constant MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND to 1 (Home - Setup - Other).
+
* In most countries, both methods are possible. In this case just use method 1 that will be more accurate for accounting (since if you use method 2, the total of vat collected on your invoice will not be the sum of F, nor the sum of G and this may create confusion subsequently). If you prefer to use method 2, use Dolibarr version 3.5+ and set constant MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND to 1 (Home - Setup - Other).
  
 
= Second or Third Tax =
 
= Second or Third Tax =

Revision as of 07:15, 13 September 2018

This page explains how VAT calculations are done (or can be done depending on the options chosen) in Dolibarr ERP CRM.


Standard VAT and rounding rules

For an example we will use an invoice with two products, based in a country where the totals must be rounded to two decimal places.

  A
Description
B
Quantity
C
Unit price
D
Vat rate
E
Total without tax
=(B*C)
F
Exact tax amount
=(D*E)
G
Tax amount rounded
to 2 dec. places
=round(F)
H
Exact price
inc tax
=(E+F)
I
Price inc tax rounded
to 2 decimals
=(E+G)
1 Product alpha 1 1.24 10% 1.24 0.124 0.12 1.24+0.124=1.364 1.36
2 Product beta 1 1.24 10% 1.24 0.124 0.12 1.24+0.124=1.364 1.36

We have two ways to calculate the total of the invoice: summing each rounded line or summing the lines and rounding the total.

1) If we choose to sum the rounded lines (to 2 decimal places) lines, we get:

  • Total without tax: 1.24(E1) + 1.24(E2) = 2.48
  • Total tax 10%: 0.12(G1) + 0.12(G2) = 0.24 (we sum the rounded values of tax on each line)
  • Total inc tax (we sum total without tax + total tax): 2.48(Ex) + 0.24(Gx) = 2.72

Note that if we sum the rounded price inc. tax on each line, we get: 1.36(I1) + 1.36(I2) = 2.72 (the same result, so we know there is no error)

2) If we choose to round the amount (to 2 decimals) after summing the unrounded lines, we get:

  • Total without tax: 1.24(E1) + 1.24(E2) = 2.48 (same as method 1)
  • Total tax 10%: (1.24(E1) + 1.24(E2)) * 10% = 0.124 + 0.124 = 0.248 rounded to nearest two decimals gives 0.25 (we sum the amount without tax for each lines, calculate vat rate on this and subsequently we round the value to 2 decimals)
  • Total inc tax (we sum each line without tax and add the total tax): 2.48 + 0.25 = 2.73

The first point to note is that the result of Method 1 differs from the result of method 2 by 0.01. If you have n times the same line, the difference can be higher but is always lower than/equal to (n-1)*0.01. Also if you decide to round up or down instead of "to the nearest", you will have same problem (for example with rounding down, try with a quantity of 2 on line 2 and you will have same differences between method 1 and 2). Difference will just appears with different data but will still occur, so the problem is not on how we make the rounding but when.

The second point is that if we use method 2, we must not show the column I on the invoice, otherwise the total you show on your invoice (2.73) will not be the same as the total you get summing the totals of each line (1.36+1.36=2.72). Showing column H might be better but the total will still differ because the total (2.73) is rounded and the result of summing column H lines (1.364+1.364=2.728) will still differ.

So what to do ?

  • In some countries, calculations must always be done using method 1 for generating invoices. As this is the default calculation rule for Dolibarr, there is nothing to change from the default configuration..
  • In other countries (rarely), calculations must always be done using method 2 for generating invoices. To avoid having the total shown at the top of the invoice that differs from the totals of detailed lines, just do not show column I on invoice. This is the case with Dolibarr default invoice templates, so that's not a problem. To enable this rule of calculation, you must use Dolibarr version 3.5+ and add/override the constant MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND to 1 (in Home - Setup - Other).
  • In most countries, both methods are possible. In this case just use method 1 that will be more accurate for accounting (since if you use method 2, the total of vat collected on your invoice will not be the sum of F, nor the sum of G and this may create confusion subsequently). If you prefer to use method 2, use Dolibarr version 3.5+ and set constant MAIN_ROUNDOFTOTAL_NOT_TOTALOFROUND to 1 (Home - Setup - Other).

Second or Third Tax

For Brazil

See page BrasilTaxes


For Canada

Lexical

  • GST = Goods and Services Tax (TPS = Taxe sur les Produit et Services for Quebec)
  • PST = Provincial sales taxes (TVQ = Taxe de Vente Québecoise for Quebec = QST = Quebec Sale Tax)

Setup

The GST is applied automatically on each lines (when added or edited). Value of rate for second tax PST is automatically extracted by system from the dictionary table of VAT rates, for the GST vat rate line used and your country (Table llx_c_tva).

  • Warning.png Note that the second tax will be added only if you setup your company into Home - Setup - Company - Use 2nd tax to yes (this option is visible for country whose a second tax is defined into dictionary tables of vats).


Example of user setup: Go into Home - Setup - Dictionary - VAT and sale tax, into column "Rate" enter a GST vat rate with value 5, into column "Tax 2" (PST) enter a VAT rate 9.5 with type "2" (Type "2" means the tax 2 is calculated for product and services on the price including the GST). Change values or rates according to your province rates.

Note: Another solution is to set the "Tax 2" (PST) with vat rate 9.975 and set type of tax 2 to type "1" (Type "1" means tax 2 is added for product and services, and calculated on net price, so does not include GST vat for calculation. It is same than using 9.5 and making calculation on price including GST).


Example of calculation

  A
Description
B
Quantity
C
Unit price
D1
Vat rate GST
D2
Vat rate PST
E
Total without tax
=(B*C)
F
Tax GST
=(B*C*D1)=(D1*E)
G
Tax PST (B*C*D2)=(D2*E)
H
Price inc GST + PST=(E+F+G)
1 Product alpha 10 10 5% 9.975% 100 5 9.98 114.98

For India

There is SGST, CGST and IGST. Setup is available by default with 6.0

For Italy

You may need to add a negative withholding tax calculated on net amount.

Setup

Value of rates are found into the dictionary table from the standard vat rate (Table llx_c_tva). Total with tax and total amount of vat is modified according to calculation.

Setup example: When vat rate is 22, add a tax 2 (witholding) of type "1" (Type "1" means tax 2 is added for product and services and calculated on net price), rate is -20% (negative means amount will be substracted)

Example or calculation

  A
Description
B
Quantity
C
Unit price
D1
Vat rate
D2
Vat rate withholding tax
E
Total without tax
=(B*C)
F
Tax VAT
=(B*C*D1)
G
Tax 2 (B*C*D2)
H
Price inc VAT + Tax 2=(E+F+G)
1 Product alpha 10 10 22% -20% 100 22 -20 102


For Spain

Specific management for spain are supported from Dolibarr 3.0.

In spain, there is 2 more vat rate for each line:

  • The vat rate RE (a vat rate calculated on total without tax for products, and added to total to obtain total with tax)
  • The vat rate IRPF (a vate rate calculated on total without tax for services, and substracted from total to obtain total with tax)

Both complementary taxes can't be found in an invoice. RE is applied only for products and IRPF only for services. Because IRPF tax is always negative, in credit invoices the total IRPF will be positive.

Setup

The two vat rate are applied automatically (if company has been setup to use them) on each lines (when added or edited). Value of rates are found into the dictionary table from the standard vat rate (Table llx_c_tva). Total with tax and total amount of vat is modified according to calculation.

Setup example: For standard vat rate 10, Localtax 1 (RE) is set with type "3" (tax is applied on net price, for products only), rate 1.4%

Example of calculation

  A
Description
B
Quantity
C
Unit price
D1
Vat rate
D2
RE
E
Total without tax
=(B*C)
F
Exact tax amount
=(B*C*D1)=(D1*E)
G
Tax RE (B*C*D2)=(D2*E)
H
Price inc standard vat + RE=(E+F+G)
1 Product alpha 10 10 10% 1.4% 100 10 1.4 111.4

Example of calculation in credit notes

  A
Description
B
Quantity
C
Unit price
D1
Vat rate
D2
IRPF
E
Total without tax
=(B*C)
F
Exact tax amount
=(B*C*D1)=(D1*E)
G
Tax RE (B*C*D2)=(D2*E)
H
Price inc standard vat + RE=(E+F+G)
1 Product alpha 10 -10 21% -21% -100 0 21 100

Note

R.E. (Localtax1) is applied to product sales and not to service sales. But a service may be invoiced in the same invoice with a product sale if this is related to the product sales and it increasing its cost (ex: shipping costs).

Currently to treat this case you must enter these services (ex: shipping costs) with a free line, and indicating the type as product, not as service.