News:

Looking for documentation? Take a look on our wiki

Main Menu

Wrong tax if a price discount is given

Started by Anders69, March 10, 2012, 15:24:00 PM

Previous topic - Next topic

Anders69

Hi!
I'm using Joomla! 2.5.2 and Virtuemart 2.0.2
I have a problem with taxes. If i give a product the price of 100 swedish krona and the taxrate is 25% and then set an discount of say 50 swedish krona.
The tax is still 25% of 100 swedish krona and not 25% of 50 kr. Is it a bug or is it me who cant get it right?

Biggreuda

I couldn't find that either.
Since we only use one tax rule here for everything, we hardcoded it temporarily until there is a better solution.
In administrator\components\com_virtuemart\helpers\calculationh.php we added the following lines at line 370 (after "$prices['priceWithoutTax'] = $salesPrice - $prices['taxAmount'];"):
if ($this->override) {
$prices['taxAmount'] = $this->product_override_price/119*19;
}


We have 19% here, so it would be

if ($this->override) {
$prices['taxAmount'] = $this->product_override_price/125*25;
}

in your case.
This is a very dirty solution, so i wouldn't recommend it, but it's the only solution for this i know so far ;)

PRO

what do you have the discount setting to?


Anders69

Thank you Biggreuda for your solution. I have not tried it yet but i will. Not sure it will work for me, i have both 25% and 6% products.

Quote from: BanquetTables.pro on March 11, 2012, 11:54:25 AM
what do you have the discount setting to?


In this case a used Pricing rules overrides and entered the Discounted Price there. The help text there says that the store will create a new discount from the price you enter. Can´t see that i did.

Milbo

oha guys, you will get in deep trouble with the tax office. Please learn this basics !

When you do a discount after the tax, you have to pay the tax for the netto.

When you use the discount before tax, yes then you get a difference, because then you change your netto.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Biggreuda

#5
What is that supposed to mean?   ???
In our shop, all prices are with tax and we added that info on all places where any prices are shown.
Of course all our discounts are before tax, too. We are able to think that far, it's going like this for dozens of years now ;)
A good thing would be to have a simple way to add a discount before tax directly into the product, because they are all individual (backward-calculation of the full price with tax is still a big issue, too).
I tried twice to create a discount with "DBTax", but it was added immediatly to the whole store, even if i did not select any category or whatever.
This and the inconvenient way of adding a whole rule for each reduced article did lead us to this desperate measure.

zebrafilm

OK I have to hook in here:

I am on 2.0.3H and also have a problem with the TAX / discounts:

There is 19% VAT rule for each product. Works fine.
I have a discount coupon for 100% discount.

When I go to the checkout and enter the discount it still shows the VAT left over, everything else zero's out as it should be but VM2 still wants the client to pay VAT over a non existing price.
Seems a bug to me.

Bastiaan

Attachment is a screenshot of the problem.





[attachment cleanup by admin]

woutsun

This is a bug for me. From above posts I assume* that it is normal in some countries to add a discount AFTER the tax. Like Milbo said.
Where I live... it's nothing but absurd really.
*Just saying.. don't really believe this but ok.

Let me explain the difference between the way virtuemart works and how I, and most likely a few others, need it to work.

Say you have a € 1000,00 product and the tax rate is 19%.
Where I'm at tax is always calculated on top of the sales price. Not the stated sales price but the actual price for which the product is sold.
This makes Sales Price + 19% or € 1000,00 x 1,19  =  € 1190,00. The tax is € 190,00.

A 10 % discount on this price is € 1190,00 x 0,10  =  € 119,00
Now € 1190,00 - € 119,00 = € 1071,00 which is the new sales price
In virtuemart the tax stays the same even though the sales price has changed: € 190,00. This makes my netto price 1071,00 - 190,00 = € 881,00
Where I live the tax has to be calculated again: € 1071,00 / 1,19 = € 900 - My Netto price. Notice the difference of € 19,00.
The new tax amount is 19% of 900 so €900 x 0,19 = € 171,00.. Also a difference of €19,00

Should you need any more clarifications please let me know.


Since this is my first post I also want to compliment everybody developing VM. I'm getting the hang of it right now and it keeps working better and better!



dj55b

I'm also in the same boat as these guys.

Milbo

Quote from: Milbo on March 12, 2012, 20:35:07 PM
oha guys, you will get in deep trouble with the tax office. Please learn this basics !

When you do a discount after the tax, you have to pay the tax for the netto.

When you use the discount before tax, yes then you get a difference, because then you change your netto.

oha guys, what a shame on me ! Imho your problem is fixed. After long discussions, with various merchants, retail price options and whatever...

The new version has now a VAT tax option, which is recalculated. Please try the svn, or http://dev.virtuemart.net/projects/virtuemart/files

expect version b tomorrow, just too tired, todo the installer 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/

bpluijms

#10
Quote from: Milbo on May 09, 2012, 00:42:33 AM
The new version has now a VAT tax option, which is recalculated. Please try the svn, or http://dev.virtuemart.net/projects/virtuemart/files
expect version b tomorrow, just too tired, todo the installer now.

Hello, I have tried version 2.0.7b and I am able to add a discount to the products.
There are still some problems:

Price calculation:
default_showprices.php shows:
----base price without tax (= old price without discount with tax) (example: 100 euro)
----discounted price without tax (example: 10 euro)
----discounted price with tax (example: 11,90 euro)
----tax only.  (1,90 euro)
----discount (base price-discounted price with tax = 100 euro - 11,90 euro = 88,10 euro).

2 things are wrong:
- 1. Page doesn't display base price with tax  (= old price without discount, with tax: example 119 euro)
- 2. Discount is calculated wrong. It should be: "base price WITH TAX - discounted price WITH tax"  or "(base price WITHOUT TAX - discounted price WITHOUT tax) * TAX"

Error message
After updating to v2.0.7 and I tried to edit a product I get the following error:
"Warning: shell_exec() has been disabled for security reasons in /public_html/administrator/components/com_virtuemart/models/orderstatus.php on line 79"

Calculation base price doesn't work as expected
When I add a final price (let's say 100 euro) and I click "Calculate base price" , the final price becomes 99.99996

I hope you can figure out what's going wrong with price calculation, cause it's the most important feature of a shop I guess.

Milbo

Please check again the latest svn, I found a small error, with the VatTax, imho fixed 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/

bpluijms

Quote from: Milbo on May 20, 2012, 15:24:09 PM
Please check again the latest svn, I found a small error, with the VatTax, imho fixed now

Hello, thank you for the update, but there are still the same problems:

- No display of "base price with tax".
- Wrong calculation of Discounted price.

I have a screenshot attached.
My base price is 100 euro (shown)
Tax is 19%.
Base price with tax is 119 euro (still not shown!)

Discounted price without tax is 10 euro (shown).
Discounted price WITH tax is 11,90euro (shown).
Discount ammount: 88,10 euro is shown, but not correct.

Discounted ammount calculation is at the moment:
Base price without tax - discounted price WITH tax = discounted ammount, but it should be:
base price with tax - discounted price with tax = discounted ammount
or
(base price without tax - discounted price without tax) * tax = discounted ammount

I hope you can fix this, cause if it isn't fixed correctly a store without correct price calculation is quite useless.

Thanks in advance,
Bart

[attachment cleanup by admin]

jjk

#13
Your calculation looks to me like you are applying a 90 percent discount to your base price, for which the numbers are correct.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

bpluijms

No, it is still not correct.

I have no discount rules, only a tax rule.

I use the discount option on the product page. See attached a new screenshot of the product admin.

Still, the calculation is wrong, even if I have done what you suggested:

You suggested:
100 euro base price (without tax)
90% of base price:
100 - (100x0,9) = 10 euro without tax.
10 euro * 19 % tax = 11,90 (still correct).

I have done:
100 euro base price (without tax)
new price without price = 10 euro (= 11,90 with tax)

These calculations are correct (but not used in VM)
Discount ammount without tax:
base price without tax - sales price without tax = discount ammount without tax
100 - 10 = 90 euro (not 88,10 as in the screenshot in my last post.

Discount with 19% tax:
base price with tax - sales price with tax = discount ammount with tax
119 - 11,90 = 107,10 (still not 88,10).

So it doesn't matter which way you look at it: discount and tax calculations are still wrong.
This calculation is now used in VM and NOT correct
base price without tax - sales price WITH tax = wrong discounted ammount
100 - 11,90 = 88,10 (is not correct because there is a tax conflict. )



note: see also the error message noted in a previous post on the screenshot

[attachment cleanup by admin]