SELECT STOKGRUP.KODU AS GRUPKODU,STOKGRUP.ADI AS GRUPADI,TBL.SKODU,SUBELER.SUBEADI,DEPO.DEPOID AS DEPOID,DEPO.DEPOADI AS DEPOAD,TBL.STOKID, TBL.STOKKODU, TBL.ADI,MAX(STOK.BIRIM) AS BIRIM,  SUM(TBL.GADET) AS GADET, SUM(TBL.CADET) AS CADET, SUM(TBL.KALANADET) AS KALANADET,   SUM(TBL.KALANTUTARSALIS) AS KALANTUTARSONALIS ,  SUM(TBL.KALANTUTARBFIYAT) AS KALANTUTARORTBIRIMFIYAT,   SUM(TBL.KALANADET*SFIYAT1) AS KALANTUTARSATISFIYAT  FROM           (SELECT TARIH, SKODU,DEPOID,STOKID, STOKKODU, ADI, SUM(CASE WHEN GCADET > 0 THEN GCADET ELSE 0 END) AS GADET,                                                   SUM(CASE WHEN GCADET < 0 THEN GCADET ELSE 0 END) AS CADET,   SUM(GCADET) AS KALANADET,   MAX(SALISFIYAT) * SUM(GCADET) AS KALANTUTARSALIS,  AVG(BFIYAT) * SUM(GCADET) AS KALANTUTARBFIYAT  FROM    STOKISL WHERE 1=1 GROUP BY TARIH,SKODU,   DEPOID,STOKID, STOKISL.ADI, STOKKODU) AS TBL  INNER JOIN  STOK ON TBL.STOKID=STOK.STOKID  LEFT OUTER JOIN STOKGRUP ON STOK.GRUP COLLATE TURKISH_CI_AS=STOKGRUP.KODU COLLATE TURKISH_CI_AS INNER JOIN DEPO ON TBL.DEPOID=DEPO.DEPOID LEFT OUTER JOIN SUBELER ON TBL.SKODU COLLATE TURKISH_CI_AS=SUBELER.SUBEKODU COLLATE TURKISH_CI_AS GROUP BY   STOKGRUP.KODU ,STOKGRUP.ADI,  TBL.SKODU,SUBELER.SUBEADI,  DEPO.DEPOID,DEPOADI,  STOKGRUP.KODU ,  STOKGRUP.ADI ,  TBL.STOKID, TBL.STOKKODU, TBL.ADI   ORDER BY TBL.SKODU,DEPOAD,STOKKODU  
Elektra
                                                                                                                                                                                                             Tarih       : [BUGUN   ]
                                                                                                                                                                                                             Saat        :   [BUSAAT]
                                                                                     TARİH ARALIKLI STOK DEĞER BAKİYE RAPORU


  GRUPKODU     GRUPADI      SUBEKODU     SUBEADI      DEPOADI                STOKKODU     ADI                         BIRIM    GADET      CADET      KALANADET    KALANTUTARSONALIS    KALANTUTARORTBIRIMFIYAT    KALANTUTARSATISFIYAT     
  ------------ ------------ ------------ ------------ ---------------------- ------------ --------------------------- -------- ---------- ---------- ------------ -------------------- -------------------------- -----------------------
{ [GRUPKODU  ] [GRUPADI   ] [SKODU     ] [SUBEADI   ] [DEPOAD              ] [STOKKODU  ] [ADI                      ] [BIRIM ] [$GADET:N] [$CADET:N] [$KALANADET] [$KALANTUTARSONALIS] [$KALANTUTARORTBIRIMFIYAT] [$KALANTUTARSATISFIYAT]}[TARIH:D][DEPOID]
