Product pricing - Does not calculate backwards from Final price

Started by John2400, April 06, 2012, 13:52:53 PM

Previous topic - Next topic

John2400

This is really just a check for version J.
* I cannot add a tax to a product and then get the software to calculate from Final price back to cost price.
* I cannot type in the base price once set and save nor delete it , change it at any stage.

Cost , base and final are always the same even with a tax added ?

* could someone try and see if this is a bug - in J

kg

Tested on standard install J 2.5.4 VM 2.0.3 J
Added a product with price 100
Had tax rule 9.25% (std install)

The final price changed to 99.999995
The Cost price was set to 93.36384
Base price the same as cost price

I expected it to be 91.53318 since 100 / 1.0925 is 91.533318 or ...

I also checked the "Calculate the costprice" before saving the product.



Milbo

You never enter the baseprice.

The baseprice is the same as costprice, when the product currency is the same as the vendor currency. The stuff kg has problems with is normal rounding errors, which are not really solveable, because rounding itself is a dirty operation http://en.wikipedia.org/wiki/Round-off_error
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

kg

Milbo,
I think this can't only be a rounding error.
The extra decimals (100 becoming 99.9999 etc) I understand, but I am not sure I understand how you calculate the tax part.

If I have a product that has a price of 100 and the tax % is 9.25% for me that means that 9.25% tax is added to the base price (so 100 = 109.25% of the price ex tax ) and that makes it 91.533318...
If you calculate the other way so the 9.25% tax means that of the final price, 9.25% is tac, then the base should be 90.75

So it looks like there are some error in the calculation.

Milbo

No lol

you do the error. You think you can use +, no you cant.

When you add to 9 30%, what do you get? 30% of 9 are 3 and 9+3 is 12. So what do you get, when you substract 30% of 12? you get 8, hmm, not 9, eh? Because the base changed. When you want to come from 12 to 9 you must reduce 12 by 25% and not 30%. Got it now?
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

kg

Milbo
We are actually saying the same thing
I am not using + and I am fully aware of how to calculate (would have been very strange if I would not with my background :)

If the product sales price is 100 including tax and the tax rate is 30% (and the tax rate is the % added to the base price to come to the price 100) then the calculation is easy:
base price = price / 1.3 (130%)
In this example the base price will be 76.92

I now see what was the problem on the standard installation where I tested this.
The dicount is still there regardless of me trying to get rid of it. That was what made the answer the wrong one
Tried to add a product without discount but that will not work in a standard installation.
I'll check that again in a fresh 2.0.3 J install and if the problem exsists also there, I'll post a comment about it.


Milbo

Good.

Other important point is to understand that when you use the checkbox for calculating the costprice from the finalprice, that it gets calculated while storing it. When it is displayed the normal calculation is done. So when you use save, you get directly back the real result.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

lipes

Hi. It will be possible (in the future) have +- the same system used in VM1 ?? (Yes / No answer)

In VM1 we can see the demo that it does automatic any calculations from    'Product final price (Gross)'  or from   'Product Price (Net)'  very very fast!  Without using any checkbox for calculating that :-/

In VM2 If we forgot to hit that checkbox (argh!) and edit/update the price and then the save or save e close... we lose that work :( which is frustrating...  :'(
(like i said before with the files/image upload .. sometimes we forget to click on 'upload' in vm2 and then dont see the image that we select to upload and hit to save or save&close..)  I know that developers have more important things to do with superior order... but to adapt to this it's very boring

http://demo.virtuemart.net/administrator/index.php?page=product.product_form&limitstart=0&keyword=&product_id=46&product_parent_id=&option=com_virtuemart
VM V. online: J2.5.14 | VM 2.0.20a | SQL 5.1.70 | PHP 5.3.25

John2400

Thanks KG and MIlbo,

I'm marking this solved I did not publish the Tax :   I could see it in the "pricing rules and overrides" and thought it was OK.

* Thus if you are texting calcultaions on taxes _ please ensure they are published in the taxes and Calculations Rules "first"

I realised this after KG said it worked OK. Thanks

Sorry lipes - your question might need to go in a new post - but I have see this answered in lenght only two days ago