private string ExportarPDF() { DsReportePlanillaTrasbordo reporte = new DsReportePlanillaTrasbordo(); IPlanillaTrasbordo planilla = PlanillaTrasbordoFactory.GetPlanillaTrasbordoFactory(); planilla.PlanillaTrasbordoID = id; reporte = planilla.GetReportePlanillaTrasbordo(); ReportDocument oRD = new ReportDocument(); ExportOptions oExO; DiskFileDestinationOptions oExDo = new DiskFileDestinationOptions(); string nombArchi = "PlanillaTrasbordo_" + id + ".pdf"; string sNombrePDF = Server.MapPath(".") + "/ReportesPDF/" + nombArchi; if (System.IO.File.Exists(sNombrePDF)) { System.IO.File.Delete(sNombrePDF); } oRD.Load(Server.MapPath("." + "/Reportes/PlanillaTrasbordo.rpt")); oRD.SetDataSource(reporte); oExDo.DiskFileName = sNombrePDF; oExO = oRD.ExportOptions; oExO.ExportDestinationType = ExportDestinationType.DiskFile; oExO.ExportFormatType = ExportFormatType.PortableDocFormat; oExO.DestinationOptions = oExDo; oRD.Export(); oRD.Close(); oRD.Dispose(); return(nombArchi); }
public DsReportePlanillaTrasbordo GetReportePlanillaTrasbordo() { try { DsReportePlanillaTrasbordo ds = new DsReportePlanillaTrasbordo(); SqlParameter id = new SqlParameter("@PlanillaTrasbordoID", Utiles.BaseDatos.IntToSql(this.PlanillaTrasbordoID)); Config.Conexion.LlenarTypeDataSet(ds.Reporte, System.Data.CommandType.StoredProcedure, "ReportePlanillaTrasbordoByPlanillaID", id); return(ds); } catch (Exception e) { throw e; } }