## Unanswered: Calculating total price for checkout problem

Hello,
I am having a problem with the tax calculation on an e-commerce site.
I need to do this for both a normal receipt and a receipt showing the tax breakdown after checkout.

On the regular receipt I use a price with 2 decimal places which is excluding tax, I then apply the tax to each article to show the price as display on the site and multipe by the quantity, ie. a price of 49.59 ex tax + tax at 21% gives me a price of 60 inclucing tax, this is the way the price is shown on the site, 5 of this articles give me a total of 300, make sens so far.

On the other side i have to create a receipt for the site owner which shows the breakdown of tax, he is only interested in the price ex tax in the first place, so I multiply the price ex tax by the quantity using the same number the above example gives me 5 x 49.59 = 247.95
Then the tax is added to this again at 21%, it gives me a total of tax of 52.07 which gives me a total of 300.02 in stead of the 300 from above.

Both techniques are correct mathematically, however it is not good enough since this both totals don't match.

I understand why this happens but i just don't know how to change it as price visible to customer have to been shown including tax.

Any idea of how I should do this?