Calculating VAT is always hard

• Don't you think using percentages in calculations is always a nasty thing? Well, the developer of finefoods-online.com definitely does.

Some translations from Dutch:

BTW: VAT (taxes...)
Hoeveelheid: Amount
Prijs/Stuk: Price/Unit
Totaal(bedrag): Total (price)

I for one think it's strange to see how subtracting and then adding the VAT can result in a different price then the original!

• @elmotheelk said:

I for one think it's strange to see how subtracting and then adding the VAT can result in a different price then the original!

That's not what they're doing. First they add the VAT to the price of one unit and round it before multiplying it by 100. Then they recalculate it, this time only rounding the final result.

• It's not an error I can figure out.

Subtract 7% of €110 gives €102.30

Subtract 7/107 of €110 gives ~€102.80

Yet somehow this site ends up with €102.70?

EDIT:

@Vempele said:

First they add the VAT to the price of
one unit and round it before multiplying it by 100. Then they
recalculate it, this time only rounding the final result.

But that would imply that their without VAT price is €1,027. Who puts prices accurate to thousandths of a euro?

•  I can't edit, but it seems that that is exactly what they are doing. Some items on their site are more expensive when you try to buy 100, because the individual price is rounded down.

• Perhaps they internally use the price of a kilogram.

per gram € 1,10 (€1.098,89 / Kg)

• It's verry easy to understand:

the price per unit is 1,0989 which is rounded to 1,10.

I think they have some culculations with the price internally in the DB.

• @Thief^ said:

But that would imply that their without VAT price is €1,027. Who puts prices accurate to thousandths of a euro?

Typically, you put them to more decimal places than that.

In eCommerce applications, you typically store all of your prices NET of VAT. Unfortunately, customers typically want to have prices displayed in the ilk of £9.99 or £17.50, rather than £14.22 or £7.78, so you store a highly accurate net price.

It'd be perfectly possible to store a gross price, however if you're shipping to a different EU country, depending on how much you export, your rate of VAT then varies (you end up charging VAT at the rate of the country you're shipping to), and the last thing you want to be doing is going from UK Gross to NET to French Gross, or something daft like that.

So yeah. Prices are stored to many decimal places.

• I for one think it's strange to see how subtracting and then adding the VAT can result in a different price then the original!

Here's an exercise.  Deduct 7% from 100.  Then add 7% of the result back to the result.   You get 99,51.  7% of 93 is a smaller value than 7% of 100.

• @mrprogguy said:

7% of 93 is a smaller value than 7% of 100.

Who would have thought?

• @mrprogguy said:

Here's an exercise.  Deduct 7% from 100.  Then add 7% of the result back to the result.   You get 99,51.  7% of 93 is a smaller value than 7% of 100.

No shit. But that's not how you do it.

10/1.07 = 9.34579439 --- that's your net price

9.34579439*1.07 = 10 --- wow, back to gross. Crazy!

•  sigh

Do you have any idea how to do VAT calculations?
I mean have you actually coded/maintained applications that work with, say, 20 different countries worth of VAT systems? Let's say you have a work shop invoice. The actual parts sold may have
different VAT compared to the work  sold, but certain countries may
require that only one VAT type is included in any given invoice. There
are as many different VAT legislations as there are VAT countries, and
I can tell you it's no picnic sorting them out. Let's not even go to when you can and can't round  figures to which digit amounts. brrh

This screenshot
demonstrates quite well the problems one can have in VAT calculation --
you have a single item that sells for 1,10 €,  but the actual 'company
sees' price is 1,02 something plus VAT -- digits of precision may
change with legislation as well, btw --, so the price is simply
multiplied with 10 to get the price of 10 items. Then the customer is
shown VAT calculation from 10 times the 'company sees' price, which
differs by 11 cents here due to the original calculation having roundings per item, not per total... that's, btw, one of the things that legislations differ the most about.

TRWTF is that whoever set this up uses different calculation modes for totals and singles.

Also, did you know that tax officials don't give a flying hoot whether you do VAT calculations per-item or per-total, and only a few of them care where you do your roundings as long as you're consistent about it.

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.