SELECT dateadd(day, datediff(day, 0, A.PTARIH), 0) 'Tarih',UG.ADI 'Grup',SUM(S.TUTAR) 'Tutar'
FROM A_Adisyon  A
JOIN A_AdsSatir S ON S.FISID=A.ID
JOIN URUN     U ON U.KODU=S.URUNKODU
JOIN UGRUP    UG ON U.GRUP=UG.KODU
--WHERE ( (@TUMLISTE = 1) OR (A.TARIH BETWEEN @T1 AND @T2) )
GROUP BY dateadd(day, datediff(day, 0, A.PTARIH), 0),UG.ADI 
UNION
SELECT dateadd(day, datediff(day, 0, SIPARISTARIHI), 0),'_Günlük Toplam',SUM(TUTAR)
FROM A_AdsSatir 
GROUP BY dateadd(day, datediff(day, 0, SIPARISTARIHI), 0)
ORDER BY 1,2 ASC
