Sales Per Hour Report

I personally do not go by every hour instead I use a breakfast time, Lunch Time, Dinner Time. I have it setup to tag the orders based on time of day.

[Sales:1, 1]
$1|[${REPORT TICKET DETAILS:([T.TotalAmount]).Sum:(TT.Service=$1)}]

[Percent Sales:1, 1]
$1|[=F({REPORT TICKET TOTAL:(TT.Service=$1)} / {REPORT TICKET TOTAL:(TT=Service)})*100]

So you tag the ticket based on ticket created time?
When I get to this would like to maybe try tagging on order level on hour basis as above as would be handy for their manager to better see peak times of the day and ensure sufficient staff on duty etc.

why order level? Its a ticket tag so you onle need to tag once .

As the aim would see when the busy times are, as sometime tickets - especially might be open customer bar tabs might be open all day or over lunch & dinner.
Would I be right to say that with ticket tag the whole ticket value would go to the time that the ticket was opened?
Say if someone came in at 12 and started a tab with drinks, wife came in at 4 - they both had food and stayed for few more drinks till say 6 or 8, their bill could easily be over £100. If im right to say the value would be tagged as ticket start time this would be £100+ at 12noon.
Does that make sense?

The exemple that i posted here is not from sambapos. I saw it on a friend pos and I’m trying to make this report on custom reports.
Sql or tags report it does not matter.
Can you please help me out?

There is a post with a few reports here, not had much practice with reports;

Ok that makes sense JTRTech. My method works but the issue with the report your looking for it would require a LOT of tags and doesnt seem realistic. It might be better to just build it with SQL. @emre has provided examples many times let me see if I can find one.

Please, is Joe :smile:
Its not important at this time, have more general work to do before looking too heavily at custom reports.
My samba development has had to go on back burner as have allot on at the minute. Was just a curiosity…

1 Like

@pizzaeilat4 do you want the report to look exactly like the one you showed sales per every hour? Or do you want it broken down to specific blocks of time like I did with Breakfast, Lunch, Dinner?

Thank you so much.
I like it to be Exactly the same if possible.
Also will it work on v4? Or only on v5?

You can use SQL in either version. I am pretty sure @gerlandog has put sample report showing Tickets Per Hour with sales.

I serched but could not find any

Was this the one? Is by gerlandog…

Thats it, you can customize that one to do what you want it shows the gist of how to build the sql.

For next version I’ve added Format Time (FT) function support to V5 reports so you can create something like that.

[ORDERS:1, 1, 1,1]
>Time|Order Count|Total|Percent
{REPORT ORDER DETAILS:FT([O.Time],'hh'),O.Id.Count,O.Total.Sum,O.Total.Percent}


This is great emre thanks.
I’m trying to help a friend, is there any way we can have this kind of report on v4?

SQL is the only way to create that report in v4. It is a good report. I will put something together.

1 Like

Thanks @QMcKay
I will be waiting

Need to get learning some sql, can’t believe you get a report like that from such a short bit of code. :slight_smile:

This won’t be “short” in SQL.

I need to step out until tomorrow, but I started some code - saving it here until later…

declare @Start datetime = '2015-01-10T00:00:00.000'
declare @End datetime = '2015-01-10T23:59:59.000'
declare @Hour int = 0

declare @tbl_Sales table
   ,[Hour] varchar(5)
   ,[Amount] money

WHILE @Hour < 24
    INSERT INTO @tbl_Sales
      @Hour as [Hour]
    , SUM(CASE WHEN (DATEPART(hour,[Date])>=@Hour AND DATEPART(hour,[Date])<@Hour+1)
               THEN [TotalAmount]
               ELSE 0 END) as [Amount]
    FROM [dbo].[Tickets]
    WHERE [Date]>=@Start AND [Date]<=@End
SET @Hour = @Hour + 1

SELECT [Hour], [Amount] FROM @tbl_Sales