protected void Page_Load(object sender, EventArgs e) { List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"]; var ListaExamenes = (List <string>)Session["objListaExamenes"]; List <string> _filesNameToMerge = new List <string>(); if (!IsPostBack) { _serviceId = ListaServicios[0].IdServicio; var rp = new crConsolidatedReports(); foreach (var com in ListaExamenes) { ChooseReport(rp, com); } var ruta = Server.MapPath("files/CM" + ListaServicios[0].IdServicio + ".pdf"); _filesNameToMerge.Add(ruta); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); Session["EliminarArchivo"] = NewPath; ShowPdf1.FilePath = "files/" + Dif + ".pdf"; //ShowPdf1.FilePath = "files/" + Dif + ".pdf"; //ShowPdf1.FilePath = @"D:\RepSIGSO_v1.0\dev\src\server\webclientadmin\ui\ExternalUser\files\CMN009-SR000000353.pdf"; } }
protected void Page_Load(object sender, EventArgs e) { string rutaReportes = WebConfigurationManager.AppSettings["rutaReportes"]; List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"]; var ListaExamenes = (List <string>)Session["objListaExamenes"]; //Agregar Archivos foreach (var item in ListaServicios) { foreach (var itemExaId in ListaExamenes) { _filesNameToMerge.Add(rutaReportes + item.IdServicio + "-" + itemExaId + ".pdf"); } } var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; //_mergeExPDF.DestinationFile = Application.StartupPath + @"\TempMerge\" + _serviceId + ".pdf"; ; _mergeExPDF.DestinationFile = rutaReportes + "Borrar.pdf";; _mergeExPDF.Execute(); LinkButton objLinkButton = new LinkButton(); objLinkButton.ID = "Borrar";// ListaServicios[0].IdServicio; objLinkButton.Text = ListaServicios[0].Paciente; objLinkButton.Click += new EventHandler(link_Click); DivControls.Controls.Add(objLinkButton); DivControls.Controls.Add(new LiteralControl("<br>")); }
public MessageCustom ReImprimirAdicional(int userId, string serviceId) { MessageCustom _MessageCustom = new MessageCustom(); try { MergeExPDF _mergeExPDF = new MergeExPDF(); #region BuscarPDF var ruta = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["directorioExamAdicional"]); var rutaBasura = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["directorioBasura"]); var datosGrabo = new ServiceDal().DevolverDatosUsuarioFirma(userId); var CMP = datosGrabo == null ? "SIN-PROFESIONAL" : datosGrabo.CMP; List <string> pdfList = new List <string>(); pdfList.Add(string.Format("{0}.pdf", Path.Combine(ruta, serviceId + "-" + "ORDEN-EX-MED-ADICI-" + CMP))); _mergeExPDF.FilesName = pdfList; _mergeExPDF.DestinationFile = string.Format("{0}.pdf", Path.Combine(rutaBasura, "REIMPRESO-" + serviceId + "-" + CMP)); _mergeExPDF.Execute(); _MessageCustom.Id = string.Format("{0}.pdf", Path.Combine("REIMPRESO-" + serviceId + "-" + CMP)); _MessageCustom.Error = false; _MessageCustom.Status = 200; #endregion return(_MessageCustom); } catch (Exception ex) { _MessageCustom.Message = "No existen PDFs por reimprimir."; _MessageCustom.Error = true; _MessageCustom.Status = 500; return(_MessageCustom); } }
private void ShowReport() { List <string> _filesNameToMerge = new List <string>(); OperationResult objOperationResult = new OperationResult(); string ruta = Common.Utils.GetApplicationConfigValue("Interconsulta").ToString(); var aptitudeCertificate = new ServiceBL().GetReportInterconsulta(_serviceId, _Altitud, _Especialidad, _Labor, _Solicita, _Observaciones); //Verificar si el reporte existe en el repositorio string findReportInter = ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + ".pdf"; string[] files = Directory.GetFiles(ruta, "*.pdf"); int strIndex = 0; for (int i = 0; i < files.Length; i++) { strIndex = files[i].IndexOf(findReportInter); if (strIndex >= 0) { File.Copy(findReportInter, ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_antiguo.pdf"); _filesNameToMerge.Add(ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_antiguo.pdf"); } } //Crear el nuevo reporte Interconsulta var rp = new Reports.crReporteInterconsulta(); string RutaReportInterNew = ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_nuevo.pdf"; DataSet ds1 = new DataSet(); DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(aptitudeCertificate); dt.TableName = "dtInterconsulta"; ds1.Tables.Add(dt); DataTable dt1 = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(_Lista); dt1.TableName = "dtDxs"; ds1.Tables.Add(dt1); rp.SetDataSource(ds1); rp.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, RutaReportInterNew); //crystalReportViewer1.ReportSource = rp; //crystalReportViewer1.Show(); //Agregar el nuevo reporte a la lista para unir PDFs _filesNameToMerge.Add(RutaReportInterNew); //Fusionar los reportes de la lista en un solo PDF var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; _mergeExPDF.DestinationFile = ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + ".pdf"; _mergeExPDF.Execute(); _mergeExPDF.RunFile(); //Borrar temporal creadas System.IO.File.Delete(ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_nuevo.pdf"); System.IO.File.Delete(ruta + _serviceId + "-" + aptitudeCertificate[0].Paciente + "_antiguo.pdf"); }
public string BuildReport(List <ComponentsServiceId> data) { var serviceId = data[0].ServiceId; foreach (var component in data) { switch (component.ComponentId) { case BE.Sigesoft.Common.ACCIDENTES_DE_TRABAJO_F1: GenerateAccidentesTrabajoF1(serviceId, component.ComponentId); break; case BE.Sigesoft.Common.ACCIDENTES_DE_TRABAJO_F2: GenerateAccidentesTrabajoF2(serviceId, component.ComponentId); break; } } var reportsPdf = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = reportsPdf; _mergeExPDF.DestinationFile = _ruta + "/" + serviceId + ".pdf"; _mergeExPDF.Execute(); return(serviceId); }
protected void Page_Load(object sender, EventArgs e) { List <string> _filesNameToMerge = new List <string>(); _tempSourcePath = Path.Combine(Server.MapPath("/TempMerge")); List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"]; foreach (var item in ListaServicios) { ReportDocument rp = new ReportDocument(); OperationResult objOperationResult = new OperationResult(); var aptitudeCertificate = new ServiceBL().GetAptitudeCertificate(ref objOperationResult, item.IdServicio).ToList(); DataSet ds = new DataSet(); DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(aptitudeCertificate); dt.TableName = "AptitudeCertificate"; ds.Tables.Add(dt); if (aptitudeCertificate[0].i_EsoTypeId == ((int)TypeESO.Retiro).ToString()) { rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificateRetiros.rpt")); } else { if (aptitudeCertificate[0].i_AptitudeStatusId == (int)AptitudeStatus.AptoObs) { rp.Load(Server.MapPath("cr.CertficadoObservado.rpt")); } else { rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificate.rpt")); } } //rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificate.rpt")); rp.SetDataSource(ds); rp.SetDataSource(ds); var ruta = Server.MapPath("files/CM" + item.IdServicio.ToString() + ".pdf"); _filesNameToMerge.Add(ruta); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); } _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); ShowPdf1.FilePath = "files/" + Dif + ".pdf"; }
private void btnOK_Click(object sender, EventArgs e) { if (txtLabel.Text.Trim() == "") { MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtSubject.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (rbInforme1.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.INFORME_FICHA_MEDICA_TRABAJADOR + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbInforme2.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.INFORME_FICHA_MEDICA_TRABAJADOR_2 + ".pdf"; _filesNameToMerge.Add(o); } } var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; var EmpresaCliente = _EmpresaCliente.Replace("/", "_"); _mergeExPDF.DestinationFile = ruta + "Informes " + EmpresaCliente + ".pdf"; _mergeExPDF.Execute(); EmailBL oEmailBL = new EmailBL(); emailDto oemailDto = new emailDto(); oemailDto.v_Email = txtLabel.Text; OperationResult objOperationResult = new OperationResult(); oEmailBL.AddEmail(ref objOperationResult, oemailDto); this.Enabled = false; _frmWaiting.Show(this); RunWorkerAsyncPackage packageForSave = new RunWorkerAsyncPackage(); packageForSave.NombreEmpresaCliente = _EmpresaCliente; packageForSave.FechaInicio = _FechaInicio; packageForSave.FechaFin = _FechaFin; backgroundWorker1.RunWorkerAsync(packageForSave); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ReportDocument rp = new ReportDocument(); List <string> _filesNameToMerge = new List <string>(); List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"]; if (ListaServicios == null) { Alert.Show("Seleccione un registro"); return; } else { foreach (var item in ListaServicios) { OperationResult objOperationResult = new OperationResult(); var headerRoadMap = _calendarBL.GetHeaderRoadMap(item.CalendarId); var detailRoadMap = _serviceBL.GetServiceComponentsByCategoryExceptLab(ref objOperationResult, item.IdServicio); DataSet ds = new DataSet(); DataTable dtHeader = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(headerRoadMap); DataTable dtDetail = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(detailRoadMap); dtHeader.TableName = "dtHeaderRoadMap"; dtDetail.TableName = "dtDetailRoadMap"; ds.Tables.Add(dtHeader); ds.Tables.Add(dtDetail); rp.Load(Server.MapPath("crRoadMap.rpt")); rp.SetDataSource(ds); var ruta = Server.MapPath("files/HojaRuta-" + item.IdServicio.ToString() + ".pdf"); _filesNameToMerge.Add(ruta); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); } if (ListaServicios.Count != 0) { _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); ShowPdf1.FilePath = "files/" + Dif + ".pdf"; } } } }
private void btnImprimir_Click(object sender, EventArgs e) { using (new LoadingClass.PleaseWait(this.Location, "Generando...")) { DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions(); OperationResult objOperationResult = new OperationResult(); string ruta = Common.Utils.GetApplicationConfigValue("rutaReportes").ToString(); var Lista = new AuthorizedPersonBL().GetAuthorizedPersonPagedAndFiltered(ref objOperationResult, 0, null, null, null); foreach (var item in Lista) { var Cabecera = new CalendarBL().HojaRutaCabecera(item.v_AuthorizedPersonId); var Detalle = new CalendarBL().HojaRutaDetalle(item.v_ProtocolId); var rp = new Reports.crRoadMapCampania(); DataSet ds = new DataSet(); DataTable dtHeader = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Cabecera); DataTable dtDetail = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Detalle); dtHeader.TableName = "dtCabecera"; dtDetail.TableName = "dtDetalle"; ds.Tables.Add(dtHeader); ds.Tables.Add(dtDetail); rp.SetDataSource(ds); rp.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; objDiskOpt = new DiskFileDestinationOptions(); objDiskOpt.DiskFileName = Application.StartupPath + @"\TempMerge\" + Guid.NewGuid().ToString() + ".pdf"; _filesNameToMerge.Add(objDiskOpt.DiskFileName); rp.ExportOptions.DestinationOptions = objDiskOpt; rp.Export(); } var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; //_mergeExPDF.DestinationFile = Application.StartupPath + @"\TempMerge\" + _serviceId + ".pdf"; ; _mergeExPDF.DestinationFile = ruta + "xxx" + ".pdf";; _mergeExPDF.Execute(); _mergeExPDF.RunFile(); } }
protected void Page_Load(object sender, EventArgs e) { List <string> _filesNameToMerge = new List <string>(); List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"]; var ListaExamenes = (List <string>)Session["objListaExamenes"]; for (int i = 0; i < ListaServicios.Count(); i++) { if (ListaExamenes.Count() == 1) { var ruta = Server.MapPath("files/EM" + ListaServicios[i].IdServicio + ".pdf"); _filesNameToMerge.Add(ruta); GeneratePDFOnlyOne(ListaExamenes[0], ruta, ListaServicios[i].IdServicio, ListaServicios[i].IdPaciente, ListaServicios[i].EmpresaCliente); } else { //_filesNameToMerge = new List<string>(); foreach (var item in ListaExamenes) { var ruta1 = Server.MapPath("files/EX-" + ListaServicios[i].IdServicio + "-" + item.ToString() + ".pdf"); _filesNameToMerge.Add(ruta1); GeneratePDF(item, ruta1, ListaServicios[i].IdServicio, ListaServicios[i].IdPaciente, ListaServicios[i].EmpresaCliente); } } } _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); Session["EliminarArchivo"] = NewPath; ShowPdf1.FilePath = "files/" + Dif + ".pdf"; }
protected void btnSaveRefresh_Click(object sender, EventArgs e) { List <string> _filesNameToMerge = new List <string>(); _tempSourcePath = Path.Combine(Server.MapPath("/TempMerge")); var w = (List <string>)Session["objLista"]; foreach (var item in w) { ReportDocument rp = new ReportDocument(); OperationResult objOperationResult = new OperationResult(); var aptitudeCertificate = new ServiceBL().GetAptitudeCertificate(ref objOperationResult, item.ToString()); DataSet ds = new DataSet(); DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(aptitudeCertificate); dt.TableName = "AptitudeCertificate"; ds.Tables.Add(dt); rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificate.rpt")); rp.SetDataSource(ds); rp.SetDataSource(ds); var ruta = Server.MapPath("files/CM" + item.ToString() + ".pdf"); _filesNameToMerge.Add(ruta); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); } _mergeExPDF.FilesName = _filesNameToMerge; _mergeExPDF.DestinationFile = Server.MapPath("files/yyy.pdf"); _mergeExPDF.Execute(); _mergeExPDF.RunFile(); //rp.ExportToHttpResponse(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, //Response, false, "PersonDetails"); }
private void link_Click(object sender, System.EventArgs e) { string rutaReportes = WebConfigurationManager.AppSettings["rutaReportes"]; OperationResult objOperationResult = new OperationResult(); LinkButton senderCtrl = (LinkButton)sender; string path; List <string> _filesNameToMerge = new List <string>(); MergeExPDF _mergeExPDF = new MergeExPDF(); _filesNameToMerge.Add(rutaReportes + Session["ServiceId"].ToString() + "-FMT.pdf"); //_filesNameToMerge.Add(rutaReportes + Session["ServiceId"].ToString() + "-312.pdf"); //_filesNameToMerge.Add(rutaReportes + Session["ServiceId"].ToString() + "-7C.pdf"); var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; _mergeExPDF.DestinationFile = rutaReportes + "Descargar Historia" + ".pdf";// Server.MapPath(@"\TempMerge\" + "Descargar" + ".pdf"); _mergeExPDF.DestinationFile = rutaReportes + "Descargar Historia" + ".pdf"; _mergeExPDF.Execute(); path = rutaReportes + "Descargar Historia" + ".pdf"; Download(senderCtrl.Text, path); }
private void link_Click(object sender, System.EventArgs e) { string rutaReportes = WebConfigurationManager.AppSettings["rutaReportes"]; OperationResult objOperationResult = new OperationResult(); LinkButton senderCtrl = (LinkButton)sender; string path; List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"]; List <string> _filesNameToMerge = new List <string>(); MergeExPDF _mergeExPDF = new MergeExPDF(); foreach (var item in ListaServicios) { _filesNameToMerge.Add(rutaReportes + item.IdServicio.ToString() + "-CAPE.pdf"); } var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; _mergeExPDF.DestinationFile = rutaReportes + "Descargar Certificado" + ".pdf";// Server.MapPath(@"\TempMerge\" + "Descargar" + ".pdf"); _mergeExPDF.DestinationFile = rutaReportes + "Descargar Certificado" + ".pdf"; _mergeExPDF.Execute(); path = rutaReportes + "Descargar Certificado" + ".pdf"; Download(senderCtrl.Text, path); }
private void btnOK_Click(object sender, EventArgs e) { if (txtLabel.Text.Trim() == "") { MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtSubject.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (rb312.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbEmpresarial.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD_EMPRESARIAL + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbSinDx.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD_SIN_DX + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbToxicologico.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.TOXICOLOGICO_ID + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbAltura18.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.ALTURA_ESTRUCTURAL_ID + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbSomnolencia.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.SOMNOLENCIA_ID + ".pdf"; _filesNameToMerge.Add(o); } } var resultado = MessageBox.Show("¿Desea enviar certificados?", "¡ INFORMACIÓN !", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (resultado == DialogResult.Yes) { foreach (var item in _ListaServicios) { _serviceBL.ActualizarEnvioCertificado(item, 1); } } var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; var EmpresaCliente = _EmpresaCliente.Replace("/", "_"); _mergeExPDF.DestinationFile = ruta + "Certificados " + EmpresaCliente + " " + _FechaInicio + " " + _FechaFin + ".pdf"; _mergeExPDF.Execute(); EmailBL oEmailBL = new EmailBL(); emailDto oemailDto = new emailDto(); oemailDto.v_Email = txtLabel.Text; OperationResult objOperationResult = new OperationResult(); oEmailBL.AddEmail(ref objOperationResult, oemailDto); this.Enabled = false; _frmWaiting.Show(this); RunWorkerAsyncPackage packageForSave = new RunWorkerAsyncPackage(); packageForSave.NombreEmpresaCliente = _EmpresaCliente; packageForSave.FechaInicio = _FechaInicio; packageForSave.FechaFin = _FechaFin; backgroundWorker1.RunWorkerAsync(packageForSave); }
private void btnImprimir_Click(object sender, EventArgs e) { if (grdDataAdditionalExam.Rows.Count == 0) { MessageBox.Show("No hay exámenes para imprimir", "VALIDACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var ruta = Common.Utils.GetApplicationConfigValue("rutaExamenesAdicionales").ToString(); var rutaBasura = Common.Utils.GetApplicationConfigValue("rutaReportesBasura").ToString(); string pathFile = ""; string CMP = ""; var openFile = false; using (new LoadingClass.PleaseWait(this.Location, "Cargando...")) { OperationResult objOperationResult = new OperationResult(); var datosGrabo = new ServiceBL().DevolverDatosUsuarioFirma(Globals.ClientSession.i_SystemUserId); CMP = datosGrabo.CMP; pathFile = string.Format("{0}.pdf", Path.Combine(ruta, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + datosGrabo.CMP)); List <Categoria> AdditionalExam = new List <Categoria>(); List <Categoria> DataSource = new List <Categoria>(); List <string> ComponentList = new List <string>(); var ListadditExam = new AdditionalExamBL().GetAdditionalExamByServiceId_all(_serviceId, Globals.ClientSession.i_SystemUserId); foreach (var componenyId in ListadditExam) { ComponentList.Add(componenyId.ComponentId); } foreach (var componentId in ComponentList) { var ListServiceComponent = new ServiceBL().GetAllComponents(ref objOperationResult, (int)TipoBusqueda.ComponentId, componentId); Categoria categoria = DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId); if (categoria != null) { List <ComponentDetailList> componentDetail = new List <ComponentDetailList>(); componentDetail = ListServiceComponent[0].Componentes; DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId).Componentes.AddRange(componentDetail); } else { DataSource.AddRange(ListServiceComponent); } } var MedicalCenter = new ServiceBL().GetInfoMedicalCenter(); var DatosPaciente = new PacientBL().DevolverDatosPaciente(_serviceId); new PrintAdditionalExam().GenerateAdditionalexam(pathFile, MedicalCenter, DatosPaciente, datosGrabo, txtComentario.Text, DataSource, ListadditExam); } List <string> pdfList = new List <string>(); pdfList.Add(pathFile); _mergeExPDF.FilesName = pdfList; _mergeExPDF.DestinationFile = string.Format("{0}.pdf", Path.Combine(rutaBasura, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + CMP)); _mergeExPDF.Execute(); _mergeExPDF.RunFile(); }
protected void Page_Load(object sender, EventArgs e) { ReportDocument rp = new ReportDocument(); OperationResult objOperationResult = new OperationResult(); List <string> _filesNameToMerge = new List <string>(); string ServiceId = null; //setear dato de aptitud if (Request.QueryString["v_ServiceId"] != null) { ServiceId = Request.QueryString["v_ServiceId"].ToString(); } if (Session["ConsultorioId"] == null) { _tempSourcePath = Path.Combine(Server.MapPath("/TempMerge")); List <MyListWeb> ListaServicios = (List <MyListWeb>)Session["objLista"]; foreach (var item in ListaServicios) { var aptitudeCertificate = new ServiceBL().GetAptitudeCertificate(ref objOperationResult, item.IdServicio).ToList(); DataSet ds = new DataSet(); DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(aptitudeCertificate); dt.TableName = "AptitudeCertificate"; ds.Tables.Add(dt); if (aptitudeCertificate[0].i_NumberQuotasMen == (int)EmpresaDx.ConDx) { if (aptitudeCertificate[0].i_EsoTypeId == ((int)TypeESO.Retiro).ToString()) { rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificateRetiros.rpt")); } else { if (aptitudeCertificate[0].i_AptitudeStatusId == (int)AptitudeStatus.AptoObs) { rp.Load(Server.MapPath("cr.CertficadoObservado.rpt")); } else { rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificate.rpt")); } } } else { if (aptitudeCertificate[0].i_EsoTypeId == ((int)TypeESO.Retiro).ToString()) { rp.Load(Server.MapPath("crOccupationalRetirosSinDx.rpt")); } else { if (aptitudeCertificate[0].i_AptitudeStatusId == (int)AptitudeStatus.AptoObs) { rp.Load(Server.MapPath("cr.CertficadoObservadoSinDx.rpt")); } else { rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificateSinDx.rpt")); } } } //rp.Load(Server.MapPath("crOccupationalMedicalAptitudeCertificate.rpt")); rp.SetDataSource(ds); rp.SetDataSource(ds); var ruta = Server.MapPath("files/CM" + item.IdServicio.ToString() + ".pdf"); _filesNameToMerge.Add(ruta); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); } _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); ShowPdf1.FilePath = "files/" + Dif + ".pdf"; } else if (Session["ConsultorioId"].ToString() == "6") // RX { var RX_TORAX_ID = new ServiceBL().ReportRadiologico(ServiceId, Constants.RX_TORAX_ID); DataSet ds = new DataSet(); DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(RX_TORAX_ID); dt.TableName = "dtRadiologico"; ds.Tables.Add(dt); rp.Load(Server.MapPath("crInformeRadiologico.rpt")); rp.SetDataSource(ds); rp.SetDataSource(ds); var ruta = Server.MapPath("files/CM" + ServiceId + ".pdf"); _filesNameToMerge.Add(ruta); var OIT_ID = new ServiceBL().ReportInformeRadiografico(ServiceId, Constants.OIT_ID); if (OIT_ID.Count != 0) { DataSet dsOIT_ID = new DataSet(); DataTable dtOIT_ID = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(OIT_ID); dtOIT_ID.TableName = "dtInformeRadiografico"; dsOIT_ID.Tables.Add(dt); rp.Load(Server.MapPath("crInformeRadiograficoOIT.rpt")); rp.SetDataSource(ds); rp.SetDataSource(ds); var ruta1 = Server.MapPath("files/CM" + ServiceId + ".pdf"); _filesNameToMerge.Add(ruta1); } rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); ShowPdf1.FilePath = "files/" + Dif + ".pdf"; } else if (Session["ConsultorioId"].ToString() == "5") // CARDIO { var ELECTROCARDIOGRAMA_ID = new ServiceBL().GetReportEstudioElectrocardiografico(ServiceId, Constants.ELECTROCARDIOGRAMA_ID); DataSet ds = new DataSet(); DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(ELECTROCARDIOGRAMA_ID); dt.TableName = "dtEstudioElectrocardiografico"; ds.Tables.Add(dt); rp.Load(Server.MapPath("crEstudioElectrocardiografico.rpt")); rp.SetDataSource(ds); rp.SetDataSource(ds); var ruta = Server.MapPath("files/CM" + ServiceId + ".pdf"); _filesNameToMerge.Add(ruta); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); ShowPdf1.FilePath = "files/" + Dif + ".pdf"; } else if (Session["ConsultorioId"].ToString() == "15") // AUDIO { DataSet dsAudiometria = new DataSet(); var dxList = new ServiceBL().GetDiagnosticRepositoryByComponent(ServiceId, Constants.AUDIOMETRIA_ID); if (dxList.Count == 0) { DiagnosticRepositoryList oDiagnosticRepositoryList = new DiagnosticRepositoryList(); List <DiagnosticRepositoryList> Lista = new List <DiagnosticRepositoryList>(); oDiagnosticRepositoryList.v_ServiceId = "Sin Id"; oDiagnosticRepositoryList.v_DiseasesName = "Sin Alteración"; oDiagnosticRepositoryList.v_DiagnosticRepositoryId = "Sin Id"; Lista.Add(oDiagnosticRepositoryList); var dtDx = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Lista); dtDx.TableName = "dtDiagnostic"; dsAudiometria.Tables.Add(dtDx); } else { var dtDx = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(dxList); dtDx.TableName = "dtDiagnostic"; dsAudiometria.Tables.Add(dtDx); } var recom = dxList.SelectMany(s1 => s1.Recomendations).ToList(); if (recom.Count == 0) { Sigesoft.Node.WinClient.BE.RecomendationList oRecomendationList = new Sigesoft.Node.WinClient.BE.RecomendationList(); List <Sigesoft.Node.WinClient.BE.RecomendationList> Lista = new List <Sigesoft.Node.WinClient.BE.RecomendationList>(); oRecomendationList.v_ServiceId = "Sin Id"; oRecomendationList.v_RecommendationName = "Sin Recomendaciones"; oRecomendationList.v_DiagnosticRepositoryId = "Sin Id"; Lista.Add(oRecomendationList); var dtReco = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Lista); dtReco.TableName = "dtRecomendation"; dsAudiometria.Tables.Add(dtReco); } else { var dtReco = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(recom); dtReco.TableName = "dtRecomendation"; dsAudiometria.Tables.Add(dtReco); } var audioUserControlList = new ServiceBL().ReportAudiometriaUserControl(ServiceId, Constants.AUDIOMETRIA_ID); var audioCabeceraList = new ServiceBL().ReportAudiometria(ServiceId, Constants.AUDIOMETRIA_ID); var dtAudiometriaUserControl = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(audioUserControlList); var dtCabecera = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(audioCabeceraList); dtCabecera.TableName = "dtAudiometria"; dtAudiometriaUserControl.TableName = "dtAudiometriaUserControl"; dsAudiometria.Tables.Add(dtCabecera); dsAudiometria.Tables.Add(dtAudiometriaUserControl); rp.Load(Server.MapPath("crFichaAudiometria.rpt")); rp.SetDataSource(dsAudiometria); var ruta = Server.MapPath("files/AU" + ServiceId + ".pdf"); _filesNameToMerge.Add(ruta); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); //HISTORIA OCUPACIONAL AUDIOMETRÍA var dataListForReport_1 = new ServiceBL().ReportHistoriaOcupacionalAudiometria(ServiceId); DataSet ds = new DataSet(); DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(dataListForReport_1); dt.TableName = "dtHistoriaOcupacional"; ds.Tables.Add(dt); rp.Load(Server.MapPath("crHistoriaOcupacionalAudiometria.rpt")); rp.SetDataSource(ds); rp.SetDataSource(ds); var ruta1 = Server.MapPath("files/CM" + ServiceId + ".pdf"); _filesNameToMerge.Add(ruta1); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta1); _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); ShowPdf1.FilePath = "files/" + Dif + ".pdf"; } else if (Session["ConsultorioId"].ToString() == "1") // LAB { var ruta = Server.MapPath("files/INFLAB" + ServiceId + ".pdf"); GenerateLaboratorioReport(ruta, ServiceId); _filesNameToMerge.Add(ruta); _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); ShowPdf1.FilePath = "files/" + Dif + ".pdf"; } else if (Session["ConsultorioId"].ToString() == "14") // OFTALMO { var OFTALMOLOGIA_ID = new PacientBL().GetOftalmologia(ServiceId, Constants.OFTALMOLOGIA_ID); DataSet ds = new DataSet(); DataTable dt = Sigesoft.Server.WebClientAdmin.UI.Utils.ConvertToDatatable(OFTALMOLOGIA_ID); dt.TableName = "dtOftalmologia"; ds.Tables.Add(dt); rp.Load(Server.MapPath("crOftalmologia.rpt")); rp.SetDataSource(ds); rp.SetDataSource(ds); var ruta = Server.MapPath("files/CM" + ServiceId + ".pdf"); _filesNameToMerge.Add(ruta); rp.ExportToDisk(ExportFormatType.PortableDocFormat, ruta); _mergeExPDF.FilesName = _filesNameToMerge; string Dif = Guid.NewGuid().ToString(); string NewPath = Server.MapPath("files/" + Dif + ".pdf"); _mergeExPDF.DestinationFile = NewPath; _mergeExPDF.Execute(); ShowPdf1.FilePath = "files/" + Dif + ".pdf"; } }
public MessageCustom GenerateHistoriaClinica(string personId, string serviceId) { MessageCustom _MessageCustom = new MessageCustom(); try { DatabaseContext ctx = new DatabaseContext(); var ruta = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["directorioHistoriaClinica"]); var rutaBasura = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["directorioBasura"]); string pathFile = string.Format("{0}.pdf", Path.Combine(ruta, serviceId + "-" + "HISTORIA-CLINICA")); var objPacient = ctx.Person.Where(x => x.v_PersonId == personId).FirstOrDefault(); int Edad = new PacientBL().GetEdad(objPacient.d_Birthdate.Value); int GrupoEtario = ObtenerIdGrupoEtarioDePaciente(Edad); List <EsoCuidadosPreventivosComentarios> Comentarios = new EsoAntecedentesDal().ObtenerComentariosCuidadosPreventivos(personId); var listaProblema = new PlanIntegralDal().GetProblemaPagedAndFiltered(personId); var listPlanIntegral = new PlanIntegralDal().GetPlanIntegral(personId); var datosPersonales = new PacientBL().GetDatosPersonalesAtencion(serviceId); var datosP = new PacientBL().DevolverDatosPaciente(serviceId); int GrupoBase = ObtenerGrupoBase(GrupoEtario, objPacient); int Grupo = int.Parse(GrupoBase.ToString() + GrupoEtario.ToString()); if (Edad <= 12) { GrupoEtario = 4; Grupo = 2824; } else if (13 <= Edad && Edad <= 17) { GrupoEtario = 2; Grupo = 2822; } else if (18 <= Edad && Edad <= 64) { GrupoEtario = 1; Grupo = 2821; } else { GrupoEtario = 3; Grupo = 2823; } var listAntecedentes = new EsoAntecedentesDal().ObtenerEsoAntecedentesPorGrupoId(Grupo, GrupoEtario, personId); var datosNin = new EsoAntecedentesDal().DevolverNinio(serviceId); var datosAdol = new EsoAntecedentesDal().DevolverAdolescente(serviceId); var datosAdul = new EsoAntecedentesDal().DevolverAdulto(serviceId); var datosAdulMay = new EsoAntecedentesDal().DevolverAdultoMayor(serviceId); List <EsoCuidadosPreventivosFechas> Fechas = new EsoAntecedentesBL().ObtenerFechasCuidadosPreventivos(personId); foreach (var F in Fechas) { F.Listado = new EsoAntecedentesDal().ObtenerListadoCuidadosPreventivos(GrupoBase, personId, F.FechaServicio); } if (Fechas.Count > 6) { Fechas = Fechas.Skip((Fechas.Count - 6)).ToList(); } var MedicalCenter = new ServiceDal().GetInfoMedicalCenter(); var listEmb = new EsoAntecedentesDal().GetEmbarazos(personId); //primer pdf var pathFile2 = string.Format("{0}.pdf", Path.Combine(ruta, serviceId + "-" + "HISTORIA-CLINICA-INTEGRAL")); var exams = new SigesoftDal().GetServiceComponentsReport(serviceId); var medico = new PacientBL().ObtenerDatosMedicoMedicina(serviceId, Constants.ATENCION_INTEGRAL_ID, Constants.EXAMEN_FISICO_7C_ID); var datosGrabo = new ServiceDal().DevolverDatosUsuarioGraboExamen((int)CategoryTypeExam.ExamenFisico, serviceId); var diagnosticRepository = new ServiceDal().GetServiceComponentConclusionesDxServiceIdReport(serviceId); var medicina = new ServiceDal().GetReceta(serviceId); var medicoTratante = new ServiceDal().GetMedicoTratante(serviceId); AtencionIntegral.CreateAtencionIntegral(pathFile2, medico, datosP, listAntecedentes, MedicalCenter, exams, datosNin, datosAdol, datosAdul, listEmb, datosAdulMay, diagnosticRepository, medicina, exams, medicoTratante, datosGrabo); ////////////////// if (GrupoEtario == (int)Enumeratores.GrupoEtario.Ninio) { Ninio.CreateAtencionNinio(pathFile, listaProblema, listPlanIntegral, datosPersonales, datosP, listAntecedentes, Fechas, MedicalCenter, datosNin, Comentarios); } else if (GrupoEtario == (int)Enumeratores.GrupoEtario.Adolecente) { GrupoBase = 285; if (datosPersonales.Genero.ToUpper() == "MUJER") { GrupoBase = 283; } var Fechas2 = new EsoAntecedentesDal().ObtenerFechasCuidadosPreventivos(personId); foreach (var F in Fechas2) { F.Listado = new EsoAntecedentesDal().ObtenerListadoCuidadosPreventivos(GrupoBase, personId, F.FechaServicio); foreach (var obj in F.Listado) { var find = Comentarios.Find(x => x.GrupoId == obj.GrupoId && x.ParametroId == obj.ParameterId); if (find != null) { obj.DataComentario = find; } } } listAntecedentes = new EsoAntecedentesDal().ObtenerEsoAntecedentesPorGrupoId(2822, GrupoEtario, personId); AtencionIntegralAdolescente.CreateAtencionIntegral(pathFile, listaProblema, listPlanIntegral, datosPersonales, datosP, listAntecedentes, Fechas2, MedicalCenter, datosAdol, Comentarios); } else if (GrupoEtario == (int)Enumeratores.GrupoEtario.Adulto) { listAntecedentes = new EsoAntecedentesDal().ObtenerEsoAntecedentesPorGrupoId(2821, GrupoEtario, personId); AtencionIntegralAdulto.CreateAtencionIntegral(pathFile, listaProblema, listPlanIntegral, datosPersonales, datosP, listAntecedentes, Fechas, MedicalCenter, datosAdul, listEmb, Comentarios); } else if (GrupoEtario == (int)Enumeratores.GrupoEtario.AdultoMayor) { listAntecedentes = new EsoAntecedentesDal().ObtenerEsoAntecedentesPorGrupoId(2823, GrupoEtario, personId); AtencionIntegralAdultoMayor.CreateAtencionIntegral(pathFile, listaProblema, listPlanIntegral, datosPersonales, datosP, listAntecedentes, Fechas, MedicalCenter, datosAdulMay, listEmb, Comentarios); } List <string> pdfList = new List <string>(); pdfList.Add(pathFile2); pdfList.Add(pathFile); MergeExPDF _mergeExPDF = new MergeExPDF(); _mergeExPDF.FilesName = pdfList; _mergeExPDF.DestinationFile = string.Format("{0}.pdf", Path.Combine(rutaBasura, serviceId + "-COPIA-HISTORIA-CLINICA")); _mergeExPDF.Execute(); _MessageCustom.Id = string.Format("{0}.pdf", Path.Combine(serviceId + "-COPIA-HISTORIA-CLINICA")); _MessageCustom.Error = false; _MessageCustom.Status = (int)StatusHttp.Ok; return(_MessageCustom); } catch (Exception ex) { _MessageCustom.Error = true; _MessageCustom.Status = (int)StatusHttp.BadRequest; _MessageCustom.Message = "Sucedió un error, por favor vuelva a intentar."; return(_MessageCustom); } }
private void btnOK_Click(object sender, EventArgs e) { var Path1 = Application.StartupPath; if (ultraValidator1.Validate(true, false).IsValid) { if (txtLabel.Text.Trim() == "") { MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtSubject.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (rbCotizacion.Checked) { ServiceBL oServiceBL = new ServiceBL(); ProtocolBL oProtocolBL = new ProtocolBL(); ReportDocument rp; DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions(); string ruta = Common.Utils.GetApplicationConfigValue("rutaCotizacion").ToString(); var MedicalCenter = oServiceBL.GetInfoMedicalCenterSede(); DataSet ds = new DataSet(); var Valores = new ServiceBL().ObtenerCabeceraCotizacion(ddlCustomerOrganization.SelectedValue.ToString()); DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Valores); dt.TableName = "dtCartaCotizacion"; ds.Tables.Add(dt); //Reporte 1 rp = new Reports.crReporteCotizacion01(); rp.SetDataSource(ds); rp.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; objDiskOpt = new DiskFileDestinationOptions(); objDiskOpt.DiskFileName = ruta + "Cotizacion1.pdf"; _filesNameToMerge.Add(objDiskOpt.DiskFileName); rp.ExportOptions.DestinationOptions = objDiskOpt; rp.Export(); rp.Close(); //Reporte 2 rp = new Reports.crReporteCotizacion02(); rp.SetDataSource(ds); rp.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; objDiskOpt = new DiskFileDestinationOptions(); objDiskOpt.DiskFileName = ruta + "Cotizacion2.pdf"; _filesNameToMerge.Add(objDiskOpt.DiskFileName); rp.ExportOptions.DestinationOptions = objDiskOpt; rp.Export(); rp.Close(); //Reporte 3 rp = new Reports.crReporteCotizacion03(); rp.SetDataSource(ds); rp.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; objDiskOpt = new DiskFileDestinationOptions(); objDiskOpt.DiskFileName = ruta + "Cotizacion3.pdf"; _filesNameToMerge.Add(objDiskOpt.DiskFileName); rp.ExportOptions.DestinationOptions = objDiskOpt; rp.Export(); rp.Close(); //Reporte 4 rp = new Reports.crReporteCotizacion04(); rp.SetDataSource(ds); rp.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; objDiskOpt = new DiskFileDestinationOptions(); objDiskOpt.DiskFileName = ruta + "Cotizacion4.pdf"; _filesNameToMerge.Add(objDiskOpt.DiskFileName); rp.ExportOptions.DestinationOptions = objDiskOpt; rp.Export(); rp.Close(); var l = oProtocolBL.CotizacionProtocoloPorEmpresaClienteId(ddlCustomerOrganization.SelectedValue.ToString()); HojaCotizacion.CrearHojaCotizacion(l, ddlCustomerOrganization.Text, MedicalCenter, ruta + ddlCustomerOrganization.Text + ".pdf"); _filesNameToMerge.Add(string.Format("{0}.pdf", Path.Combine(ruta + ddlCustomerOrganization.Text))); _filesNameToMerge.Add(string.Format("{0}.pdf", Path1 + @"\Archivos\Archivo2")); var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; _mergeExPDF.DestinationFile = ruta + ddlCustomerOrganization.Text + " " + DateTime.Now.Date.ToString("dd MMMM") + ".pdf";; _mergeExPDF.Execute(); } else if (rbCarta.Checked) { string ruta = Common.Utils.GetApplicationConfigValue("rutaCotizacion").ToString(); ReportDocument rp; DiskFileDestinationOptions objDiskOpt = new DiskFileDestinationOptions(); DataSet ds = new DataSet(); var Valores = new ServiceBL().ObtenerCabeceraCotizacion(ddlCustomerOrganization.SelectedValue.ToString()); DataTable dt = Sigesoft.Node.WinClient.BLL.Utils.ConvertToDatatable(Valores); dt.TableName = "dtCartaCotizacion"; ds.Tables.Add(dt); rp = new Reports.crCartaPresentación(); rp.SetDataSource(ds); rp.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat; rp.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile; objDiskOpt = new DiskFileDestinationOptions(); objDiskOpt.DiskFileName = ruta + "Carta Presentación " + ddlCustomerOrganization.Text + ".pdf"; _filesNameToMerge.Add(objDiskOpt.DiskFileName); rp.ExportOptions.DestinationOptions = objDiskOpt; rp.Export(); rp.Close(); _filesNameToMerge.Add(string.Format("{0}.pdf", Path1 + @"\Archivos\Archivo1")); var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; _mergeExPDF.DestinationFile = ruta + "Carta Presentación " + ddlCustomerOrganization.Text + " " + DateTime.Now.Date.ToString("dd MMMM") + ".pdf"; _mergeExPDF.Execute(); } //else if (rbDocumentos.Checked) //{ // List<string> ArchivoAdjunto = new List<string>(); // ArchivoAdjunto.Add(Path1 + @"\Archivos\Acreditacion.pdf"); // ArchivoAdjunto.Add(Path1 + @"\Archivos\Recomendaciones.pdf"); // ArchivoAdjunto.Add(Path1 + @"\Archivos\Informacion.pdf"); // ArchivoAdjunto.Add(Path1 + @"\Archivos\Mapa.pdf"); // ArchivoAdjunto.Add(Path1 + @"\Archivos\PLANTILLA.xlsx"); // ArchivoAdjunto.Add(Path1 + @"\Archivos\FICHA CLIENTE.xlsx"); //} EmailBL oEmailBL = new EmailBL(); emailDto oemailDto = new emailDto(); oemailDto.v_Email = txtLabel.Text; OperationResult objOperationResult = new OperationResult(); oEmailBL.AddEmail(ref objOperationResult, oemailDto); this.Enabled = false; _frmWaiting.Show(this); RunWorkerAsyncPackage packageForSave = new RunWorkerAsyncPackage(); packageForSave.NombreEmpresaCliente = ddlCustomerOrganization.Text; backgroundWorker1.RunWorkerAsync(packageForSave); } }
public MessageCustom SaveadditionalExams(List <AdditionalExamCustom> listExams, int userId, int nodeId) { try { MessageCustom _MessageCustom = new MessageCustom(); var resul = new ServiceBl().AddAdditionalExam(listExams, userId, nodeId); if (resul) { _MessageCustom.Error = false; _MessageCustom.Status = (int)StatusHttp.Ok; _MessageCustom.Message = "Los exámenes se agregaron correctamente"; } else { _MessageCustom.Error = true; _MessageCustom.Status = (int)StatusHttp.BadRequest; _MessageCustom.Message = "Sucedió un error y no se agregaron los exámenes adicionales"; } #region Para imprimir los exámenes var _serviceId = listExams[0].ServiceId; var datosGrabo = new ServiceBl().DevolverDatosUsuarioFirma(userId); var MedicalCenter = new ServiceBl().GetInfoMedicalCenter(); var DatosPaciente = new PacientBL().DevolverDatosPaciente(_serviceId); List <Categoria> AdditionalExam = new List <Categoria>(); List <Categoria> DataSource = new List <Categoria>(); List <string> ComponentList = new List <string>(); var ListadditExam = new ServiceDal().GetAdditionalExamByServiceId_all(_serviceId, userId); foreach (var componenyId in ListadditExam) { ComponentList.Add(componenyId.ComponentId); } foreach (var componentId in ComponentList) { var ListServiceComponent = new ServiceDal().GetAllComponents((int)TipoBusqueda.ComponentId, componentId); Categoria categoria = DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId); if (categoria != null) { List <ComponentDetailList> componentDetail = new List <ComponentDetailList>(); componentDetail = ListServiceComponent[0].Componentes; DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId).Componentes.AddRange(componentDetail); } else { DataSource.AddRange(ListServiceComponent); } } string CMP = "SIN-PROFESIONAL"; var ruta = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["directorioExamAdicional"]); var rutaBasura = HttpContext.Current.Server.MapPath("~/" + System.Configuration.ConfigurationManager.AppSettings["directorioBasura"]); string pathFile = string.Format("{0}.pdf", Path.Combine(ruta, _serviceId + "-" + "ORDEN-EX-MED-ADICI-SIN-PROFESIONAL")); if (datosGrabo != null) { if (datosGrabo.CMP != null) { CMP = datosGrabo.CMP; pathFile = string.Format("{0}.pdf", Path.Combine(ruta, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + datosGrabo.CMP)); } } new PrintAdditionalExam().GenerateAdditionalexam(pathFile, MedicalCenter, DatosPaciente, datosGrabo, listExams[0].Commentary, DataSource, ListadditExam); List <string> pdfList = new List <string>(); pdfList.Add(pathFile); MergeExPDF _mergeExPDF = new MergeExPDF(); _mergeExPDF.FilesName = pdfList; _mergeExPDF.DestinationFile = string.Format("{0}.pdf", Path.Combine(rutaBasura, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + CMP)); _mergeExPDF.Execute(); #endregion _MessageCustom.Id = string.Format("{0}.pdf", Path.Combine(_serviceId + "-" + "ORDEN-EX-MED-ADICI-" + CMP)); return(_MessageCustom); } catch (Exception ex) { return(null); } }
private void btnOK_Click(object sender, EventArgs e) { //if (_auxiliaryExams == null) // _auxiliaryExams = new List<ServiceComponentList>(); try { var ruta = Common.Utils.GetApplicationConfigValue("rutaExamenesAdicionales").ToString(); var rutaBasura = Common.Utils.GetApplicationConfigValue("rutaReportesBasura").ToString(); string pathFile = ""; string CMP = ""; var openFile = false; using (new LoadingClass.PleaseWait(this.Location, "Cargando...")) { OperationResult objOperationResult = new OperationResult(); List <AdditionalExamCustom> ListAdditionalExam = new List <AdditionalExamCustom>(); foreach (ListViewItem item in lvExamenesSeleccionados.Items) { AdditionalExamCustom _additionalExam = new AdditionalExamCustom(); var fields = item.SubItems; _additionalExam.ComponentId = fields[1].Text; _additionalExam.IsProcessed = int.Parse(fields[2].Text); _additionalExam.IsNewService = int.Parse(fields[3].Text); _additionalExam.Commentary = txtCommentary.Text; _additionalExam.ServiceId = _serviceId; _additionalExam.PersonId = _personId; _additionalExam.ProtocolId = ""; if (_additionalExam.IsNewService == 1) { _additionalExam.ProtocolId = Constants.Prot_Hospi_Adic; } ListAdditionalExam.Add(_additionalExam); } var datosGrabo = objServiceBL.DevolverDatosUsuarioFirma(Globals.ClientSession.i_SystemUserId); if (datosGrabo != null) { if (datosGrabo.CMP != null) { CMP = datosGrabo.CMP; pathFile = string.Format("{0}.pdf", Path.Combine(ruta, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + datosGrabo.CMP)); } } using (var ts = new TransactionScope()) { var success = _additionalExamBl.AddAdditionalExam(ListAdditionalExam, Globals.ClientSession.GetAsList()); if (!success) { throw new Exception("Sucedió un error, por favor vuelva a intentarlo"); } ts.Complete(); } List <Categoria> AdditionalExam = new List <Categoria>(); List <Categoria> DataSource = new List <Categoria>(); List <string> ComponentList = new List <string>(); var ListadditExam = new AdditionalExamBL().GetAdditionalExamByServiceId_all(_serviceId, Globals.ClientSession.i_SystemUserId); foreach (var componenyId in ListadditExam) { ComponentList.Add(componenyId.ComponentId); } foreach (var componentId in ComponentList) { var ListServiceComponent = new ServiceBL().GetAllComponents(ref objOperationResult, (int)TipoBusqueda.ComponentId, componentId); Categoria categoria = DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId); if (categoria != null) { List <ComponentDetailList> componentDetail = new List <ComponentDetailList>(); componentDetail = ListServiceComponent[0].Componentes; DataSource.Find(x => x.i_CategoryId == ListServiceComponent[0].i_CategoryId).Componentes.AddRange(componentDetail); } else { DataSource.AddRange(ListServiceComponent); } } var MedicalCenter = objServiceBL.GetInfoMedicalCenter(); var DatosPaciente = new PacientBL().DevolverDatosPaciente(_serviceId); new PrintAdditionalExam().GenerateAdditionalexam(pathFile, MedicalCenter, DatosPaciente, datosGrabo, txtCommentary.Text, DataSource, ListadditExam); } List <string> pdfList = new List <string>(); pdfList.Add(pathFile); _mergeExPDF.FilesName = pdfList; _mergeExPDF.DestinationFile = string.Format("{0}.pdf", Path.Combine(rutaBasura, _serviceId + "-" + "ORDEN-EX-MED-ADICI-" + CMP)); _mergeExPDF.Execute(); _mergeExPDF.RunFile(); this.Close(); } catch (Exception ex) { MessageBox.Show("ERROR:" + ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void btnOK_Click(object sender, EventArgs e) { if (txtLabel.Text.Trim() == "") { MessageBox.Show("Por favor ingrese Correo Electrónico.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (txtSubject.Text.Trim() == "") { MessageBox.Show("Por favor ingrese un Asunto.", "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (rb312.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbEmpresarial.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD_EMPRESARIAL + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbSinDx.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.INFORME_CERTIFICADO_APTITUD_SIN_DX + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbToxicologico.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.TOXICOLOGICO_ID + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbAltura18.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.ALTURA_ESTRUCTURAL_ID + ".pdf"; _filesNameToMerge.Add(o); } } else if (rbSomnolencia.Checked) { foreach (var item in _ListaServicios) { var o = ruta + item.ToString() + "-" + Constants.SOMNOLENCIA_ID + ".pdf"; _filesNameToMerge.Add(o); } } var x = _filesNameToMerge.ToList(); _mergeExPDF.FilesName = x; _mergeExPDF.DestinationFile = ruta + "Consolidado de Formatos" + ".pdf"; _mergeExPDF.Execute(); EmailBL oEmailBL = new EmailBL(); emailDto oemailDto = new emailDto(); oemailDto.v_Email = txtLabel.Text; OperationResult objOperationResult = new OperationResult(); oEmailBL.AddEmail(ref objOperationResult, oemailDto); this.Enabled = false; _frmWaiting.Show(this); backgroundWorker1.RunWorkerAsync(); }