//Used for showing simple report public void ShowSimple() { using (ReportClass rptH = new ReportClass()) { rptH.FileName = Server.MapPath("~/") + "//Rpts//simple.rpt"; rptH.Load(); rptH.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport"); } }
//Used for showing simple report public void ShowSimple() { using (ReportClass reportClass = new ReportClass()) { var productList = _db.Products.ToList().Select(x => new ProductViewModel { ProductId = x.ProductId, ProductName = x.Name, ProductPrice = x.Price }); reportClass.FileName = Server.MapPath("~/") + "//CrystalReports//simple.rpt"; reportClass.SetDataSource(productList); reportClass.Load(); reportClass.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crystalReport"); } }
//Used for showing simple report public void ShowSimple() { using (ReportClass reportClass = new ReportClass()) { var productList = _db.Products.ToList().Select(x => new ProductViewModel { ProductId = x.ProductId, ProductName = x.Name, ProductPrice = x.Price }); reportClass.FileName = Server.MapPath("~/") + "//CrystalReports//simple.rpt"; reportClass.SetDataSource(productList); reportClass.Load(); reportClass.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crystalReport"); } }
// GET: /Management/Reports/ReportManagementReportSummaryReport public void ReportManagementReportSummaryReport() { using (ReportClass rptH = new ReportClass()) { rptH.FileName = Server.MapPath("~/Areas/Management/Reports/rptSupplierWiseInvestment.rpt"); var rptSource = System.Web.HttpContext.Current.Session["rptSource"]; if (rptSource != null) { rptH.Load(); rptH.SetDataSource(rptSource); rptH.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "SupplierWiseInvestmentReport_" + System.DateTime.Now.ToString("ddmmyyyy")); } Session["rptSource"] = null; } }
// GET: Account/AccountingReport/GlDateWiseTransactionReport public void GlDateWiseTransactionReport() { using (ReportClass rptH = new ReportClass()) { rptH.FileName = Server.MapPath("~/Areas/Account/AccountingReport/rptGLWiseTransactionReport.rpt"); var rptSource = System.Web.HttpContext.Current.Session["rptSource"]; if (rptSource != null) { rptH.Load(); rptH.SetDataSource(rptSource); rptH.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport"); } Session["rptSource"] = null; } }
public void SaleInvoiceReport() { using (ReportClass rptH = new ReportClass()) { rptH.FileName = Server.MapPath("~/Areas/Inventory/ReportsEverything/Reports/SaleInvoice.rpt"); //var rptSource = _db.spSaleInvoice().ToList(); var rptSource = System.Web.HttpContext.Current.Session["rptSource"]; if (rptSource != null) { rptH.Load(); rptH.SetDataSource(rptSource); rptH.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport"); } Session["rptSource"] = null; } }
// GET: Account/AccountingReport/DateWiseTransactionReport public void DateWiseTransactionReport() { using (ReportClass rptH = new ReportClass()) { rptH.FileName = Server.MapPath("~/Areas/Account/AccountingReport/rptDateWiseTransaction.rpt"); var rptSource = System.Web.HttpContext.Current.Session["rptSource"]; DateTime startDate = Convert.ToDateTime(Session["FromDate"]); DateTime endDate = Convert.ToDateTime(Session["ToDate"]); if (rptSource != null) { rptH.Load(); rptH.SetDataSource(rptSource); rptH.SetParameterValue("FromDate", startDate); rptH.SetParameterValue("ToDate", endDate); rptH.ExportToHttpResponse(ExportFormatType.PortableDocFormat, System.Web.HttpContext.Current.Response, false, "crReport"); } Session["rptSource"] = null; Session["FromDate"] = null; Session["ToDate"] = null; } }
protected void Page_Load(object sender, EventArgs e) { try { using (var db = new BaseDataContext()) { db.CommandTimeout = 600; queryEncrypt = Request.QueryString["q"] ?? string.Empty; query = string.Empty; filtros = new string[0]; rpt = string.Empty; tipo = string.Empty; if (queryEncrypt != string.Empty) { var dadoEncriptado = CryptoServiceHelper.UrlHelper.UrlTokenDecode(queryEncrypt); query = CryptoServiceHelper.RijndaelHelper.Default.Decrypt(dadoEncriptado); dadoEncriptado = null; filtros = query.Split('&'); rpt = RecuperaValor(filtros, "RPT"); tipo = RecuperaValor(filtros, "Tipo"); } else { rpt = Request.QueryString["RPT"].ToString(); tipo = Request.QueryString["Tipo"].ToString(); } if (rpt == "ListaDeBancos" && tipo == "Excel") { using (cr = new ListaDeBancos()) { Funcoes.ConfiguraReport(cr); cr.ExportToHttpResponse(tipo == "PDF" ? ExportFormatType.PortableDocFormat : ExportFormatType.Excel, Response, tipo == "Excel", rpt); } } else if (rpt == "ListaDeContas" && tipo == "Excel") { using (cr = new ListaDeContas()) { Funcoes.ConfiguraReport(cr); cr.ExportToHttpResponse(tipo == "PDF" ? ExportFormatType.PortableDocFormat : ExportFormatType.Excel, Response, tipo == "Excel", rpt); } } else if (rpt == "ListaDeMoedas" && tipo == "Excel") { using (cr = new ListaDeMoedas()) { Funcoes.ConfiguraReport(cr); cr.ExportToHttpResponse(tipo == "PDF" ? ExportFormatType.PortableDocFormat : ExportFormatType.Excel, Response, tipo == "Excel", rpt); } } else if (rpt == "ListaDeTransacoes" && tipo == "Excel") { using (cr = new ListaDeTransacoes()) { Funcoes.ConfiguraReport(cr); cr.ExportToHttpResponse(tipo == "PDF" ? ExportFormatType.PortableDocFormat : ExportFormatType.Excel, Response, tipo == "Excel", rpt); } } else if (rpt == "ListaDeUsuarios" && tipo == "Excel") { using (cr = new ListaDeUsuarios()) { Funcoes.ConfiguraReport(cr); cr.ExportToHttpResponse(tipo == "PDF" ? ExportFormatType.PortableDocFormat : ExportFormatType.Excel, Response, tipo == "Excel", rpt); } } } } catch (Exception ex) { //String exDetail = String.Format("Exception message: {0}{1}Exception Source: {2}{1}Exception StackTrace: {3}{1}", ex.Message, Environment.NewLine, ex.Source, ex.StackTrace); } }