SHARE
TWEET

cek PLU ganda (POTrader)

MoemoeChan Apr 15th, 2020 295 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Cek PLU ganda atau tidak
  2.  
  3. select PLU, COUNT(*) as c
  4. from (
  5.        select /*B.BARANG_ID, S.REF$SATUAN_ID, B.REF$MERCHANDISE_GRUP_ID, */B.BRG_CODE AS PLU, B.BRG_NAME AS BARANG,
  6.               S.SAT_CODE as SATUAN, /*BHJ.BHJ_SELL_PRICE_DISC AS HARGA, */
  7.               --LS.LS_STOCK AS STOCK, SS.SAT_CODE AS SATUAN_STOCK,
  8.               /*    LS.GUDANG/,
  9.               ISNULL(BHJ.BHJ_PURCHASE_PRICE,0) AS BHJ_PURCHASE_PRICE, */K.ISACTIVE, b.BRG_IS_DECIMAL AS IS_DECIMAL
  10.        from BARANG B
  11.             inner join BARANG_HARGA_JUAL BHJ
  12.                     on B.BARANG_ID = BHJ.BARANG_ID AND B.BRG_IS_ACTIVE = 1
  13.             inner join REF$KONVERSI_SATUAN K
  14.                    on K.BARANG_ID = BHJ.BARANG_ID AND K.REF$SATUAN_ID = BHJ.REF$SATUAN_ID -- AND K.ISACTIVE = 1
  15.             inner join REF$SATUAN S
  16.                    on BHJ.REF$SATUAN_ID = S.REF$SATUAN_ID
  17.             left outer join (
  18.                 select LS_BARANG_ID,  LS_SATUAN_ID, sum(LS_STOCK) as LS_STOCK, 'GORO' AS GUDANG
  19.                 from LAST_STOCK group by LS_BARANG_ID, LS_SATUAN_ID
  20.             ) AS LS      on LS.LS_BARANG_ID = B.BARANG_ID
  21.             left outer join REF$SATUAN SS
  22.                          on SS.REF$SATUAN_ID = LS.LS_SATUAN_ID
  23.             where K.ISACTIVE = 1
  24.      ) as R
  25. group by PLU, barang
  26. having COUNT(*) > 0
  27. order by PLU;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top