Borçlu ve alacaklı cari hesaplara vade getirilme tanımlı alanları
VAL(_SQLINFO("odeme_vade","TIGER_36..vw_ortalamavade_036","cari_kod='"+[Cari Hesap Kodu]+"'")) tahsilatvade1-_CLVAL([Firma No.],[Cari Hesap Kodu],[Günün Tarihi],DATE(01,01,2015),DATE(31,12,2017),"",1) gununvade-AFTER([TAHSİLATVADE1],[Günün Tarihi]) select clc.code cari_kod, clc.defınıtıon_ açıklama, fatura_vade = round(sum(datediff(d, pay.procdate, pay.date_)*pay2.total) / isnull(sum(pay2.total), 1), 2), odeme_vade = round(sum(datediff(d, pay.procdate, pay2.date_)*pay2.total) / isnull(sum(pay2.total), 1), 2), gecikme_vade = round(sum(datediff(d, pay.date_, pay2.date_)*pay2.total) / isnull(sum(pay2.total), 1), 2), fatura_total = round(sum(pay.total), 2), odeme_total = round(sum(pay2.total), 2), BAKIYE = round(max(gnt.debıt - gnt.credıt), 2) from LG_017_CLCARD clc inner join LV_017_01_GNTOTCL gnt on gnt.cardref = clc.logıcalref and tottyp = 1 inner join LG_017_01_PAYTRANS pay on pay.cardref = clc.logıcalref and pay.sıgn = 0 left join LG_017_01_PAYTRANS pay2 on pay2.logıcalref = pay.crossref and not (pay2.modulenr = 5 and pay2.trcode = 14) where pay.modulenr = 4 and pay.trcode in (7,8,9) and pay.cancelled = 0 group by clc.code, clc.defınıtıon_