Printing Tutorial in Detail

Hello. In this tutorial I’ll show you how printing works and how to configure it for most common cases.

#How it works?

In this section I’ll show you how SambaPOS printing system works.

##Printers

These are the printers that are used on your system. To configure your printer start by adding a printer here. For this example I’ll add a Bar Printer

Enter a name for your printer and select your printer from drop down list. If it is a network printer you can also type it’s network name here.

###Printer Types

  • Ticket Printer: Native printing for ESC/POS compatible thermal or dot matrix printers. If lines starts with unexpected characters be sure your printer supports ESC/POS emulation and it is enabled. Some driver or hardware issues can also cause that. Try with different printer to ensure.
  • Text: Just prints plain text. All formatting tags skipped.
  • HTML: Select this printer type for postscript (graphical) printing. If your printer is not ESC/POS compatible (inkjet, laser) or you need to print in mixed languages you can try using this printer type.
  • Port Printer: This printer directly sends data to serial port. This printer type is useful for configuring LCD customer displays or similar devices that you can send data through serial port. In this case you should enter PORT name to Printer Share Name / Port Name area.
  • Demo Printer: This printer type sends printing content to notepad. Very useful to test printouts without wasting paper. Enter a dummy Printer Share Name as . or something similar not to leave it empty. Open Notepad application and send prints to see how it appears.
  • Windows Printer: This printer type shows regular windows print dialog to let you choose a printer.
  • Raw Printer: Use this printer type if you need to configure a printer that supports a unique command set. Useful for programming Barcode Printers or Card Printers.
  • Custom Printer Some Samba Market add-ons installs custom printers. For example Url Printer module adds a custom printer to let you send a printer output to a web service. For example you can prepare a printer template to send SMS messages to customers through SMS webservices. There is also a pre-installed custom printer that prints output to text files.

Other Settings

  • Character Set: If your printer is ESC/POS compatible and you selected Ticket Printer type enter your printers language code here to support printing language specific characters.
  • RTL Support: Some ESC/POS compatible printers does not support RTL printing. In this case you can try fixing printer output by using this setting.
  • Line Count: This setting is useful for configuring Customer LCD Displays. If you enter 2 here it printer will print only last two lines of the output.
  • Line Character Count: Enter how many characters per line your printer supports.
  • Char Replacement: If your printer does not support language specific characters you can replace them by using this setting. For example ß=ss will print ss instead of ß character.

##Printer Templates
After adding our bar printer we’ll see how Printer Templates works. Printer Templates used to configure how printouts appears.

On first install we should have three pre-installed printer templates. Ticket Template is used to configure output for printing Bills and Kitchen Orders Template is used for configuring the printouts for that we send to Kitchen to inform kitchen staff for new orders. Let’s say I also have a Bar Printer and I need to configure a printer template for Bar Orders. First we need to talk about some printing features.

###Replacement Tags
Basically printer templates configured as Text files. If you just enter Hello in your printer template and print it, it prints Hello. Of course we need more features than just printing hello. We use replacement tags to configure where specific data will appear. For example if your printer template is Hello {TICKET DATE} SambaPOS will replace {TICKET DATE} tag with the date of the ticket you’re printing and you’ll see something like Hello 1.1.2014

There are two types of Replacement Tags.

  1. Printing Tags. A printing tag replaces with a dynamic data. For example {TICKET DATE} replaces with the date of the ticket, {TICKET TOTAL} replaces with the total amount of the ticket or {ENTITY NAME:Customer} tag replaces with the Customer Name. You can find a list of all supported tags at the right side of the screen.

  2. Section Tags. A section tag appears in Blue color and that tag replaces with a section’s content.

We have [ORDERS] section in our template. Lines under this section defines how a single order line appears in ticket output. SambaPOS will format each order line by using this format and replace whole printout with {ORDERS} section tag. You’ll notice [ORDERS] section contains another section tag called {ORDER TAGS}. That means SambaPOS will format each Order Tag that assigned to an order by using [ORDER TAGS] template and replace output with {ORDER TAGS } tag. You can also configure specific formats for specific order lines. For example [ORDERS:Gift] section defines output for Gift Orders. Or [ORDERS:Void] section used for orders that have Void state.

You can read more info about formatting your printouts.

For this sample I’ve prepared a Bar Orders Template and only change header to make them appear from different from other printouts. I’ll use this template to send bar orders to bar printer.

##Print Jobs

I have two pre-configured print jobs. Print Bill job works when I hit Print button inside a ticket and Print Orders to Kitchen Printer works automatically when I add new orders to a ticket and close ticket.

Before continuing I want to show you how these two Print Jobs triggers. Understanding it will be very useful to be able to customize it for your needs.

###Print Bill

That one is simple. When I hit Print Bill button it sends bill to printer.

This button appears there because of this Automation Command configuration.

When we check how it mapped we’ll see that button configured to appear in ticket and payment screens.

It is always visible but only enabled when ticket state is one of New Orders, Unpaid or Closed. As you know when we print a bill Ticket’s state changes to Locked so Print Bill button becomes disabled until I unlock ticket (change ticket state to Unpaid)

OK. That’s nice but how it prints when I click Print Bill button?

Print Bill Rule controls this. Edit Print Bill Rule to see what happens when I click that button.

  1. It executes Execute Bill Print Job action.
  2. Locks ticket
  3. It updates table state to appear it as Maroon color.
  4. Updates ticket’s state as Locked
  5. Closes Ticket.

So for example if you don’t want to close ticket when you click Print Bill button you can just remove it from actions list.

So Execute Print Bill Action action starts printing. Let’s see how this action configured.

Nothing special here. It just starts printing by using “Print Bill” job.

So we can see how Print Bill Job is configured.

This configuration tells SambaPOS Print Bill Job sends output to Ticket Printer by using Ticket Template.

In summary when we click on Print Bill button.

  1. Print Bill Automation Command executes.
  2. Print Bill Rule handles it and starts Execute Print Bill Job action.
  3. Execute Print Bill Job action starts printing by using Print Bill Print Job.
  4. Print Bill Print Job formats output by using Ticket Template and sends it to Ticket Printer

##Printing to Kitchen.

That one uses same mechanism but it works automatically without the need of printing a button. Ticket Closing Rule controls it.

When we close a ticket Ticket Closing Rule works and …

  1. Executes Kitchen Orders Print Job
  2. Updates Ticket status as Unpaid.
  3. Updates Orders statuses as Submitted

So how SambaPOS knows which orders should be printed to Kitchen? When we add a new order to a ticket that order’s status becomes New

Let’s see how Execute Kitchen Orders Print Job action configured.

This action configured slightly differently from Execute Print Bill Job action. It configured to filter only New orders. If there are no New orders it prints nothing.

After printing Ticket Closing Rule executes Update Order Status rule to change New orders statuses to Submitted. That’s why these lines does not prints again.

Let’s see what will happen when I Void an already printed order.

Void command changes order state back to New so that line prints again to Kitchen Printer to inform Kitchen staff that previously printed order voided.

Now we can configure Bar items to print from Bar printer.

Configuring Bar Items

We know all new orders sends to kitchen printer by using Print Orders to Kitchen Printer Print Job. I can change this job to map beverages to Bar Printer

I’ve added a new mapping line and mapped Beverages to Bar Printer. It will also use Bar Orders Template. That means if a product is a beverage it will be sent to Bar Printer. Everything else to Kitchen Printer

I’ll continue adding more tutorials to answer some common questions.

7 Likes

##How to automatically print bill after payment received?

We can use Payment Processed rule to execute print bills automatically.

… and we should add default mapping.

3 Likes

##How to use department specific printer templates for print bills

For this sample I’ve created a Take Away ticket type and Take Away department.

Also I’ve created a separate Printer Template for Take Away department.

We need to have separate print jobs for each department. I’ll right click on Print Bill job and clone a new template.

I’ll clone Execute Print Bill Job action and change it for new Print Job.

I’ll clone Automation Command

… and map it to Take Away department.

Also I need to map current Print Bill Automation Command to Restaurant department.

Finally I’ll clone Print Bill rule for new Automation Command.

I need to Replace Execute Bill Print Job with Execute Take Away Print Bill Job and change constraint to work when Take Away Print Bill button clicked.

6 Likes

@emre
how to make print bill size text smaller on specify part and bold
example for Tax i need it decrees font size and No tax products bold
like eggs. coz no tax for

Try here @shuhain_ismail

1 Like

Emre,
Apologies if these questions have been answered in the tutorial but I couldn’t find the answers.

Is there a way to use a different printer template on the print job “Print Orders to Kitchen Printer” depending on the department such as

If department==“Restaurant” then
“use the restaurant template”
else if department==“Take Away” then
"ise the Take Away template
end if ?

I can see different product groups or individual products can be filtered but not departments. Also if there are 2 mappings does matching the first end the print job. In the example there are 2 mappings, to separate the beverages to the bar from the kitchen BUT the second mapping contains the first so does it print to both printers?

Regards

Mike

You can map whatever template you want to whatever department you want. You can name and rename templates to whatever you want as well even the built in examples can be renamed.

Kendash,
Thanks for the reply. I want to print, using different templates, to the kitchen printer. In the example below (taken from the bar printer example above) the print job mappings doesn’t have the department as option.

Regards

Mike

You don’t map department by the job you map it via the action that calls that Job.

