Blog Of Sem: version 6 depo bazlı stoklar ve cari bakiyeleri

version 6 depo bazlı stoklar ve cari bakiyeleri

depo bazlı ürünler

select DEPO.ADI WarehouseName,SKART.KOD URUN_KODU,SKART.ADI URUN_ADI,SUM((TGIRIS-TCIKIS)) Quantity
from SKARTK
LEFT JOIN SKART ON SKARTK.KOD = SKART.KOD
left join  DEPO ON SKARTK.DEPO = DEPO.KOD
 where (SKARTK.SIRKET='08' AND SKART.SIRKET='08' AND DEPO.SIRKET = '08')
 where (SKARTK.SIRKET='_ActiveCompanyId_' AND SKART.SIRKET='_ActiveCompanyId_' AND DEPO.SIRKET = '_ActiveCompanyId_')
GROUP BY DEPO.ADI,SKART.ADI,SKART.KOD

cari bakiyeleri
select CKART.KOD,CKART.ADI,ISNULL(sum(cast(CARID.BORC AS DECIMAL(10,2)) - cast(CARID.ALACAK AS DECIMAL(10,2))),0) BAKIYE from CKART left join CARID on (CKART.SIRKET=CARID.SIRKET and CKART.KOD=CARID.CKOD) where
 --CKART.SIRKET='08' AND
CKART.SIRKET='_ActiveCompanyId_' AND
 CKART.SAYI1 >= 0 and CKART.SAYI1 <= 999999999999999 and
 CKART.SAYI2 >= 0 and CKART.SAYI2 <= 999999999999999 and
 CKART.SAYI3 >= 0 and CKART.SAYI3 <= 999999999999999 and
 CKART.SAYI4 >= 0 and CKART.SAYI4 <= 999999999999999 and
 CKART.SAYI5 >= 0 and CKART.SAYI5 <= 999999999999999 and INUSE=1
 GROUP BY CKART.KOD,CKART.ADI
 ORDER BY CKART.ADI