Invoice Calculation - Please help us!


Item prices that include taxes are a completely new feature and not as easy to implement.

See Berrechnung von Steuern für Endkunden


I think the best way is Calculation 1.

When you make a discount you did it over the product price or service price. In the Calculation 2 you make a discount over the taxes too.

I dont know how works in other countries but in mine the taxes are a collection that is made for the government.

You can´t make a discount over the taxes. if do it on this way, you would be making a discount to the amount you have to pay to the government. The government will claim you the same amount, so you would end up paying for the benefit of your product or service.

pinned globally #25


Genau dieses Problem versuche ich hier bereits seit geraumer Zeit vorzubringen.
Siehe Thread: “Berrechnung von Steuern für Endkunden”

Leider wurde bisher sogar angezweifelt dass es in Deutschland einfach NUR so geht.


In fact these are two entirely different things.

  1. The option to calculate the item discount before or after the item taxes.
  2. The option to define products with taxes included.

Please do not mix things up. The first option has to do with this topic while the second option is a completely new feature.


I’m using version 1.5.4 and there’s something I’m not sure about invoice with discounts calculation.

I have an invoice with just 1 item, and the numbers reads like this:

[item_quantity] => 24.00
[item_price] => 3.05
[item_discount_amount] => 0.20

[item_subtotal] => 73.20

[item_tax_total] => 16.10
[item_discount] => 4.80
[item_total] => 84.50
[item_tax_rate_percent] => 22.00

as far as these numbers are concerned it looks like discount is applied after the tax has been calculated and added to the subtotal

But when you get to the invoice, these are the values I get

[invoice_item_subtotal] => 68.40
[invoice_item_tax_total] => 16.10
[invoice_tax_total] => 0.00
[invoice_total] => 84.50

It looks like the “invoice_item_subtotal” variable is the item_subtotal minus the item_discount, and in this case the discount is applied before taxes… :thinking:

My proposal is to go with calculation 1, specifying how to calculate item tax after applying the discount, as follows

1. item price x item amount = item subtotal
1.1 (item subtotal - item discount ) * item tax rate = item tax
2. (item subtotal - item discount ) + item tax = item total
3. (item total - invoice discount ) + invoice tax = invoice total


I work with an open source POS where both ways of computing Prices are possible.
A switch in the settings decides what way is used.

Either Gross Price (bruto) or Net Price (netto) then the taxes get calculated.

Personaly I do not matter as long as it is consistent.



The Tax should not be subject to any discount, as this is the money that you are required to charge by your tax authority. Therefore the correct caculation cann only be:

1. item price x item amount = item subtotal
2. (item subtotal - item discount ) + item tax = item total
3. (item total - invoice discount ) + invoice tax = invoice total

However, the issue is dependant on the type of discount, if it is percentage then the above calculation works, but if it is a fixed amount off a product then it relies on the discount being entered as the discount per item * quantity


In the UK you need to give the Net price (after any discounts whether percentage discount or amount), the VAT/Tax element payable on that Net price and then the total payable.

A separate Invoice tax itself is not relevant for our calculations as each item may have its own VAT/tax rate but separating total invoice VAT/Tax and total Net is required.

  1. (item price - item discount) x item amount = item subtotal (would be the Net item subtotal and acruing in item total)
  2. item tax rate percent x item subtotal = item tax subtotal (would be the Tax element of the item line and acruing in tax total)
  3. item total + tax total = invoice total (would be the amount payable)

This isnt quite what happens at present so things are a bit fudged to get the required invoice numbers but I thought I would add the voice to the mix if it helps.

unpinned #34


What @cornelinux and @donty say is correct the scenario occurs in that way, but generally the discount is applied to the product that is not yet calculated the tax, even when there is a deduction or deduction is separated from the calculation of the tax. I believe that such a proposal must be defined in the future.


Calculation 1


(sorry if I write something wrong, I really dont speak english very well.)
For me the correct order is this
(subtotal before discount)

Just to explain me a little bit, for taxes, the only thing that matters is the money you will receive for goods, so if you discount your mercancy the moeny in taxes are lower too, so taxes should be calculated after all kind of discount.