# Calculate order discount correctly when Tax is set per unit?

I'm sure this has been asked before, but I could not find an answer when I searched. Lets say I have an invoice with 3 line items shown below (All excluding tax)

``````SomeItemOne - Cost:£2.45 | Qty:1
SomeItemTwo - Cost:£22.45 | Qty:5
SomeItemThree - Cost:£68.99 | Qty:4
``````

And the tax (VAT = 20%) is calculated based on individual unit price (See link).

So based on the above I would have the following to work out the tax

``````SomeItemOne: £2.45 + £0.49(20%) x 1 = £2.94
SomeItemTwo: £22.45 + £4.49(20%) x 5 = £134.70
SomeItemThree: £68.99 + £13.80(20%) x 4 = £331.16
``````

Which gives me the following

``````Subtotal: £390.66
Tax: £78.14
Total: £468.80
``````

Now I need to be able to offer % discounts off the entire order. Currently I have a 10% discount I need to apply, which would be discount before tax (As I obviously cannot discount tax).

How would I go about doing this? As the tax is calculated per unit? And there are many line items with varying qty?

That is not how VAT usually works.

To my knowledge (IANAL, but have coded quite a few systems to handle VAT)

• VAT is always to be calculated on the total sum of an invoice (if you have different rates, you have to calculate one sum for every rate)

• VAT is always rounded up.

Example:

This is simple: So let´s say you have an item that costs just 7 cent´s. That makes 1.4 cent rounded to 2 cents of VAT.

Now you have a customer ordering 100 of these for \$7. The total VAT is \$1.40

You give a 10% discount to \$6.30, VAT is \$1.26. -> Tax per piece would be 1.26 cent

But this: Customer changes his order to 103 for \$7.21. Tax would be \$1.45 (1.442 rounded up)

You give discount again \$6.49. VAT is \$1.30. Now if you calculate \$6.49 / 103 pcs * 20% you get tax per piece of 1.26019417475728 cent

If you calculate \$1.30 tax/ 103 pcs you get tax per piece of 1.26621359223301 cent

Makes for a total difference of 0.2 cents already for the 103 pieces. So what is correct, 20% on the individual rebated price or the 1.26621359223301 cent out of the \$1.30?

Answer: Neither, VAT is a transaction fee - it is added to the value of the transaction (the invoice) not the item.

You can try to calculate back the per-item VAT then as a statistical value, but it may not be exactly 20% anymore. Don´t get that mixed up or you will acquire a lot of rounding errors down the road.

As per comments, example of a groceries bill taxed 7% and plastic bag taxed 19%: Notice how the 0.95... cents of tax for the plastic bag are rounded up to a full cent, and this full cent is owed by the supermarket. Also note that in this example item prices are given including tax, so the supermarket has to deal with some fluctuations in net prices. In a B-to-B invoice this would be the other way around

• Really appreciate you taking the time to reply :) "VAT is always to be calculated on the total sum of an invoice"... The issue here is you can have line items that are either VAT exempt or have reduced VAT (10%)? So how would you work that out on the total? This is why it's done at the line item level in the example in the link. I couldn't see any other way around it. – leen3o Oct 9 '18 at 14:33
• @leen3o As I wrote, you make one sum per tax level. You can see this in any German supermarket where wh have 7% on groceries, but 19% on "Luxury-items" such as sweets or alcohol and non-food. Often they just put an A and B behind each item and then sum A and B at the bottom with respective tax. – Daniel Oct 9 '18 at 14:44
• Did you read the link in the question? It states clearly that (at least in the UK) VAT may be calculated based on either the individual line items or on the total, as long as you’re consistent in always using one of those approaches. – Mike Scott Oct 9 '18 at 15:03
• @Mike Scott: The link is a product manual stating nothing about tax law. As I said, I Am Not A Lawyer, and also not from the UK. This is how I saw it implemented usually - and it has some advantages in total tax amount if your subscribe to the rounding up rule at least. – Daniel Oct 9 '18 at 15:10
• This answer has actually raised a more difficult question for me, see this money.stackexchange.com/questions/100857/… – leen3o Oct 10 '18 at 11:05

If you’re discounting the total price, then you’re discounting the tax by the same amount. The tax is calculated on what you actually charge, not on the headline price before discounts are applied. Just apply the discount to each line item and then calculate the tax as normal on the discounted price. Or if you don’t want to calculate the discount for each line item separately then just add a new line item for the discount, with a negative price and negative tax.