private void Load_timCTNhapHang() { CTPhieuNhap_BUS ctpnBUS = new CTPhieuNhap_BUS(); List <CTPhieuNhap_DTO> listctpn = new List <CTPhieuNhap_DTO>(); listctpn = ctpnBUS.TimCTPhieuNhap(int.Parse(txtMaPN.Text)); dtgCTPN.DataSource = listctpn; }
private void Load_timCTNhapHang() { CTPhieuNhap_BUS ctpnBUS = new CTPhieuNhap_BUS(); List <CTPhieuNhap_DTO> listctpn = new List <CTPhieuNhap_DTO>(); listctpn = ctpnBUS.TimCTPhieuNhap(int.Parse(txtMaPhieuNhap.Text)); dataGridViewQLDSCTHD.DataSource = listctpn; }
private void Load_fromCTNhapHang() { CTPhieuNhap_BUS ctpn = new CTPhieuNhap_BUS(); listctpn = ctpn.LayDanhSachCTPN(); dtgCTPN.SelectionMode = DataGridViewSelectionMode.FullRowSelect; dtgCTPN.RowHeadersVisible = false; dtgCTPN.AutoGenerateColumns = false; dtgCTPN.DataSource = listctpn; }
private void btnLưu_Click(object sender, EventArgs e) { PhieuNhap_DTO npluu = new PhieuNhap_DTO(); npluu.NgayTaoPN = (DateTime)dTPNgayTao.Value; npluu.MaNhanVien = int.Parse(txtTenNV.Text); //npThem.MaPN = int.Parse("1"); npluu.MaNhaCungCap = int.Parse(cbbNCC.SelectedValue.ToString().Trim()); npluu.TongTien = (decimal)long.Parse(txtTongTien.Text); CTPhieuNhap_BUS ctpn = new CTPhieuNhap_BUS(); ctpn.LuuTongTienCTPhieuNhap(int.Parse(txtMaPN.Text)); Load_fromNhapHang(); }
private void btnXoaCTPhieuNhap_Click(object sender, EventArgs e) { if (dataGridViewQLDSCTHD.SelectedRows.Count > 0) { CTPhieuNhap_DTO ctpn = (CTPhieuNhap_DTO)dataGridViewQLDSCTHD.SelectedRows[0].DataBoundItem; if (MessageBox.Show("Bạn có chắc muốn xóa sản phẩm trong Phiếu Nhập " + ctpn.MaPhieuNhap + " không?", "Cảnh báo", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { CTPhieuNhap_BUS pn1 = new CTPhieuNhap_BUS(); pn1.XoaDanhSachCTPN(ctpn); MessageBox.Show("Đã xóa thành công Sản phẩm trong phiếu nhập"); Load_fromCTNhapHang(); } } }
private void btnThemHD_Click(object sender, EventArgs e) { if (txtMaPN.Text.Trim() == "") { MessageBox.Show("Chưa Nhập Mã Phiếu", "Thông Báo", MessageBoxButtons.OK); txtMaPN.Focus(); return; } if (cbbTenNL.Text.Trim() == "") { MessageBox.Show("Chưa Nhập Tên Nguyên Liệu", "Thông Báo", MessageBoxButtons.OK); cbbTenNL.Focus(); return; } if (txtSL.Text.Trim() == "") { MessageBox.Show("Chưa Nhập Số Lượng", "Thông Báo", MessageBoxButtons.OK); txtSL.Focus(); return; } CTPhieuNhap_DTO ctpnThem = new CTPhieuNhap_DTO(); ctpnThem.MaPhieuNhap = int.Parse(txtMaPN.Text); ctpnThem.MaNguyenLieu = int.Parse(cbbTenNL.SelectedValue.ToString()); //npThem.MaPN = int.Parse("1"); ctpnThem.SoLuong = int.Parse(txtSL.Text); ctpnThem.DonGiaCTPN = (decimal)double.Parse(txtDonGia.Text); ctpnThem.ThanhTien = (decimal)double.Parse(txtThanhTien.Text); CTPhieuNhap_BUS ctpn = new CTPhieuNhap_BUS(); ctpn.ThemDanhSachCTPN(ctpnThem, 1); Load_fromCTNhapHang(); double TongTien = double.Parse(txtTongTien.Text); double thanhtien = double.Parse(txtThanhTien.Text); double kq = TongTien + thanhtien; txtTongTien.Text = kq.ToString(); }