예제 #1
0
 protected void btnThemTemp_Click(object sender, EventArgs e)
 {
     if (txtBarcode.Text != "")
     {
         string      IDPhieuKiemKho = IDPhieuKiemKho_Temp.Value.ToString();
         dtBanHangLe dt             = new dtBanHangLe();
         DataTable   tbThongTin     = dt.LayThongTinHangHoa_ThemDonHang(txtBarcode.Value.ToString());
         if (tbThongTin.Rows.Count > 0)
         {
             string    IDHangHoa   = tbThongTin.Rows[0]["ID"].ToString();
             string    MaHangHoa   = tbThongTin.Rows[0]["MaHang"].ToString();
             string    IDDonViTinh = dtHangHoa.LayIDDonViTinh(IDHangHoa);
             float     TonKho      = dtCapNhatTonKho.SoLuong_TonKho(IDHangHoa, Session["IDKho"].ToString());
             float     ChechLech   = -TonKho;
             DataTable dt1         = data.KTChiTietPhieuKiemKho_Temp(IDHangHoa, IDPhieuKiemKho);
             if (dt1.Rows.Count == 0)
             {
                 data = new dtKiemKho();
                 data.ThemPhieuKiemKho_Temp(IDPhieuKiemKho, IDHangHoa, TonKho, ChechLech, MaHangHoa, IDDonViTinh);
             }
             LoadGrid(IDPhieuKiemKho);
         }
         txtBarcode.Text  = "";
         txtBarcode.Value = "";
         txtBarcode.Focus();
     }
 }
예제 #2
0
 protected void cmbHangHoa_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbHangHoa.Text != "")
     {
         string IDPhieuKiemKho = IDPhieuKiemKho_Temp.Value.ToString();
         string IDNguyenLieu   = cmbHangHoa.Value.ToString();
         float  TonKho         = dtSetting.SoLuong_TonKho(IDNguyenLieu, Session["IDChiNhanh"].ToString());
         string MaNguyenLieu   = dtThemHangHoa.LayMaNguyenLieu(IDNguyenLieu);
         string IDDonViTinh    = dtThemHangHoa.LayIDDonViTinh(IDNguyenLieu);
         data = new dtKiemKho();
         DataTable dt = data.KTChiTietPhieuKiemKho_Temp(IDNguyenLieu, IDPhieuKiemKho);
         if (dt.Rows.Count == 0)
         {
             data = new dtKiemKho();
             data.ThemPhieuKiemKho_Temp(IDPhieuKiemKho, IDNguyenLieu, TonKho.ToString(), (-TonKho).ToString(), MaNguyenLieu, IDDonViTinh);
             LoadGrid(IDPhieuKiemKho.ToString());
             cmbHangHoa.Text = "";
         }
     }
     else
     {
         cmbHangHoa.Focus();
         ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Vui lòng chọn nguyên liệu!!');", true);
     }
 }
예제 #3
0
 protected void cmbKe_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbKe.Text != "")
     {
         // kiểm kho phải kiểm từng kệ.
         data = new dtKiemKho();
         data.XoaPhieuKiemKho_Temp_IDPhieuKiemKho(IDPhieuKiemKho_Temp.Value.ToString());
         Random ran = new Random();
         IDPhieuKiemKho_Temp.Value = ran.Next(100000, 999999).ToString();
         dtKe      k  = new dtKe();
         DataTable db = k.DanhSachChiTietKe(cmbKe.Value.ToString());
         if (db.Rows.Count > 0)
         {
             string IDPhieuKiemKho = IDPhieuKiemKho_Temp.Value.ToString();
             foreach (DataRow dr in db.Rows)
             {
                 string    IDHangHoa  = dr["IDHangHoa"].ToString();
                 string    MaHang     = dr["MaHang"].ToString();
                 string    IDonViTinh = dr["IDonViTinh"].ToString();
                 int       TonKho     = dtCapNhatTonKho.SoLuong_TonKho(IDHangHoa, Session["IDKho"].ToString());
                 int       ChechLech  = -TonKho;
                 DataTable dt         = data.KTChiTietPhieuKiemKho_Temp(IDHangHoa, IDPhieuKiemKho, cmbKe.Value.ToString());
                 if (dt.Rows.Count == 0)
                 {
                     data = new dtKiemKho();
                     data.ThemPhieuKiemKho_Temp(IDPhieuKiemKho, IDHangHoa, TonKho, ChechLech, MaHang, IDonViTinh, cmbKe.Value.ToString());
                 }
             }
             LoadGrid(IDPhieuKiemKho);
         }
         else
         {
             Response.Write("<script language='JavaScript'> alert('Kệ chưa có hàng hóa.'); </script>");
         }
     }
 }