[solved]2.0.6 - Rounding glitch for prices: impossible have a precise price!

Started by simbus82, April 17, 2012, 12:49:05 PM

Previous topic - Next topic

simbus82

Edit by Milbo: Please read here http://forum.virtuemart.net/index.php?topic=108809.msg367089#msg367089

In shipment methods i have set a tax of 21% and i want a price with tax of 10,00 euro.

So in price i have to set a value equal to 10/1.21 for have the price without tax.

10/1.21= 8,264462809917355371900826446281


The problem is that in cart in FE and orders in BE (invoice and paypal) i can see or 10.01 or 9.99 under shipment price.

I see that the tax in cart is 1,73 and then the price results 9,99.

So VM2 calculate 1.73 + 8.26... and i have 9,99 euro!

If i set 8,27 to compensate this VM2 critical calculation error... it calculate tax 1.74 + 8.27... so give me 10.01 ..... :S

I have not found any rounding option (8.2644 or 8.2645 or 8.264463 or 8.264462 etc etc etc) that give me 10,00 euro!

Really! It is IMPOSSIBILE TO HAVE a shipment with tax of 10,00 euro!!!!

I know VM have a rounding system inside but... maybe it is not working correctly when we apply a tax in a shipment price too!!!

For products i see strange behaviors too.

THIS BUG IS VERY CRITICAL
With a so evident and critical error in calculation the shop is clearly not usable in production site!



PS: Tax is 21% for products and shipments.


[attachment cleanup by admin]
Joomla! 2.5.16 & VM 2.0.24b

simbus82

Maybe con help rising the precision for the tax calculation, where i can try to do this in code?

Thanks!

EDIT:

I have found calculationh.php in helpers.

I have changed the $_internalDigits from 6 to 7 and then to 8, only some x.x9 in some products change

In cart in i have 2 products with 30 euro of price with 21% tax, the total is 60,01 euro.


Searching the function roundInternal i ses that is applied a lot of time.

Maybe wrong using of rounding? Some variables not rounded?
Joomla! 2.5.16 & VM 2.0.24b


teobgeno

The product cost 24,79 the 21% tax of this is 5,2059   Total Price with tax = 29,9959    So 29,9959*3=89,9877 -> 89,99
The result is correct . The Base price with tax (30) is not correct as it should be 29,9959

simbus82

Quote from: teobgeno on April 18, 2012, 21:11:52 PM
The product cost 24,79 the 21% tax of this is 5,2059   Total Price with tax = 29,9959    So 29,9959*3=89,9877 -> 89,99
The result is correct . The Base price with tax (30) is not correct as it should be 29,9959

Te result is incorrect because the base price with tax is calculated by VM!!!

My product cost 30,00 tax included... what i have to do???????

In the product page 30,00 is right. But for VM calculation metod, 30 x 2 = 60,01. This is what an user see.

The big error is that VM round prices at the wrong step.

If VM calculate 29.9959 and show me 30,00, why in the cart if i have 2 product for 30,00 each one.. the result is 60,01?

The cart have to multiply 30,00x2, not an imaginary number called "base price" rounded inside the core of VM.

I need only that:

1) insert my price exposed in the shelf in the real shop
2) setup the right tax for the product
3) do not care how VM calculate the base price and I do not care about the value of the base price.
4) in frontend i want to see theprice that i have inserted!
5) the cart and invoice HAVE TO RESPECT prices in frontend, not working with strange numbers!

I really do not understand :-(  I've never seen an ecommerce where there is a problem in prices rounding!

If i can i really want to resolve this biggest bug.
Joomla! 2.5.16 & VM 2.0.24b

jjk

I'm php illiterate, so I'm unable to help with code. But in your case it looks like you can use a few settings as a (temporary) workaround.
1. In the Product Edit view, enter an 'Override Price' (in your case 30 €), select the checkbox next to it and save the product.
2. In Configuration - 'Pricing' tab, select 'Final Sales Price - Rounding "0"
And eventually:
3. In the same view as above, uncheck 'Show tax in Cart' (because the tax amount for Shippng will probably be wrong)

The result should be 3 x 30 = 90 Euro and the Shipping Cost should display 10 Euro.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations