In this tutorial I’ll show you how to create a deliverer entity, entity screen and close all open deliverer tickets with one automation command.
##Creating Deliverer Entity Type
First I’ll create Deliverer Entity Type
I don’t need custom fields for deliverer on this tutorial. If you need you can add additional info for deliverers from “Custom Fields” section.
I’ll create an Entity Screen to Choose deliverers.
View mode is search so I can search for deliverers by typing their names. If you need you can choose “Select Entity” to generate buttons for entities.
From Entity List page I’m choosing Entity Type for this screen as “Deliverers”. If you are creating “Select Entity” screen you’ll add entities that will appear on screen by clicking “Select Entities” Link.
Finally I’ll map this screen to all departments.
So when you click on “POS” you should see “Search Deliverers” Button
Click “New Deliverer” button and add some deliverers.
Finally we need to map Deliverer entity type to a Ticket Type so we can assign deliverers to Tickets.
Click Tickets > Ticket Types > Ticket > Entity Type List and add Deliverers Entity type to the list. Now you can assign deliverers to tickets.
Switch to “Search Deliverers” Screen and assign 3 tickets to a deliverer you’ve recently created.
Type few words to find Jet Li and Click “Select Deliverer” button to create a ticket.
Deliverer becomes Jet Li. Add few items and click close.
On real life we should start creating a ticket by choosing a customer and assign deliverer as we are ready to deliver the order. On this tutorial we only need few tickets assigned to deliverers so I’ll skip customer selection. For more information you can read “Custom Package Delivery” samples on http://sambapos.org/wiki/doku.php/p?id=en/p
When you search Jet Li again and click “Select Deliverer” you’ll see previously created ticket. To create a new ticket for Jet Li, click “Add Ticket” button.
After creating second ticket click Close. Now we assigned two tickets to Jet Li. So when we select Jet Li again through Search Deliverer screen we’ll see a Ticket List.
##Closing all deliverer tickets
Jet Li is a fast deliverer so we need a button on ticket list to close all tickets assigned to him.
We’ll start by creating an automation command.
…and map it to Ticket List
If you want you can also map it to a specific user role so only managers can use this button.
When we click on button we should loop through all listed tickets and settle them one by one. So we need a looper action.
The Name parameter is important. If we don’t name it properly it can conflict with other loopers we might have. Copy it to clipboard since we’ll need it. We’ll pass “Ticket Ids” parameter from automation command.
Now we need to create a rule to handle “All Cash” button.
When we click on “All Cash” button we’ll execute looper action. We’re passing ticket Id’s by using Command Value parameters. Since this automation command is mapped to a “Ticket List” it contains all needed ticket Id’s listed (or selected) on screen.
Don’t forget to add a default mapping to the rule
Now we’ll create actions to load and automatically pay tickets.
We need a pay ticket action
… and a Load Ticket action.
Looper action executes “Value Looped” event so we can load, pay and close tickets. On final step we’ll handle this by creating a rule.
We’ll create a constraint to check if looper name equals to the looper we recently created. Check Loop Deliverer Tickets action if you forgot how you’ve named it.
We’ll execute three actions:
- Load Ticket: Loads ticket to memory. We’ll assign this parameter to Loop Value as shown in the screen shot. You should be able to choose it from drop down menu.
- Pay Ticket with cash: It pays ticket that loaded into the memory. No parameters needed.
- Close Ticket: It closes loaded ticket. This action should already exists and no parameters needed.
Finally create default mapping for the rule.
Now let’s see what we have. Call Jet Li again.
Now you can see new created button here. Clicking it will close all listed tickets with cash.
PS: I’ve noticed we have a little problem with button labeling here. That will work fine on next update.