private void dgvHienThi_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (dgvHienThi.RowCount > 0) { frmXuLyNhapKho fr = new frmXuLyNhapKho("Update", getDatagridview()); fr.ShowDialog(); //Entities.TruyenGiaTri tra = new Entities.TruyenGiaTri(); //tra = new Common.Utilities().CaiDatKho("View", "", ""); //Entities.HoaDonNhap nhap = new Entities.HoaDonNhap(); //nhap.Hanhdong = "Select"; //nhap.MaHoaDonNhap = ""; //nhap.MaKho = tra.Giatritruyen; //SelectData(nhap); } else { } } catch (Exception ex) { string s = ex.Message.ToString(); } }
private void toolStripStatus_Sua_Click(object sender, EventArgs e) { try { if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 1)) { return; } if (dgvHienThi.RowCount > 0) { frmXuLyNhapKho fr = new frmXuLyNhapKho("Update", getDatagridview()); fr.ShowDialog(); //Entities.TruyenGiaTri tra = new Entities.TruyenGiaTri(); //tra = new Common.Utilities().CaiDatKho("View", "", ""); //Entities.HoaDonNhap nhap = new Entities.HoaDonNhap(); //nhap.Hanhdong = "Select"; //nhap.MaHoaDonNhap = ""; //nhap.MaKho = tra.Giatritruyen; //SelectData(nhap); } else { } } catch (Exception ex) { string s = ex.Message.ToString(); } }
private void toolStripStatus_ThemMoi_Click(object sender, EventArgs e) { try { if (!Common.Utilities.User.Administrator && !CheckQuyen(this.Name, 4)) { return; } for (int j = 0; j < 100; j++) { if (BaoDong == "") { frmXuLyNhapKho fr = new frmXuLyNhapKho("Insert"); fr.ShowDialog(); Entities.TruyenGiaTri tra = new Entities.TruyenGiaTri(); tra = new Common.Utilities().CaiDatKho("View", "", ""); Entities.HoaDonNhap nhap = new Entities.HoaDonNhap(); nhap.Hanhdong = "Select"; nhap.MaHoaDonNhap = ""; nhap.MaKho = tra.Giatritruyen; SelectData(nhap); } else { BaoDong = ""; break; } } } catch (Exception ex) { string s = ex.Message; } }
private void TraveLoai() { try { if (names == "Lay_HangHoa_GoiHang") { GiaTriCanLuu.Loaitrave = "Lay_HangHoa_GoiHang"; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "DonDatHang_HangHoa") { GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoa"; frmXuLyDonDatHang fr = new frmXuLyDonDatHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HoaDonDat_HangHoa") { GiaTriCanLuu.Loaitrave = "HoaDonDat_HangHoa"; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "DonDatHang_NhaCungCap") { GiaTriCanLuu.Loaitrave = "DonDatHang_NhaCungCap"; frmXuLyDonDatHang fr = new frmXuLyDonDatHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HoaDonNhap_NhaCungCap") { GiaTriCanLuu.Loaitrave = "HoaDonNhap_NhaCungCap"; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "ThongTin_KhachHangTraLai") { GiaTriCanLuu.Loaitrave = "ThongTin_KhachHangTraLai"; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HoaDonNhap_DonDatHang") { GiaTriCanLuu.Loaitrave = "HoaDonNhap_DonDatHang"; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HangTraLai_KhachHangTraLai_MaDonHang") { GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_MaDonHang"; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HangTraLai_KhachHangTraLai_KhachHang") { GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_KhachHang"; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HangTraLai_TraLaiNhaCungCap") { GiaTriCanLuu.Loaitrave = "HangTraLai_TraLaiNhaCungCap"; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "ChiTietKhachHangTraLaiHang_HangHoa") { GiaTriCanLuu.Loaitrave = "ChiTietKhachHangTraLaiHang_HangHoa"; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "ChiTietTraLaiNhaCungCap_MaHangHoa") { GiaTriCanLuu.Loaitrave = "ChiTietTraLaiNhaCungCap_MaHangHoa"; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HoaDonNhap_MaDonDatHang") { GiaTriCanLuu.Loaitrave = "HoaDonNhap_MaDonDatHang"; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "KiemKeKho_HangHoa") { GiaTriCanLuu.Loaitrave = "KiemKeKho_HangHoa"; frmXuLyKiemKeKho fr = new frmXuLyKiemKeKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HangTraLai_DonDatHangNhaCungCap") { GiaTriCanLuu.Loaitrave = "HangTraLai_DonDatHangNhaCungCap"; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "HangTraLai_MaTraLaiNhaCungCap") { GiaTriCanLuu.Loaitrave = "HangTraLai_MaTraLaiNhaCungCap"; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "XuLyKhachHang") { GiaTriCanLuu.Loaitrave = "XuLyKhachHang"; frmXuLyKhachHang fr = new frmXuLyKhachHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } if (names == "DonDatHang_KhachHang") { GiaTriCanLuu.Loaitrave = "DonDatHang_KhachHang"; frmXuLyDonDatHang fr = new frmXuLyDonDatHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } catch (Exception ex) { string s = ex.Message; } }
private void TraVe() { try { if (names == "Lay_HangHoa_GoiHang") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells["MaHang"].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells["TenHang"].Value.ToString(); string Gia = dgvHieThi.Rows[vitri].Cells["GiaNhap"].Value.ToString(); string banbuon = dgvHieThi.Rows[vitri].Cells["GiaBanBuon"].Value.ToString(); string banle = dgvHieThi.Rows[vitri].Cells["GiaBanLe"].Value.ToString(); string giatrigiatang = dgvHieThi.Rows[vitri].Cells["Thue"].Value.ToString(); GiaTriCanLuu.Loaitrave = "Lay_HangHoa_GoiHang"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = Gia; GiaTriCanLuu.Giatri2 = banbuon; GiaTriCanLuu.TonKho = banle; GiaTriCanLuu.giatrigiatang = giatrigiatang; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "DonDatHang_HangHoa") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoa"; string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString(); string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString(); string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString(); GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = Gia; GiaTriCanLuu.Giatri2 = banbuon; GiaTriCanLuu.TonKho = banle; GiaTriCanLuu.giatrigiatang = giatrigiatang; frmXuLyDonDatHang fr = new frmXuLyDonDatHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HoaDonDat_HangHoa") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString(); string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString(); string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString(); GiaTriCanLuu.Loaitrave = "HoaDonDat_HangHoa"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = Gia; GiaTriCanLuu.Giatri2 = banbuon; GiaTriCanLuu.TonKho = banle; GiaTriCanLuu.giatrigiatang = giatrigiatang; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "DonDatHang_NhaCungCap") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); string giatri = dgvHieThi.Rows[vitri].Cells[4].Value.ToString(); GiaTriCanLuu.Loaitrave = "DonDatHang_NhaCungCap"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; GiaTriCanLuu.Giatri2 = giatri; frmXuLyDonDatHang fr = new frmXuLyDonDatHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HoaDonNhap_NhaCungCap") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); string no = dgvHieThi.Rows[vitri].Cells[4].Value.ToString(); GiaTriCanLuu.Loaitrave = "HoaDonNhap_NhaCungCap"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; GiaTriCanLuu.TonKho = no; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "ThongTin_KhachHangTraLai") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); GiaTriCanLuu.Loaitrave = "ThongTin_KhachHangTraLai"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HoaDonNhap_DonDatHang") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); GiaTriCanLuu.Loaitrave = "HoaDonNhap_DonDatHang"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HangTraLai_KhachHangTraLai_MaDonHang") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[0].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_MaDonHang"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HangTraLai_KhachHangTraLai_KhachHang") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string duno = dgvHieThi.Rows[vitri].Cells[4].Value.ToString(); GiaTriCanLuu.Loaitrave = "HangTraLai_KhachHangTraLai_KhachHang"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri2 = duno; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HangTraLai_TraLaiNhaCungCap") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); string nohienthoi = dgvHieThi.Rows[vitri].Cells[4].Value.ToString(); GiaTriCanLuu.Loaitrave = "HangTraLai_TraLaiNhaCungCap"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; GiaTriCanLuu.Giatri2 = nohienthoi; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "ChiTietKhachHangTraLaiHang_HangHoa") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { frmXuLyHangTraLai.soluongmua = doituong; string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); string sl = dgvHieThi.Rows[vitri].Cells[4].Value.ToString(); string giatrigiatrang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString(); GiaTriCanLuu.Loaitrave = "ChiTietKhachHangTraLaiHang_HangHoa"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; GiaTriCanLuu.Giatri2 = sl; GiaTriCanLuu.giatrigiatang = giatrigiatrang; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "ChiTietTraLaiNhaCungCap_MaHangHoa") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { frmXuLyHangTraLai.soluongmua = doituong; string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); string sl = dgvHieThi.Rows[vitri].Cells[4].Value.ToString(); string g = dgvHieThi.Rows[vitri].Cells[5].Value.ToString(); GiaTriCanLuu.Loaitrave = "ChiTietTraLaiNhaCungCap_MaHangHoa"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; GiaTriCanLuu.makhachhang = sl; GiaTriCanLuu.giatrigiatang = g; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HoaDonNhap_MaDonDatHang") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string add = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); GiaTriCanLuu.Loaitrave = "HoaDonNhap_MaDonDatHang"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = add; frmXuLyNhapKho fr = new frmXuLyNhapKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "KiemKeKho_HangHoa") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { int temVITRI = dgvHieThi.CurrentRow.Index; string ID = dgvHieThi.Rows[temVITRI].Cells["MaHangHoa"].Value.ToString(); string Name = dgvHieThi.Rows[temVITRI].Cells["TenHangHoa"].Value.ToString(); string add = dgvHieThi.Rows[temVITRI].Cells["GiaNhap"].Value.ToString(); string ton = dgvHieThi.Rows[temVITRI].Cells["Tonkho"].Value.ToString(); string sl = dgvHieThi.Rows[temVITRI].Cells["Tonkho"].Value.ToString(); GiaTriCanLuu.Loaitrave = "KiemKeKho_HangHoa"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.TonKho = ton; GiaTriCanLuu.Giatri2 = sl; GiaTriCanLuu.Giatri = add; frmXuLyKiemKeKho fr = new frmXuLyKiemKeKho(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } ///------------------------------------------------------------------- if (names == "DonDatHang_HangHoaTheoKho") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { GiaTriCanLuu.Loaitrave = "DonDatHang_HangHoaTheoKho"; string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string Gia = dgvHieThi.Rows[vitri].Cells[3].Value.ToString(); string banbuon = dgvHieThi.Rows[vitri].Cells[5].Value.ToString(); string banle = dgvHieThi.Rows[vitri].Cells[6].Value.ToString(); string giatrigiatang = dgvHieThi.Rows[vitri].Cells[7].Value.ToString(); GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri = Gia; GiaTriCanLuu.Giatri2 = banbuon; GiaTriCanLuu.TonKho = banle; GiaTriCanLuu.giatrigiatang = giatrigiatang; frmXuLyDonDatHang fr = new frmXuLyDonDatHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HangTraLai_DonDatHangNhaCungCap") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[0].Value.ToString(); string ngay = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); GiaTriCanLuu.Loaitrave = "HangTraLai_DonDatHangNhaCungCap"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = ngay; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "HangTraLai_MaTraLaiNhaCungCap") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string ngay = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); GiaTriCanLuu.Loaitrave = "HangTraLai_MaTraLaiNhaCungCap"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = ngay; frmXuLyHangTraLai fr = new frmXuLyHangTraLai(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "XuLyKhachHang") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string ngay = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); GiaTriCanLuu.Loaitrave = "XuLyKhachHang"; GiaTriCanLuu.Ma = ID; frmXuLyKhachHang fr = new frmXuLyKhachHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } if (names == "DonDatHang_KhachHang") { int x = dgvHieThi.RowCount; int y = dgvHieThi.ColumnCount; if (y <= -1 || x <= -1) { } else { string ID = dgvHieThi.Rows[vitri].Cells[1].Value.ToString(); string Name = dgvHieThi.Rows[vitri].Cells[2].Value.ToString(); string duno = dgvHieThi.Rows[vitri].Cells[4].Value.ToString(); GiaTriCanLuu.Loaitrave = "DonDatHang_KhachHang"; GiaTriCanLuu.Ma = ID; GiaTriCanLuu.Ten = Name; GiaTriCanLuu.Giatri2 = duno; frmXuLyDonDatHang fr = new frmXuLyDonDatHang(); Application.OpenForms[fr.Name].Focus(); this.Close(); } } } catch (Exception ex) { string s = ex.Message.ToString(); } }
private void frmXuLyNhapKho_Load(object sender, EventArgs e) { try { this.GetDate(); frmXuLyNhapKho fr = new frmXuLyNhapKho(); this.cbxHinhthucthanhtoan.Items.AddRange(new object[] { "Tiền mặt", "ATM" }); if (hanhdong == "Insert") { Common.Utilities ck = new Common.Utilities(); string ngay = this.Date.ToString("dd/MM/yyyy"); makNgaydonhang.Text = ngay; makHanthanhtoan.Text = ngay; cbxHinhthucthanhtoan.SelectedIndex = 0; toolStrip_txtNgayhethan.Text = this.Date.ToString("dd/MM/yyyy"); toolStripStatus_Themmoi.Enabled = true; Application.OpenForms[fr.Name].Text = "Thêm đơn nhập kho - F3 Thanh toán - F6 sửa hàng hóa - F9 Sửa giá hàng hóa"; Entities.HienThi_ChiTiet_DonDatHang[] lay = new Entities.HienThi_ChiTiet_DonDatHang[0]; dgvInsertOrder.DataSource = null; dgvInsertOrder.DataSource = lay; DoiTen(dgvInsertOrder); toolStrip_txtTracuu.Focus(); format(); if (Double.Parse(txtThanhtoanngay.Text.Replace(",", "")) == Double.Parse(txtTongThanhToan.Text) && (txtThanhtoanngay.Text.Replace(",", "") != "0")) { lbtinhtrang.Visible = true; lbtinhtrang.Text = "Đã thanh toán"; toolStripStatus_Thanhtoan.Enabled = false; } else { if (txtTongThanhToan.Text == "0" || txtTongThanhToan.Text == "00") { lbtinhtrang.Visible = true; lbtinhtrang.Text = "Chưa thanh toán"; toolStripStatus_Thanhtoan.Enabled = true; } else { lbtinhtrang.Visible = true; lbtinhtrang.Text = "Chưa thanh toán hết"; toolStripStatus_Thanhtoan.Enabled = true; } } getID("HoaDonNhap"); txtSodonhang.Text = makiemtra; toolStripStatus_Thanhtoan.Enabled = false; toolStripStatus_In.Enabled = false; } new Common.Utilities().ComboxKhoHang(cbxKhoHang); LayTenTT(); txtTygia.Text = tigia[0].Giatri2.ToString(); cbxTienTe_TyGia.SelectedIndex = 0; cbxTienTe_TyGia.Enabled = false; if (hanhdong == "Update") { palNhap.Enabled = false; palXem.Enabled = false; Entities.HienThi_ChiTiet_DonDatHang[] lay = new Entities.HienThi_ChiTiet_DonDatHang[0]; dgvInsertOrder.DataSource = null; dgvInsertOrder.DataSource = lay; txtMadondathang.ReadOnly = true; btnTimMadatmuahang.Enabled = false; txtManhacungcap.ReadOnly = true; btnTimnhacungcap.Enabled = false; toolStripStatus_Themmoi.Enabled = false; Application.OpenForms[fr.Name].Text = "Quản lý hóa đơn nhập - Xem hóa đơn nhập <Enter - Thêm hàng hóa, F3 - Thanh toán - F9 Sửa giá hàng hóa>"; DoDuLieu(this.hoadon); toolStripStatus_In.Enabled = true; } } catch { Entities.HienThi_ChiTiet_DonDatHang[] lay = new Entities.HienThi_ChiTiet_DonDatHang[0]; dgvInsertOrder.DataSource = null; dgvInsertOrder.DataSource = lay; DoiTen(dgvInsertOrder); if (txtSodonhang.Text == "") { txtSodonhang.Text = "HDN_0001"; } } }
private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { i = e.RowIndex; if (i < 0) return; try { bool kt = true; string objname = congnochitiet[i].TruongNgam; string madoituong = congnochitiet[i].MaTruongNgam; switch (objname) { case "BanBuon": { kt = false; dtgvngam.DataSource = bb1; int so = 0; for (int j = 0; j < bb1.Length; j++) { if (bb1[j].MaHDBanHang == madoituong) { so = j; kt = true; break; } } if (kt == true) { frmXuLyBanBuon b = new frmXuLyBanBuon("Sua", dtgvngam.Rows[so]); b.ShowDialog(); } break; } case "Thu": { dtgvngam.DataSource = ptc; kt = false; int so = 0; for (int j = 0; j < ptc.Length; j++) { if (ptc[j].MaPhieuThu == madoituong) { so = j; kt = true; break; } } if (kt == true) { frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]); tmptc.ShowDialog(); } break; } case "Chi": { dtgvngam.DataSource = ptc; kt = false; int so = 0; for (int j = 0; j < ptc.Length; j++) { if (ptc[j].MaPhieuThu == madoituong) { so = j; kt = true; break; } } if (kt == true) { frmXuLyPhieuThuChi tmptc = new frmXuLyPhieuThuChi("Chi", "Sua", dtgvngam.Rows[so]); tmptc.ShowDialog(); } break; } case "KHTL": { kt = false; int so = 0; for (int j = 0; j < khtl1.Length; j++) { if (khtl1[j].MaKhachHangTraLai == madoituong) { so = j; kt = true; break; } } if (kt == true) { frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_KhachHangTraLai", "KhachHangTraLai", "Update", khtl1[so]); b.ShowDialog(); } break; } case "HoaDonNhap": { kt = false; int so = 0; for (int j = 0; j < hdn1.Length; j++) { if (hdn1[j].MaHoaDonNhap == madoituong) { so = j; kt = true; break; } } if (kt == true) { frmXuLyNhapKho b = new frmXuLyNhapKho("Update", hdn1[so]); b.ShowDialog(); } break; } case "TLNCC": { kt = false; int so = 0; for (int j = 0; j < tlncc1.Length; j++) { if (tlncc1[j].MaHDTraLaiNCC == madoituong) { so = j; kt = true; break; } } if (kt == true) { frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_TraLaiNhaCungCap", "TraLaiNhaCungCap", "Update", tlncc1[so]); b.ShowDialog(); } break; } case "PhieuTTCuaKH": { kt = false; dtgvngam.DataSource = phieuttcuakh1; int so = 0; for (int j = 0; j < phieuttcuakh1.Length; j++) { if (phieuttcuakh1[j].MaPhieuTTCuaKH == madoituong) { so = j; kt = true; break; } } if (kt == true) { frmXuLyPhieuTTCuaKH b = new frmXuLyPhieuTTCuaKH("Sua", dtgvngam.Rows[so]); b.ShowDialog(); } break; } case "PhieuTTNCC": { kt = false; dtgvngam.DataSource = phieuttncc1; int so = 0; for (int j = 0; j < phieuttncc1.Length; j++) { if (phieuttncc1[j].MaPhieuTTNCC == madoituong) { so = j; kt = true; break; } } if (kt == true) { frmXuLyPhieuTTNCC b = new frmXuLyPhieuTTNCC("Sua", dtgvngam.Rows[so]); b.ShowDialog(); } break; } default: break; } } catch (Exception ex) { } }
private void dtgvhienthi_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { i = e.RowIndex; if (i < 0) return; try { string objname = soquy[i].TruongNgam; string maphieu = soquy[i].MaPhieu; switch (objname) { case "PhieuThu": { dtgvngam.DataSource = pt; int so = 0; for (int j = 0; j < pt.Length; j++) { if (pt[j].MaPhieuThu == maphieu) { so = j; break; } } frmXuLyPhieuThuChi b = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]); b.ShowDialog(); break; } case "PhieuChi": { dtgvngam.DataSource = pc; int so = 0; for (int j = 0; j < pc.Length; j++) { if (pc[j].MaPhieuThu == maphieu) { so = j; break; } } frmXuLyPhieuThuChi b = new frmXuLyPhieuThuChi("Thu", "Sua", dtgvngam.Rows[so]); b.ShowDialog(); break; } case "BanBuon": { dtgvngam.DataSource = bb; int so = 0; for (int j = 0; j < bb.Length; j++) { if (bb[j].MaHDBanHang == maphieu) { so = j; break; } } frmXuLyBanBuon b = new frmXuLyBanBuon("Sua", dtgvngam.Rows[so]); b.ShowDialog(); break; } case "BanLe": { dtgvngam.DataSource = bl; int so = 0; for (int j = 0; j < bl.Length; j++) { if (bl[j].MaHDBanHang == maphieu) { so = j; break; } } frmXuLyBanLe b = new frmXuLyBanLe("Sua", dtgvngam.Rows[so]); b.ShowDialog(); break; } case "HoaDonNhap": { int so = 0; for (int j = 0; j < hdn.Length; j++) { if (hdn[j].MaHoaDonNhap == maphieu) { so = j; break; } } frmXuLyNhapKho b = new frmXuLyNhapKho("Update", hdn[so]); b.ShowDialog(); break; } case "KHTL": { int so = 0; for (int j = 0; j < kh.Length; j++) { if (kh[j].MaKhachHangTraLai == maphieu) { so = j; break; } } frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_KhachHangTraLai", "KhachHangTraLai", "Update", kh[so]); b.ShowDialog(); break; } case "TLNCC": { int so = 0; for (int j = 0; j < tl.Length; j++) { if (tl[j].MaHDTraLaiNCC == maphieu) { so = j; break; } } frmXuLyHangTraLai b = new frmXuLyHangTraLai("Sua_TraLaiNhaCungCap", "TraLaiNhaCungCap", "Update", tl[so]); b.ShowDialog(); break; } default: break; } } catch (Exception ex) { } }