private void loadbang() { lstCTHDNhap = CTHDNhap_BUS.LoadCTHDNhap(txMaHD2.Text); dgvCTHDNhap_CT.DataSource = lstCTHDNhap; dgvCTHDNhap_CT.Columns["SMaCTHDN"].Visible = false; dgvCTHDNhap_CT.Columns["SMaSP"].Visible = false; dgvCTHDNhap_CT.Columns["SMaHDN"].Visible = false; }
private void dgvHDNhap_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e) { cbNCC.Items.Clear(); cbNV.Items.Clear(); AddNVToComBox(cbNV); AddNCCToComBox(cbNCC); string str = dgvHDNhap[0, e.RowIndex].Value.ToString(); txMaHD.Text = str; string nv = dgvHDNhap[5, e.RowIndex].Value.ToString(); string ncc = dgvHDNhap[6, e.RowIndex].Value.ToString(); int i = 0; while (cbNV.Items[i].ToString() != nv) { i++; } cbNV.SelectedIndex = i; i = 0; while (cbNCC.Items[i].ToString() != ncc) { i++; } cbNCC.SelectedIndex = i; string ngay = dgvHDNhap[3, e.RowIndex].Value.ToString(); DateTime dt = DateTime.Parse(ngay); dtpNgayNhap.Value = new DateTime(dt.Year, dt.Month, dt.Day); string t = dgvHDNhap[4, e.RowIndex].Value.ToString(); txTongTT.Text = t; List <CTHDNhap_DTO> lstCTHDNhap = CTHDNhap_BUS.LoadCTHDNhap(str); dgvCTHDNhap.DataSource = lstCTHDNhap; dgvCTHDNhap.Columns["SMaCTHDN"].Visible = false; dgvCTHDNhap.Columns["SMaSP"].Visible = false; dgvCTHDNhap.Columns["SMaHDN"].Visible = false; int count = 0; for (i = 0; i < dgvCTHDNhap.Rows.Count; i++) { count += int.Parse(dgvCTHDNhap[4, i].Value.ToString()); } txTongSP.Text = count.ToString(); }
private void dgvHDNhap_DM_CellClick(object sender, DataGridViewCellEventArgs e) { if (rdFillter.Checked && e.RowIndex == dgvHDNhap_DM.Rows.Count - 1) { MessageBox.Show("Dòng này không có dữ liệu"); return; } string str = dgvHDNhap_DM[0, e.RowIndex].Value.ToString(); List <CTHDNhap_DTO> lstCTHDNhap = CTHDNhap_BUS.LoadCTHDNhap(str); dgvCTHDNhap.DataSource = lstCTHDNhap; dgvCTHDNhap.Columns["SMaCTHDN"].Visible = false; dgvCTHDNhap.Columns["SMaSP"].Visible = false; dgvCTHDNhap.Columns["SMaHDN"].Visible = false; int count = 0; for (int i = 0; i < dgvCTHDNhap.Rows.Count; i++) { count += int.Parse(dgvCTHDNhap[4, i].Value.ToString()); } }