private void toolIn_Click(object sender, EventArgs e) { DataRowView row = (DataRowView)bindingNavigator.BindingSource.Current; if (row != null) { PhieuNhapController ctrlPN = new PhieuNhapController(); String ma_phieu = row["ID"].ToString(); CuahangNongduoc.BusinessObject.PhieuNhap ph = ctrlPN.LayPhieuNhap(ma_phieu); frmInPhieuNhap PhieuNhap = new frmInPhieuNhap(ph); PhieuNhap.Show(); } }
private void toolSavePrint_Click(object sender, EventArgs e) { if (status != Controll.Normal) { MessageBox.Show("Vui lòng lưu lại Phiếu nhập hiện tại!", "Phieu Nhap", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { String ma_phieu = txtMaPhieu.Text; PhieuNhapController ctrlPN = new PhieuNhapController(); CuahangNongduoc.BusinessObject.PhieuNhap ph = ctrlPN.LayPhieuNhap(ma_phieu); frmInPhieuNhap PhieuNhap = new frmInPhieuNhap(ph); PhieuNhap.Show(); } }
void ThemMoi() { DataRow row = ctrl.NewRow(); row["ID"] = txtMaPhieu.Text; row["NGAY_NHAP"] = dtNgayNhap.Value.Date; row["TONG_TIEN"] = numTongTien.Value; row["ID_NHA_CUNG_CAP"] = cmbNhaCungCap.SelectedValue; row["DA_TRA"] = numDaTra.Value; row["CON_NO"] = numConNo.Value; ctrl.Add(row); PhieuNhapController ctrlPN = new PhieuNhapController(); if (ctrlPN.LayPhieuNhap(txtMaPhieu.Text) != null) { MessageBox.Show("Mã Phiếu nhập này đã tồn tại !", "Phieu Nhap", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ThamSo.LaSoNguyen(txtMaPhieu.Text)) { long so = Convert.ToInt64(txtMaPhieu.Text); if (so >= ThamSo.LayMaPhieuNhap()) { ThamSo.GanMaPhieuNhap(so + 1); } } ctrl.Save(); ctrlMaSP.Save(); SanPhamController ctrlSP = new SanPhamController(); foreach (DataGridViewRow view in dataGridView.Rows) { ctrlSP.CapNhatGiaNhap(Convert.ToString(view.Cells["colSanPham"].Value), Convert.ToInt64(view.Cells["colDonGiaNhap"].Value), Convert.ToInt64(view.Cells["colSoLuong"].Value)); } }