News:

Support the VirtueMart project and become a member

Main Menu

price calculation adds 1 cent each time, i cannot fix

Started by mblokdijk, July 23, 2024, 09:54:41 AM

Previous topic - Next topic

mblokdijk

i have a selling price of 35 euro (including tax)
tax: 21%
i use the option calculate cost price
click save, and the eventual price is 35.01
i have no option to change. it taxes on the base price, which has 2 digits. the costprice has 4 digits. if it taxed on the costprice it would be fine.
how can i change this?
J4 and VM4
Passionate Joomla webdeveloper from the Netherlands, please checkout jmodules.com

mblokdijk

anyone?? how can this be an issue? really? its a basic feature....
Passionate Joomla webdeveloper from the Netherlands, please checkout jmodules.com

Jumbo!

Quote from: mblokdijk on July 23, 2024, 09:54:41 AMi have a selling price of 35 euro (including tax)
tax: 21%
i use the option calculate cost price
click save, and the eventual price is 35.01
i have no option to change. it taxes on the base price, which has 2 digits. the costprice has 4 digits. if it taxed on the costprice it would be fine.
how can i change this?
J4 and VM4

It seems to be functioning well in my tests. Watch the video I recorded during the test. You can find it here: https://www.youtube.com/watch?v=sofYXwsFV60.

iWim

I can confirm both.

On an existing site (J5) the baseprice is limited to 2 decimals and rounded up.
While on a test site with a new installation of VM the baseprice has 5 decimals.

The existing site is an oldie, updated all the way from J1/VM1.

mblokdijk

same here...
i have no option to change. it taxes on the base price, which has 2 digits. the costprice has 4 digits. if it taxed on the costprice it would be fine.
Passionate Joomla webdeveloper from the Netherlands, please checkout jmodules.com

mblokdijk

Passionate Joomla webdeveloper from the Netherlands, please checkout jmodules.com

hazael

why are you one cent short? it's simple :)

product price in the admin panel before rounding:
0,333 + 0,333 + 0,333 = 0,999 ~ 1,00 EUR

product price in the frontapage after rounding 0,333 ~ 0,33 EUR
0,33 + 0,33 + 0,33  = 0,99 ~ 0,99 EUR

Therefore, try to add full prices to avoid these discrepancies
or...
display products without rounding in Euro cents  ;D
or...
wait another decade until Milbo solves this problem on his own  ;)

PS.
Do these 5 or 6 decimal places have any justification at all? I have never seen anyone in any store use such precision.
Currency rates are generally quoted with a maximum accuracy of 4 decimal places

iWim

In the attachment you'l find a screenshot of what mblokdijk means...
Top (incorrect baseprice), bottom (expected baseprice)

The issue is that baseprice is rounded to 2 decimals instead of 5.

With 21% vat:
Currently: 28,93 * 0,21 = 6,0753 ~~> 28,93 + 6,0753 = 35,0053 = 35,01
Should be: 28,92562 * 0,21 = 6,07438 ~~> 28,92562 + 6,07438 = 35,00

I see the same on a shop I manage since VM1 (top).
The problem is I don't see it on a "messy" clean install (bottom).

mblokdijk

somewhere the code gives 2 decimals. that should be changed...
Passionate Joomla webdeveloper from the Netherlands, please checkout jmodules.com

Milbo

There is a setting in vm config, where you can say if you round any numbers, or if you round just the final numbers, try the second mode.

Just consider, sell a screw for 1 cent with 20% VAT. So you sell it for 1.2 cent, so for 1 cent. But 100 screws are 1 Dollar/euro. So the tax is here 20 cent. The first mode whould have no tax, because any step is rounded, but the second one has 20 cent tax. But the invoice will look strange, because the single item has not tax.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

mblokdijk

thanks everyon. i have updated to the latest version and now it seems to work. i was on a J4 version from march.
Passionate Joomla webdeveloper from the Netherlands, please checkout jmodules.com

AH

Regards
A

Joomla 4.4.5
php 8.1