Tax based on bill total

Oops. May have put the constraints in wrong place Stand by

Still not working I tried adding this constraint initially under add custom constraint. Then removed them as it was still charging 5%. I then put them under actions - select actions. Charged 13%

I’ve tried adding this a few times. Still not functioning.

Hmm, yes, not working. Seems Ticket Total Changed event does not have access to either of these:

{PLAIN TOTAL}
{GROUP CODE}

So we need to go about this a different way. Need to think about it a bit. I think we’ll need to use Order Added event, and set/check some Order States.

But {TAX TOTAL} works, maybe {TICKET TOTAL} - {TAX TOTAL}.

BTW: IIRC, Porvincial Alcohol tax and Food/Beverages also different too.

1 Like

So… if I substitute group code for ticket total ?

Maybe try emre suggestion but change from {TICKET TOTAL} Equals/Less 4 to [=TN({TICKET TOTAL}) - TN({TAX TOTAL})] Equals/Less 4

EDIT Maybe [=…] not necessary.

How about another idea:
Map both GST and PST to products but check if {TICKET TOTAL} - {TAX TOTAL} Equal or Less than 4 then set PST to 0?

EDIT: I think this way would work better. I think PST 8% for Food and Bev but 10% for Alcohols products.

No.

Yes great. Partially solved then, since that would probably work for the Rule constraints on the Less/Greater/Equal to amount.

@natascafe, the problem is that the Ticket Total Changed event does not have access to {GROUP CODE} which is what we are trying to use in the Action Constraint.

So we need to go about filtering Non-Tax Products in a different manner. Probably, we need to use a different event other than Ticket Total Changed, something like Order Added to Ticket event.

How would you accomplish that?

That what I’m going to ask :slight_smile:

EDIT: Maybe have to use calculation for PST instead of Tax template. Create Product Custom Tag for PST rate?

That was my original response. Use a Calculation for the 8% that is applied on Tickets having Total greater than 4, and use Tax Template for 5% mapped to applicable Product Groups.

Yes, I think so.

Remove the Tax Template for 8%.

Map applicable Product Groups (GroupCodes) to the 5% Tax Template, and ensure non-Taxed GroupCodes are not in the Tax Template.

Create a Calculation Type:


Create an Action for Update Ticket Calculation:


Now you should have only 1 Rule to apply the 8% Tax Calculation on Ticket Total (plain total) greater than 4…

[=TN('{TICKET TOTAL}')-TN('{TAX TOTAL}')]


Adjust constraints and parameters as necessary for your desired outcome.

@QMcKay, I think PST will apply on non-GST items too. It calculate from plain total. Not sure if PST must apply on NON-GST item or not.

Maybe need to set Taxable order state and use Order State Total and ODI to calculate PST.

I get what you are saying @sukasem. But I am just trying to make it work with 5% and (+8) 13% when plain total greater than 4, and excluding non-Tax Products, as per OP.

I found that it was not applying calculations properly, so changed to a Custom Calculation …

Revised Calculation (Custom):


Script for Custom Calculation:

Handler must be: Calculation_<calculationTemplateName>

Script:

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


Revised Action:


Revised Rule:


REFERENCE:

Oh V4 doesn’t have Script and maybe ODI too.

Yes it does, at least for Custom Calculations it works. That reference I quoted was from a V4 question and is supported as of v4.1.49

Sorry if I missed it but did you tried {PLAIN TOTAL:} ? When there is an empty parameter it will always return the plain total.

PS: If there are order specific tax templates triggering a dummy order state update may work as we can update tax per order on order state updated event. However triggering it on each ticket total change might be a little costly so maintaining additional ticket state to determine current tax level might be helpful not to trigger unnecessary updates.

1 Like

Thanks guys. Should I try this?

Try what? I would try my last posted solution using Custom Calculation. Can’t hurt right? :wink: