I think, that in a custom currency value it is wrong calculation. Entered decimals are affecting not only output value (convert to), but also input value (convert from).
Example:
Product price is 5.83 €. In other currency I set exchange rate 26.5 and decimal 0.
Normally I am awaiting 5.83 x 26.5 = 154.495 Kc, after applied rounding 154 € (I this case I prefer PHP_ROUND_HALF_DOWN precision, but it doesn't matter at this moment).
But calculation is 6 x 26.5 = 159 Kc, what is wrong.
If you are using j2.5.14, then please read here http://forum.virtuemart.net/index.php?topic=120120.0 this is maybe your reason.
Because I see 159 Kc and not 159,00 Kc.
Furthermore you must have set teh correct option in the vm config... "round only display" to avoid rounding errors like this.
Quote from: Milbo on November 14, 2013, 10:01:59 AM
If you are using j2.5.14, then please read here http://forum.virtuemart.net/index.php?topic=120120.0 this is maybe your reason.
Because I see 159 Kc and not 159,00 Kc.
Furthermore you must have set teh correct option in the vm config... "round only display" to avoid rounding errors like this.
This problem I had solved, look at posts there :)
But I have other problem. It must be 154 Kc as the result, not 159 Kc.
First time I thought, that problem is somewhere in my modified code. But right now I have installed clean installation of Joomla 2.5.16 + Virtuemart 2.0.24 and problem is same as I am describing above.
In calculationh.php is calling roundInternal function on vendor currency with decimals from other choosed currency. It is wrong!
Eshop main currency is €.
Currency choosed from frontend module is czech koruna.
I debugged $afterTax variable assignment, when it calls roundInternal function.
In current scope I have choosed currency code is 33 (czech koruna), vendor is 47 (euro). In 33 currency I have 0 decimals. It is necessary, that vendor currency will stay unaffected from this rounding to 0 decimals, because it has not logic.
For example:
Product price in € is 8.33
Product price in czech koruna currency by manual calculation, exchange rate 26.5 and rounding must be 221 Kc.
So 8.33 * 26.5 = 220.745, after rounding 221 €
After Virtuemart calculation it is 212 Kc.
8.33 rounded to 8 * 26.5 = 221 Kc.
(221 - 212) / 26.5 = 0.334 € difference