private void icoBtnPrint_Click(object sender, EventArgs e) { var cmdText = ""; var unit = ""; if (cboLuaChon.SelectedValue.Equals("Month")) { cmdText = "select MONTH(NgayLap) as Unit, sum(TongTien) as Value From HOA_DON group by(MONTH(NgayLap))"; unit = "Tháng"; } if (cboLuaChon.SelectedValue.Equals("Quarter")) { cmdText = "select datepart(QUARTER,NgayLap) as Unit, sum(TongTien) as Value From HOA_DON group by(datepart(QUARTER,NgayLap))"; unit = "Quý"; } if (cboLuaChon.SelectedValue.Equals("Year")) { cmdText = "select YEAR(NgayLap) as Unit, sum(TongTien) as Value From HOA_DON group by(YEAR(NgayLap))"; unit = "Năm"; } DataSet ds = GetData(cmdText); ClassReport.ReportDataDoanhThu dt = new ClassReport.ReportDataDoanhThu(); FormReport.ReportDoanhThu Frm = new FormReport.ReportDoanhThu(unit); Frm.DataSource = ds.Tables["Data"]; frmReportViewer Rpv = new frmReportViewer(Frm); Rpv.ShowDialog(); }
public frmReportViewer(FormReport.ReportDoanhThu frm) { InitializeComponent(); FormDT = frm; load(); }