 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 HESAPISL2.SKODU='01' AND KODU=H.KODU GROUP BY KODU) AS HFATURA, (SELECT SUM(ALACAK)  FROM HESAPISL2 WHERE HESAPISL2.SKODU='01' AND KODU=H.KODU GROUP BY KODU) AS HODEME, (SELECT SUM(HI.BORC) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0)) AS TOPFATURA, (SELECT SUM(HI.ALACAK)  FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0)) AS TOPODEME , ((SELECT SUM(HI.BORC) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0))- (SELECT SUM(HI.ALACAK)  FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0))) AS BAKIYE , (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>= 0) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=15)) AS BORC15ALTI, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=16) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=30)) AS BORC1630, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=31) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=45)) AS BORC3145, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=46) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=60)) AS BORC4660, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=61) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )<=90)) AS BORC6190, (SELECT SUM(HI.BORC-HI.KAPANAN) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=91)) AS BORC91USTU FROM HESAP AS H WHERE H.KODU LIKE  '120%'  AND  (((SELECT SUM(BORC)FROM HESAPISL2 WHERE HESAPISL2.SKODU='01' AND KODU=H.KODU GROUP BY KODU)-(SELECT SUM(ALACAK) FROM HESAPISL2 WHERE HESAPISL2.SKODU='01' AND KODU=H.KODU GROUP BY KODU))>0) AND  H.KODU IN (SELECT DISTINCT HESAPISL2.KODU FROM HESAPISL2 WHERE HESAPISL2.SKODU='01' AND HESAPISL2.KODU LIKE  '120%' ) AND (SELECT SUM(HI.BORC) FROM HESAPISL2 AS HI WHERE HI.SKODU='01' AND (HI.KODU=H.KODU) AND (( CAST(CAST('10.26.2007' AS SMALLDATETIME) AS FLOAT) - CAST(TARIH AS FLOAT) )>=0)) IS NOT NULL ORDER BY H.KODU
 [Elektra                                                                                           ]
                                                                                                                                            Tarih       : [GVADE  ]
                                                                                                                                            Saat        :   [BUSAAT]

                   MERKEZ  Alıcılar Yaşlandırma Raporu (26.10.2007)

 Kodu                Hesap Adı                   Döviz Toplam Fatura  Toplam Ödeme   Bakiye         Borç 0-10      Borç 11-20   Borç 21-30   Borç 31-40          Borç 40+
 ------------------- --------------------------- ----- -------------- -------------- -------------- -------------- ------------ ------------ -------------- --------------
{[KODU             ] [ACIKLAMA                 ] [DVZ] [~2TOPFATURA ] [~2TOPODEME  ] [~2BAKIYE    ] [~2BORC15ALTI] [~2BORC1630] [~2BORC3145] [~2BORC4660  ] [~2BORC91USTU ]}
