VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: pooyan on January 20, 2012, 23:43:56 PM

Title: All prices are rounded BEFORE calculation is executed
Post by: pooyan on January 20, 2012, 23:43:56 PM
Hi all,

I have a problem with a calculation rule for adding the tax to a net price.
Because all price values are rounded BEFORE the calculation is processed, I get rounding errors.

An example:
I want to have a gross price of 8.80€ (should be the salesPrice).
The net price is: 7.39496, and I have a calculation rule (type Tax) with a value of 19 (+%).

The problem:
In calculation.php (function getProductPrices(...)) all prices are rounded to 2 decimal places. Also the incoming price of the calculation!
So the following is done in method interpreteMathOp(...): (7.39 * 19 / 100) + 7.39 = 8.79€ -> not the expected result!

What is my mistake? Seems to be incorrect!?

Thank to all in advance



Title: Re: All prices are rounded BEFORE calculation is executed
Post by: loobi on January 26, 2012, 16:59:40 PM
I have a similar problem, it is rounding my prices up. My selling price (gross price) is £6.99, and VAT tax is +20%, calculated net price is £5.8250. The calculated 20% VAT is then £1.17 ( actual is £1.165 which it rounds up to £1.17), when added to the net price it shows selling price as £7.00.  I have tried setting decimal points to 3 in 'edit store', it still calculates the VAT at £1.170 not £1.165.

I am using Joomla 1.5.15 and Virtuemart 1.1.4.
Title: Re: All prices are rounded BEFORE calculation is executed
Post by: loobi on January 26, 2012, 17:41:05 PM
To clarify my above post, the shopping cart shows selling price as £6.99. When they confirm order the next screen is the paypal confirmation screen which shows price as £7.00. When the customer receives the confirmation purchase order it shows selling price as £7.00.
Title: Re: All prices are rounded BEFORE calculation is executed
Post by: Milbo on January 26, 2012, 19:26:09 PM
hmmmm
maybe the new version dont have that problem, because we changed the db format to decimal which is exacter than float.
Title: Re: All prices are rounded BEFORE calculation is executed
Post by: jenkinhill on January 26, 2012, 22:37:29 PM
Quote from: loobi on January 26, 2012, 16:59:40 PM
I am using Joomla 1.5.15 and Virtuemart 1.1.4.

Really??? This is the VirtueMart 2 forum section......