Kendash,
I am always pleasantly surprised by the speed of replies on this forum.

I did think of that before but the print to kitchen is ‘fired’ by the clicking on the ‘Close’ button.
The sequence order is that the ‘Before ticket close’ rule is fired and this calls the ‘Execute Kitchen orders print job’ I couldn’t see a way of calling different rules from the action fired by the ‘Close’ button.

Regards

Mike

You can make two before closing rules map them to specific departments and they will only fire if that department is found. The built in rules and actions are not set in stone. Matter of fact there is no difference in them and any you make yourself. They are there simply so people have an easy start with samba. Imagine if he did not include a basic sample setup. Most people would think its broken.

Kendash,
Many thanks, with your help I think I have done it. For anyone else I have outlined what I did.

SETTINGS section

  1. Clone the original ‘Kitchen printer windows’ in the Printer Templates section and name it ‘TA Kitchen printer windows

  2. Modify the printer template as required (I added a big TAKE AWAY to the top, added several blank lines so that it is visible on the magnetic ticket holder and added the customer name)

  3. Clone the original ‘Print Orders to Kitchen Printer’ in the ‘Print Jobs’ section and change its name to ‘TA Print Orders to Kitchen Printer

  4. modify the template used to that in step 1) above.

AUTOMATIONS section
5) In the ‘Actions’ section clone the ‘Execute Kitchen Orders Print Job’ and name it ‘TA Execute Kitchen Orders Print Job
6) Change the ‘Print Job Name’ to ‘TA Print Orders to Kitchen Printer’ (defined in step 3) above)

  1. In the ‘Rules’ section clone the original ‘Ticket Closing Rule’ and call it ‘TA Ticket Closing Rule
  2. Click on ‘Select Actions’ and delete the ‘Execute Kitchen Orders Print Job’ and add the and ‘TA Execute Kitchen Orders Print Job
    NB make sure that the ‘TA Execute Kitchen Orders Print Job’ is placed at the top of the list by dragging it up the order.
  3. map this new rule to the ‘TakeAway’ department. (NB change the original rule to use the ‘Restaurant’ department).

I hope this helps.

Regards

Mike

3 Likes

Great solution I am sure others will benefit thanks for sharing.

Kendash,
Unfortunately something has broken with this implementation. The close button on the takeaway order is no longer working and hence doesn’t print to the kitchen. At the moment we have to use the settle button from the takeaway screen and print the bill which seems to kick the process into action.

Looking at the scripts for the Ticket Closing Rules they are almost identical except for thier names

Ticket Closing Rule compared to TA Ticket Closing Rule
it has the following Actions selected
Execute Kitchen Orders Print Job compared to TA Execute Kitchen Orders Print Job and the mappings Restaurant department compared to Take Away.

Could it be that the actions Update Ticket Status and Update Order Status in the first rule are interfering and changing the status of the ticket and order? I was going to reverse the order of the rules in the Ticket Closing section but can’t see how to sort just these two. Should I remove the Update Ticket Status and Update Order Status from BOTH rules and have a third rule that does this only ?

I thought that I was getting the logic behind the order of actions until this road block. Any help / guidance is much appreciated.

Regards from Melbourne

Mike

Help, I have broken something within the rules. Before I started to change things I had 2 sections (with entity screens) Restaurant and Take Away and when I clicked on the button it opened the screen. However, since making some changes I have obviously made a mistake and can’t seem to undo what I have done. When I click on the take away I now get the screen below:


rather than the entity screen.

Does this mean that there is a ticket still needing to be closed ? If so it doesn’t appear in the tickets open or not. I am getting myself in a mess here and stupidly I have been working on the laptop and hadn’t realised that all the rules were stored in the SQL so it is updating the live version! Is there a way to selectively import the default rules so that I can check? That is what comes of having a quiet night and tinkering!

Regards

Mike

You probably messed with mapping and got it unmapped. Check the settings of your departments and ensure the Entity Screens are mapped to the right department. I recommend doing your testing and tinkering on a different database. If using SQL Express you can simply go to your connection string in Settings > Local Settings and change the Database Name to something else and it will load a fresh new database to play with. When your done tinkering just put the name of your previous database in the Connection String and it will load it right back up. You can easily swap between the two databases this way.

Hint: The new database will have all of the default sample data.

@michaeal_linahan

gsreddy,
Thanks, that was it. I don’t know how I changed that but… all’s well that ends well as my dear old mum used to say.

Mike

kendash,
I quite agree and actually thought I was but I had my lap top version pointed to the sql server and so was modifying the ‘working copy’.

I may have to think about how I will do this in the future but atleast I have purchased the database tools so can backup and restore easier.

Regards

Mike

You point it to the SQL server just you tell it a different db name. SQL server can run multiple databases.