private void crystalReportViewer1_Load(object sender, EventArgs e) { DataSet dataSet = new HoaDonDataSet(); DataTable data = BUS.HoaDonBUS.XemHoaDonBaoCao(soHoaDon); //tao khung dataSet.Tables[0].Merge(data); //lấy thông tin HoaDon hoaDon = BUS.HoaDonBUS.LayThongTinHoaDon(soHoaDon); //lấy datable ,list rptHoaDon rpHoaDon = new rptHoaDon(); rpHoaDon.SetDataSource(dataSet); rpHoaDon.DataDefinition.FormulaFields["TenKhachHang"].Text = "'" + hoaDon.TenKhachHang + "'"; rpHoaDon.DataDefinition.FormulaFields["SoDienThoai"].Text = "'" + hoaDon.SoDienThoai + "'"; rpHoaDon.DataDefinition.FormulaFields["GiamGia"].Text = "'" + hoaDon.GiamGia + "'"; rpHoaDon.DataDefinition.FormulaFields["TienGio"].Text = "'" + hoaDon.TienGio + "'"; rpHoaDon.DataDefinition.FormulaFields["GioBatDau"].Text = "'" + hoaDon.GioVao + "'"; rpHoaDon.DataDefinition.FormulaFields["GioKetThuc"].Text = "'" + hoaDon.GioRa + "'"; rpHoaDon.DataDefinition.FormulaFields["Phong"].Text = "'" + hoaDon.MaPhong + "'"; crystalReportViewer1.ReportSource = rpHoaDon; }
private void pictureBox2_Click(object sender, EventArgs e) { rptHoaDon rpt = new rptHoaDon(); rpt.ShowPreviewDialog(); }