/*before running this script run the report from backoffice first to store the data to table itemsales*/
/*this query will find out variance between sales after tax/gross sales and collected*/
--1.run this script to group all item per salesno
SELECT salesno,splitno,
Sum(([ItemSales].[Quantity]*[ItemSales].[ItemAmount])*case when
([ItemSales].[TransMode]='REG') then 1 else -1 end *case when ((FunctionID)=26)
then 1 else 0 end...
