SELECT h.STOKKODU,S.MUHASEBEKODU 'Grup',S.STOKADI 'StokAdý',H.TARIH AS 'ÝslemTarih',
ROUND((H.ADET), +4) 'AlisAdet',h.E_CIKAN AS 'CikanAdet',(H.ADET-H.E_CIKAN) AS 'KalanAdet',ROUND((H.FIYAT), +3) 'AlisBirimFiyat',ROUND((H.TUTAR), +3) 'AlisTutar',
ROUND((H.ADET-H.E_CIKAN)*(H.FIYAT), +3) AS 'AlisFiyatKalanTutar',
S.SFIYAT as 'SonFiyat',ROUND((H.ADET-H.E_CIKAN)*(S.SFIYAT), +3) AS 'SonAlisFiyatKalanTutar'
/*ROUND(SUM(H.ADET), +4) 'AlisAdet',ROUND(SUM(H.FIYAT), +3) 'BirimFiyat',ROUND(SUM(H.TUTAR), +3) 'AlisTutar'*/

FROM STOKHAREKET  H
JOIN STOK S ON S.STOKKODU=H.STOKKODU 
where (ADET<>E_CIKAN) and (h.DURUM='GIRIS')

/*GROUP BY h.STOKKODU,S.MUHASEBEKODU,S.STOKADI*/

ORDER BY 1 ASC