Task Editor - Separate KDS for Delivery

Hello - I am using the advanced delivery tutorial with Gloriafood. When I add a new delivery ticket there is a ticket tag called “Delivery” which is added. New tickets get the status “Delivery: Waiting” once they are confirmed.

I have a kitchen display screen with a task editor. Right now all orders are being pushed to it. However I want to seperate the screens into one with delivery and one without.

is it possible to use the “Custom data filter” option on the ticket editor to filter this way? If so could anyone help with the syntax.

Note: The ticket type for these tickets is “Delivery Ticket”, maybe we can filter that way?

What is the “Ticket Editor” ?

Which KD Tutorial did you follow?

It should be possible to filter by Custom Data, but we will need to SET some Custom Data in the first place. The KD Tasks are created through automation via Printing with the Task Printer. So we need to identify newly created Tasks and modify them to contain some Custom Data such as the Ticket Type. This would be done via JScript and GraphQL, because there is no Action for “Update Task” that we can use.

Sorry it’s “Task Editor” I failed to write, it’s late.

I setup my KDS like so: Kitchen/Bar Display using Task Printer - separate displays for Food and Drink [thanks by the way, awesome tut]

My tickets that I want to separate are incoming from Gloria Food via Emre’s test setup. These tickets already have a different ticket type (Delivery Ticket) and they also contain the following custom tag:

Source: Gloria

I was hoping to be able to add a filter to the Task Editor to show only tickets with the Delivery Ticket type of possible only tickets that contain that contain a ticket tag with Source: Gloria – is this possible?

I was able to make this work by modifying your KDS guide and creating new printer tasks which filter by ticket type. I still wonder if there is a cleaner solution.

One remaining issue - when my tasks come into delivery and go into the “waiting” queue they do not appear on my KDS. I have open and close the ticket to get them to appear. Any suggested solution for this?

That would be because the Tutorial waits for the Ticket Closing Event to change the Order KDStatus state.

You will need to find another Event or way to make that happen. I don’t know how the Gloria Food setup works so I can’t really offer any solid suggestions. The fact that the Tasks were appearing on the KDS before you modified the KD Setup suggests that you may have missed something.

I think so. And it has to do with your “Source” Ticket Tag. You should instead be able to modify your KD Printer Template to include that Tag as a Task Custom Field. As I mentioned in another Topic, you can silently create Custom Data fields in a Task without defining them in the Task Type.

So when it comes to the Template, if you have a section something like this:

