Logo Yazılım Tüm ürünlerlerin Fiyat ve Stok Bilgisi
- 3 sene önce, Burak Çalışkan tarafından yazılmıştır.
- Logo Yazılım Tüm ürünlerlerin Fiyat ve Stok Bilgisi 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 |
SELECT I.CODE AS 'URUN_KODU' , I.NAME AS 'URUN_ADI', I.STGRPCODE AS 'GRUP KODU', I.SPECODE AS 'ÖZEL KODU', I.LOGICALREF , ISNULL(PR.PRICE,0)AS FIYAT, ISNULL(PR.CURRENCY,0) AS DOVIZ, SUM ((CASE S.TRCODE WHEN 1 THEN S.AMOUNT*UINFO2 ELSE 0 END )+ (CASE S.TRCODE WHEN 13 THEN S.AMOUNT*UINFO2 ELSE 0 END)+ (CASE F.TRCODE WHEN 3 THEN S.AMOUNT*UINFO2 ELSE 0 END )+(CASE S.TRCODE WHEN 14 THEN S.AMOUNT*UINFO2 ELSE 0 END)+ (CASE S.TRCODE WHEN 50 THEN S.AMOUNT*UINFO2 ELSE 0 END)) + SUM((CASE F.TRCODE WHEN 8 THEN S.AMOUNT*UINFO2 ELSE 0 END)+(CASE S.TRCODE WHEN 6 THEN S.AMOUNT*UINFO2 ELSE 0 END)+ (CASE S.TRCODE WHEN 12 THEN S.AMOUNT*UINFO2 ELSE 0 END)+(CASE S.TRCODE WHEN 11 THEN S.AMOUNT*UINFO2 ELSE 0 END)+ (CASE S.TRCODE WHEN 51 THEN S.AMOUNT*UINFO2 ELSE 0 END)+(CASE S.TRCODE WHEN 20 THEN S.AMOUNT*UINFO2 ELSE 0 END)) AS 'STOK' from LG_021_ITEMS AS I LEFT JOIN LG_021_01_STLINE AS S ON I.LOGICALREF=S.STOCKREF AND I.ACTIVE='0' and S.CANCELLED='0' LEFT JOIN LG_021_01_INVOICE AS F ON S.INVOICEREF=F.LOGICALREF LEFT JOIN LG_021_PRCLIST AS PR ON I.LOGICALREF=PR.CARDREF and PR.PTYPE=2 LEFT JOIN LG_021_01_STINVTOT AS ST ON I.LOGICALREF=ST.STOCKREF GROUP BY I.CODE,I.NAME,I.STGRPCODE,I.SPECODE,PR.PRICE,PR.CURRENCY,PR.PRIORITY,I.LOGICALREF,PR.PRICE ORDER BY URUN_KODU ASC |