 SELECT H.KODU, H.ACIKLAMA, H.ACIKLAMA2, H.ACIKLAMA3, H.EK1, H.EK2,  H.EK3, H.EK4, 'TL' AS DVZ,  (SELECT SUM(BORC)FROM HESAPISL2 WHERE KODU=H.KODU GROUP BY KODU) AS HFATURA, (SELECT SUM(ALACAK)  FROM HESAPISL2 WHERE KODU=H.KODU GROUP BY KODU) AS HODEME, (SELECT SUM(HI.BORC) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0)) AS TOPFATURA, (SELECT SUM(HI.ALACAK)  FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0)) AS TOPODEME , (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>= 0) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=15)) AS BORC15ALTI, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=16) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=30)) AS BORC1630, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=31) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=45)) AS BORC3145, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=46) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=60)) AS BORC4660, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=61) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=90)) AS BORC6190, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=91)) AS BORC91USTU FROM HESAP AS H WHERE ((H.DOVTURU IS NULL)OR(H.DOVTURU ='')) AND H.KODU LIKE  '326%'  AND  (((SELECT SUM(BORC)FROM HESAPISL2 WHERE KODU=H.KODU GROUP BY KODU)-(SELECT SUM(ALACAK) FROM HESAPISL2 WHERE KODU=H.KODU GROUP BY KODU))>0) AND  H.KODU IN (SELECT DISTINCT HESAPISL2.KODU FROM HESAPISL2 WHERE HESAPISL2.KODU LIKE  '326%'  ) UNION ALL  SELECT H.KODU, H.ACIKLAMA, H.ACIKLAMA2, H.ACIKLAMA3, H.EK1, H.EK2,  H.EK3, H.EK4, H.DOVTURU,  (SELECT SUM(BORC)FROM HESAPISL2 WHERE KODU=H.KODU GROUP BY KODU) AS HFATURA, (SELECT SUM(ALACAK)  FROM HESAPISL2 WHERE KODU=H.KODU GROUP BY KODU) AS HODEME, (SELECT SUM(HI.DBORC) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0)) AS TOPFATURA, (SELECT SUM(HI.DALACAK)  FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0)) AS TOPODEME , (SELECT SUM(HI.DBORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>= 0) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=15)) AS BORC15ALTI, (SELECT SUM(HI.DBORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=16) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=30)) AS BORC1630, (SELECT SUM(HI.DBORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=31) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=45)) AS BORC3145, (SELECT SUM(HI.DBORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=46) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=60)) AS BORC4660, (SELECT SUM(HI.DBORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=61) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=90)) AS BORC6190, (SELECT SUM(HI.DBORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE (HI.KODU=H.KODU) AND (( CAST(CAST('08.01.2005' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=91)) AS BORC91USTU FROM HESAP AS H WHERE NOT((H.DOVTURU IS NULL)OR(H.DOVTURU ='')) AND H.KODU LIKE  '326%'  AND  (((SELECT SUM(BORC)FROM HESAPISL2 WHERE KODU=H.KODU GROUP BY KODU)-(SELECT SUM(ALACAK) FROM HESAPISL2 WHERE KODU=H.KODU GROUP BY KODU))>0) AND  H.KODU IN (SELECT DISTINCT HESAPISL2.KODU FROM HESAPISL2 WHERE HESAPISL2.KODU LIKE  '326%'  ) ORDER BY DVZ,KODU
 [Elektra                                                                                           ]
                                                                              Tarih       : [GTARIH  ]
                                                                              Saat        :   [BUSAAT]

                             326 Yaşlandırma Raporu (01.08.2005)

 Kodu        Hesap Adı           Döviz Toplam Fatura    Toplam Ödeme          Bakiye      Borç 0-15      Borç 16-30      Borç 31-45      Borç 46-60      Borç 61-90        Borç 91+
 ----------- ------------------- ----- --------------- --------------- --------------- --------------- --------------- --------------- --------------- --------------- ---------------
{[KODU     ] [ACIKLAMA         ] [^DVZ][~2TOPFATURA  ] [~2TOPODEME   ] [~2BAKIYE     ] [~2BORC15ALTI ] [~2BORC1630   ] [~2BORC3145   ] [~2BORC4660   ] [~2BORC6190   ] [~2BORC91USTU ]}
