KDS Portion sorting / counter

Hello, I’m using task editor KDS and i’m trying to either sort the Pizzas by portion size or add a portion counter besides the group line.

Here is the current template:

[LAYOUT]

++{TICKET TYPE}
<size 22>{ENTITY NAME:Table}
<size 15>Pzs: {TICKET TAG:PIZZANO}

WAIT: {TICKET TAG:Wait Time}
COLLECTION: {TICKET TAG:Collection Time}

{ORDERS}


{TIME}

[ORDERS GROUP|PRODUCT GROUP]
<size 14>[=‘~~~ {GROUP KEY} ~~~~~~~~~~~~’.substr(0,40)]

[ORDERS]
<size 16>[=(‘{QUANTITY}’+’ ‘).substr(0,2)] {PRODUCT NAME} [=’{PORTION}‘==‘12 inch (Regular Size)’ ? ‘<color #43c109><size 14>{PORTION}’ : ‘’][=’{PORTION}'==‘9 inch (Small Size)’ ? ‘ <color #Adec91><size 14>{PORTION}’ : ‘’]

{SORTED ORDER TAGS}

[ORDERS:PRODUCT TAG:White Pizza=Yes]
<size 16>[=(‘{QUANTITY}’+’ ‘).substr(0,2)] {PRODUCT NAME}[=’{PORTION}‘==‘12 inch (Regular Size)’ ? ‘<color #43c109><size 14>{PORTION}’ : ‘’][=’{PORTION}'==‘9 inch (Small Size)’ ? ‘ <color #Adec91><size 14>{PORTION}’ : ‘’]
{SORTED ORDER TAGS}

[SORTED ORDER TAGS:Calzone Option]
<size 20>[=(‘{ORDER TAG QUANTITY}’>1 ? {ORDER TAG QUANTITY} : ’ ')] {ORDER TAG NAME}

{ORDER TAGS}

[ORDER TAGS]

  • {ORDER TAG QUANTITY} {ORDER TAG NAME}

[TICKET TAGS]
{TICKET TAG NAME}
<size 20>Table:{ENTITY NAME:Table}

[ORDERS:Gift]
<size 16>[=(‘{QUANTITY}’+’ ‘).substr(0,2)] {PRODUCT NAME}[=’{PORTION}‘==’’ ? ‘’ : ‘ <color #FF55FF33><size 14>{PORTION}’] FREE
{SORTED ORDER TAGS}

[ORDERS:Void]
<size 20>[=(‘{QUANTITY}’+’ ‘).substr(0,2)] {PRODUCT NAME}[=’{PORTION}‘==’’ ? ‘’ : ‘ <size 14>{PORTION}’] VOID
{SORTED ORDER TAGS}

by adding this line:

REG: {REPORT ORDER DETAILS:O.Quantity.Sum.desc:(ODI=True) and (MG=PIZZA) and O.PortionName=“12 inch (Regular Size)” } / SML: {REPORT ORDER DETAILS:O.Quantity.Sum.desc:(ODI=True) and (MG=PIZZA) and O.PortionName=“9 inch (Small Size)” }

it does return the total portions but for the whole work period, I tried to add something like:

and T.Id={TICKET ID}

to constrain it to the current ticket but it returns nothing.

here a mockup of what I need:

KDS Order

I feel i’m so close but cannot find the solution, if anyone can help would be greatly appreciated.