private void btnAddProductExportDetail_Click(object sender, EventArgs e) { try { if (cmbIDBillExportDetail.Text == "" || cmbIDProductDetailStore.Text == "" || txtAmountOfProductExportDetail.Text == "") { XtraMessageBox.Show("Bạn phải điền đầy đủ thông tin !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ChiTietHoaDonBan_DTO phieunhap = new ChiTietHoaDonBan_DTO(); phieunhap.MaHDB = cmbIDBillExportDetail.Text; phieunhap.MaSPCH = cmbIDProductDetailStore.Text; if (txtAmountOfProductExportDetail.Text == "") { phieunhap.SoLuong = 0; } else { phieunhap.SoLuong = Convert.ToInt32(txtAmountOfProductExportDetail.Text.ToString()); } phieunhap.DonViTinh = cmbUnitCalculator.Text; phieunhap.SoLuongMuaLe = Convert.ToInt32(txtRetail.Text.ToString()); if (cbRetail.Checked == true) { phieunhap.HinhThucBan = 1; } else { phieunhap.HinhThucBan = 0; } if (ChiTietHoaDonBan_BUS.ThemChiTietPHBan(phieunhap)) { LoadPhieuBanHang(); LoadChiTietPhieuBanHang(); uctSanPhamCH.uctSPCH.LoadSanPhamCH1(); XtraMessageBox.Show("Thêm chi tiết hóa đơn bán hàng thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearDisplay1(); return; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void btnUpdateProductExportDetail_Click(object sender, EventArgs e) { try { if (cmbIDBillExportDetail.Text == "" || cmbIDProductDetailStore.Text == "" || txtAmountOfProductExportDetail.Text == "") { XtraMessageBox.Show("Bạn phải chọn chi tiết phiếu cần chỉnh sửa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (cmbIDBillExportDetail.Text != (string)dtgvDetailBillSale.CurrentRow.Cells["MaHDB1"].Value || cmbIDProductDetailStore.Text != (string)dtgvDetailBillSale.CurrentRow.Cells["MaSPCH"].Value) { XtraMessageBox.Show("Chi tiết hóa đơn bán hàng cập nhật thất bại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } ChiTietHoaDonBan_DTO phieunhap = new ChiTietHoaDonBan_DTO(); phieunhap.MaHDB = (string)dtgvDetailBillSale.CurrentRow.Cells["MaHDB1"].Value; phieunhap.MaSPCH = (string)dtgvDetailBillSale.CurrentRow.Cells["MaSPCH"].Value; phieunhap.SoLuong = Convert.ToInt32(txtAmountOfProductExportDetail.Text.ToString()); phieunhap.DonViTinh = cmbUnitCalculator.Text; if (cbRetail.Checked == true) { phieunhap.HinhThucBan = 1; phieunhap.SoLuongMuaLe = Convert.ToInt32(txtRetail.Text.ToString()); } else { phieunhap.HinhThucBan = 0; phieunhap.SoLuongMuaLe = 0; } if (ChiTietHoaDonBan_BUS.SuaChiTietPHBan(phieunhap)) { LoadPhieuBanHang(); LoadChiTietPhieuBanHang(); uctSanPhamCH.uctSPCH.LoadSanPhamCH1(); XtraMessageBox.Show("Chi tiết hóa đơn bán hàng cập nhật thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearDisplay1(); return; } }catch { XtraMessageBox.Show("Chi tiết hóa đơn bán hàng cập nhật thất bại !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void frmChiTietHoaDonBan_Load(object sender, EventArgs e) { ChiTietHoaDonBan_BUS cTHDB_BUS = new ChiTietHoaDonBan_BUS(); dsCTHDB = cTHDB_BUS.LayDanhSach(); dataGridViewCTHDB.DataSource = dsCTHDB; dataGridViewCTHDB.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dataGridViewCTHDB.Columns["MAHDB"].HeaderText = "Mã Hoá Đơn Bán"; dataGridViewCTHDB.Columns["MAHH"].HeaderText = "Mã Hàng Hoá"; dataGridViewCTHDB.Columns["SOLUONG"].HeaderText = "Số Lượng"; dataGridViewCTHDB.Columns["KHUYENMAI"].HeaderText = "Khuyến Mại (%)"; dataGridViewCTHDB.Columns["GIAMGIA"].HeaderText = "Giảm Giá"; dataGridViewCTHDB.Columns["THANHTIEN"].HeaderText = "Thành Tiền"; dataGridViewCTHDB.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; }
private void txtAmountOfProductExportDetail_TextChanged(object sender, EventArgs e) { int num; if (txtAmountOfProductExportDetail.Text == "") { num = 0; } else { num = Convert.ToInt32(txtAmountOfProductExportDetail.Text.ToString()); } int num1 = Convert.ToInt32(ChiTietHoaDonBan_BUS.SoLuongMax(cmbIDProductDetailStore.Text.ToString())); if (num < 0) { XtraMessageBox.Show("Số lượng sản phẩm nhỏ hơn 0 !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } if (num > num1) { XtraMessageBox.Show("Sản phẩm trong Cửa hàng không đủ !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void cmbIDProductDetailStore_TextChanged_1(object sender, EventArgs e) { cmbUnitCalculator.Text = ChiTietHoaDonBan_BUS.TimDonViSanPham(cmbIDProductDetailStore.Text.ToString()); }
private void btnDeleteProductExportDetail_Click(object sender, EventArgs e) { try { if (cmbIDBillExportDetail.Text == "" || cmbIDProductDetailStore.Text == "" || txtAmountOfProductExportDetail.Text == "") { XtraMessageBox.Show("Bạn phải chọn chi tiết phiếu cần xóa", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } ChiTietHoaDonBan_DTO phieunhap = new ChiTietHoaDonBan_DTO(); phieunhap.MaHDB = (string)dtgvDetailBillSale.CurrentRow.Cells["MaHDB1"].Value; phieunhap.MaSPCH = cmbIDProductDetailStore.Text; if (ChiTietHoaDonBan_BUS.XoaChiTietPHBan(phieunhap)) { LoadPhieuBanHang(); LoadChiTietPhieuBanHang(); uctSanPhamCH.uctSPCH.LoadSanPhamCH1(); XtraMessageBox.Show("Chi tiết phiếu Bán hàng xóa thành công !", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); ClearDisplay1(); if (dtgvDetailBillSale.Rows.Count == 0) { dtgvDetailBillSale.ColumnCount = 6; dtgvDetailBillSale.ColumnHeadersVisible = true; dtgvDetailBillSale.Columns[0].Name = "MaHDB1"; dtgvDetailBillSale.Columns[1].Name = "MaSPCH"; dtgvDetailBillSale.Columns[2].Name = "SoLuong"; dtgvDetailBillSale.Columns[3].Name = "DonViTinh"; dtgvDetailBillSale.Columns[4].Name = "HinhThucBan"; dtgvDetailBillSale.Columns[5].Name = "SoLuongMuaLe"; dtgvDetailBillSale.Columns[0].DataPropertyName = "MaHDB"; dtgvDetailBillSale.Columns[1].DataPropertyName = "MaSPCH"; dtgvDetailBillSale.Columns[2].DataPropertyName = "SoLuong"; dtgvDetailBillSale.Columns[3].DataPropertyName = "DonViTinh"; dtgvDetailBillSale.Columns[4].DataPropertyName = "HinhThucBan"; dtgvDetailBillSale.Columns[5].DataPropertyName = "SoLuongMuaLe"; dtgvDetailBillSale.Columns[0].HeaderText = "Mã HDB"; dtgvDetailBillSale.Columns[1].HeaderText = "Mã SPCH"; dtgvDetailBillSale.Columns[2].HeaderText = "Số lượng"; dtgvDetailBillSale.Columns[3].HeaderText = "Đơn vị tính"; dtgvDetailBillSale.Columns[4].HeaderText = "Hình thức bán"; dtgvDetailBillSale.Columns[5].HeaderText = "Số lượng mua lẻ"; dtgvDetailBillSale.Columns[0].Width = 75; dtgvDetailBillSale.Columns[1].Width = 80; dtgvDetailBillSale.Columns[2].Width = 75; dtgvDetailBillSale.Columns[3].Width = 85; dtgvDetailBillSale.Columns[4].Width = 100; dtgvDetailBillSale.Columns[5].Width = 120; } return; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void LoadChiTietPhieuBanHang() { List <ChiTietHoaDonBan_DTO> listChiTietPhieuBan = ChiTietHoaDonBan_BUS.LoadChiTietPhieuBan(); dtgvDetailBillSale.DataSource = listChiTietPhieuBan; }