# Service Charge Calculation on Tax Included Ticket ( and products)

Hi extremely new to Sambapos, Started exploring on Friday, seems like a great products so far. I would like to use Tax Included Tickets ( and products) but also Calculate a Service Charge from the price of product without Tax ( i.e. taxable amount ) . Ive tried but the systems calculates Service Charge on both Taxable amount + the Tax (i.e Ticket amount) and Then updates the Tax Total from the Ticket Total which includes Service Charge ( The Tax is incorrect in this case as it should only be levied on the product price and not on the Service Charge.)

How can I use tickets (and products) with Tax Included pricing ( because our products are priced with the tax included)

AND

Calculate the Service Charge from the Taxable amount ( not on taxable amount AND the tax) (note: local tax is not service chargeable )

WITHOUT

Calculating tax on service charge (i.e. Ticket Total after Service Charge is added at checkout ) ( note: our restaurant service charge is not taxable)

Hello @Aryanking welcome to SambaPOS forums. Thank you for the detailed explanation.

Can you please also add a screenshot of a ticket that displays incorrect values and tell us what are the expected values? That way I can easily understand how you need it to calculate.

Before Service Charge:

Tax Is correct here. And should remain so after service charge is applied because our service charge is not taxable.

After Service Charge:

Tax Should remain \$9.09. AND Service Charge should be not be \$8.00 because Service Chargeable amount = taxable amount=\$100-\$9.09 = \$90.91 AND 8% of \$90.91 = \$7.27

Hope this helps clarify. Thanks

Something like this?

8% of 3.25 = .26 3.25 + .26 = 3.51 Tax is listed but not affecting total. Is this what you want?

@Jesse Thanks for the reply. If you observe my before and after screens, you would notice that tax is not affecting the total balance. So that’s not my issue.

My first issue lies with the fact that my Servicing Calculation Type template uses the Calculation Method “Rate from ticket amount”. This would be fine if my ticket amount and product price was not set to to be “tax included”. However , since my ticket amount and product price is tax inclusive, Service Charge is calculated against both food/beverage price and tax, which is wrong. My Service Charge is suppose to be calculated against the pre-taxed food/beverage price only i.e Ticket Total - Tax Total, which is the service chargeable amount ).

How can i use or create a custom Calculation?

The second issue is that tax gets levied on a non-taxable fee i.e my Service Charge
This would be fine if the law made provisions to collect Tax on my Service Charge. However this is not what the law requires, and therefore i need to ensure that Tax Total is based only on the Taxable amount.

How do i prevent tax from being levied on a non-taxable fee like my Service Charge?

1 Like

• Change Calculation Type as Custom and enable Tax Included.

• Create a new script and type handle as `Calculation_[CalculationTemplateName]`. If your calculation template name is `Service` it should be `Calculation_Service`.

result = (Ticket.PSum + Ticket.PreSum - Ticket.Tax) * 0.08

• Have fun.

1 Like

Ok thanks. Will try your suggestion.

@emre Here is the results of the script:
Before Payment processed -

After Payment Processed -

Why is the Total Charged and Balance not same?

This is how it works for me…

I think you should carefully review your configuration for rounding or similar settings that may change totals. Please let me know if you notice something.

Please help me understand why AFTER the Servicing Button is selected, Balance != Total Charged AND Balance != Sum (item1,item2,item3), in this ticket . And the other strange thing is that, Balance == Total Charged AFTER i select the Ticket Button BUT still Balance != Sum (item1,item2,item3) . However, in payment screen, After Pressing the Close Button, then Selecting the Settle Button and returning to the payment screen, all the values on Ticket reconciled; i.e Balance == Total Charged == Sum (item1,item2,item3) . So i decided to create an Automation Command button and a related Rule to “refresh” the payment screen" when selected. @emre Do you Know the reason for this quirky behavior? Is there another direct and automatic way to get all variables to reconcile after Selecting the Servicing Button ?

See screens below:

OK. I’ve didn’t noticed you’ve enabled the button to add servicing and I was testing it with automatic calculation. I’ve reproduced it. When you add it with button it does not update Total Value. It will work fine on next update.

Also it seems you’ve set `Rate` value for the calculation. You should set it to 0 since it will make an custom calculation.

OK thanks @emre . You are correct about `Rate`. Also:

1/ Is there a workaround way to get Total Value (& each order item price value) updated automatically after selecting Servicing button, before you release next update?

2/ Toggle does not work for ‘Servicing’ button when using Custom Calculation

@emre . Thanks very much for fixing 1/ in 4.1.55 as promised! Can you please explain to me the following script:

result = (Ticket.PSum + Ticket.PreSum - Ticket.Tax) * 0.08

I would like to be able to do custom calculations and scripts on my own because i love to solve problems by automation and programming (i’m currently learning python ), and this will be good practice for my mind and a more efficient way to make changes to my system. This way i can also help others in forum with custom issue that can be solved with scripts. Where can I find the Sambapos script language basics on variables/functions/reserved words/syntax required to write scripts ( like the calculation script above)

Concerning

Do i need to do another button with a custom calculation script if i want to reverse to (servicing) calculation? Thanks Again