# Is my DISCOUNT calculation correct?

• ### Question

• User1216627406 posted

We are building a website that encourages users to use the website to make online purchases.

To entice them, we give 10% discount for online purchases.

Code below shows 10% discount applied.

In other words, original price plus tax plus tip gives grossTotal.

Then 10% discount was applied after gross Total was ascertained.

Did I do this right?

```select distinct h.hourly
, h.hourly * IIf([CarTypes] = 'Sedan', 55,
IIf([CarTypes] = 'Stretch (6 Passengers)', 75,
IIf([CarTypes] = 'Stretch (8 Passengers)', 90,
IIf([CarTypes] = 'Stretch (10 Passengers)', 95,
IIf([CarTypes] = 'Stretch (12 Passengers)', 110)))))  as Fare
, h.hourly * IIf([CarTypes] = 'Sedan', 55,
IIf([CarTypes] = 'Stretch (6 Passengers)', 75,
IIf([CarTypes] = 'Stretch (8 Passengers)', 90,
IIf([CarTypes] = 'Stretch (10 Passengers)', 95,
IIf([CarTypes] = 'Stretch (12 Passengers)', 110))))) * 7/100 as Tax
, h.hourly * IIf([CarTypes] = 'Sedan', 55,
IIf([CarTypes] = 'Stretch (6 Passengers)', 75,
IIf([CarTypes] = 'Stretch (8 Passengers)', 90,
IIf([CarTypes] = 'Stretch (10 Passengers)', 95,
IIf([CarTypes] = 'Stretch (12 Passengers)', 110))))) * 20/100 as Tip
, Fare+Tax+TIP as grossTotal,
grossTotal*10/100 as Discount,
grossTotal-Discount as Total
FROM HourlyRates h
INNER JOIN carType c on h.hourly = c.hourly ```

Tuesday, November 25, 2014 11:53 AM

• User1918509225 posted

Hi simflex,

Based on my understanding,If you want to  give discount on the gross total ,you are in the right way.

If you want to give a discount on the fare, you can set Fare*10/100 as Discount ,and just deduct this from gross total.

Best Regards,

Kevin Shen.

• Marked as answer by Thursday, October 7, 2021 12:00 AM
Wednesday, November 26, 2014 8:15 AM
• User1759999623 posted

Kevin, I agree that the calculations are correct; I'm also taking in account reality.  In some tax entities, you report tax based on the tax calculated, not taken.  If you first calculate tax based on the fare before the discount, then there is a possibility that the original tax calculation is the required payment amount to the tax authority, not a discounted amount based on the gross total.  It's semantics argument, but one you likely won't win with the taxman.

• Marked as answer by Thursday, October 7, 2021 12:00 AM
Wednesday, November 26, 2014 12:12 PM

### All replies

• User1759999623 posted

I would believe that you would apply the discount on the fare only.  Note that you don't want to take the discount on the tax as you will likely still have to pay the tax as based on the original fare and you would want the tip to be independent of your fares and hope for the generosity of your passengers.

Tuesday, November 25, 2014 12:36 PM
• User1216627406 posted

Thanks a lot for clarifying this.

Just one more clarification just say I got it right.

The code would then be:

Fare*10/100 as Discount?

Then assume the discount amount is \$15.00, do I then deduct this from the overall total amount or do I still need to subtract it from the fare?

Much appreciated.

Tuesday, November 25, 2014 1:08 PM
• User1918509225 posted

Hi simflex,

Based on my understanding,If you want to  give discount on the gross total ,you are in the right way.

If you want to give a discount on the fare, you can set Fare*10/100 as Discount ,and just deduct this from gross total.

Best Regards,

Kevin Shen.

• Marked as answer by Thursday, October 7, 2021 12:00 AM
Wednesday, November 26, 2014 8:15 AM
• User1759999623 posted

Kevin, I agree that the calculations are correct; I'm also taking in account reality.  In some tax entities, you report tax based on the tax calculated, not taken.  If you first calculate tax based on the fare before the discount, then there is a possibility that the original tax calculation is the required payment amount to the tax authority, not a discounted amount based on the gross total.  It's semantics argument, but one you likely won't win with the taxman.

• Marked as answer by Thursday, October 7, 2021 12:00 AM
Wednesday, November 26, 2014 12:12 PM