Logo Tiger Kapanmamış Satış Faturlarının Listesi
SELECT PAYTRANS.CARDREF, PAYTRANS.MODULENR, PAYTRANS.FICHEREF, PAYTRANS.TRCODE, SUM(PAYTRANS.TOTAL) AS FATURA_TOPLAMI, SUM(PAYTRANS.PAID) AS KAPANAN_TUTAR, SUM(PAYTRANS.TOTAL) - SUM(PAYTRANS.PAID) AS KALAN_TUTAR, CLCARD.CODE, CLCARD.DEFINITION_, CLCARD.TOWN,CLCARD.DISTRICT, CLCARD.TELNRS2, PAYTRANS.PROCDATE AS FATURA_TARIHI, PAYTRANS.DATE_ AS ODEME_TARIHI, ( SELECT ( SELECT DEFINITION_ FROM lg_001_PAYPLANS WHERE LOGICALREF = PAYDEFREF ) FROM lg_001_03_INVOICE WHERE LOGICALREF = PAYTRANS.FICHEREF ) AS ODEME_PLANI FROM lg_001_03_PAYTRANS AS PAYTRANS LEFT OUTER JOIN lg_001_CLCARD AS CLCARD ON PAYTRANS.CARDREF = CLCARD.LOGICALREF WHERE PAYTRANS.CARDREF IN ( SELECT LOGICALREF FROM lg_001_CLCARD AS SYN_CLCARD WHERE CODE LIKE '131 %') AND ( SELECT PAYDEFREF FROM lg_001_03_INVOICE WHERE LOGICALREF = PAYTRANS.FICHEREF) IN( 41, 43, 39 ) AND PAYTRANS.MODULENR IN( 4 ) AND PAYTRANS.PROCDATE <> PAYTRANS.DATE_ AND PAYTRANS.DATE_ <= '2016-10-11 00:00:00.000' GROUP BY PAYTRANS.CARDREF, PAYTRANS.MODULENR, PAYTRANS.FICHEREF, PAYTRANS.TRCODE, CLCARD.CODE, CLCARD.DEFINITION_, CLCARD.TOWN,CLCARD.DISTRICT, CLCARD.TELNRS2, PAYTRANS.PROCDATE, PAYTRANS.DATE_ HAVING SUM(PAYTRANS.TOTAL) - SUM(PAYTRANS.PAID) > 0.99 ORDER BY PAYTRANS.CARDREF;