Custom report arranged by Ticket Tag

Continuing the discussion from Ticket List by Customer report:

Hi, I´m just getting to know SambaPOS and I’m amazed how customizable it is. I been trying to get some custom report to work after reading some post about it but my SQL knowledge is not really good.

I’m tagging the paid tickets with a number just before they are close and printed and I use this number as the invoice number, it is store as a ticket tag called FACTURA. I’m also tagging the ticket with the number of people making use of the entity: ADULTS and KIDS .

What I’m looking for is to have a custom report that is arrange by the ticket tag number used as invoice number called FACTURA, and contains the date, time, the customer(CLIENTE) name(Nombre),customer ID number(Cedula), ticket tag number of people(ADULTS,KIDS), Subtotal (Total without taxes(10%Servicios,12%IVA)), taxes (Tax templates (10%Servicios,12%IVA)), Total amount (Subtotal+Taxes) and payment type (Cash, Credit or Deposit).

At the end I also would like to have the total of ADULTS, KIDS, Subtotal, taxes(10% Servicios, 12%IVA) and Total amount.

Anyone can give me a hand with this if it is possible, I’ll really apreciate it! Thanks in advance.

Take a look here for Report Tags its simpler than pure SQL.


You can start with something like that.

>Date|Ticket No|Amount|Cash|Credit Card
PA.Credit Card;#.00;-#.00;-,}

PS: #.00;-#.00;- format string after PA.Cash and PA.Credit Card fields used to display zero payment amounts as “-” for more readability. You can try removing it if you want zeros instead.


Nice, thanks a lot for your help! I got it working, I would like to know what expression should I use when there is no value associated to show “-” instead, like the one that is used when the value is zero (#.00;-#.00;-)?

Also how do I get all the values from a column added at the end? Because I have Ticket Tag Values in the table that I would like to be added at the end like Number of persons grand total, and also I would like taxes and total amount grand total at the end.

You can format them as you want. Format syntax is…

<positive format>;<negative format>;<zero format>

So if you have #.00;-#.00;*zero* 0 value will appear as *zero*.

If you have a ticket tag named People you can add it into report by adding TT.Person field as…

[Tickets:1,1, 1,1, 1, 1]
>Date|Ticket No|Amount|Cash|Credit Card
PA.Credit Card}

Reading tutorials @Jesse linked will give more idea so once you get the idea you can create your own reports. SQL is needed for some advanced cases. Generally Custom Report tag syntax does the job fine.


Thanks for all the information!

I understood you can format it if the values are positive, negative and zero, but my question was what if there was no value (no zero, no positive, no negative), how to make a ¨-¨ be show also if there is no value associated. This can be caused when a ticket tag was not assigned in a ticket for some reason.

My other question was how to add all the values in each individual column and show them at the end like this:
(Can ticket tag values been add together at the end of the column as well?)

Thank you and have a great day!

This will work with 5.1.57 update

Hmm… I think I understand what you’re asking. I’ve created a person ticket tag and constructed my report as shown in the screen shot.

I’ve added two reports to demonstrate the difference. On first report you’ll see first ticket does not have a person value. On second report I’ve forced it to process as a number by using TTN (comes with .57). So empty values processed as 0 and it will obey your zero format.

Last line created to add totals.

Here is the report

>Date|Ticket No|Person|Amount
{REPORT TICKET DETAILS:T.Date,T.TicketNumber,TT.Person,T.TotalAmount}

[TICKETS2:1,1, 1, 1]
>Date|Ticket No|Person|Amount
{REPORT TICKET DETAILS:T.Date,T.TicketNumber,TTN.Person,T.TotalAmount}
>Totals||{REPORT TICKET DETAILS:TTN.Person.sum;0.##,T.TotalAmount.sum}

This is exactly what I been looking for! Thanks for the great software! Where can i get the last update? or when will it be released? Thanks a los for your help!

I have the following situation, following the example above I have created an average sales per person, of the following way:

[Promedio Ventas:1,1, 1, 1,1,1]
>Total Personas||{REPORT TICKET DETAILS:TTN.Personas.sum;0.##,T.TotalAmount.sum}

>Promedio||[=F(TN('{REPORT TICKET DETAILS:T.TotalAmount.sum }')/TN('{REPORT TICKET DETAILS:TTN.Personas.sum }'))]

>Fecha|Ticket No|Pers|Montos
{REPORT TICKET DETAILS:T.Date,T.TicketNumber,TT.Personas,T.TotalAmount}

Then: This type of average adds all sales and all ticket types from all departments.
What I specifically need is for me to average my customer ticket at the table, not for delivery customers.

How are you recording eat in and eat out.
You need to add a report constraint based on that factor.
What are you using? Ticket tag?

1 Like

Rob, while posting templates can you format your post properly to make it more readable? You can select code and click </> button to make it appear in a box.

1 Like

Im using Departaments for tracking sales example:
Restaurant: departament Restaurant
Delivery Departament Delivery

Adiotionally i use tickets type for different departaments, example:

Restautant: Ticket Type= Ticket
Delivery: Ticket Type=Delivery

Any suggestions?


Add ticket type constraint to report: TY=Ticket for just eat in;

[Promedio Ventas:1,1, 1, 1,1,1]
>Total Personas||{REPORT TICKET DETAILS:TTN.Personas.sum;0.##,T.TotalAmount.sum:(TY=Ticket)}

>Promedio||[=F(TN('{REPORT TICKET DETAILS:T.TotalAmount.sum:(TY=Ticket)}')/TN('{REPORT TICKET DETAILS:TTN.Personas.sum:(TY=Ticket)}'))]

>Fecha|Ticket No|Pers|Montos
{REPORT TICKET DETAILS:T.Date,T.TicketNumber,TT.Personas,T.TotalAmount:(TY=Ticket)}
1 Like

Still gettign total Amount

Thats not the report you showed before!..

One total is 828,161 and the other one is 882.600. It is hard to follow as I can’t understand the language. Can you explain it in more detail?

Anyway i still gettign sum of all my tickets: “Restaurant” and “Ticket para Llevar” (this second is delivery)

[Promedio Ventas:1,1, 1, 1,1,1]
>Total Personas||{REPORT TICKET DETAILS:TTN.Personas.sum;0.##,T.TotalAmount.sum:(TY=Restaurant)}

>Promedio||[=F(TN('{REPORT TICKET DETAILS:T.TotalAmount.sum:(TY=Restaurant)}')/TN('{REPORT TICKET DETAILS:TTN.Personas.sum:(TY=Restaurant)}'))]

>Fecha|Ticket No|Pers|Montos
{REPORT TICKET DETAILS:T.Date,T.TicketNumber,TT.Personas,T.TotalAmount:(TY=Restaurant)}

This is my actual code

So what are your ticket types??? Your jumping arround a bit.
TY is ticket type, your report doesnt show a Restaurant ticket type…

Just change the ticket type “Ticket” to “Restaurant”

Are you open? is sales figure changing? Show both reports from same time with no extra sales.