Hello. This is not a real question. I’ll document some new report tags. While implementing them I’ve tried different options to build a nice syntax. It works fine but I’m not so happy with the syntax. So I’ve decided to release that as it is instead of deleting it and doing at from start I hope we can share some ideas for better syntax.
###New Tags
We have three new basic tags.
{REPORT TICKET DETAILS}: Lists tickets.
{REPORT TICKET TOTAL} Prints ticket’s total amount.
{REPORT TICKET COUNT} Prints ticket’s count.
Expanded syntax is
- {REPORT TICKET DETAILS:<custom entity fields>:<states>:<tags>:<expression>}
- {REPORT TICKET TOTAL:<expression>}
- {REPORT TICKET DETAILS:<expression>}
So if we need to include table numbers and customer phone numbers in ticket report tag becomes…
{REPORT TICKET DETAILS:Table.Name,Customer.Phone}
If I have a Waiter
Ticket Tag I can include Waiter Names to table as.
{REPORT TICKET DETAILS:Table.Name,Customer.Phone::Waiter}
Please note I’ve added double semi colons before waiter to skip States
section.
Expressions are useful to filter reports. I’ll give expression samples for Total and Count tags but they will work for Details tag too.
Total of Paid Tickets.
{REPORT TICKET TOTAL:(TS Status=Paid)}
(TS Status=Paid)
part is an expression to filter by (T)icket (S)tate. If used with Details tag it lists only paid tickets. We can use few expression operators. For example
{REPORT TICKET TOTAL:(TS Status=Paid) or (TS Status=Unpaid)}
To get Paid Ticket Counts by Waiter Emre Eren we can write it as
{REPORT TICKET COUNT:(TS Status=Paid) and (TT Waiter=Emre Eren)}
TT stands for (T)icket (T)ag.
###New Syntax for Parameters
Check this Sample
[Ticket Totals by State:1, 1]
Unpaid|{REPORT TICKET TOTAL:(TS Status=Unpaid)}
Paid|{REPORT TICKET TOTAL:(TS Status=Paid)}
Unpaid
and Paid
words are hardcoded so I need to add a new line for all states I need to list. Instead of listing all lines we can define a parameter list.
[Ticket Totals by State:1, 1]
@Unpaid,Paid
$1|{REPORT TICKET TOTAL:(TS Status=$1)}
The list I create after @
char will create a new line by using line(s) after parameter list as a template. If a line contains $1
we assume it as a template and $1(s)
replaces with parameter.
So to add a new state to my list I need to add a new parameter to parameter list. For example I want to add Locked
tickets.
[Ticket Totals by State:1, 1]
@Unpaid,Paid,Locked
$1|{REPORT TICKET TOTAL:(TS Status=$1)}
One nice feature is I can fetch a parameter list with SQL tags so it becomes totally dynamic.
[Ticket Totals by State:1, 1]
@ @@GetTicketStatuses
$1|{REPORT TICKET TOTAL:(TS Status=$1)}
I need to add a space between parameter list identifier and sql tag.
Feel free to ask questions or share your ideas.