Print Last Receipt

Hi Guys,

I was following up on an old article a few years back, hoping to get some help.

I was following the simplest tutorial, and unable to get the dice rolling, the output is always an executed print bill… showing all the variables. Clearly I’m doing something wrong. Or that when I close a ticket, the information is not passed onto the database, and all I get is the Customer Invoice showing all the variables and not the actual content of the last receipt.

I was following JTRTech Last Receipt…

I am just going to outline what I believe i’ve done… but being able to print the last receipt would be awesome instead of jump into account, searching for the table and printing.

As to JTR instruction,

  1. Setup a rule to log the last paid ticket
    Create a rule called “Print Last Bill Log Last Ticket ID”
    Event Name: Ticket Closing
    Execute rule if Matches
    Remaining Amount equals 0
    Total Amount Greater than 0
    Action:
    Update Program Setting
    Setting Name: LASTBILL_{:CURRENTTERMINAL}
    Setting Value: [:TicketId]

  2. Create Automation Command: Print Last Bill
    setting mapping to Status=

  3. Create Action:
    Action Name:Execute Print Last Bill
    Action Type: Execute Print Job
    Print Job Name: Print Bill
    Print Ticket: True
    TicketIds:[:Ticket ID]

  4. Create Rule
    Rule Name: Print Last Bill Button
    Event Name: Automation Command Executed
    Automation Command Name Equals Print Last Bill
    Select ACtions: Execute Print Last Bill
    TicketID: {SETTING:LASTBILL_{:CURRENTTERMINAL}}

This wasn’t in the instruction but reading other Last Receipt tutorials, it talks about the Upgrade Program Settings, which i have created in Actions.

Action Name: Log Last Ticket ID
Action Type: Update Program Setting

Parameters
Settings Name: LASTBILL_{:CURRENTTERMINAL}
Setting Value: [:TicketId]
Update Type: Update
Is Local: False

As I have no experience on how to configure all this… I’m just trying to do the basic tutorials on what i need from sambapos. So what ever is written in the tutorials i type it word for word. So if i’m filling it in … incorrectly… I was just following the tutorial.

Check in database program settings table to see that the setting is getting updated with ticket id as expected.
Or as a show message using the program setting to display value.
Sounds like ticket id is missing/not being passed to the print action so no ticket data going into template.

Sounds like the same issue I had. It turned out that I had copied a refresh ticket action that had a blank field for ticket Id (thus resetting the ‘store last ticket Id’ to 0.

Thanks JTR again for responding so soon, I’ll check that out first.

Thanks Muzzargh, i did see your post, and im running on default settings, so i don’t think mine is as advanced as yours, as i didn’t see any refresh thing you posted, so i thought my beginner setup wouldn’t relate.

Cheers guys, i’ll check it out hopefully … It’s an easy one … i get the concept… but putting it in action seems like… i need to learn… to not just push buttons… but to configure them… one step at a time…

So am i suppose to … install the SQL something tool… to view the table?

I wish i knew how to just do as asked, JTR… but could you point me to how… is it in sambapos?

I think you need SQL Server Management Studio (SSMS).

1 Like


JTR is this what im looking for or at?

I even tried to follow the instructions to this one… didn’t work either… hopefully you guys can tell me where to look … how to check if data is being stored… i’m running on trial at home (version5.3.4)… doing the simulations first before deploying this little feature.

Can you share all of the screens you’ve configured? It’s likely a simple mistake. All this does is set a program variable and then it’s recalled to print the ticket.

1 Like

No, there is a program settings table which is where local=false settings are saved.
I use non local even though its prime setup for just using local as like to be able to easily check the settings in dB to see where issue might be.
The alternative is like I said to use a popup or show message action to display the {Setting:xxx} value being returned.
As said its a simple setup so likely just a simple mistake somewhere.

Sounds like your template may not have [LAYOUT] at top.

The popup the JTRTech is talking about is an Action. Just create a new action (call it Test Message) and select Show Message as the action type.

I’m not in front of my work PC at present but I think my message reads:

  • Last Ticket ID is {SETTING:LastTicketId}

I then added this action to the Print Last Bill Rule.

Thanks Jesse, unfortunately its there!

Was hoping it was as simple as this…

Can you show your template? Another cause can be html template but printer in esc/pos mode

Sorry Jesse, i have no idea how to show the code itself… i tried to comment out the whole thing but instead it made the invisible.

Printer is set on HTML mode

[LAYOUT]
– General layout

-
TAX INVOICE
-
{ENTITIES}
Date:{TICKET DATE}
Time:{TIME}
Ticket Notes:
{NOTE}
-

{ORDERS}
=
{TICKET QUANTITY SUM} Total item
=

{DISCOUNTS}
[Total Gift:|{ORDER STATE TOTAL:Gift}]

– Display the Taxes

{TAXES}

– The Tax on applied on this bill
– Total:|{TICKET TOTAL}

Total ${TICKET TOTAL}

-
– When Payment is received

{PAYMENTS}

[DISCOUNTS]
{CALCULATION NAME} %{CALCULATION AMOUNT}|{CALCULATION TOTAL}

[PAYMENTS]

Payment Received

{PAYMENT NAME}|${PAYMENT AMOUNT}

[ORDERS]
– Default format for orders


J00:2{QUANTITY} {NAME}{TOTAL}
– {ORDER TAGS}

{QUANTITY}x {NAME}
{ITEM TAG:English}
${TOTAL PRICE}
{ORDER TAGS}







{ORDER TAGS}

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

{QUANTITY}x {NAME}
{ITEM TAG:English}
${TOTAL PRICE}
{ORDER TAGS}

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

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






* {ORDER TAG NAME} ${ORDER TAG PRICE}

{ORDER TAG NAME} x {ORDER TAG QUANTITY} - ${ORDER TAG PRICE}

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

[ENTITIES:Customer]
– Customer entity format
Customer: {ENTITY NAME} | {ENTITY DATA:Phone}

[TAXES]
Tax Name: {TAX NAME}
Tax Amount: ${TAX AMOUNT}

Guys… I’m not sure what’s going on… but… its working now…

I decided to do the whole thing again… as per my first post…

I swear i did exactly the same thing yesterday at least 8 times… i even copy and paste so no mistakes was made… I placed the button on the navigation.

It’s suddenly working, the only thing that may have fixed it i can only assume was i did a reboot on the system last night… i guess doesn’t matter as long as its working…

So strange… but thanks all that responded… really appreciate how the sambapos community support works… you go to sleep… and you wake up with a ton of responses… cheers!

2 Likes