Пример #1
0
        // Hiển thị ds sp trong 1 hđ (dgv chi tiết hđ)
        private void disPlayListCTHDToDGV(DataGridView dgv, List <ChiTietHoaDon> list)
        {
            dgv.Rows.Clear();
            dgv.ColumnCount = 4;

            int i = 0;

            foreach (ChiTietHoaDon item in list)
            {
                dgv.Rows.Add();
                // lấy tên sp theo mã
                dgv.Rows[i].Cells[0].Value = spDao.getNameProduct(item.MaSP);
                dgv.Rows[i].Cells[1].Value = item.SoLuongSP;
                // tong tien = so luong * gia
                dgv.Rows[i].Cells[2].Value = (item.SoLuongSP * spDao.getPriceProduct(item.MaSP)) + " VND";
                i++;
            }
        }