Using the Custom Report Module, What code do you write in the script section of automation command.
Currently I am using the code provided in the tutorial which is:
select
T.TicketNumber,
min(convert(nvarchar,T.Date,105)) as Date,
min(convert(nvarchar,T.Date,108)) as Time,
COALESCE(min(case when TE.EntityTypeId = 2 then TE.EntityName else null end),’-’) as [Table Name],
min(T.TotalAmount) as TotalAmount
from Tickets as T
left outer join TicketEntities as TE on TE.Ticket_Id = T.Id
Where Date > ‘{Start}’ and Date < ‘{End}’
group by T.TicketNumber
order by Date,Time
This code shows the Ticket Number, Date, Time, Table Name and Total Amount as individual transactions which is perfect.
So how do I show 3 extra fields which include: Cash Amount, Credit Amount, Department
To show payments you would need to join from the payments table based on ticket id HOWEVER this will result in duplicate ticket info if a ticket has multiple payments ie;
Ticket 1 - Ticket 1 info ticket 1 info - Cash Payment 1
Ticket 1 - Ticket 1 info ticket 1 info - Cash Payment 2
Ticket 1 - Ticket 1 info ticket 1 info - Card Payment 3
For department you have DepartmentId in tickets table so if you want that translated in to Department Name you would need to also SELECT D.[Name] from Departments table with JOIN [Departments] D ON T.[DepartmentId] = D.[Id]
Thanks Kendash for the alternative. I have been using Samba pos 4 for around a year now. I have always been able to find all the guides I need via the forum and programmed a lot of custom code into the pos system. Although because of time constraints for this particular project concerning the custom reports, I have requested help for the first time and I must say I am impressed by how fast you guys responded.
I will upgrading to version 5 shortly once I get the chance to test it
Wow that is perfect,but it doesn’t work for version 4.
I will upgrade in around 2 weeks to version 5. I have to figure out how to do in version 4 by tomorrow morning and then later I can use this code to produce the same result.
Normally I can figure these things out really easily but this time I got stuck so I had to come onto the forum as my last resort. I would appreciate any suggestions, thanks
Report tags are easier to use and much simpler as I demonstrated. For most cases they are just fine. SQL is much more flexible because it has endless possibilities constricted only by the SQL syntax. Report tags are coded by Emre to help solve most things without having to use long SQL code blocks.
I prefer Report Tags myself. In v5 Report Tags can be used for other clever things not just reports.
This explains most of the Report tags and their uses.
Thanks Kendash will check it out on my way to the office tomorrow.
I have another question regarding the report. If I save the report, it is saved as an XPS file. Is there a way to save it as an (excel file) instead? like the csv builder does?
Or can I add a link below the table, that says (export sales data) ?
Yes of course but when I save the report which is generated using the custom reports module. It saves as an XPS file. Which is similiar to a PDF format.
I wanted to know if it was possible to change the saving format to csv or to add a link below the report saying “export file” this would import the report as an csv rather than xps