コード例 #1
0
        protected void btnDuyet_Click(object sender, EventArgs e)
        {
            string    IDPhieuKiemKho = Request.QueryString["IDPhieuKiemKho"];
            string    IDChiNhanh     = dtKiemKho.LayIDChiNhanh(IDPhieuKiemKho).ToString();
            DataTable dt             = data.DanhSachChiTietPhieuKiemKho_IDPhieuKiemKho(Int32.Parse(IDPhieuKiemKho));

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string ThucTe       = dr["ThucTe"].ToString();
                    string IDNguyenLieu = dr["IDNguyenLieu"].ToString();
                    dtSetting.CapNhatKho(IDNguyenLieu, ThucTe, IDChiNhanh);
                }
                data = new dtKiemKho();
                data.CapNhatTrangThai(IDPhieuKiemKho);
                // Response.Redirect("DanhSachKiemKho.aspx");
                // chưa ghi lịch sử
                btnDuyet.Enabled = false;
                gridChiTietPhieuKiemKho.Columns["chucnang"].Visible = false;
            }
            else
            {
                Response.Write("<script language='JavaScript'> alert('Danh sách kiểm kho rỗng'); </script>");
            }
        }
コード例 #2
0
        protected void btnDuyet_Click(object sender, EventArgs e)
        {
            data = new dtKiemKho();
            string    IDPhieuKiemKho = Request.QueryString["IDPhieuKiemKho"];
            DataTable dt             = data.DanhSachChiTietPhieuKiemKho_IDPhieuKiemKho(Int32.Parse(IDPhieuKiemKho));

            if (dt.Rows.Count > 0)
            {
                string IDKho = dtKiemKho.LayIDKho_PhieuKiem(IDPhieuKiemKho);
                if (IDKho != "")
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        string ThucTe    = dr["ThucTe"].ToString();
                        string IDHangHoa = dr["IDHangHoa"].ToString();
                        // lấy chênh lệch lưu lại thẻ kho
                        int ChenhLech = Int32.Parse(dr["ChenhLech"].ToString());
                        if (ChenhLech > 0)
                        {
                            object TheKho1 = dtTheKho.ThemTheKho("", "Kiểm kho: " + dtTheKho.LayTenKho_ID(IDKho), "0", "0", (Int32.Parse(dtCapNhatTonKho.SoLuong_TonKho(IDHangHoa, IDKho).ToString()) + ChenhLech).ToString(), Session["IDNhanVien"].ToString(), IDKho, IDHangHoa, "Nhập", "0", "0", ChenhLech.ToString());
                            if (TheKho1 != null)
                            {
                                dtCapNhatTonKho.CapNhatKho(IDHangHoa, ThucTe, IDKho);
                            }
                        }
                        else if (ChenhLech < 0)
                        {
                            object TheKho2 = dtTheKho.ThemTheKho("", "Kiểm kho: " + dtTheKho.LayTenKho_ID(IDKho), "0", "0", (Int32.Parse(dtCapNhatTonKho.SoLuong_TonKho(IDHangHoa, IDKho).ToString()) + ChenhLech).ToString(), Session["IDNhanVien"].ToString(), IDKho, IDHangHoa, "Xuất", "0", "0", ChenhLech.ToString());
                            if (TheKho2 != null)
                            {
                                dtCapNhatTonKho.CapNhatKho(IDHangHoa, ThucTe, IDKho);
                            }
                        }
                    }
                    data = new dtKiemKho();
                    data.CapNhatTrangThai(IDPhieuKiemKho);
                    btnDuyet.Enabled = false;
                    gridChiTietPhieuKiemKho.Columns["chucnang"].Visible = false;

                    //  dtLichSuTruyCap.ThemLichSu(Session["IDNhanVien"].ToString(), Session["IDNhom"].ToString(), "Chi tiết phiếu kiểm kho", Session["IDKho"].ToString(), "Nhập xuất tồn", "Duyệt");
                }
            }
            else
            {
                Response.Write("<script language='JavaScript'> alert('Danh sách kiểm kho rỗng'); </script>");
            }
        }
コード例 #3
0
 private void LoadGrid(int IDPhieuKiemKho)
 {
     data = new dtKiemKho();
     gridChiTietPhieuKiemKho.DataSource = data.DanhSachChiTietPhieuKiemKho_IDPhieuKiemKho(IDPhieuKiemKho);
     gridChiTietPhieuKiemKho.DataBind();
 }