private void displayHD(DataGridView dgv, List <HoaDon> list) { dgv.Rows.Clear(); dgv.ColumnCount = 4; int i = 0; foreach (HoaDon item in list) { dgv.Rows.Add(); dgv.Rows[i].Cells[0].Value = item.MaHD; dgv.Rows[i].Cells[1].Value = nvDao.GetNameNhanVien(item.MaNV); dgv.Rows[i].Cells[2].Value = item.NgayLap.Split(null)[0]; dgv.Rows[i].Cells[3].Value = item.TongTienHD + " VND"; i++; } }
// hiển thị dshđ gồm vào dgv private void displayHD(DataGridView dgv, List <HoaDon> list) { dgv.Rows.Clear(); dgv.ColumnCount = 4; // 4 cột int i = 0; foreach (HoaDon item in list) { dgv.Rows.Add(); dgv.Rows[i].Cells[0].Value = "HD" + item.MaHD; dgv.Rows[i].Cells[1].Value = nvDao.GetNameNhanVien(item.MaNV); // l // split tác chuỗi vì trong mã hđ có số tự tăng và ngày lập hđ dgv.Rows[i].Cells[2].Value = item.NgayLap.Split(null)[0]; dgv.Rows[i].Cells[3].Value = item.TongTienHD + " VND"; i++; } }
// hiển thị ds sp trong dgv private void displayListTodgv(DataGridView dgv, List <SPTK> list) { dgv.Rows.Clear(); dgv.ColumnCount = 6; int i = 0; foreach (SPTK item in list) { dgv.Rows.Add(); dgv.Rows[i].Cells[0].Value = item.Tensp; dgv.Rows[i].Cells[1].Value = item.slnhap; dgv.Rows[i].Cells[2].Value = item.dongianhap + " đ"; dgv.Rows[i].Cells[3].Value = item.tongtien + " đ"; dgv.Rows[i].Cells[4].Value = nvDao.GetNameNhanVien(item.tennvnhap); dgv.Rows[i].Cells[5].Value = item.ngaynhap.Split(' ')[0]; i++; } }