[ORDERS]
++{ORDER DATE} {ORDER TIME} {ENTITY NAME:Table} {ENTITY NAME:Customer}
(Id={NAME}-{TICKET ID}-{ORDER UID})
(TID={TICKET ID})
(Color=#FF333333)
<bold>[=('{QUANTITY}'>1 ? ('{QUANTITY}'+'  ').substr(0,2) : '  ')] {PRODUCT NAME}</bold>
[='{PORTION}'=='' ? '' : '<font Consolas>  <color #FF55FF33><size 17><bold>{PORTION}</bold></size></color></font>']
{SORTED ORDER TAGS}

You can see these 3 things in there, which are Custom Fields:

(Id={NAME}-{TICKET ID}-{ORDER UID})
(TID={TICKET ID})
(Color=#FF333333)

Actually, Id and Color are “special” data fields, but TID is Custom and it isn’t even defined in the Task Type… but that doesn’t matter - it requires no definition So you should be able to add, for example:

(Id={NAME}-{TICKET ID}-{ORDER UID})
(TID={TICKET ID})
(Color=#FF333333)
(Source={TICKET TAG:Source})

That should populate a Task Custom Data field named “Source” with the content of your Ticket Tag (assuming your Ticket Tag Name is “Source”).

Now you should be able to use the Task Editor Widget to filter based on the Custom Data Field named “Source”.

Thanks! I have still trying to figure out a good way to trigger this. I am thinking on ticket creation would work but with a few constraints; if I can assure the ticket is an online ticket then it would be fine to push it to the KDS on a few constraints but my testing is failing.

Below is a sample ticket – it seems what is listed at the top (Source: Gloria) is a ticket state? Same with Delivery?

The code that creates those is:
var statePart = states:[ {stateName:"Status",state:"Unpaid"}, {stateName:"Source",state:"Gloria"}, {stateName:"Delivery",state:"${newCustomer ? 'Unconfirmed' : 'Waiting'}"} ],;
}

If that is the case would it be possible to use those as constraints in a rule? I tried but to no avail, please take a look maybe you can see my error? I tried to have it identify the state as a condition but it seems to fail.

Thank you for any help.

Tickets coming from gloria food integration script will not trigger ticket events. So you need to manually trigger Task Print Jobs. To demonstrate it I updated original script to execute additional print jobs.

https://forum.sambapos.com/t/integrators-graphql-api-guide/14047/8

Script configuration part contains a setting for additional print jobs to execute after creating the ticket.

You can add Task Printing Jobs (or any additional needed print job) here.

1 Like

@emre I have applied your modified script and added my KDS Print jobs to it but yet I still do not get them fired to my KDS screens. If I click the order in “Waiting” and assign a driver in the delivery screen it does push it but ideally I need it to happen automatically when the order comes in. Do you think there is something else I can try?

To clarify, I followed the proper formatting and added my print jobs:

var printJobName = 'Print Delivery Chit';
var additionalPrintJobs = ['Print Kitchen Display Task - Food','Print Kitchen Display Task -     Beverages','Print Kitchen Display Taks - Misc', 'Delivery Print Kitchen Display Task - Beverages','Print   Kitchen Display Task - Delivery Food'];  // array of additional print job names

Thank you,

@emre Any feedback would be great, I know you are super busy. I can confirm I run an updated copy of your script and it does not fire the print job. I made a new print job named test and I tested it inside sambapos, it prints to notepad. It works manually but if I set the GloriaFood script to fire Test it does not. It refuses to fire any print jobs. Everything else works properly.

This is a seemingly big issue for integrations as it does not allow us to get notified when a new ticket is created, since it won’t fire the rules associated nor a print task we have no way to be notified of a new order.

Please let us know how to resolve this, thanks so much.

Are you using the updated script from the link above? I don’t know what changed, but besides setting the array, you check these functions to be sure they are correct:

function printTicketToKitchen(ticketId, callback) {
    gql(getKitchenPrintScript(ticketId), (data) => {
        if (additionalPrintJobs && additionalPrintJobs.length > 0) {
            var scripts = additionalPrintJobs.map((x) => getAdditionalPrintScript(x, ticketId)).join('\r\n');
            gql(scripts, callback);
        } else callback(data);
    });
}

function getAdditionalPrintScript(name, ticketId) {
    var mName = name.split(' ').join('_');
    return `mutation m_${mName} {
                n_${mName}:executePrintJob(name: "${name}", ticketId: ${ticketId}) 
                {name}
            }`;
}

Also, your array does not look correct to me as your previous post. There are extra spaces in some of the Job Names, and one has a typo (“Taks” instead of “Task”), so you should probably double-check that too:

'Print Kitchen Display Task - Food'
'Print Kitchen Display Task -     Beverages'
                              ^^^^
'Print Kitchen Display Taks - Misc'
                       ^^^^
'Delivery Print Kitchen Display Task - Beverages'
'Print   Kitchen Display Task - Delivery Food'
       ^^

Yes, the formatting was weird on there but not the cause, for testing i also tried just a single print job name. In addition to the “Additional Print Jobs” not getting fired the primary print job listed in Emre’s script is not fired.

I tried a vanilla install with just some print jobs that fire to notepad, even those don’t get called via the script. It seems the print job functionality doesn’t work.

Are you able to get them to work?

I configured gloriafood and I have the same problem, it receives and the order is updated but the printing is not done. I can not find a guide to explain this.

Printing is handled by the GQL code in the script.

I have done a lot of tests, the configuration seems right but it does not print!

I did this test, restored the default database, I followed the step by step but not print, or better, from the passage from unconfirmed order to confirmed I print the document, once confirmed the customer the order is not printed automatically

Wow that is a long printjob name. It probably has nothing to do with it but try a single word naame?

already made this test but does not print, however I am doing tests with the default database and however I can not print. there is someone who has tried to verify that it is not just me. the order is printed only when it passes from unconfirmed to confirmed, with the client already confirmed I do not print anything.

That is how it was designed to work. If you want a different printing flow you will need to alter the code to make it print differently.

could it be that I’m working with a non-registered version of sambapos?