Need some advice regarding Custom Reports

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 :slight_smile: 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.

Dear @Emre, I am trying to understand this. So far I managed to report tickets, with status, and tags!!! Great…

I do have calculations on tickets like discounts and my famous Taxa Serviço. I havent been able to guess how to include those with the ticket data.

could you help me out?
I tried: {REPORT TICKET DETAILS:Tables Pizzaria.Name:Calculations.Taxa Serviço}

THANKS!!!

G.

Is your calculation a State?

@gerlandog as I find a nice syntax I’d like to add calculations, payments, department info etc… but I’m still working on finding a better syntax.

Maybe it can be

{REPORT TICKET DETAILS:EF.Customer.Phone,TT.Waiter,TS.Status:<expresssion>}

How it looks?

:exclamation: This is just an idea. Not working.

I like simple expressions like:

EF:Customer.Phone,Customer.Name TT:Waiter,Persons EX:(TT Waiter=Gerlando) AND (TS Status=Unpaid)

NOTE: between Name and TT there is a SPACE so you can parse the string… and that way order would not matter…

Could that help you?

Thanks!!!

G.

what happend with this?
G.

I’ve decided to implement my idea

{REPORT TICKET DETAILS:EF.Customer.Phone,TT.Waiter,TS.Status:<expresssion>}

This method allows us to use fields in mixed order such as

{REPORT TICKET DETAILS:EF.Customer.Phone,TT.Waiter,EF.Table.Name:<expresssion>}

I’ve used Two EF fields and a Ticket Tag between them.

I’ll post more details about it after next release.

2 Likes