# How do I deduct ticket discount in a calculation?

Dear Friends,

I have a Calculation Type for GST, where I calculate the tax, based on the criteria, as shown in the code below:

The code of the Amount Line is as follows:

``````[=(TN('{TICKET ORDER TOTAL EXP:(1=1) AND (ODI=True)}') * 0.05 + TN('{TICKET ORDER TOTAL EXP:(MT.ReportGroup=Food) AND (ODI=True)}') + TN('{TICKET ORDER TOTAL EXP:(MT.ReportGroup=Beverages) AND (ODI=True)}')) * 0.025]
``````

The calculations works fine as long as there is no discount on the ticket.

How do I deduct the discount from this calculation? Which tag do I have to use for that?

Thanks,

Somil

Why you’re not using Tax Templates? You can map them to product groups and it will work fine with calculations.

1 Like

Good Evening Emre,

I use the Tax Templates in most cases. But, this is a tough case.

The customers sells wines, on which there is no tax, but he charges 5% service charge for serving the wine, and I am supposed to charge tax on the service charge amount.

For eg:
Food sales = 500
Wine sales = 700
Service Charge at 5% = 60
Here, taxable amount is 500+60=560

If I use a Tax Template, and do not map it for the wines, it does not calculate the tax on its service charge component.

It comes out as
Food sales = 500
Wine sales = 700
Service Charge at 5% = 60
Taxable Amount = 500 + 25 (service charge of the food) = 525

Hence, I am using the formula.

Regards,

Somil

I figured it out!

Here is the code which also deducts the discount

``[=(TN('{TICKET ORDER TOTAL EXP:(1=1) AND (ODI=True)}') * 0.05 + TN('{TICKET ORDER TOTAL EXP:(MT.ReportGroup=Food) AND (ODI=True)}') + TN('{TICKET ORDER TOTAL EXP:(MT.ReportGroup=Beverages) AND (ODI=True)}') - TN('{ORDER STATE TOTAL:Gift}') - TN('{ORDER STATE TOTAL:Discount}') * (TN('{TICKET TAG:Discount Rate}')/100)) * 0.025]``
1 Like

@somilmittal it sounds like a common case to me and I think that asked before. I’d like to implement a solution for that so you won’t need that complex calculation setup. But I need your help. Can you tell me on your example what will be the resulting tax if I add %10 discount?

Is it how you want it to calculate?

1 Like

Greetings Emre!

Here is my ticket calculation snapshot:

Ticket Total = 6075
Service Charge at 5% = 303.75
Discount on Food = 1225
Taxable Amount = Food Total - Food Discount + Service Charge = 2450 - 1225 + 303.75 = 1528.75
CGST Tax at 2.5 % = 1528.75 x 2.5 / 100 = 38.22
SGST Tax at 2.5 % = 1528.75 x 2.5 / 100 = 38.22
Hence Total Ticket Balance is 5230.

These kind of calculations are only possible in SambaPOS!

Which is why I am so obsessed with SambaPOS, and keep scouring the forum all the time for new ideas.

Regards,

Somil

1 Like

My final Tax calculation looks like this:

``[=(TN('{TICKET TAG:Service Charge}') + TN('{TICKET ORDER TOTAL EXP:(MT.ReportGroup=Food) AND (ODI=True)}') + TN('{TICKET ORDER TOTAL EXP:(MT.ReportGroup=Beverages) AND (ODI=True)}') - TN('{TICKET ORDER TOTAL EXP:(OS.GStatus=Gift) AND (ODI=True) AND ((MT.ReportGroup=Food) OR (MT.ReportGroup=Beverages))}') - TN('{TICKET TAG:Discount Amount}')) * 0.025]``
1 Like

OK Thank you very much. I found the same amount.

After next update you can enable `Include All Calculations` setting for the tax template to calculate tax from full servicing & discount amount.

3 Likes

Dear Emre,

Thanks a lot for adding this new feature!

SambaPOS rocks!

Regards,

Somil

1 Like

This is very beneficial, thanks! I think many including myself have had to include many calculations in printer templates to get the correct tax amounts, with this new feature means we should just be able to specify tax amount and tax total. 