Trying to setup print bill when payment button is pressed but with confirmation popup

Continuing the discussion from How to print bill when 'Cash' button is clicked on payment screen?:

Big thanks to QMcKay, you’ve got me very close to what I need to setup here, thanks for posting your guide.

Can’t get the last steps, hope someone can help me with this.

I’ve setup the print bill when ‘Cash’ button is clicked on payment screen from


and have tried to modify it to have a confirmation box.

I can’t figure out how to pass the values from the Ask Question action into performing the right tasks. But believe I’m close. Here’s what I’ve got so far:

Ask question action:

Which gives me the nice popup like so:

But I can’t figure out how to program the automation commands (I guess?)

Here’s how I changed the ‘Print Bill after Payment Processed’ Rule:

This actually gets me very close in that when I click a payment, I get the pop-up asking for no, 1 or 2 copies, but it prints 2 copies no matter what I choose (Yes I know I’m missing an important part, but I’ve tried so many ways, that I just removed the fails here and left what I think I have right)

If I could get ‘Print Bill after Payment Processed’ Rule to respond to the button presses like this, believe it would fit perfectly:

0=No copies, stops executing the ‘Print Bill after Payment Processed’ Rule at this point
1=1 copy, runs the execute Print Bill job once and stops executing the ‘Print Bill after Payment Processed’ Rule at this point
2=2 copies, runs the execute Print Bill Job and continues on to the next action, execute print job.

Thanks in advance to any kind souls out there. I’ve been trying for days and nights on this.

Respectfully,
Andre

Continuing the discussion from How to print bill when 'Cash' button is clicked on payment screen?:

Your print bill needs to be on a second rule trigered by the ask question command name.
When triggered the command value will be the = part from the button pressed.
So add an automation command name to the ask question.
Make a new rule as automation command executed and constraints of
Command name equals (the name on ask question)
Command value greater than 0

Make a new or clone print action but put [:Coppies] in the Coppies field. That will let you set the number of prints from the rule.

Add that new print action to the second rule you just made and select command value in the Coppies field.

Then when the ask question button is pressed; is value is 0 nothing happens, and the others the value becomes the number of Coppies
:slight_smile:

1 Like

Thanks for posting back JTRTech,

Got most of what you’re saying conceptually, but missing out on some of the how to. I don’t know the proper syntax for entering the variables for reacting to the command value, could you please give me an example? With the add an Automation command, understand the constraints, just not sure how to name the automation command and have it tied to the rules and actions.

Thanks again greatly appreciate the assistance.

Respectfully,
Andre

You don’t need a button.
You put the automation command name on the ask question and it acts like a mapped button where the ask questions buttons give command value.

Make the new rule, add constraint of command name equals and you will need to type the command name.
The dropdown only gives setup command buttons.

Command value should be in the dropdown options on the action.

Am not at PC to show screenshots.

Hi Joe,

Thanks so much! Your instructions got me going on the automation command, and was able to get the buttons doing the correct actions! (Almost all correct…)

Changed the pop-up to ask whether a guest copy, a store copy or both is needed to be printed:

Added a printer template for the store copy (Just a copy of the Ticket Template with the ad line removed and a signature line added.)

Got it working by adding three rules with constraint of automation command executed and:
Command Value = 1, Print Guest Copy
Command Value = 2, Print Resort Copy
Command Value = 3, First Print Resort Copy, Show Message saying to tear first receipt, then print Guest Copy

Was so happy that it all looked like it was working good, UNTIL, I starting making test tickets and found a strange issue.

Clicking on the Ask Question pop-up causes the following actions:

Clicking No - Not needed. No receipt printed, everything looks good.
Clicking Yes - Guest Copy, prints a guest copy of the receipt, Account balance correct
Clicking Yes - Sangat Copy, prints a guest copy of the receipt, Account balance correct

Clicking Yes - a copy for the guest and Sangat,
Prints a Resort copy first,
Displays the Show Message pop-up window saying to tear first receipt and give to the guest to sign,
Then prints the guest copy after clicking ok on the Show message window.

Everything looked good until, I noticed that if I used a customer account (or a staff account) as the payment method, the first copy (resort copy) of the receipt would show the account balance before the transaction is added, and the second copy (guest copy) would show the correct balance with the current transaction added.

I tried switching the order and printing the guest copy and then the resort copy, delivers the same results (1st copy short on account balance.)

I don’t understand this because. I’m using the same actions from all three rules, and they’re only calling print jobs.
(Only difference is the third rule has the Show message popup between receipts.)

