Post by GarfNo17 » Tue Sep 15, 2015 8:01 pm

Hi there

I have issue with rounding with VAT and I am wondering what I have missed.

If I have an item at £4.17 + VAT ( at 20%) then an individual item is £5.00
However 10 of them becomes £50.04 due to the £4.17 * 1.2 = £5.004.

Is there a way to round before the multiplication of quantity?

Thanks in advance

Newbie

Posts

Joined
Wed Nov 19, 2014 5:47 am

Post by artcore » Tue Sep 15, 2015 8:56 pm

Can you store it as 4.16666667?
(haven't used oc2 in a live setup yet but that's what I do in oc1.5)

Attn: I no longer provide OpenCart extensions, nor future support - this includes forum posts.
Reason: OpenCart version 3+ ;D

Thanks!


User avatar
Active Member

Posts

Joined
Tue Jul 09, 2013 4:13 am
Location - The Netherlands

Post by jrfcomputing » Tue Sep 15, 2015 9:04 pm

You have to use 4 decimal places to get it to round correctly.

The easiest way to to get the correct pricve is work backwards

if you do £5 - 16.6666% then that will give you the price to put in which is 4.1666

Opencart sites I am currently working on:
http://www.cablecafe.co.uk
http://www.exclusivelygorgeous.co.uk/


User avatar
Active Member

Posts

Joined
Mon May 09, 2011 11:29 pm

Post by GarfNo17 » Tue Sep 15, 2015 9:31 pm

That is a not really a fix.

I would rather find the calculations and do Product * Price round to 2 dp then multiple by the quantity.

Newbie

Posts

Joined
Wed Nov 19, 2014 5:47 am

Post by GarfNo17 » Tue Sep 15, 2015 9:48 pm

Also... that fix will cause you issues with the tax man at some point

Newbie

Posts

Joined
Wed Nov 19, 2014 5:47 am

Post by GarfNo17 » Tue Sep 15, 2015 10:04 pm

I have figured it out.

Just a couple of round($XXXXXXX,2) in tax.php and that's sorted it

Newbie

Posts

Joined
Wed Nov 19, 2014 5:47 am

Post by jrfcomputing » Tue Sep 15, 2015 10:15 pm

The tax man uses more than 2 decimal places as it is impossible to calculate multiples correctly.

The customer will still see as 2 decimal places you will be taking the right amount of VAT as 16.6666% is just working the tax backwards.

Your example where your item is £4.17 + 20% actually equals £5.004 so if you sold enough then it would mean you are paying too little tax and that is why with multiples it adds the extra pence

Opencart sites I am currently working on:
http://www.cablecafe.co.uk
http://www.exclusivelygorgeous.co.uk/


User avatar
Active Member

Posts

Joined
Mon May 09, 2011 11:29 pm

Post by micrdy » Tue Nov 03, 2015 4:59 pm

GarfNo17 wrote:I have figured it out.

Just a couple of round($XXXXXXX,2) in tax.php and that's sorted it
Could you tell us where exactly?

New member

Posts

Joined
Mon Mar 09, 2015 6:40 pm
Who is online

Users browsing this forum: No registered users and 8 guests