Logo Banka Hesap Ekstresi Bakiyeli
SELECT
T.[CARI_HESAP_KODU],T.ACIKLAMA,T.TARIH,T.FIS_NO,T.FIS_TURU,T.BELGE_NO,T.SATIR_ACIKLAMASI,T.BORC,T.ALACAK,
ROUND((SUM(T.Tutar) OVER (ORDER BY NR)),2) AS BAKIYE,
T.ISLEM_DOVIZI,
T.ISLEM_DOVIZ_TUTARI
FROM (
SELECT TOP 100 PERCENT
ROW_NUMBER() OVER (ORDER BY (SELECT 100)) AS NR,
CLNTC.CODE [CARI_HESAP_KODU],
CLNTC.DEFINITION_ [ACIKLAMA],
CTRNS.DATE_ TARIH,
CTRNS.TRANNO [FIS_NO],
CASE ((CTRNS.MODULENR100)+CTRNS.TRCODE) WHEN 381 THEN ‘Satış Siparişi’ WHEN 382 THEN ‘Satınalma Siparişi’ WHEN 431 THEN ‘Satın Alma Faturası’ WHEN 432 THEN ‘Perakende Satış İade Faturası’ WHEN 433 THEN ‘Toptan Satış İade Faturası’ WHEN 434 THEN ‘Alınan Hizmet Faturası’ WHEN 435 THEN ‘Alınan Proforma Faturası’ WHEN 436 THEN ‘Alım İade Faturası’ WHEN 437 THEN ‘Perakende Satış Faturası’ WHEN 438 THEN ‘Toptan Satış Faturası’ WHEN 439 THEN ‘Verilen Hizmet Faturası’ WHEN 440 THEN ‘Verilen Proforma Faturası’ WHEN 441 THEN ‘Verilen Vade Farkı Faturası’ WHEN 442 THEN ‘Alınan Vade Farkı Faturası’ WHEN 443 THEN ‘Alınan Fiyat Farkı Faturası’ WHEN 444 THEN ‘Verilen Fiyat Farkı Faturası’ WHEN 456 THEN ‘Müstahsil Makbuzu’ WHEN 501 THEN ‘Nakit Tahsilat’ WHEN 502 THEN ‘Nakit Ödeme’ WHEN 503 THEN ‘Borç Dekontu’ WHEN 504 THEN ‘Alacak Dekontu’ WHEN 505 THEN ‘Virman İşlemi’ WHEN 506 THEN ‘Kur Farkı İşlemi’ WHEN 512 THEN ‘Özel İşlem’ WHEN 514 THEN ‘Açılış Fişi’ WHEN 570 THEN ‘Kredi Kartı Fişi’ WHEN 661 THEN ‘Çek Girişi’ WHEN 662 THEN ‘Senet Girişi’ WHEN 663 THEN ‘Çek Çıkış Cari Hesaba’–CSTRANS.CLACCREF WHEN 664 THEN ‘Senet Çıkış Cari Hesaba’ WHEN 720 THEN ‘Gelen Havaleler’ WHEN 721 THEN ‘Gönderilen Havaleler’ WHEN 728 THEN ‘Banka Alınan Hizmet’ WHEN 729 THEN ‘Banka Verilen Hizmet’ WHEN 1001 THEN ‘Nakit Tahsilat’ WHEN 1002 THEN ‘Nakit Ödeme’ WHEN 6103 THEN ‘Borç Dekontu (Çek)’ WHEN 6104 THEN ‘Alacak Dekontu (Çek)’ END [FIS_TURU], CTRNS.DOCODE [BELGE_NO], CTRNS.LINEEXP [SATIR_ACIKLAMASI], CASE SIGN WHEN 0 THEN ROUND(AMOUNT,2) ELSE 0 END BORC, CASE SIGN WHEN 1 THEN ROUND(-1AMOUNT,2) ELSE 0 END ALACAK,
CASE SIGN WHEN 0 THEN ROUND(AMOUNT,2) ELSE ROUND(-1AMOUNT,2) END TUTAR, CASE CTRNS.TRCURR WHEN 0 THEN ‘TL’ WHEN 160 THEN ‘TL’ WHEN 1 THEN ‘USD’ WHEN 17 THEN ‘GBP’ WHEN 20 THEN ‘EUR’ END [ISLEM_DOVIZI], CASE SIGN WHEN 0 THEN ROUND(CTRNS.TRNET,2) ELSE ROUND(-1CTRNS.TRNET,2) END [ISLEM_DOVIZ_TUTARI]
FROM GOPLUS.DBO.LG_039_01_CLFLINE CTRNS WITH (NOLOCK)
LEFT OUTER JOIN GOPLUS.DBO.LG_039_PAYPLANS PAYPL WITH (NOLOCK) ON (CTRNS.PAYDEFREF = PAYPL.LOGICALREF)
LEFT OUTER JOIN GOPLUS.DBO.LG_039_01_CLFICHE CLFIC WITH (NOLOCK) ON (CTRNS.SOURCEFREF = CLFIC.LOGICALREF)
LEFT OUTER JOIN GOPLUS.DBO.LG_039_01_INVOICE INVFC WITH (NOLOCK) ON (CTRNS.SOURCEFREF = INVFC.LOGICALREF)
LEFT OUTER JOIN GOPLUS.DBO.LG_039_01_CSROLL RLFIC WITH (NOLOCK) ON (CTRNS.SOURCEFREF = RLFIC.LOGICALREF)
LEFT OUTER JOIN GOPLUS.DBO.LG_039_01_EMFICHE GLFIC WITH (NOLOCK) ON (CTRNS.ACCFICHEREF = GLFIC.LOGICALREF)
LEFT OUTER JOIN GOPLUS.DBO.LG_039_CLCARD CLNTC WITH (NOLOCK) ON (CTRNS.CLIENTREF = CLNTC.LOGICALREF)
LEFT OUTER JOIN GOPLUS.DBO.LG_039_01_ORFICHE ORFIC WITH (NOLOCK) ON (CTRNS.SOURCEFREF = ORFIC.LOGICALREF)
LEFT OUTER JOIN GOPLUS.DBO.LG_039_PURCHOFFER POFFER WITH (NOLOCK)ON (CTRNS.OFFERREF = POFFER.LOGICALREF)
WHERE (CTRNS.BRANCH IN ( 0 )) AND (CTRNS.DEPARTMENT IN ( 0 ))
AND (CTRNS.TRCODE IN ( 31, 32, 33, 34, 36, 37, 38, 39, 43, 44, 56, 1, 2, 3, 4, 5, 6, 12, 14, 41, 42, 45, 46, 70,71, 72, 73, 20, 21, 24, 25, 28, 29, 30, 61, 62, 63, 64, 75, 81, 82 ))
–AND CLNTC.CODE=’SAT.00283′
AND (CTRNS.DATE_ <= CONVERT(DATETIME, DATEFROMPARTS(YEAR(GETDATE()),12,31), 101))
ORDER BY CTRNS.DATE_,
CASE WHEN CTRNS.TRCODE = 14 AND CTRNS.MODULENR = 5 THEN 0 ELSE 1 END,
CASE WHEN CTRNS.MODULENR = 5 THEN CLFIC.TIME WHEN CTRNS.MODULENR = 4 THEN INVFC.TIME_ ELSE CTRNS.FTIME END,
CLFIC.LOGICALREF
) AS T