I thought about making a new printer template for the third rule to call and changing the calculation that receipt to:
Guest Account Balance:|P [=F(TN(’{ENTITY BALANCE}’+{TICKET TOTAL}),’#;-#;0’)],
but realized that would cause a wrong printout if the customer had an outstanding balance, but was paying THIS ticket by cash or credit card.

I also tried making a fake ‘null’ printer and having a print bill job run there first. Same results with first ticket actually printed with the account balance missing the current transaction.

Hope you or someone here can help me Joe, it’s driving me crazy trying to get this working. I’ve tried to include all the screenshots of the applicable rules and actions:

Print Bill after Payment Processed Rule:

Confirm to print guest receipt Rule

Confirm to print store copy Rule

Tear off first receipt Rule

Ask Printing Action:

Ask Printing Automation Action

Execute Bill Print Job Action:

Execute Bill Print Job Store Copy Action:

My printer template for the store copy (guest copy is almost identical)

Ticket Template Store Copy

[LAYOUT]
-- General layout
<XCT>27,101,4
<L00>         Sangat Island Dive Resort
<L00>
<J00>Date: {TICKET DATE}|Time: {TIME}
{ENTITIES}
<L00>Ticket No:{TICKET NO}
<F>-
{ORDERS}
<F>-
<EB>
{DISCOUNTS}
{TAXES}
[<J10>Total Gift:|{ORDER STATE TOTAL:Gift}]
<J10>Tax|P {TAX TOTAL}
{SERVICES}
<XCT>27,101,2
-- <XCT>27,75
<XCT>27,33,128
<R00>Total:  P {TICKET TOTAL}
<XCT>27,33,4
<XCT>27,77,1
{PAYMENTS}
<DB>
<F>=
<L00>
<XCT>27,33,128
<L00>X___________________
<XCT>27,33,4
<XCT>27,77,1
<XCT>27,101,2
<J00>Signature|Sangat Island Copy
[DISCOUNTS]
<J00>{CALCULATION NAME}|P {CALCULATION TOTAL}

[SERVICES]
<J00>{CALCULATION NAME}|P {CALCULATION TOTAL}

[PAYMENTS]
<J00>{PAYMENT NAME}|P {PAYMENT AMOUNT}

[ORDERS]
-- Default format for orders
<J00>- {QUANTITY} {NAME}|P {TOTAL PRICE}
{ORDER TAGS}

[ORDERS:Gift]
-- Format for gifted orders
<J00>- {QUANTITY} {NAME}|**GIFT**
{ORDER TAGS}

[ORDERS:Void]
-- Nothing will print for void lines

[ORDER TAGS]
-- Format for order tags
<J00> * {ORDER TAG NAME} | {ORDER TAG PRICE}

[ENTITIES:Table]
-- Table entity format
<L00>Table: {ENTITY NAME}

[ENTITIES:Customer]
-- Customer entity format
<L00>Guest: {ENTITY NAME}
<J00>Guest Account Balance:|P [=F(TN('{ENTITY BALANCE}'),'#;-#;0')]

[ENTITIES:Staff]
-- Staff entity format
<L00>Staff: {ENTITY NAME}
<J00>Staff Account Balance:|P [=F(TN('{ENTITY BALANCE}'),'#;-#;0')]

Thanks in advance to any kind souls.

Respectfully,
Andre

Will have to have a better read of your post when back at PC.

Much appreciated Joe!

So to clarify, what happens if you put the customer copy first before ask question?
The problem stays on first printed with the guest copy or moves with the resort copy to the second print?

Hi Joe,

Yes, the problem stays on whichever is printed first.

Both the resort or the guest copy will have the account balance without the current transaction if it’s the first one. Also the second one (guest or resort version) has the correct account balance, no matter which version (guest or resort) is printed first.

Ok, humor me as obviously not got your exact setup…

Try moving the ask question to 1st and print, then to last and print, and come back with how this influences the balance?

Hi again Joe,

Actually it’s Show Message instead of Ask Question on the rule:
Tear off first receipt Rule

And yes you are intuitive, it did change the behaviour.

If I move the Show Message action to the 1st action on the Tear off first receipt Rule
It makes the account balance come out correct on both printed copies.

But when I move the Show Message action to the last action on the Tear off first receipt Rule
It makes the account balance come out wrong on both printed copies. (Missing current transaction amount.)

When I saw this, I thought, okay, I’ll just put two Show Message actions, the first one the staff just has to click to start the printing, and the second one will give them the chance to tear the receipt before the second copy prints.

Here’s what’s weird, I left the rule set with the Show Message first that worked to make both printed copies have the correct balance, and added a fourth action (in the third position) to make a Show-message Pop-up to click to continue printing.

BUT, when I did this, it goes back to the same way of printing the first receipt with the wrong account balance and the second receipt with the correct balance? (Doesn’t matter if the guest or resort copy prints first, whichever one prints first has the wrong account balance)

Here’s the Test Action I added:

Any ideas Joe?

Thanks for all your help already. Because of you I’ve gotten further on this in the last day then I did in the last week.

Respectfully,
Andre

Hmmm, not sure whats going on there.
Try this…
Change the show message to another ask question with command name and just OK for button.
Move the second print bill action to a new rule with event of the automation command of the second ask question.

I think this is happening maybe because show message/ask question are not meant to be used for a ‘pause’ in a list of actions…

Payment processed rule with pirnt what question, option 3 selected
Option 3 command value rule with tear receipt ask question set to trigger the the 3rd rule and print 1st receipt
Tear receipt automation command from that ask question with print second receipt action

Hi Joe,

Thanks for the plan. tried it and no matter whether I have a Show Message or an Ask Question, if’s it after the a print operation, the receipt comes out with the wrong account balance.

I put just one print action on the rule, but didn’t setup the new automation rule, because I could already see it’s not working on the first receipt that’s printed. (Doesn’t matter if I leave the original question popup before these two actions, same results.)

Continue Printing Action

Had one other idea, maybe you can tell me if it’s possible?

The rule to start the ask copies and printing runs off the event of Payment Processed with a constraint of Remaining Amount equals Zero. Is there anyway further along the flow of Payment Processed (or the next task) that I could make a rule that would watch for a later point and make a pop-up and then print the second copy?

(Wish it was an auto-cut printer, ready to say, “Here’s a pair of scissors, just cut the double receipts in half.”)

Thanks for keeping trying with me.

Respectfully,
Andre

The reason of that issue is Account Transactions completes after payment made but “Payment Processed” rule executes before it updates account transaction. Displaying a message box allows SambaPOS complete transaction so second print displays correct amount.

To solve such problems we use “Execute Automation Command” action. Like message box does it allows SambaPOS to complete queued work and execute command.

Create an action like that. It executes immediately by default so you can set Background parameter to True to make it run in background.

It will execute a command named Background Ask Printing. You don’t need to define that Automation Command. You can just type it in.

In payment processed rule execute this action instead of “Ask Printing” action.

Finally create a rule that executes Ask Printing Action when Background Ask Printing executes. As you didn’t configured Background Ask Printing command it won’t appear in drop down list but you can type it there.

That ensures printing to start after payment process fully completes.

PS: Sorry I couldn’t fully tested with a printer and I’m not sure if it is possible with V4.

2 Likes

Hi Emre,

Thank you very much I’ll give it a try first thing in the morning (GMT+8).

Respectfully,
Andre

Hi Emre,

Thanks for all the help, tried the instructions, unfortunately couldn’t do this part:

Unfortunately it looks like V4 does not have the option to run an action in the background, I set everything else as specified, but without the “run in background” parameter, it still does the miscalculation on the first receipt. We’ve decided to just use 2 ply receipt paper to solve the issue as it gets all the goals accomplished and changed the Pop-up question like so:

I really do appreciate the help and love the how customizable SambaPOS is, believe the resort owner is going to be very happy with the setup.

If I may, two more questions (haven’t been able to find the right formatting commands.)

One on the receipt I have it print the account balance using instructions found on the Samba forum with this entity entry modified on the printer template like so:

[ENTITIES:Customer]
– Customer entity format

Guest: {ENTITY NAME}
Guest Account Balance:|P [=F(TN(’{ENTITY BALANCE}’),’#;-#;0’)]

Can I make the account balance have commas for the thousands? (In other words instead of printing a balance of 12323, would like it to print 12,323)

And question 2, is there any way I could have it print the entity name on the top part of the receipt where it is now, but have the account balance print below the total? (I tried to make sections Entities1:Customer and Entities2:Customer on the Printer Template, but that doesn’t work) at the end of this message I put a copy of our current Printer Template.

Thanks again Emre.

Andre

[LAYOUT]
– General layout
27,33,64

27,101,2
Sangat Island Dive Resort

27,33,4
27,77,1
Date: {TICKET DATE}|Time: {TIME}
{ENTITIES}
Ticket No: {TICKET NO}
-
{ORDERS}
-

{DISCOUNTS}
{TAXES}
[Total Gift:|{ORDER STATE TOTAL:Gift}]
Tax|P {TAX TOTAL}
{SERVICES}
27,101,2
– 27,75
27,33,128
Total: P {TICKET TOTAL}
27,33,4
27,77,1
{PAYMENTS}

=
Visit us online at:

27,80
www.sangat.com.ph
fb.com/sangatislanddiveresort

27,33,4
27,77,1

[DISCOUNTS]
{CALCULATION NAME}|P {CALCULATION TOTAL}

[SERVICES]
{CALCULATION NAME}|P {CALCULATION TOTAL}

[PAYMENTS]
{PAYMENT NAME}|P {PAYMENT AMOUNT}

[ORDERS]
– Default format for orders
{QUANTITY} {NAME}|P {TOTAL PRICE}
{ORDER TAGS}

[ORDERS:Gift]
– Format for gifted orders
- {QUANTITY} {NAME}|GIFT
{ORDER TAGS}

[ORDERS:Void]
– Nothing will print for void lines

[ORDER TAGS]
– Format for order tags
* {ORDER TAG NAME} | P {ORDER TAG PRICE}

[ENTITIES:Table]
– Table entity format
Table: {ENTITY NAME}

[ENTITIES:Customer]
– Customer entity format

Guest: {ENTITY NAME}
Guest Account Balance:|P [=F(TN(’{ENTITY BALANCE}’),’#;-#;0’)]

[ENTITIES:Staff]
– Staff entity format

Staff: {ENTITY NAME}
Staff Account Balance:|P [=F(TN(’{ENTITY BALANCE}’),’#;-#;0’)]