
1. Re: If / Case Function
jonmyrah Apr 5, 2016 9:54 AM (in response to Takahide)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.

2. Re: If / Case Function
siplus Apr 5, 2016 9:59 AM (in response to Takahide)(100  (100 * 0.1)) * 0.045 = 4.05
where 100 = service fee,
0.1 = discount
Not sure that this is what you meant, though.


4. Re: If / Case Function
jonmyrah Apr 5, 2016 11:15 AM (in response to Takahide)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
)


6. Re: If / Case Function
jonmyrah Apr 5, 2016 2:26 PM (in response to Takahide)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


8. Re: If / Case Function
jonmyrah Apr 5, 2016 2:53 PM (in response to Takahide)$55.00  10% = $49.50
4.5% of $49.50 = $2.2275 ... rounded = $2.23
Where did you get $2.25 from?

9. Re: If / Case Function
JesseH Apr 5, 2016 2:57 PM (in response to Takahide)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

10. Re: If / Case Function
Takahide Apr 5, 2016 3:02 PM (in response to Takahide)it rounded up. $50

11. Re: If / Case Function
ch0c0halic Apr 5, 2016 3:17 PM (in response to Takahide)Takahide,
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)
CF:
new_total (amount ; discount_percent ; tax_rate )
Calculation:
Let ( [
new_amount = amount * ( 1  discount_percent ) ;
tax = new_amount * ( tax_rate * 100 ) ;
final_amount = tax + new_amount
] ;
final_amount
)
Note that since Tax Rates change this should NOT be a calculation field. Make it an AutoEnter calculation, possibly using a custom function.