Could you put your suggestion into a more readable format like explained in the first post?

# Invoice Calculation - Please help us!

**Siddhant_Naik**#17

Calculation that I gave is for peoples who wants tax to be calculated automatically.

eg like retailers who sell there product directly based on mrp, for them it will be difficult to calculate and insert item pricing.

so to fix this will have to create input box for ‘item total’ .

here vendors will enter MRP and qty, and tax will be calculated automatically.

in above comment MRP == 200.

**cutenature**#18

i just make a calculation, if seller sell a product at specific price (including all discounts and taxes) and discount & taxes calculated on the basis on selling price automatically.

i just create input field where seller input their final prices, discount & taxes calculated on the basis on final prices.

so customer will input

- Item Price
- Tax Rate
- Item Final Price (Selling Price)

when save invoice, Item Final Price Remains same as entered and there are changes in discount & taxes according to Item Final Price. As i make tax calculation after any discount.

item_sp >>> Item Final Price (Selling Price)

if(item_sp > 0){

itemP1 = 100 * item_sp / (100 + item_tax_rate_percent);

item_discount = item->item_price - itemP1;

item_discount_total = item_discount * item_quantity;

}

**Kovah**#19

Listen please, this thread is not about adding new features like calculating discounts or taxes from a final item price.

This thread is just about the **order of calculations in the current state**.

**cutenature**#20

ok, then i delete my reply, or if you have any such topic, you can transfer this to those topic

**beli3ver**#22

For me in Germany I need this:

item price (include taxes) x item amount = invoice total

invoice total / 1 + (tax rate in percent) = invoice tax

So in the invoice it stands like this

product 1 3,99€ 1 piece = 3,99

----------------------------------

price without tax = 3,35

taxes includes 19% = 0,64

total = 3,99

The problem in the version 1.5.5 with prices like 3,99 the will rounding errors. Like this

3,35€ * 10 pieces = 33,50 * 0,19 taxes = 6,37 € + 33,50 € = 39,87

but

3,99€ * 10 pieces = 39,99 (here the taxes included in the price)

So I give my customers 12 cents.

**Manuel_Rojas**#24

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.

**nickbe**#26

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.

**Kovah**#27

In fact these are two entirely different things.

- The option to calculate the item discount before or after the item taxes.
- 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.

**Gio**#29

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…

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
```

**janvl**#30

Hi,

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.

Regards,

Jan

**Adam**#32

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

**donty**#33

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.

- (item price - item discount) x item amount = item subtotal (would be the Net item subtotal and acruing in item total)
- item tax rate percent x item subtotal = item tax subtotal (would be the Tax element of the item line and acruing in tax total)
- 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.

**sinitcom**#35

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.

**dennis_vargas**#37

(sorry if I write something wrong, I really dont speak english very well.)

For me the correct order is this

subtotal

discount

(subtotal before discount)

taxes

total

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.