Assuming "Sales Tax" is a calculated field, what formula do you have in there? It looks like it is Service Total * 0.045, but it should be ( Service Total - Promotion ) * 0.045.
(100 - (100 * 0.1)) * 0.045 = 4.05
where 100 = service fee,
0.1 = discount
Not sure that this is what you meant, though.
There is no problem with "Promotion" using a radio button set, just keep in mind that the data is being stored as text based on your value list. Give this a try for your "Sales Tax" formula:
If ( Promotion = "No Discount" ;
Service total * 0.0045 ;
( Service total * ( GetAsNumber ( Left ( Promotion ; 2 ) ) / 100 ) ) * 0.0045
Sorry about that... the formula I gave you was calculating tax on the amount of the discount (the 10%) not the discounted total (the 90%).
Change that portion to:
( Service total * ( 1 - ( GetAsNumber ( Left ( Promotion ; 2 ) ) / 100 ) ) ) * 0.0045
$55.00 - 10% = $49.50
4.5% of $49.50 = $2.2275 ... rounded = $2.23
Where did you get $2.25 from?
Your Grand Total amount math is also wrong:
10% discount of $55.00 is $49.50 plus $2.23 = $51.73, not $52.23
BTW, 4.5% of $49.50 is $2.23
it rounded up. $50
According to the image the Amount is not getting the discount. I think you haven't applied the discount correctly.
The Amount starts as $55.00
Then you apply a 10% discount so the amount shown at the bottom should now be $49.50
Tax is calculated on the discounted amount. At a tax rate of 4.5% that is $2.2455 but should be rounded to $2.25 since it is over $.005.
adding amount plus tax is $49.90 + $2.25 = $52.15
So I'd make the calculation match the requirements. If you make it a custom function it would look like this:
I've mixed in using either the decimal or percent of a value so you can see the difference. But, I suggest you make both use the same format.
Pass in amount = 55, discount = .1, and tax_rate = 4.5 (if you pass in .045 then remove the "* 100" from the tax calculation)
new_total (amount ; discount_percent ; tax_rate )
Let ( [
new_amount = amount * ( 1 - discount_percent ) ;
tax = new_amount * ( tax_rate * 100 ) ;
final_amount = tax + new_amount
Note that since Tax Rates change this should NOT be a calculation field. Make it an AutoEnter calculation, possibly using a custom function.