Logo Yazılım Hangi Ürün Kime Satılmış Raporu
- 3 sene önce, Burak Çalışkan tarafından yazılmıştır.
- Logo Yazılım Hangi Ürün Kime Satılmış Raporu için yorumlar kapalı
- MySQL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
SELECT CONVERT(nvarchar(20), INVOICE.DATE_,104) as Tarih, --INVOICE.DATE_ AS [Tarih], CLCARD.CODE as [Cari Kod], CLCARD.DEFINITION_ as [Cari Ad], INVOICE.SERIALCODE [Seri No], INVOICE.FICHENO [Fiş No], COALESCE( CASE STLINE.UINFO1 WHEN 0 THEN STLINE.AMOUNT ELSE STLINE.AMOUNT*STLINE.UINFO2/STLINE.UINFO1 END, STLINE.AMOUNT/1000) [Miktar], UNT.CODE [Birim], CASE WHEN STLINE.LINETYPE=4 THEN SRV.CODE ELSE INV.CODE END AS [Malzeme Kod], CASE WHEN STLINE.LINETYPE=4 THEN SRV.DEFINITION_ ELSE INV.NAME END AS [Malzeme Ad], CASE WHEN STLINE.LINETYPE=4 THEN '' ELSE INV.STGRPCODE END AS [Malzeme Grup], CASE WHEN STLINE.LINETYPE=4 THEN SRV.SPECODE ELSE INV.SPECODE END AS [Malzeme Özel Kod], STLINE.PRICE [Birim Fiyat], STLINE.VATMATRAH [KDV Matrah], STLINE.VATAMNT [KDV Tutar], STLINE.VAT [KDV %], (CASE WHEN INVOICE.TRCODE=1 THEN 'Satınalma Faturası' WHEN INVOICE.TRCODE=2 THEN 'Perakende Satış İade Faturası' WHEN INVOICE.TRCODE=3 THEN 'Toptan Satış İade Faturası' WHEN INVOICE.TRCODE=4 THEN 'Alınan Hizmet Faturası' WHEN INVOICE.TRCODE=5 THEN 'Alınan Proforma Faturası' WHEN INVOICE.TRCODE=6 THEN 'Satınalma İade Faturası' WHEN INVOICE.TRCODE=7 THEN 'Perakende Satış Faturası' WHEN INVOICE.TRCODE=8 THEN 'Toptan Satış Faturası' WHEN INVOICE.TRCODE=9 THEN 'Verilen Hizmet Faturası' WHEN INVOICE.TRCODE=10 THEN 'Verilen Proforma Faturası' WHEN INVOICE.TRCODE=12 THEN 'Alınan Vade Farkı Faturası' WHEN INVOICE.TRCODE=13 THEN 'Satınalma Fiyat Farkı Faturası' WHEN INVOICE.TRCODE=14 THEN 'Satış Fiyat Farkı Faturası' WHEN INVOICE.TRCODE=26 THEN 'Müstahsil Makbuzu' END ) as [Fatura Tipi], CASE WHEN CLCARD.ISPERSCOMP=1 THEN CLCARD.TCKNO ELSE CLCARD.TAXNR END AS [Cari VNO], CLCARD.TAXOFFICE as [Cari VDaire], EMUH.CODE as [Muhasebe Hesap Planı Kod], EMUH.DEFINITION_ as [Muhasebe Hesap Planı Ad], RTRIM(INVOICE.GENEXP1+' '+INVOICE.GENEXP2+' '+INVOICE.GENEXP3+' '+INVOICE.GENEXP4) AS [Açıklama] FROM LG_021_01_INVOICE AS INVOICE WITH (NOLOCK) RIGHT OUTER JOIN LG_021_01_STLINE AS STLINE ON INVOICE.LOGICALREF = STLINE.INVOICEREF RIGHT OUTER JOIN LG_021_ITEMS INV ON INV.LOGICALREF=STLINE.STOCKREF LEFT JOIN LG_021_SRVCARD SRV ON SRV.LOGICALREF=STLINE.STOCKREF RIGHT OUTER JOIN LG_021_CLCARD CLCARD ON CLCARD.LOGICALREF=INVOICE.CLIENTREF LEFT JOIN LG_021_EMUHACC EMUH ON EMUH.LOGICALREF=STLINE.ACCOUNTREF RIGHT OUTER JOIN LG_021_UNITSETL UNT ON UNT.UNITSETREF=INV.UNITSETREF AND LINENR=1 WHERE(INVOICE.TRCODE IN(2,3,7,8,9,10,14)) --AND INVOICE.DATE_ >= '2020-01-01 00:00:00.000' --AND INVOICE.DATE_ <= '2020-12-31 23:59:59.999' ORDER BY INVOICE.DATE_, INVOICE.SOURCEINDEX, INVOICE.FICHENO |