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?