Is [=(expression)] support in printer template or Syntax for passing program setting to Script?

I tried to display Amount Due with remaining total if paying amount (program setting) is 0. If not, print paying amount. I’m making Customer Display with browser printer. So, if I select items, it will calculate amount of selected items and store in program setting PartialPaid_{:CURRENTTERMINAL}

What I try:
Expression method - Return Empty

[=('{:PartialPaid_{:CURRENTTERMINAL}}' == '0' ? '{REMAINING TOTAL}' : '{:PartialPaid_{:CURRENTTERMINAL}}')]

CALL method - Always Return Remaining Total even {:PartialPaid_{:CURRENTTERMINAL}} is 3.10

{CALL:PartialPayment.GetAmountDue('{:PartialPaid_{:CURRENTTERMINAL}}','{REMAINING TOTAL}')}
{CALL:PartialPayment.GetAmountDue('{SETTING:PartialPaid_{SETTING:CURRENTTERMINAL}}','{REMAINING TOTAL}')}

Script Handler: PartialPayment

function GetAmountDue(PayingAmount,RemainingTotal) 	{
	if (Number(PayingAmount) > 0) {
		return PayingAmount;
	} else {
		return RemainingTotal;
	}
}

Would it not be easer to say if {BALANCE} is 0 rather than having program setting or am I misunderstanding?

In case customers want to pay separately. I can select the items that customer want to pay. No more move/create new ticket.

Yer, you select them on the payment screen and it automaticly calculates the tendered amount for the selected order lines.
Am not catching on to what your trying to do in your receipt, sorry, been a long day…

Expressions and even the Ternary operator are supported in Printer Templates, however…

A Printer Tag is not the same as a Program Variable.

So instead of using this in a Template:

{:PartialPaid_{:CURRENTTERMINAL}}

You should use this:

{SETTING:PartialPaid_{SETTING:CURRENTTERMINAL}}

P.S. It is nice to see others using the power of scripting in v5 ! :wink:

2 Likes

I did try both with SETTING and without.

Here what I’m doing:

3.10 is paying amount from {:PartialPaid_{:CURRENTTERMINAL}} but $21.90 is return from CALL{X} above. It is suppose to be Amount Due: $3.10

{:PartialPaid_{:CURRENTTERMINAL}}- Amount Due: {CALL:PartialPayment.GetAmountDue('{SETTING:PartialPaid_{SETTING:CURRENTTERMINAL}}','{REMAINING TOTAL}')}

Showing what item we are selecting on Customer Display

Sure you can restrict print jobs to selected items, but think thats from ticket screen.
Did see an idea where you could select items from the ticket screen and when going to payment screen only hose items were taken and paid (automaticly creating new ticket and then returning to origional one) think he had set it up but is a huge amoutn of automation but sounds like thats actually what your would be after and the template your putting together is a work arround.
I might still be misunderstanding…
@QMcKay do you know the post im talking about?
Is a very nice setup, but dont think it got as far as a tutorial more of a demo.
But would be very tidy solution for yours as automaticly seperates the selected orders from which you can just use the regular customer display template as does the same thing as splitting the ticket but automats it straight into payment screen and even returns to origional ticket and the order than are left.

Although you might want to have the customer display ‘print’ before actually splitting the ticket is it is for them to check…

I saw partial settlement that Emre show on video but I think moving to new ticket is harder to correct when server select wrong items (merge it back and do it again vs this one I think it is 1 click to reset it back never leave original order screen) and I still can’t automate that emre show yet.

BTW you do not need to store the payments in a program setting. {TENDERED} works

I think there is an easier method to accomplish this. But first can you clear something up… The screen you showed is a customer display right?

I am going to attempt to try something new with the Add Task widget.

Yes, Customer Screen using browser printer.

It would be extremely easy if selected orders work while in payment screen.

**

UPDATE: Changing from Program Setting to Ticket Tag and everything work fine. Both Expression and Call method. Don’t know why I was using Program Setting. Ticket Tag make more sense.

**

It would be easier if they see what items they will be charged for.

Maybe you try QMcKay tutorial and change Ignore Selected Orders to False. You don’t even have to change {TICKET TOTAL}, it show correct amount for selected orders. You will see live screen each item you select is live on screen. That is awesome.

@Jesse any idea how to archive this easier method. I got another problem.
The SELECTED ORDERS will be looped thru each order so, every actions in that rule will execute on each order. So, it will ask question every items :frowning:

I can’t make it one button now. I has to change the order state first than execute ask question for payment after (2 buttons now)

How can prevent actions trigger until loop finished?