Jump to content

Intermittent tax calculation errors


Recommended Posts

I've been wrestling with this problem for a while now. Initially my site had all kinds of problems as we worked out the inevitable bugs. One of the more persistent were the tax calculation errors. I was able to run down mistakes in my setup of the shop and also to find bugs in the Prestashop code and everything was fine, for a while. Prestashop has never calculated taxes correctly. To be clear, there are multiple calculation methods for calculating sales tax. Prestashop is rounding differently than either of the two major software accounting packages. This isn't a complaint really, but more to let Prestashop know, "You're doin' it wrong."

My question for the friendly community here is this, I've come across this error for the first time in months. What I thought had been the cause must have only been one problem and I'm not certain if this is a bug in Prestashop, my web server or a misconfiguration on my part. I've attached a copy of a customer's receipt (edited) showing what would appear to be Prestashop failing at Jr High math (or is it elementary). Anyhow, if anyone has a suggestion or two on how to fix this, or you've encountered this as well, I'd be greatly appreciative to hear from you.

post-265576-0-94249000-1364321498_thumb.png

Link to comment
Share on other sites

I will test now - I really hope so lol

I've tried rewriting the tax stuff over the last few days - but its so heavily integrated

 

 

 

Is tax not calculated completely wrong in prestashop anyhow????

 

Surely, tax is paid per item not per order?

 

Prestashop works out tax by:

 

Tools::ps_round($row['price'] * (float)$row['cart_quantity'] * (1 + (float)$tax_rate / 100), 2);

 

Which is: Product * Quantity * Tax rate. This is Lazy!

 

Should it not be: (Product * Tax Rate), rounded up 2 decimal places, multiplied by the quantity????

 

If a product in the UK is £99.31, and vat is 20% - you would not charge the customer £119.172, you would charge them £119.17.

It may appear ok to do it like that - but if they ordered 100 items, thats 20p more because of all the 0.002 Pences!

If you pay via paypal, there will be an error because the submitted paypal order paid total, will be more than the prestashop stored total required for that order

 

 

Should this not actually be worked out as:

$dave = Tools::ps_round($row['price'] * (1 + (float)$tax_rate / 100), 2);

$actualtotal = $dave * (float)$row['cart_quantity'];

 

Maybe someone with an accountancy background instead of a coding background can take a look at it for me - As Logically, my method makes more sense to me

Edited by mrotacon (see edit history)
Link to comment
Share on other sites

Prestashop is a French company and has never propperly implemented, nor do I think they fully understand, North American retail policies, practices and laws. Taxes would most likely be their weakest point. We've done a good bit of customizing so we passed up 1.5.3 after testing and finding it didn't fix anything and broke all of our fixes so hopefully 1.5.4 will be better.

Tomin, thanks for point that out. We'd been waiting on it to come out and I hadn't noticed it was out yet. We'll give it a go.

  • Like 1
Link to comment
Share on other sites

I actually managed to fix cart tax calculation on my 1.5.3.1 site, and will try the same method in 1.5.4 after the Easter weekend is over.

Please see my thread POSTED HERE

 

It could probably help you too.

I included the code in the Cart.php class extension (/override/classes/Cart.php)

 

There will probably still be tax issues with calculation on invoices, but I can probably fix that too :)

Link to comment
Share on other sites

  • 2 years later...
×
×
  • Create New...