News:

Looking for documentation? Take a look on our wiki

Main Menu

Tax calculation issue with discount

Started by sobers_2002, May 30, 2009, 10:05:30 AM

Previous topic - Next topic

sobers_2002

Description:
This is a bug in the existing virtuemart (till 1.1.3) system that is seen when discounts are being used and the tax calculation is set to be done on the reduced price.

This issue is not seen when using tax calculation based on vendor address, but only in case of shipping address based tax calculation.

VirtueMart Version:
1.1.3

Joomla/Mambo Version:
1.5.9

Steps to replicate:
- Select tax calculation based on shipping address
- Enable discount calculation after the discount
- Checkout with relevant tax address information

Proposed fix(es):
Please visit my post here for the fix.

System info:
Dreamhost

I hope this helps people facing the issue with a similar problem and hopefully the fix posted is correct.

I am not sure if this is the same issue as listed in the changelog of 1.1.3 for tax_rate().

aravot

Sobers, I tried your code, didn't work, we want to release 1.1.4 so if you can help us fix this bug it would be awesome.

For this purpose I created a product with price of $100 my tax is 9.25% and I created a coupon $50, I have 'Subtract payment discount before tax/shipping?' checked.

So the result should be:
$100 - 50(coupon) = 50 + 9.25%(tax) = 54.63

instead I get:
$100 - 50(coupon) = 50 + 9.25%(tax) = 59.25
it seem tax is still calculated from total price.

sobers_2002

maybe I missed something ? I'll check into it because this is most definitely part, if not full of the code I used to fix the issue!

Jeffrey Hughes

The code worked great for me. Below is a review of what I did:

  • I used setting "Based on shipping address".
  • I bought a product for $39.95 with a 90% off coupon bringing the total to $3.99.
  • The system calculated 6% tax, which is $0.23 (3.99 x 0.06)
  • The total came to $4.23 (3.99+0.23)
  • I then ran a PayPal purchase and the correct amount with tax was processed.
Before I did the code modification, tax was calculated of the $39.95 and came to $2.40 (39.95 x 0.06); which was incorrect. 

This is a major accomplishment and the word to this form needs to be spread throughout various VM Forms, please do so as you see people needing help in this issue.

sobers_2002

Hi Jeffrey,

Thanks for your feedback and glad to know it worked out fine!! The issue that Aravot has reported is actually the above code not working with the SVN branch. It works fine with code upto 1.1.3 using the instructions I posted.

I'll be updating the code soon to make it work with the SVN branch and then it will be posted as a fix in the next VM release.

cheers,
Saurabh

Maverix

Is there a fix available which solves following problem:

Tax based on vendor address.

Zwischensumme :     EUR69,00
Rabatt:            - EUR2,90 (without tax)
Gutschein-Rabatt:    - EUR3,45 (with tax - but handled as without tax)
Versandkosten :    EUR6,90
enthaltene MwSt. :    EUR11,01
Endsumme:            EUR68,44

The first discount (-2.90) is a payment discount (- 5%)
The second discount (-3.45) is a coupon discount (- 5%)

It seems that both discounts are handled without tax although they both should be equal ( 5% each = 3.45 tax included)




The correct bill should look like this

Zwischensumme :     EUR69,00
Rabatt:            - EUR3,45 (with tax)
Gutschein-Rabatt:    - EUR3,45 (with tax)
Versandkosten :    EUR6,90
enthaltene MwSt. :    EUR11,02
Endsumme:            EUR69,00