Day by Day Sales Report

I usually like to compare day sales between weeks or even months, lets say second saturday of every month… or all saturdays in a month…

that why I use this report… hope this is usefull!!!

Report:

[Ventas Dia a Dia:2,1, 1, 1, 1, 1]
>Fecha|Dia|Neto|Taxa|Desc|Total
@@VentasDiarias
>TOTAL||@@TotalVentasDiarias

SQL:

@@VentasDiarias:
SELECT 
  convert(nvarchar,T.Date,103) as Fecha,  
  min(datename(dw,Date)) as Dia,
  FORMAT(ISNULL(SUM(T.TotalAmount)-SUM(Cal.CalculationAmount),0),'C') as NetoTicket,
  FORMAT(SUM(case 
      when Cal.CalculationTypeId = 4 then Cal.CalculationAmount
	  else 0 end),'C') as Taxa,
  FORMAT(SUM(case 
      when Cal.CalculationTypeId = 1 then Cal.CalculationAmount 
	  else 0 end),'C') as Desconto,
  FORMAT(SUM(T.TotalAmount),'C') as TotalTicket

FROM Tickets AS T

LEFT OUTER JOIN Calculations as Cal on Cal.TicketId = T.Id

WHERE Date > '{Start}' AND Date < '{End}'

GROUP BY convert(nvarchar,T.Date,103)

ORDER BY min(T.Date)

and

@@TotalVentasDiarias:
SELECT 
  FORMAT(ISNULL(SUM(T.TotalAmount)-SUM(Cal.CalculationAmount),0),'C') as NetoTicket,
  FORMAT(SUM(case 
      when Cal.CalculationTypeId = 4 then Cal.CalculationAmount
	  else 0 end),'C') as Taxa,
  FORMAT(SUM(case 
      when Cal.CalculationTypeId = 1 then Cal.CalculationAmount 
	  else 0 end),'C') as Desconto,
  FORMAT(SUM(T.TotalAmount),'C') as TotalTicket

FROM Tickets AS T

LEFT OUTER JOIN Calculations as Cal on Cal.TicketId = T.Id

WHERE Date > '{Start}' AND Date < '{End}'

G.

3 Likes

dear @gerlandog,
Great job with the reports,I use it a lot :smile:
I have a small request for you :blush:
Is it possible to do the same Day by Day Sales Report but sort the data by work periods and not by date?
Thanks in advance.

1 Like

Thanks!!!

Let me see if I can… since I am not accessing work period data in that case… I think it will be difficult.

G.

1 Like

Thank you very much I hope you make it :wink: