Exemple #1
0
        public void AddList(string KodeBarang_, string NamaBarang, int QtyTrans)
        {
            ListBarang lb = new ListBarang();

            lb = ChekStok(KodeBarang_, QtyTrans);

            if (lb.SaldoStok - QtyTrans < 0)
            {
                _ListBarang.Add(lb);
                _KodeBarang = _KodeBarang + KodeBarang_ + "|";
            }

            _ListBarangs.Add(lb);
        }
Exemple #2
0
        private ListBarang ChekStok(string KodeBarang, int QtyTrans)
        {
            DataTable  dt  = new DataTable();
            ListBarang lb1 = new ListBarang();

            using (Database db = new Database())
            {
                db.Commands.Add(db.CreateCommand("[usp_CekStokRealTime]")); // cekd
                db.Commands[0].Parameters.Add(new Parameter("@KodeBarang", SqlDbType.VarChar, KodeBarang));
                db.Commands[0].Parameters.Add(new Parameter("@KodeGudang", SqlDbType.VarChar, GlobalVar.Gudang));


                dt = db.Commands[0].ExecuteDataTable();
            }
            lb1.KodeBarang = KodeBarang;
            lb1.NamaStok   = dt.Rows[0]["NamaStok"].ToString();
            lb1.KodeRak    = dt.Rows[0]["KodeRak"].ToString();
            lb1.QtyTrans   = QtyTrans;
            lb1.SatJual    = dt.Rows[0]["SatJual"].ToString();
            lb1.SaldoStok  = Convert.ToInt32(dt.Rows[0]["QtyAkhir"].ToString());
            return(lb1);
        }