News:

Looking for documentation? Take a look on our wiki

Main Menu

Shipping Tax and rounding

Started by nickson, December 27, 2012, 23:53:40 PM

Previous topic - Next topic

nickson

I have the following problem.

For my tax calculations to come out correct, ive set the rounding of the tax prices to 5 decimals.
As for shipping tax in the database it stores also 5 decimals. The only problem is, the last three digits are all zero's. They shouldnt be rounded down to zero.

See the attachement for further info. The red marked entries are entries wich virtuemart generates.
The green marked (top) entry is a manual db entry to show you guys what it is supposed to be.

What to do to make this work?

This because of this rounding issue the total tax is sometimes one cent off.
I know, 1 cent is peanuts but I want it to be perfect!


Thanks in advance!

[attachment cleanup by admin]

lindapowers

#1
And how on earth have you set rounding for tax to 5????

I guess you mean in the rounding tab in configuration but we did that too and as you can see it doesnt round shipping TAX, only products TAX.

When I set round final sales price to 2 the Shipping VAT gets rounded to 2 also and rouding Tax seems to have no effect in the shipping Tax, actually it only rounds the tax for products.

There seems to be the error.

I posted the same issue days ago and guess what, no answer: http://forum.virtuemart.net/index.php?topic=111435.0

This bug causes the final price to be ruined and shows .99 or .01 in our case so is a big big issue that is avoiding us from building our website with correct final sales price.

Is even worst if you have a lot of shipping costs per country or zip code like us. You never know when rounding will show you incorrect final price.

See if this post helps you: https://forum.virtuemart.net/index.php?topic=98076.0

Didn't help me and please if you get a solution post it here cause we are desperate to solve this.

While Virtuemart keeps rounding shipping VAT we will always have problems to show a final round price. Shipping TAX can never be rounded to 2, we really need those 4 or 5 decimals or calculations will show incorrect final price.

Regards

nickson

Yes Ive set rounding to 5 digits on the configuration tab. As you can see in my screencapture of the database (the red numbers) the schipping tax also has 5 digits. The problem is. The last three are all zeros. So it uses 5 digits but still rounds to two digits.

Ive set all taxes to 5 digits (could have been three or four) because I work with small prices but larger amounts. The only tax I need is the final one. So all other taxes are not supposed to get rounded before. Because then the sum adds up wrong and my total tax is incorrect.

Anyone?

lindapowers

I'm as frustrated as you are and still trying to solve this, same issue here: http://forum.virtuemart.net/index.php?topic=111435.0

lindapowers

#4
Milbo solved it, at least it works for us:

administrator/components/com_virtuemart/helpers/calculationh.php

In line 1220 add:

$name = 0;

so your code will look something like these:

function roundInternal($value,$name = 0) {
$name = 0;
if($name!==0){
if(isset($this->_currencyDisplay->_priceConfig[$name][1])){


Regards

NOTE= This doesn't change the display of the shipping TAX but it makes the internal calculation use more decimals to round the price correctly.


Milbo

This whole thing is now added as option in the config.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lindapowers

great work Max, thanks a lot, now all our prices are rounded correctly.

Regards

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lindapowers

#9
The new option "Round only display checked" works perfectly

shipping costs get rounded and so final price.

great work!