VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Development & Testing => Topic started by: moonaway on September 25, 2014, 15:06:38 PM

Title: Price calculation: tax,sales (with samples)
Post by: moonaway on September 25, 2014, 15:06:38 PM
Sample #1 Discount after tax


(http://s020.radikal.ru/i719/1409/d4/088f5d5ac23d.jpg)


Sample #2 Discount before tax


(http://s020.radikal.ru/i704/1409/72/add53f9550e9.jpg)
Title: Re: Incorrect taxAmount calculation (with samples)
Post by: Milbo on September 26, 2014, 05:27:32 AM
Everything is alright.

the VAT uses the endresult, that means

10 euro + 20 VAT => 12 euro,.. 10 percent discount => 10.8 euro,... this is now taxed. So the VAT must be recalculated. So that x +VAT = 10.8 euro.
Title: Re: Incorrect taxAmount calculation (with samples)
Post by: moonaway on September 26, 2014, 08:18:49 AM
Quote10 euro + 20 VAT => 12 euro,.. 10 percent discount => 10.8 euro,... this is now taxed. So the VAT must be recalculated. So that x +VAT = 10.8 euro.

Hmmmmmm.... Let's see sample #1b.

(http://s020.radikal.ru/i719/1409/d4/088f5d5ac23d.jpg)

Base price = 1500р
Discount after tax = 200р
VAT tax = 20%

How calculated TAX = 266,666 ? ....I could not calculate this value
Title: Re: Incorrect taxAmount calculation (with samples)
Post by: Milbo on September 26, 2014, 16:53:47 PM
1500 + 1500 * 0.2 = 1800 with Discount => 1600.
1333.3333 with tax of 20% => 1600
Title: Re: Incorrect taxAmount calculation (with samples)
Post by: moonaway on September 26, 2014, 17:39:24 PM
Maybe I'm stupid, but how we get 1533,33333 ?? =))))
Title: Re: Incorrect taxAmount calculation (with samples)
Post by: Milbo on September 26, 2014, 19:32:26 PM
your final price is 1600. So you need the tax of a product, which results in 1600 with tax.... so x *1.2 =1600

btw, corrected my post
Title: Re: Incorrect taxAmount calculation (with samples)
Post by: moonaway on September 27, 2014, 19:14:51 PM
You right, but...

Input data:
1.Base price = 1500р
2.VAT tax = 20%
3.Discount after tax = 200р
1->2->3, yes?

Next:
1500 + 1500*0.2 - 200 = 1600 - It's sale price for customers.

We wrote:
Quoteyour final price is 1600. So you need the tax of a product, which results in 1600 with tax.... so x *1.2 =1600

This formula is correct, if we ignored the discount in calculation, but take the sales price which we have calculated in the above example.

X + X*0,2 = 1600 - It's sales price
X * 1.2 = 1600
X = 1600/1.2 = 1333,3 - It's base price
VAT = 1600 - 1333,3 = 266,6 - It's VAT
1333,3 + 266,6 = 1600 - It's final price

That is, in these calculations we ignored the discount and we calculate the tax on the sale price which was calculated in the above example.

So in these calculations we ignored the discount and calculated the tax on the final price, which was calculated in the first example.
And we see:
(http://i072.radikal.ru/1409/5a/18a1046ab17d.jpg)

discountedPriceWithoutTax + taxAmount = salesPriceWithDiscount

or (This calculation I want to publish on the frontend)

basePrice + taxAmount2 - discountAmount = salesPrice

How I can publish taxAmount2 (which is not in the object) on the frontend?
Title: Re: Incorrect taxAmount calculation (with samples)
Post by: AH on September 28, 2014, 12:42:38 PM
Why [discount_amount] -ve.   Because discount can also be +ve  the name "discount" is really an adjustment amount to a value.

Regarding TAX

Why do you say "your right, but.." ?

From a tax perspective all the values are correct.

You applied a discount to the final price inc VAT

Expressing the taxamount2 as you required is overstating tax

As you pay VAT, you have just overpaid ad if your customer is claiming VAT back they have just over claimed!

X + X*0,2 = 1600 - It's sales price
X * 1.2 = 1600
X = 1600/1.2 = 1333,3 - It's base price
VAT = 1600 - 1333,3 = 266,6 - It's VAT
1333,3 + 266,6 = 1600 - It's final price

You now want to state the Gross to be 1600 and the Tax to be 300
Net = Sales price - Tax

Hmm..
That would result in the Net being 1300

Which as we know it is not!

Because 1300 * 1.20 = 1560

As far as I can make out, there are NO errors in the values shown.

Title: Re: Price calculation: tax,sales (with samples)
Post by: Milbo on September 29, 2014, 07:55:20 AM
Moonaway. Please lern again the tax types. Just replace your VAT with a normal Tax rule and it will work as YOU expected. But the tax officials will tell you that it wrong. The VAT is based on money. So if you reduce the money, you have to pay less tax. Compare it with a normal tax, for example on Oil. Regardless the costs, the oil is always taxed the same way.
Title: Re: Price calculation: tax,sales (with samples)
Post by: moonaway on September 29, 2014, 09:45:30 AM
Thank you for your replay! :D :D

You are completely right. I just could not find documentation on the rules of calculation and, therefore, I'm thought wrong. Thank you!



QuoteWhy [discount_amount] -ve.   Because discount can also be +ve  the name "discount" is really an adjustment amount to a value.

In my samples all "discount" be -ve. But in price model discountAmount = -200 in sample#1, and = 200 in sample #2. Why?