private void rptPDF_Ingresos(String Reporte, object[] Parametros, string NombreReporte) { System.Web.UI.Page p = new System.Web.UI.Page(); CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); try { ConnectionInfo connectionInfo = new ConnectionInfo(); p = new System.Web.UI.Page(); report.Load(p.Server.MapPath("~") + "\\" + Reporte); for (int i = 0; i <= Parametros.Length - 1; i++) { report.SetParameterValue(i, Parametros[i]); } connectionInfo.ServerName = "dsia"; connectionInfo.UserID = "ingresos"; connectionInfo.Password = "******"; SetDBLogonForReport(connectionInfo, report); report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, NombreReporte); } catch (Exception ex) { throw new Exception(ex.Message); } finally { CR_Reportes.ReportSource = report; report.Close(); report.Dispose(); CR_Reportes.Dispose(); GC.Collect(); } }
private void rptPDFReferencia(String Reporte, String Nombre, String Referencia) { System.Web.UI.Page p = new System.Web.UI.Page(); CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); try { // ConnectionInfo connectionInfo = new ConnectionInfo(); //string J = System.AppDomain.CurrentDomain.BaseDirectory + Reporte; report.Load(p.Server.MapPath("~") + Reporte); //report.Load(System.AppDomain.CurrentDomain.BaseDirectory + Reporte); report.SetParameterValue(0, Referencia); report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "FichaReferenciada-" + Nombre.Substring(0, 15)); } catch (Exception ex) { } finally { CR_Reportes.ReportSource = report; report.Close(); report.Dispose(); CR_Reportes.Dispose(); GC.Collect(); } }
private void rptPDF(String Reporte, String Nombre, String Referencia, Double Importe, String Vigencia, String Concepto, String Observaciones) { System.Web.UI.Page p = new System.Web.UI.Page(); CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); try { // ConnectionInfo connectionInfo = new ConnectionInfo(); //string J = System.AppDomain.CurrentDomain.BaseDirectory + Reporte; report.Load(p.Server.MapPath("~") + Reporte); //report.Load(System.AppDomain.CurrentDomain.BaseDirectory + Reporte); report.SetParameterValue(0, Nombre); report.SetParameterValue(1, Referencia); report.SetParameterValue(2, Importe); report.SetParameterValue(3, Vigencia); report.SetParameterValue(4, Concepto); report.SetParameterValue(5, Observaciones); report.PrintOptions.PaperSize = PaperSize.PaperLetter; //connectionInfo.ServerName = "ucad"; //connectionInfo.UserID = "ingresos"; //connectionInfo.Password = "******"; //SetDBLogonForReport(connectionInfo, report); //string archivo = p.Server.MapPath("~") + "/ArchivoReferencia/Referencia - " + Referencia + ".PDF"; //report.ExportToDisk(ExportFormatType.PortableDocFormat, archivo); // "FichaReferenciada-" + Nombre.Substring(0, 15)); report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "Referencia - " + Referencia); } catch (Exception ex) { } finally { CR_Reportes.ReportSource = report; report.Close(); report.Dispose(); CR_Reportes.Dispose(); CR_Reportes = null; GC.Collect(); } }
private void rptReporte_FE(String Reporte, object[] Valores) { System.Web.UI.Page p = new System.Web.UI.Page(); CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); try { ConnectionInfo connectionInfo = new ConnectionInfo(); p = new System.Web.UI.Page(); report.Load(p.Server.MapPath("~") + "\\" + Reporte); for (int i = 0; i <= Valores.Length - 1; i++) { report.SetParameterValue(i, Valores[i]); } report.PrintOptions.PaperSize = PaperSize.PaperLetter; connectionInfo.ServerName = "dsia"; connectionInfo.UserID = "felectronica"; connectionInfo.Password = "******"; SetDBLogonForReport(connectionInfo, report); report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "RepComprobanteFiscal"); //CR_Reportes.ReportSource = report; //report.Close(); //report.Dispose(); } catch (Exception ex) { } finally { //CR_Reportes.Dispose(); CR_Reportes.ReportSource = report; report.Close(); report.Dispose(); CR_Reportes.Dispose(); GC.Collect(); } }
protected void Page_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); DataTable dt = new DataTable(); crvReporte.Visible = true; string fechainicial = Request.QueryString["fechainicial"].ToString(); string fechafinal = Request.QueryString["fechafinal"].ToString(); string idsede = Request.QueryString["idsede"].ToString(); string idproyecto = Request.QueryString["idproyecto"].ToString(); string idestado = Request.QueryString["idestado"].ToString(); ds = objPedidoDAO.ListarReportePedidos(AppUtilidad.stringToDateTime(fechainicial, "DD/MM/YYYY"), AppUtilidad.stringToDateTime(fechafinal, "DD/MM/YYYY"), Convert.ToInt32(idsede), Convert.ToInt32(idproyecto), idestado); dt = ds.Tables[0]; CrystalDecisions.CrystalReports.Engine.ReportDocument rDoc; rDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rDoc.Load(Server.MapPath("rptReportePedidos.rpt")); // Your .rpt file path rDoc.SetDataSource(dt); //set dataset to the report viewer. rDoc.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "Listado"); }
private void rptPDF2(String Reporte, string Evento, string Matricula) { ConnectionInfo connectionInfo = new ConnectionInfo(); System.Web.UI.Page p = new System.Web.UI.Page(); CrystalDecisions.CrystalReports.Engine.ReportDocument report = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); try { report.Load(p.Server.MapPath("~") + Reporte); report.SetParameterValue(0, Matricula); report.SetParameterValue(1, Evento); report.PrintOptions.PaperSize = PaperSize.PaperLetter; connectionInfo.ServerName = "dsia"; connectionInfo.UserID = "ingresos"; connectionInfo.Password = "******"; SetDBLogonForReport(connectionInfo, report); report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, false, "FichaReferenciada"); //CR_Reportes.ReportSource = report; //report.Close(); //report.Dispose(); } catch (Exception ex) { } finally { //CR_Reportes.ReportSource = report; //CR_Reportes.Dispose(); CR_Reportes.ReportSource = report; report.Close(); report.Dispose(); CR_Reportes.Dispose(); GC.Collect(); } }