public static void getCarga(string FilePath, string rptPath, DataSet ds, Tarima_almacen_carga o) { try { CultureInfo ci = new CultureInfo("es-MX"); ReportDocument reporte = new ReportDocument(); reporte.Load(rptPath); foreach (Tarima_almacen_carga_format itemTACf in o.PLstTACRpt) { DataRow dr = ds.Tables["carga"].NewRow(); dr["folio_remision"] = itemTACf.Folio_remision; dr["codigo"] = itemTACf.Mercancia_codigo; dr["rr"] = itemTACf.Rr; dr["folio_tarima"] = itemTACf.Folio_tarima; dr["estandar"] = itemTACf.Estandar; dr["bultos"] = itemTACf.Bultos; dr["piezas"] = itemTACf.Piezas; ds.Tables["carga"].Rows.Add(dr); } reporte.SetDataSource(ds.Tables["carga"]); reporte.SetParameterValue("folio", o.Folio_orden_carga); //Datos de la cita de trafico reporte.SetParameterValue("folio_cita", o.PTarAlmTrafico.Folio_cita); reporte.SetParameterValue("fecha_cita", o.PTarAlmTrafico.Fecha_solicitud.ToString("dd \\de MMM \\de yyyy", ci)); reporte.SetParameterValue("hora_cita", o.PTarAlmTrafico.Hora_cita); reporte.SetParameterValue("destino", o.PTarAlmTrafico.PSalidaDestino.Destino); reporte.SetParameterValue("linea_transporte", o.PTarAlmTrafico.PTransporte.Nombre); reporte.SetParameterValue("tipo_transporte", o.PTarAlmTrafico.PTransporteTipo.Nombre); reporte.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, FilePath); } catch { throw; } }
private void printReport(string rpt) { string path = string.Empty; string pathImg = string.Empty; string virtualPath = string.Empty; string RptFileName = string.Empty; string TemplatePath = string.Empty; bool withDet = true; object obj; int id = 0; dsReport ds = new dsReport(); switch (rpt) { case "entradaAlm": obj = (Entrada)Session["SEntrada"]; if (obj == null) { id = Convert.ToInt32(Request["_key"].ToString()); withDet = Convert.ToBoolean(Request["_wdet"].ToString()); obj = EntradaCtrl.EntradaGetAllDataById(id); } RptFileName = ((Entrada)obj).Folio + ((Entrada)obj).Folio_indice + ".pdf"; path = HttpContext.Current.Server.MapPath("~/rpt/entradasAlm/") + RptFileName; //pathImg = HttpContext.Current.Server.MapPath("~/images/logo.jpg"); if (((Entrada)obj).IsActive) { TemplatePath = HttpContext.Current.Server.MapPath("~/report/Almacen/ealm.rpt"); } else { TemplatePath = HttpContext.Current.Server.MapPath("~/report/Almacen/ealmCan.rpt"); } string TemplatePathTarima = HttpContext.Current.Server.MapPath("~/rpt/TemplatePallet.pdf"); DocEntrada.getEntradaAlm(path, TemplatePath, TemplatePathTarima, (Entrada)obj, ds, withDet); //this.getRpt(path, TemplatePath, (Entrada)obj, ds); //ReportDocument reporte = new ReportDocument(); //reporte.Load(HttpContext.Current.Server.MapPath("~/report/Almacen/EntradaAlm.rpt")); //reporte.SetParameterValue("direccion_bodega", "Luisa 208, col. Nativitas, Benito Juárez. C.P. 03500. México, CDMX"); ////reporte.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, Response, false, "Test"); //reporte.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, path); ////VisorCR.ReportSource = reporte; ShowPdf(path); break; case "remision": id = Convert.ToInt32(Request["_key"].ToString()); Tarima_almacen_remision o = AlmacenCtrl.tarimaRemisionGetAllInfoById(id); RptFileName = o.Folio + ".pdf"; path = HttpContext.Current.Server.MapPath("~/rpt/remisionAlm/") + RptFileName; TemplatePath = HttpContext.Current.Server.MapPath("~/report/Almacen/ralm.rpt"); ControlRptAlmacen.getRemision(path, TemplatePath, ds, o); ShowPdf(path); break; case "carga": id = Convert.ToInt32(Request["_key"].ToString()); Tarima_almacen_carga oTAC = AlmacenCtrl.CargaRpt(id); RptFileName = oTAC.Folio_orden_carga + ".pdf"; path = HttpContext.Current.Server.MapPath("~/rpt/cargaAlm/") + RptFileName; TemplatePath = HttpContext.Current.Server.MapPath("~/report/Almacen/Carga.rpt"); ControlRptAlmacen.getCarga(path, TemplatePath, ds, oTAC); ShowPdf(path); break; case "salidaAlm": id = Convert.ToInt32(Request["_key"].ToString()); obj = SalidaCtrl.SalidaGetAllDataById(id); RptFileName = ((Salida)obj).Folio + ((Salida)obj).Folio_indice + ".pdf"; path = HttpContext.Current.Server.MapPath("~/rpt/salidasAlm/") + RptFileName; AlmacenCtrl.CargaSetSalida(((Salida)obj)); //pathImg = HttpContext.Current.Server.MapPath("~/images/logo.jpg"); if (((Salida)obj).IsActive) { TemplatePath = HttpContext.Current.Server.MapPath("~/report/Almacen/salm.rpt"); } else { TemplatePath = HttpContext.Current.Server.MapPath("~/report/Almacen/salmCan.rpt"); } DocSalida.getSalidaAlm(path, TemplatePath, (Salida)obj, ds); ShowPdf(path); break; case "salidaAlmXls": id = Convert.ToInt32(Request["_key"].ToString()); obj = SalidaCtrl.SalidaGetAllDataById(id); RptFileName = ((Salida)obj).Folio + ((Salida)obj).Folio_indice + ".xls"; path = HttpContext.Current.Server.MapPath("~/rpt/salidasAlm/") + RptFileName; AlmacenCtrl.CargaSetSalida(((Salida)obj)); if (((Salida)obj).IsActive) { TemplatePath = HttpContext.Current.Server.MapPath("~/report/Almacen/salm.rpt"); DocSalida.getSalidaAlmXls(path, TemplatePath, (Salida)obj, ds); } ShowXls(path, RptFileName); break; } }