Select GroupCode,MenuItemName,isnull(Sold,0) as Sold,isnull(Gift,0) as Gift,isnull(Void,0) as Void from
(select
M.GroupCode as GroupCode,
O.MenuItemName as MenuItemName,
O.Quantity as Quantity,
CASE
WHEN CalculatePrice = 0 and DecreaseInventory = 1 THEN 'Gift'
WHEN DecreaseInventory = 0 and CalculatePrice = 0 THEN 'Void'
Else 'Sold'
End as OrderType
from Orders as O
inner join MenuItems as M on M.Id = O.MenuItemId
where
MenuItemName = 'Ankara Döneri') as DataTable
PIVOT(
Sum(Quantity)
For OrderType
IN ([Sold],[Gift],[Void])
) as PivotTable
I have something like this, and it works well. But the problem is, this report gives the total amounts, mean from the first day of the DB to the current day. I need it to give current day report or week or month as we can select on reports screen.
Here is an image of the result of this report
EDIT: Sorry about wrong ss. This one is what i try to get here.