protected void btnPrint_Click(object sender, EventArgs e) { ReportDocument report = new ReportDocument(); report.Load(Server.MapPath("MovCR.rpt")); ClubDBEntities club = new ClubDBEntities(); if (depID == 0) { report.SetDataSource(club.getMovReport(date)); } else { report.SetDataSource(club.getMovReport(date, depID)); } ParameterValues pvDate = new ParameterValues(); ParameterDiscreteValue DisDate = new ParameterDiscreteValue(); DisDate.Value = date; pvDate.Add(DisDate); report.DataDefinition.ParameterFields["Date"].ApplyCurrentValues(pvDate); string printer = Properties.Settings.Default.DefaultPrinter; report.PrintOptions.PrinterName = printer; report.PrintToPrinter(1, false, 0, 0); }
protected void btnShow_Click(object sender, EventArgs e) { using (ClubDBEntities club = new ClubDBEntities()) { date = Convert.ToDateTime(tbDate.Text, cul); depID = Convert.ToInt32(ddlDep.SelectedValue); if (ddlDep.SelectedIndex == 0) { var result = club.getMovReport(date); gvIncome.DataSource = result; } else { var result = club.getMovReport(date, depID); gvIncome.DataSource = result; } gvIncome.DataBind(); pnlData.Visible = true; } }