SQL Sorgu Varyantlı Satışlar

Murat OSMA

Yönetici
Site Yöneticisi
Katılım
25 May 2018
Mesajlar
1,294
En iyi yanıt
9
Puanları
113
Konum
İstanbul
Web sitesi
excelarsivi.com
Ad Soyad
Murat OSMA
Office Versiyon
Office 365 TR+EN
Logo'da Varyantlı Satışlar raporu için bu sorguyu kullanabilirsiniz.

[HIDEREPLYTHANKS]
SQL:
SELECT * FROM (SELECT DATE_ AS [TARİH],
(SELECT FICHENO FROM LG_215_01_STFICHE WHERE LOGICALREF=S.STFICHEREF)AS [FİŞ NO],
(SELECT CODE FROM LG_215_ITEMS WHERE LOGICALREF=S.STOCKREF ) AS [STOK KODU],
(SELECT NAME FROM LG_215_ITEMS WHERE LOGICALREF=S.STOCKREF ) AS [STOK AÇIKLAMASI],
(SELECT CODE FROM LG_215_VARIANT WHERE LOGICALREF=S.VARIANTREF)AS [VARYANT KODU],
(SELECT NAME FROM LG_215_VARIANT WHERE LOGICALREF=S.VARIANTREF)AS [VARYANT AÇIKLAMASI],
(SELECT CODE FROM LG_215_CLCARD WHERE LOGICALREF=S.CLIENTREF) AS [CARİ KODU],
(SELECT DEFINITION_ FROM LG_215_CLCARD WHERE LOGICALREF=S.CLIENTREF) AS [CARİ ÜNVANI],
(SELECT CODE FROM LG_215_PAYPLANS WHERE LOGICALREF=(SELECT PAYDEFREF FROM LG_215_01_STFICHE WHERE LOGICALREF=S.STFICHEREF))AS [VADE],
S.AMOUNT AS [MİKTAR],
ISNULL(CASE PRCURR WHEN 0 THEN S.PRICE END,0) AS [BİRİM FİYAT],
ISNULL(CASE WHEN PRCURR>0 THEN S.PRPRICE END,0) DOVIZLIBIRIMFIYAT,
   ROUND(CASE S.PRCURR
        WHEN 0 THEN 0
   ELSE
       CASE PRPRICE
            WHEN 0 THEN
                (SELECT REPORTRATE FROM LG_215_01_STFICHE WHERE LOGICALREF=S.STFICHEREF)
            ELSE
                PRICE/PRPRICE
            END
   END,4) AS [DÖVİZ KURU],
   CASE PRCURR WHEN 0 THEN 'TL' WHEN 20 THEN 'EURO' WHEN 1 THEN 'USD' END AS DOVIZTURU,
ISNULL(CASE WHEN PRCURR=0 THEN S.PRICE END,0) AS TL_TUTAR,
S.SOURCEINDEX AS AMBAR
FROM LG_215_01_STLINE S WHERE TRCODE=8 AND S.CANCELLED=0
AND (SELECT SPECODE5 FROM LG_215_CLCARD WHERE LOGICALREF=S.CLIENTREF)NOT IN('X','x')
) AS TABLOM
[/HIDEREPLYTHANKS]
 
Son düzenleme:

excelturk

Yeni Üye
Katılım
28 Tem 2018
Mesajlar
4
En iyi yanıt
0
Puanları
1
Yaş
49
Konum
Antalya
Ad Soyad
Ayhan KAVRUKOĞLU
Varyant ile ilgili örnekleriniz için tekrar teşekkür ederim.
 
Üst Alt