How Price Including Taxes are Calculated

how are tax returns calculated


Since the availability of the "Price Lists Including Taxes " feature, there has been some doubts on how net prices/amounts and tax amounts are calculated.

This how is aimed to explain these calculations in a simple way.

The calculation can be split into two steps:

  1. First one is to calculate the Net Price based on a given Gross Price and then the corresponding Tax Rate
  2. Second one is to calculated the Tax Amount based on the newly calculated Net Price which then needs to be adjusted so the Net Amount plus the Tax Amount is equal to the Gross Amount .

Net Price Calculation

In Openbravo cascade taxes calculation is supported. This means that when the Net Price is being calculated we might not have a single rate to work with, but a relation of different tax rates.

Cascade taxes make the calculation of a net price from a given a gross price a bit more difficult. You would normally divide the gross price by the rate to get the net price, but the rate might not be a unique one, in other words it might not be available therefore it has to be calculated.

To calculate the tax rate we need to calculate the tax amount that corresponds to the gross price. If we divide that tax amount by the gross price we get the tax rate.

Having the tax rate we can calculate the net price:

If we substitute the tax rate by the previous formula and simplify it we get:

This method returns the exact result, but its

implementation requires to round the calculated tax amount.

In former Openbravo MPs this was rounded to the Price Precision of the currency, thus having a higher price precision was recommended.

After solving the issue 24378. a 50 decimals precision is used. If the price precision is higher than that, the price precision is used.

To help reducing the impact of this rounding issue instead of using the price, the total gross amount is used to calculate the net amount which once divided by the quantity, allow us to obtain the net price. The formula used then is:

Taxes Calculation

Once the net price is calculated it is time to calculate the final tax amount of the Order or the Invoice.

When taxes are calculated we also need to consider different possible configurations. Tax amounts might be rounded either at line or document level.

Besides, a single line might have tax amounts of different tax rates, if cascade tax rates are being used. So subtracting the net amount to the gross amount is not a valid option.

As the net prices are known, the standard methods to calculate the tax amounts based on net prices are used. However, the calculated net price has to be rounded to the price precision of the currency. This means that the sum of the tax amounts and the net amount might not be equal to the total gross amount. The difference needs to be adjusted in the tax amounts by adding or subtracting the difference to the higher tax amount so the final sum is correct.

Some examples with different taxes and gross prices


Category: Taxes

Similar articles: