Create ticket listing report

We have this query and how can we create a report in system based on this query.
Customer can select date range and the report will be displayed.

There may be a way to do this with existing reporting tags, but I’m not the best when it comes to that so we’ll roll with SQL.

I converted your query from the old way of joining.

You’ll need to add a script:

DECLARE @StartDate DATETIME = '{Start}';
DECLARE @EndDate DATETIME = '{End}';

SELECT t.TicketNumber,
       t.Date,
       p.Name AS PaymentType,
       p.Amount,
       t.LastModifiedUserName
    FROM dbo.Tickets            t
         LEFT JOIN dbo.Payments p
                ON p.TicketId = t.Id
    WHERE p.Date     >= @StartDate
          AND p.Date <= @EndDate
    ORDER BY t.Id;

Then add a report (play around with column widths to suit your display needs):

[Ticket Report:3, 5, 3, 3, 3]
@@TicketReport

Restart SambaPOS to reload the scripts and take a look at your report.

1 Like

I think the report I share below will meet your request.

[Payment Details: 1, 1, 1, 1, 1, 1, 1, 1]
>Table|T.Type|T.ID|Date|Time|User|Amunt|P.Type
{REPORT PAYMENT DETAILS:EN.Tables,T.TicketType,T.Id,T.Date,T.Time,P.User,P.Amount,P.Type: (TY=Ticket) OR (TY=Delivery) OR (TY=Pickup) OR (TY=Takeaway):{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}}
2 Likes
[Payments:1,1,1,1,1]
>Ticket No|Date|Payment Type|Amount|Last Modified By
{REPORT PAYMENT DETAILS:T.TicketNumber,T.Date,P.Name,P.Amount,T.LastModifiedUserName}

I asked the helper chat bot at Knowledge base and he created that report. He can write almost any report with the right questions.

1 Like

Thank you so much guys, all the above fulfill the client requirement. awesome.