protected void btnShow_Click(object sender, EventArgs e) { DateTime date = new DateTime(Convert.ToInt32(ddlYear.SelectedValue), Convert.ToInt32(dllMonth.SelectedValue), 1); using (ClubDBEntities club = new ClubDBEntities()) { var result = club.getIncomeReport(date); gvIncome.DataSource = result; gvIncome.DataBind(); pnlData.Visible = true; } }
protected void btnPrint_Click(object sender, EventArgs e) { ReportDocument report = new ReportDocument(); report.Load(Server.MapPath("IncomeCR.rpt")); ClubDBEntities club = new ClubDBEntities(); DateTime date = new DateTime(Convert.ToInt32(ddlYear.SelectedValue), Convert.ToInt32(dllMonth.SelectedValue), 1); report.SetDataSource(club.getIncomeReport(date)); string printer = Properties.Settings.Default.DefaultPrinter; report.PrintOptions.PrinterName = printer; report.PrintToPrinter(1, false, 0, 0); }