- Katılım
- 25 May 2018
- Mesajlar
- 1,572
- En iyi yanıt
- 14
- Puanları
- 113
- Konum
- İstanbul
- Web sitesi
- excelarsivi.com
- Ad Soyad
- Murat OSMA
- Office Vers.
- Office 365 TR+EN
Logo'da Malzemelerin Ambarlardaki Eldeki Stok durum tablosu için bu sorguyu kullanabilirsiniz.
[HIDEREPLYTHANKS]
[/HIDEREPLYTHANKS]
Sonuç Tablo
[HIDEREPLYTHANKS]
SQL:
SELECT URUN.CODE AS 'ÜRÜN KODU',
URUN.NAME AS 'ÜRÜN ADI',
'GENEL '= CASE WHEN (AMBARM.MIKTAR IS NULL) THEN '0' WHEN (AMBARM.MIKTAR IS NOT NULL) THEN AMBARM.MIKTAR END,
'AMBAR 1'= CASE WHEN (AMBAR1.MIKTAR IS NULL) THEN '0' WHEN (AMBAR1.MIKTAR IS NOT NULL) THEN AMBAR1.MIKTAR END,
'AMBAR 2'= CASE WHEN (AMBAR2.MIKTAR IS NULL) THEN '0' WHEN (AMBAR2.MIKTAR IS NOT NULL) THEN AMBAR2.MIKTAR END,
'AMBAR 3'= CASE WHEN (AMBAR3.MIKTAR IS NULL) THEN '0' WHEN (AMBAR3.MIKTAR IS NOT NULL) THEN AMBAR3.MIKTAR END,
'AMBAR 4'= CASE WHEN (AMBAR4.MIKTAR IS NULL) THEN '0' WHEN (AMBAR4.MIKTAR IS NOT NULL) THEN AMBAR4.MIKTAR END,
'AMBAR 5'= CASE WHEN (AMBAR5.MIKTAR IS NULL) THEN '0' WHEN (AMBAR5.MIKTAR IS NOT NULL) THEN AMBAR5.MIKTAR END,
'A.FIYAT'= CASE WHEN (ALIS.MIKTAR IS NULL) THEN '0' WHEN (ALIS.MIKTAR IS NOT NULL) THEN ALIS.MIKTAR END,
'S.FIYAT'= CASE WHEN (SATIS.MIKTAR IS NULL) THEN '0' WHEN (SATIS.MIKTAR IS NOT NULL) THEN SATIS.MIKTAR END,
'A.DEGER'= CASE WHEN (AMBARM.MIKTAR * ALIS.MIKTAR IS NULL) THEN '0' WHEN (AMBARM.MIKTAR * ALIS.MIKTAR IS NOT NULL) THEN AMBARM.MIKTAR * ALIS.MIKTAR END,
'S.DEGER'= CASE WHEN (AMBARM.MIKTAR * SATIS.MIKTAR IS NULL) THEN '0' WHEN (AMBARM.MIKTAR * SATIS.MIKTAR IS NOT NULL) THEN AMBARM.MIKTAR * SATIS.MIKTAR END
FROM
LG_001_ITEMS URUN
LEFT JOIN (SELECT SUM(ONHAND) MIKTAR,STOCKREF FROM LG_001_01_STINVTOT WHERE INVENNO=-1 GROUP BY STOCKREF)
AMBARM ON URUN.LOGICALREF = AMBARM.STOCKREF
LEFT JOIN (SELECT SUM(ONHAND) MIKTAR,STOCKREF FROM LG_001_01_STINVTOT WHERE INVENNO=0 GROUP BY STOCKREF)
AMBAR1 ON URUN.LOGICALREF = AMBAR1.STOCKREF
LEFT JOIN (SELECT SUM(ONHAND) MIKTAR,STOCKREF FROM LG_001_01_STINVTOT WHERE INVENNO=1 GROUP BY STOCKREF)
AMBAR2 ON URUN.LOGICALREF = AMBAR2.STOCKREF
LEFT JOIN (SELECT SUM(ONHAND) MIKTAR,STOCKREF FROM LG_001_01_STINVTOT WHERE INVENNO=2 GROUP BY STOCKREF)
AMBAR3 ON URUN.LOGICALREF = AMBAR3.STOCKREF
LEFT JOIN (SELECT SUM(ONHAND) MIKTAR,STOCKREF FROM LG_001_01_STINVTOT WHERE INVENNO=3 GROUP BY STOCKREF)
AMBAR4 ON URUN.LOGICALREF = AMBAR4.STOCKREF
LEFT JOIN (SELECT SUM(ONHAND) MIKTAR,STOCKREF FROM LG_001_01_STINVTOT WHERE INVENNO=4 GROUP BY STOCKREF)
AMBAR5 ON URUN.LOGICALREF = AMBAR5.STOCKREF
LEFT JOIN ((SELECT SUM(PRICE) AS 'MIKTAR',CARDREF FROM LG_001_PRCLIST WHERE PTYPE=1 GROUP BY CARDREF))
ALIS ON URUN.LOGICALREF = ALIS.CARDREF
LEFT JOIN ((SELECT SUM(PRICE) AS 'MIKTAR',CARDREF FROM LG_001_PRCLIST WHERE PTYPE=2 GROUP BY CARDREF))
SATIS ON URUN.LOGICALREF=SATIS.CARDREF
WHERE URUN.CARDTYPE<>'10'
ORDER BY URUN.CODE
Sonuç Tablo
Son düzenleme: