News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Wrong product_item_price in order in case of price override

Started by maxxer, December 04, 2012, 15:30:01 PM

Previous topic - Next topic

maxxer

Hi.
In our shop we have several products with an imposed discounted final price. The price is overridden using the "Override final price" option.
With these settings the #__virtuemart_order_items.product_item_price  value is set to product's product_price, resulting in a wrong price shown to customers!

An example:
Product A, final price 105, 21% VAT, base price 86.77686.
Override final price with 84.9.

If a customer buys this product, the order summary will have:
Product cost: 86,78 € | Base price included tax: 105,00 € | Gross price: 84,90 € | Taxes: 18,22 € | Total: 84,90

Just the total value is correct...

sleepigrl

Since you're overriding the final price, you probably don't want to show the other prices.  You can adjust which prices are shown in VM Configuration, on the Prices tab.

maxxer

Quote from: sleepigrl on December 04, 2012, 23:01:40 PM
Since you're overriding the final price, you probably don't want to show the other prices.
Why should I? If I override the final price my government still wants me to pay taxes, so they must be calculated anyway! :)
I cannot print an invoice with wrong taxable and tax amount, just because te final price is different than the "base" one.

This is indeed a bug, wrong prices are taken into the order when final is overridden...

maxxer


Milbo

The tax works, in special since the version 2.0.15b. Maybe you choosed the tax and not vat tax.

and your numbers are not easy for comparison. VatTax is recalculated from the final amount. Example

baseprice 2 $
discount 40% => -80 cent
final price 1,20, 20% tax is then 20 cent. net 1$

or baseprice is 2
with tax is 2.4
discount 96 cent
final price 1,44 tax is then 24 cent net is 1,2
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

maxxer

Quote from: Milbo on December 18, 2012, 19:09:56 PM
The tax works, in special since the version 2.0.15b. Maybe you choosed the tax and not vat tax.
Thanks for your reply.
indeed, by mistake, I was using tax and not vattax, but it still doesn't work.
I'm using 2.0.14, the latest available for download... Where should I get 2.0.15b?

After fixing with VatTax I made the purchase of a product with base price 57.43802, vat 21%, final price 69.5. Overridden price: 45.5.
In my order, I get the following:
Cost: 57.44
Base price: 69.5
Net price: 45.5
Tax: 7.9
Total: 45.5

If the tax was recalculated it should have been:
Total: 45.5
Tax: (45.5/100)*21 = 9,555
Base price: 55,055

I checked in _order_calc_rules and correctly contains VatTax as rule for the product.
What's wrong?

thanks

Milbo

Your calculation is wrong:

If you recalculate the tax you are not allowed just to remove 21% and say thats it. Look 30% of 9 is 3. 9+3 = 12. But 12 -30%(of 12) = 8

So the calculation is different. You search for the number which multiplied by 1,21 is 45,5 =>  x * 1,21 = 45,5  => x = 45,5/1,21 = 37,6, so your tax is 7,897 ~7,90

correct
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

maxxer

Quote from: Milbo on December 18, 2012, 20:37:57 PMSo the calculation is different. You search for the number which multiplied by 1,21 is 45,5 =>  x * 1,21 = 45,5  => x = 45,5/1,21 = 37,6, so your tax is 7,897 ~7,90

indeed I was wrong.
So the NET price is 37,6, but I cannot find it anywhere. The order summary in the backend doesn't have the recalculated taxable anywhere. Or anywhere I can find it ;)

thanks again.

maxxer

so no way to get 37.6 written somewhere?
if you can point me to where the VAT is recalculated, I can try to make a patch. thanks

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

maxxer

I tried using VatTax and indeed it fixed the Vat calculation, but the Order Taxable is still at full value (see attachment).
I still miss the 37,6 value somewhere in the order, to produce a correct invoice.
thanks

[attachment cleanup by admin]

Milbo

of a new order or of an old ordeR? Do you change the tax and think it would change an old order? that would be illegal. Orders are always stored "plain", that means without references most time.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

maxxer

Quote from: Milbo on December 23, 2012, 14:01:17 PM
of a new order or of an old ordeR? Do you change the tax and think it would change an old order? that would be illegal. Orders are always stored "plain", that means without references most time.
this one was a new order after editing the cal rule to VatTax

Milbo

Can you please repeat it with easier numbers? The problem is the order, the cart, the invoice, the mail? or only order? Sorry I lost a bit track
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

maxxer

in the attached example the overridden final price is 12,1€. VAT is 21%, so the taxable is 10€  (10*1,2 = 12,1).
Original price is 20€ taxable, +vat becomes 24,2.
As you can see in no place I can find the new taxable amount of 10€.

[attachment cleanup by admin]