public static void CreateDeclaracionJuradaCoimolacheLaZanja(PacientList filiationData, List <ServiceComponentList> serviceComponent, organizationDto infoEmpresa, PacientList datosPac, string filePDF) { Document document = new Document(PageSize.A4, 30f, 30f, 42f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion var tamaño_celda = 20f; #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresa.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresa.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("DECLARACIÓN JURADA", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 90f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region DATOS GENERALES //string preOcp = "", Ocup = "", postOcup = ""; //if (DataService.i_EsoTypeId == 1) //{ // preOcp = "X"; //} //else if (DataService.i_EsoTypeId == 2) //{ // Ocup = "X"; //} //else if (filiationData.i_EsoTypeId == 3) //{ // postOcup = "X"; //} //string[] fechaServicio = datosPac.FechaServicio.ToString().Split(' '); //cells = new List<PdfPCell>() //{ // new PdfPCell(new Phrase("CLÍNICA:", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(infoEmpresa.v_Name, fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("Fecha de Entrevista", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(fechaServicio[0], fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("I. Datos Generales:", fontColumnValueBold)) { Colspan = 20,HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, // new PdfPCell(new Phrase("Apellidos Y Nombres", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("Edad", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda}, // new PdfPCell(new Phrase(datosPac.Edad.ToString() , fontColumnValue)) { Colspan = 2,HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("Fecha de Nacimiento:", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(datosPac.d_Birthdate.ToString().Split(' ')[0], fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("Estado Civil:", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, // new PdfPCell(new Phrase(datosPac.v_MaritalStatus, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, // new PdfPCell(new Phrase("Empresa", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(filiationData.v_FullWorkingOrganizationName, fontColumnValue)) { Colspan = 7, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("Cargo", fontColumnValueBold)) { Colspan = 2,HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(datosPac.v_CurrentOccupation, fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda}, // new PdfPCell(new Phrase("Tipo de Evaluación", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("Pre Ocupacional" , fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(preOcp , fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("Ocupacional", fontColumnValueBold)) { Colspan = 3,HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(Ocup, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase("Post Ocupacional" , fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, // new PdfPCell(new Phrase(postOcup , fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, //}; //columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; //table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); //document.Add(table); #endregion ServiceComponentList declaracion_jurada_coimo_zanja = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.D_J_PSICOLOGIA_COIMOLACHE_LA_ZANJA_ID); #region ENFERMEDADES Y ACCIDENTES var enfermedad_salud_mental = declaracion_jurada_coimo_zanja.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.D_J_P_COIMOLACHE_LA_ZANJA_ENFERMEDAD_MENTAL) == null ? "" : declaracion_jurada_coimo_zanja.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.D_J_P_COIMOLACHE_LA_ZANJA_ENFERMEDAD_MENTAL).v_Value1; string enfermedad_salud_mentalSINO = ""; if (enfermedad_salud_mental == "1") { enfermedad_salud_mentalSINO = "SI"; } if (enfermedad_salud_mental == "0") { enfermedad_salud_mentalSINO = "NO"; } var descripcion_salud_mental = declaracion_jurada_coimo_zanja.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.D_J_P_COIMOLACHE_LA_ZANJA_SI_DESCRIPCION) == null ? "" : declaracion_jurada_coimo_zanja.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.D_J_P_COIMOLACHE_LA_ZANJA_SI_DESCRIPCION).v_Value1; var otras_enfermedades_accidentes = declaracion_jurada_coimo_zanja.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.D_J_P_COIMOLACHE_LA_ZANJA_OTRAS_ENFERMEDADES) == null ? "" : declaracion_jurada_coimo_zanja.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.D_J_P_COIMOLACHE_LA_ZANJA_OTRAS_ENFERMEDADES).v_Value1; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Antecedentes personales", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("a) Para ser llenado por el trabajador", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Yo, " + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName + " con DNI : " + datosPac.v_DocNumber + " manifiesto que " + enfermedad_salud_mentalSINO + " se me", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("ha identificadouna enfermedad de salud mental, o psiquiátrica.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n En el caso de marcar SI, describir en breve palabras el diagnostico de la enfermedad mental, y si recibió tratamiento;", fontColumnValueApendice)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(descripcion_salud_mental, fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("b) Otras enfermedades de salud, y/o accidentes:", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(otras_enfermedades_accidentes, fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region ENFERMEDADES Y ACCIDENTES cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("VI. Antecedentes personales", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nCon la firma del presente documento, confirmo y doy fe que la información brindada sobre mi salud es ", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("\n", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\ncompleta y verdadera, haciéndome responsable de cualquier omisión o dato incorrecto; así mismo ", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nquedo obligado a informar toda circunstancia nueva que pueda influir no alterar esta información.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 10f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion var psico = serviceComponent.Find(p => p.i_CategoryId == (int)Sigesoft.Common.Consultorio.Psicología); #region Firma #region Creando celdas de tipo Imagen y validando nulls PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; PdfPCell cellFirma = null; // Firma del trabajador *************************************************** if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 80, 40)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirmaTrabajador.FixedHeight = 50F; // Huella del trabajador ************************************************** if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 30, 45)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellHuellaTrabajador.FixedHeight = 50F; // Firma del doctor Auditor ************************************************** if (psico.FirmaMedico != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(psico.FirmaMedico, null, null, 120, 50)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }; } else { cellFirma = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 50F; #endregion cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(cellFirmaTrabajador) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(cellHuellaTrabajador) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("FIRMA Y SELLO DEL PSICÓLOGO", fontColumnValueBold1)) { Rowspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(cellFirma) { Rowspan = 3, HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("", fontColumnValue)) { Rowspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("FIRMA DEL EXAMINADO \nN° DNI: " + datosPac.v_DocNumber, fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 12f }, new PdfPCell(new Phrase("HUELLA DEL EXAMINADO", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 12f }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("CON LA CUAL DECLARA QUE LA INFORMACIÓN DECLARADA ES VERAZ", fontColumnValueBold1)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, }; columnWidths = new float[] { 5f, 25f, 20f, 20f, 25f, 5f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateFichaMedicaTrabajador3(PacientList filiationData, ServiceList doctoPhisicalExam, List <DiagnosticRepositoryList> diagnosticRepository, organizationDto infoEmpresaPropietaria, string pstrExamenesConcatenados, string pstrExamenesLabConcatenados, List <ServiceComponentList> serviceComponent, string pstrRestriciones, string filePDF) { Document document = new Document(); document.SetPageSize(iTextSharp.text.PageSize.A4); //try //{NO_BORDER // step 2: we create aPA writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); //create an instance of your PDFpage class. This is the class we generated above. pdfPage page = new pdfPage(); page.Dato = "FMT3/" + filiationData.v_FirstName + " " + filiationData.v_FirstLastName + " " + filiationData.v_SecondLastName; //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class writer.PageEvent = page; // step 3: we open the document document.Open(); // step 4: we Add content to the document // we define some fonts #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; //string[] columnValues = null; string[] columnHeaders = null; PdfPTable filiationWorker = new PdfPTable(8); PdfPTable table = null; PdfPCell cell = null; #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Arial", 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableAntecedentesOcupacionales = FontFactory.GetFont("Arial", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueAntecedentesOcupacionales = FontFactory.GetFont("Arial", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueNegrita = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontAptitud = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); //Font fontTitleTableNegro = FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion //#region Logo PdfPCell CellLogo = null; #region Title CellLogo = null; cells = new List <PdfPCell>(); PdfPCell cellPhoto1 = null; if (filiationData.b_Photo != null) { cellPhoto1 = new PdfPCell(HandlingItextSharp.GetImage(filiationData.b_Photo, 23F)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT } } ; else { cellPhoto1 = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT } }; if (infoEmpresaPropietaria.b_Image != null) { CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } else { CellLogo = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } columnWidths = new float[] { 100f }; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("RESUMEN DE EXAMEN MÉDICO", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); cells.Add(CellLogo); cells.Add(new PdfPCell(table)); cells.Add(cellPhoto1); columnWidths = new float[] { 20f, 60f, 20f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #region Datos del examen cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase("NRO DE HCL:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_IdService, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("TIPO DE EXAMEN: ", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_TipoExamen, fontColumnValue)), new PdfPCell(new Phrase("FECHA EXAMEN:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.d_ServiceDate.Value.ToShortDateString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase("PROVEEDOR:", fontColumnValue)), new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Name, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("EMPRESA:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_OrganitationName, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("GRUPO DE RIESGO:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.GESO, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase("EXÁMENES REALIZADOS:", fontColumnValue)), new PdfPCell(new Phrase(pstrExamenesConcatenados, fontColumnValue)) { Colspan = 5, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase("LABORATORIO: ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(pstrExamenesLabConcatenados, fontColumnValue)) { Colspan = 5, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, }; columnWidths = new float[] { 25f, 20f, 20f, 20f, 20f, 20f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "DATOS DEL EXAMEN", fontTitleTable); document.Add(filiationWorker); #endregion #region Datos del trabajador cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase("APELLIDOS Y NOMBRES:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_FirstLastName + " " + filiationData.v_SecondLastName + " " + filiationData.v_FirstName, fontColumnValue)) { Colspan = 5, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase("DNI:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_DocNumber, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("EDAD:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.i_Age.Value.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("PUESTO:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_CurrentOccupation, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, }; columnWidths = new float[] { 25f, 20f, 10f, 10f, 10f, 50f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "DATOS DEL TRABAJADOR", fontTitleTable); document.Add(filiationWorker); #endregion #region Resultados del examen médico cells = new List <PdfPCell>(); if (diagnosticRepository != null && diagnosticRepository.Count > 0) { //PdfPCell cellDx = null; columnWidths = new float[] { 50f }; include = "v_RecommendationName"; var ListaFinal = diagnosticRepository.FindAll(p => p.i_CategoryId != 1 && p.i_CategoryId != 10); foreach (var item in ListaFinal) { if (item.v_DiseasesId == "N009-DD000000029") { cell = new PdfPCell(new Phrase("")) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(item.Categoria + " - " + item.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } // Crear tabla de recomendaciones para insertarla en la celda que corresponde var tableDx = HandlingItextSharp.GenerateTableFromList(item.Recomendations, columnWidths, include, fontColumnValue); cell = new PdfPCell(tableDx); cells.Add(cell); } columnWidths = new float[] { 50f, 54f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue))); columnWidths = new float[] { 100f }; } var GrillaDx = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "RESULTADOS DEL EXAMEN MÉDICO", fontTitleTableNegro); document.Add(GrillaDx); #endregion #region Nutrición cells = new List <PdfPCell>(); var xNutricion = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.ANTROPOMETRIA_ID); if (xNutricion != null) { // Subtitulo ****************** cell = new PdfPCell(new Phrase("NUTRICIÓN", fontSubTitleNegroNegrita)) { Colspan = 4, BackgroundColor = subTitleBackGroundColor, HorizontalAlignment = Element.ALIGN_CENTER, }; cells.Add(cell); //***************************************** // titulo var valorPeso = xNutricion.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.ANTROPOMETRIA_PESO_ID); var valorTalla = xNutricion.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.ANTROPOMETRIA_TALLA_ID); cells.Add(new PdfPCell(new Phrase("PESO(Kg):", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(valorPeso == null ? string.Empty : valorPeso.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("TALLA(m):", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(valorTalla == null ? string.Empty : valorTalla.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); // titulo cells.Add(new PdfPCell(new Phrase("EXAMEN", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("VALOR HALLADO", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("DIAGNÓSTICO", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RECOMENDACIONES", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); var valorIMC = xNutricion.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.ANTROPOMETRIA_IMC_ID); var dxIMC = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.ANTROPOMETRIA_IMC_ID); var RecoIMC = dxIMC.Recomendations.FindAll(p => p.v_ComponentId == Sigesoft.Common.Constants.ANTROPOMETRIA_ID); // 1era fila cells.Add(new PdfPCell(new Phrase("IMC", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(valorIMC == null ? string.Empty : valorIMC.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxIMC == null ? "NORMAL" : dxIMC.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(string.Join(", ", RecoIMC.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); columnWidths = new float[] { 25f, 25f, 25f, 25f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths); document.Add(table); } #endregion #region Presión Arterial cells = new List <PdfPCell>(); var xPresionArterial = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.FUNCIONES_VITALES_ID); if (xPresionArterial != null) { // Subtitulo ****************** cell = new PdfPCell(new Phrase("PRESIÓN ARTERIAL", fontSubTitleNegroNegrita)) { Colspan = 4, BackgroundColor = subTitleBackGroundColor, HorizontalAlignment = Element.ALIGN_CENTER, }; cells.Add(cell); //***************************************** // titulo cells.Add(new PdfPCell(new Phrase("EXAMEN", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("VALOR HALLADO", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("DIAGNÓSTICO", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RECOMENDACIONES", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); var valorPA1 = xPresionArterial.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAS_ID) == null ? "" : xPresionArterial.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAS_ID).v_Value1; var valorPA2 = xPresionArterial.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAD_ID) == null ? "" : xPresionArterial.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAD_ID).v_Value1; var dxPA = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAS_ID); var RecoPA = dxPA == null?null: dxPA.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("PRESIÓN ARTERIAL", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(valorPA1 + " / " + valorPA2, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxPA == null ? "NORMAL" : dxPA.v_Name, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoPA == null ?"CONTROL ANUAL":string.Join(", ", RecoPA.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); columnWidths = new float[] { 25f, 25f, 25f, 25f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths); document.Add(table); } #endregion #region Laboratorio cells = new List <PdfPCell>(); // Subtitulo ****************** cell = new PdfPCell(new Phrase("LABORATORIO", fontSubTitleNegroNegrita)) { Colspan = 4, BackgroundColor = subTitleBackGroundColor, HorizontalAlignment = Element.ALIGN_CENTER, }; cells.Add(cell); //***************************************** // titulo cells.Add(new PdfPCell(new Phrase("EXAMEN", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("VALOR HALLADO", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("DIAGNÓSTICO", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RECOMENDACIONES", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); var xHB = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.HEMOGRAMA_COMPLETO_ID); var xHTO = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.HEMOGRAMA_COMPLETO_ID); var xColesterol = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.COLESTEROL_ID); var xTrigli = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.TRIGLICERIDOS_ID); var xGlucosa = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.GLUCOSA_ID); var xUrea = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.UREA_ID); var xCreatina = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.CREATININA_ID); var xColesterol_1 = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.PERFIL_LIPIDICO); var xTrigli_1 = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.PERFIL_LIPIDICO); var xOrina = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.EXAMEN_COMPLETO_DE_ORINA_ID); var xGrupoSanguineo = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.GRUPO_Y_FACTOR_SANGUINEO_ID); if (xHB != null) { var hbValor = xHB.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEMOGRAMA_COMPLETO_HEMOGLOBINA); var dxHB = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEMOGRAMA_COMPLETO_HEMOGLOBINA); var RecoHB = dxHB == null ? null : dxHB.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("HB", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxHB == null ? "NORMAL" : dxHB.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xHTO != null) { var hbValor = xHTO.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEMOGRAMA_COMPLETO_HEMATOCRITO); var dxHTO = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEMOGRAMA_COMPLETO_HEMATOCRITO); var RecoHB = dxHTO == null ? null : dxHTO.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("HTO", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxHTO == null ? "NORMAL" : dxHTO.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xColesterol != null) { var hbValor = xColesterol.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.COLESTEROL_COLESTEROL_TOTAL_ID); var dxColesterol = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.COLESTEROL_COLESTEROL_TOTAL_ID); var RecoHB = dxColesterol == null ? null : dxColesterol.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("COLESTEROL", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxColesterol == null ? "NORMAL" : dxColesterol.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xTrigli != null) { var hbValor = xTrigli.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.TRIGLICERIDOS_BIOQUIMICA_TRIGLICERIDOS); var dxTrigli = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.TRIGLICERIDOS_BIOQUIMICA_TRIGLICERIDOS); var RecoHB = dxTrigli == null ? null : dxTrigli.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("TRIGLICÉRIDOS", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxTrigli == null ? "NORMAL" : dxTrigli.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xGlucosa != null) { var hbValor = xGlucosa.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.OFTALMOLOGIA_DESCRIPCION); var dxGlucosa = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.OFTALMOLOGIA_DESCRIPCION); var RecoHB = dxGlucosa == null ? null : dxGlucosa.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("GLUCOSA", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxGlucosa == null ? "NORMAL" : dxGlucosa.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xUrea != null) { var hbValor = xUrea.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.UREA_BIOQUIMICA_UREA); var dxUrea = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.UREA_BIOQUIMICA_UREA); var RecoHB = dxUrea == null ? null : dxUrea.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("ÚREA", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxUrea == null ? "NORMAL" : dxUrea.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xCreatina != null) { var hbValor = xCreatina.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.CREATININA_BIOQUIMICA_CREATININA); var dxCreatina = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.CREATININA_BIOQUIMICA_CREATININA); var RecoHB = dxCreatina == null ? null : dxCreatina.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("CREATINA", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxCreatina == null ? "NORMAL" : dxCreatina.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xColesterol_1 != null) { var hbValor = xColesterol_1.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.COLESTEROL_TOTAL); var dxColesterol_1 = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.COLESTEROL_TOTAL); var RecoHB = dxColesterol_1 == null ? null : dxColesterol_1.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("COLESTEROL", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxColesterol_1 == null ? "NORMAL" : dxColesterol_1.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xTrigli_1 != null) { var hbValor = xTrigli_1.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.TRIGLICERIDOS); var dxTrigli_1 = diagnosticRepository.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.TRIGLICERIDOS); var RecoHB = dxTrigli_1 == null ? null : dxTrigli_1.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("TRIGLICÉRIDOS", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(hbValor == null ? string.Empty : hbValor.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxTrigli_1 == null ? "NORMAL" : dxTrigli_1.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xOrina != null) { var dxOrina = diagnosticRepository.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.EXAMEN_COMPLETO_DE_ORINA_ID); var RecoHB = dxOrina == null ? null : dxOrina.Recomendations; // 1era fila cells.Add(new PdfPCell(new Phrase("EXAMEN ORINA", fontColumnValue))); cells.Add(new PdfPCell(new Phrase("---", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(dxOrina == null ? "NORMAL" : dxOrina.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(RecoHB == null ? "CONTROL ANUAL" : string.Join(", ", RecoHB.Select(p => p.v_RecommendationName)), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } if (xGrupoSanguineo != null) { var GSValor = xGrupoSanguineo.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.GRUPO_SANGUINEO_ID); var FSValor = xGrupoSanguineo.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FACTOR_SANGUINEO_ID); // 1era fila cells.Add(new PdfPCell(new Phrase("GRUPO SANGUÍNEO", fontSubTitleNegroNegrita))); cells.Add(new PdfPCell(new Phrase(GSValor == null ? string.Empty : GSValor.v_Value1Name, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("---", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("---", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("FACTOR RH", fontSubTitleNegroNegrita))); cells.Add(new PdfPCell(new Phrase(FSValor == null ? string.Empty : FSValor.v_Value1Name, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("---", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("---", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } columnWidths = new float[] { 25f, 25f, 25f, 25f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths); document.Add(table); #endregion #region GrupoSanguineo #endregion #region Aptitud cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase("APTO:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.i_AptitudeStatusId == (int)Sigesoft.Common.AptitudeStatus.Apto ? "X" :"", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("APTO CON RESTRICCIÓN: ", fontColumnValue)), new PdfPCell(new Phrase(filiationData.i_AptitudeStatusId == (int)Sigesoft.Common.AptitudeStatus.AptRestriccion ? "X" :"", fontColumnValue)), new PdfPCell(new Phrase("NO APTO:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.i_AptitudeStatusId == (int)Sigesoft.Common.AptitudeStatus.NoApto ? "X" :"", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("OBSERVADO:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.i_AptitudeStatusId == (int)Sigesoft.Common.AptitudeStatus.AptoObs ? "X" :"", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase("COMENTARIOS:", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_ObsStatusService == "" ? "NINGUNO":filiationData.v_ObsStatusService, fontColumnValue)) { Colspan = 7, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase("RESTRICCIONES:", fontColumnValue)), new PdfPCell(new Phrase(pstrRestriciones == "" ? "NINGUNA" : pstrRestriciones, fontColumnValue)) { Colspan = 7, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, }; columnWidths = new float[] { 20f, 10f, 20f, 10f, 20f, 10f, 20f, 10f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "APTITUD", fontTitleTable); document.Add(filiationWorker); #endregion #region Firma y sello Médico table = new PdfPTable(2); table.HorizontalAlignment = Element.ALIGN_RIGHT; table.WidthPercentage = 40; columnWidths = new float[] { 15f, 25f }; table.SetWidths(columnWidths); PdfPCell cellFirma = null; if (filiationData.FirmaDoctorAuditor != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaDoctorAuditor, null, null, 120, 45)); } else { cellFirma = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 50F; cell = new PdfPCell(new Phrase("FIRMA Y SELLO MÉDICO", fontColumnValue)); cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; table.AddCell(cell); table.AddCell(cellFirma); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); } }
public static void CreateCertificadoAptitudCompleto(List <DiagnosticRepositoryList> filiationData, organizationDto infoEmpresaPropietaria, List <DiagnosticRepositoryList> diagnosticRepository, string filePDF, string PathNegro, string PathBlanco) { // // step 1: creation of a document-object Document document = new Document(); //Document document = new Document(new Rectangle(500f, 300f), 10, 10, 10, 10); //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()); document.SetPageSize(iTextSharp.text.PageSize.A4); //Document document = new Document(PageSize.A4, 0, 0, 20, 20); try { // step 2: we create a writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); // //create an instance of your PDFpage class. This is the class we generated above. pdfPage page = new pdfPage(); //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class writer.PageEvent = page; // step 3: we open the document document.Open(); // step 4: we Add content to the document // we define some fonts #region Fonts Font fontTitle1 = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontTitleTableNegro = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); #endregion //#region Logo //Image logo = HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F); //PdfPTable headerTbl = new PdfPTable(1); //headerTbl.TotalWidth = writer.PageSize.Width; //PdfPCell cellLogo = new PdfPCell(logo); //cellLogo.VerticalAlignment = Element.ALIGN_TOP; //cellLogo.HorizontalAlignment = Element.ALIGN_CENTER; //cellLogo.Border = PdfPCell.NO_BORDER; //headerTbl.AddCell(cellLogo); //document.Add(headerTbl); //#endregion //#region Title //Paragraph cTitle = new Paragraph("CERTIFICADO DE APTITUD MÉDICO OCUPACIONAL", fontTitle2); ////Paragraph cTitle2 = new Paragraph(customerOrganizationName, fontTitle2); //cTitle.Alignment = Element.ALIGN_CENTER; ////cTitle2.Alignment = Element.ALIGN_CENTER; //document.Add(cTitle); ////document.Add(cTitle2); //#endregion #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; //PdfPTable header1 = new PdfPTable(2); //header1.HorizontalAlignment = Element.ALIGN_CENTER; //header1.WidthPercentage = 100; ////header1.TotalWidth = 500; ////header1.LockedWidth = true; // Esto funciona con TotalWidth //float[] widths = new float[] { 150f, 200f}; //header1.SetWidths(widths); //Rectangle rec = document.PageSize; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; //header1.TotalWidth = 500; //header1.LockedWidth = true; // Esto funciona con TotalWidth float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); //header2.SetWidthPercentage(widths1, rec); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; //header1.TotalWidth = 500; //header1.LockedWidth = true; // Esto funciona con TotalWidth float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; #endregion document.Add(new Paragraph("\r\n")); document.Add(new Paragraph("\r\n")); document.Add(new Paragraph("\r\n")); document.Add(new Paragraph("\r\n")); #region Title //List<PdfPCell> cells = null; PdfPCell CellLogo = null; //float[] columnWidths = null; cells = new List <PdfPCell>(); PdfPCell cellPhoto1 = null; if (filiationData[0].b_Photo != null) { cellPhoto1 = new PdfPCell(HandlingItextSharp.GetImage(filiationData[0].b_Photo, 23F)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT } } ; else { cellPhoto1 = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT } }; if (infoEmpresaPropietaria.b_Image != null) { CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } else { CellLogo = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } columnWidths = new float[] { 100f }; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("CERTIFICADO DE APTITUD MÉDICO OCUPACIONAL", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); cells.Add(CellLogo); cells.Add(new PdfPCell(table)); cells.Add(cellPhoto1); columnWidths = new float[] { 20f, 60f, 20f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion // Salto de linea string PuestoPostula = "-----"; string PuestoActual = "-----"; if (filiationData[0].i_EsoTypeId == ((int)Sigesoft.Common.TypeESO.PreOcupacional).ToString()) { PuestoPostula = filiationData[0].v_OccupationName; } else { PuestoActual = filiationData[0].v_OccupationName; } #region Cabecera del Reporte cells = new List <PdfPCell>() { new PdfPCell(new Phrase("APELLIDOS Y NOMBRES:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].v_PersonName, fontColumnValue)), new PdfPCell(new Phrase("N° HS:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].v_ServiceId, fontColumnValue)), new PdfPCell(new Phrase("DOC. DE IDENTIDAD:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].v_DocNumber, fontColumnValue)), new PdfPCell(new Phrase("EDAD:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].i_Age.ToString(), fontColumnValue)), new PdfPCell(new Phrase("EMPRESA:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].v_OrganizationName, fontColumnValue)), new PdfPCell(new Phrase("FECHA DE E.M.O:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].v_ServiceDate, fontColumnValue)), new PdfPCell(new Phrase("PUESTO AL QUE POSTULA:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(PuestoPostula, fontColumnValue)), new PdfPCell(new Phrase("FECHA DE NAC.:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].d_BirthDate.Value.ToShortDateString(), fontColumnValue)), new PdfPCell(new Phrase("OCUPACIÓN ACTUAL:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(PuestoActual, fontColumnValue)), new PdfPCell(new Phrase("GÉNERO:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].v_GenderName, fontColumnValue)), new PdfPCell(new Phrase("EXAMEN MÉDICO:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].v_EsoTypeName, fontColumnValue)) { Colspan = 3 }, new PdfPCell(new Phrase("GRUPO SANGUÍNEO Y RH:", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT }, new PdfPCell(new Phrase(filiationData[0].GrupoFactorSanguineo, fontColumnValue)) { Colspan = 3 }, }; columnWidths = new float[] { 25f, 25f, 25f, 25f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, "DATOS GENEREALES", fontTitleTableNegro, null); document.Add(filiationWorker); #endregion // Salto de linea document.Add(new Paragraph("\r\n")); #region DETALLE EXAMENES cells = new List <PdfPCell>() { new PdfPCell(new Phrase("EXAMEN", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("RESULTADO", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("RESTRICCIONES", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER } }; columnWidths = new float[] { 25f, 15f, 60f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "EXÁMENES REALIZADOS", fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region Categorias y Restricciones cells = new List <PdfPCell>(); if (filiationData != null && filiationData.Count > 0) { columnWidths = new float[] { 30f }; include = "RESULTADO"; foreach (var item in filiationData) { cell = new PdfPCell(new Phrase(item.Categoria, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.Resultado, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.v_RestrictionsName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } columnWidths = new float[] { 25f, 15f, 60f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue))); columnWidths = new float[] { 100 }; } table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro); document.Add(table); #endregion #region DETALLE CONCLUSIONES cells = new List <PdfPCell>() { new PdfPCell(new Phrase("DIAGNÓSTICOS", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("CIE10", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("RECOMENDACIONES", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER } }; columnWidths = new float[] { 20f, 10f, 70f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "CONCLUSIONES", fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region Hallazgos y recomendaciones cells = new List <PdfPCell>(); var DxNODescartados = diagnosticRepository.FindAll(p => p.i_FinalQualificationId != (int)Sigesoft.Common.FinalQualification.Descartado); if (DxNODescartados != null && DxNODescartados.Count > 0) { columnWidths = new float[] { 0.7f, 23.6f }; include = "i_Item,v_RecommendationName"; foreach (var item in DxNODescartados) { cell = new PdfPCell(new Phrase(item.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.i_DiagnosticTypeId == (int)Sigesoft.Common.TipoDx.Normal?"---": item.v_Dx_CIE10, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); // Crear tabla de recomendaciones para insertarla en la celda que corresponde table = HandlingItextSharp.GenerateTableFromList(item.Recomendations, columnWidths, include, fontColumnValue); cell = new PdfPCell(table); cells.Add(cell); } columnWidths = new float[] { 20f, 10f, 70f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue))); columnWidths = new float[] { 100 }; } table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro); document.Add(table); #endregion #region APTITUD cells = new List <PdfPCell>() { new PdfPCell(new Phrase("APTO", fontSubTitleNegroNegrita)) { Colspan = 2, HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("OBSERVADO", fontSubTitleNegroNegrita)) { Rowspan = 2, HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("NO APTO", fontSubTitleNegroNegrita)) { Rowspan = 2, HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("SIN RESTRICCIONES", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("CON RESTRICCIONES", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(HandlingItextSharp.GetImage(filiationData[0].i_AptitudeStatusId == 2 ?PathNegro :PathBlanco, 30, 7)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(HandlingItextSharp.GetImage(filiationData[0].i_AptitudeStatusId == 5 ?PathNegro :PathBlanco, 30, 7)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(HandlingItextSharp.GetImage(filiationData[0].i_AptitudeStatusId == 4 ?PathNegro :PathBlanco, 30, 7)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(HandlingItextSharp.GetImage(filiationData[0].i_AptitudeStatusId == 3 ?PathNegro :PathBlanco, 30, 7)) { Rowspan = 2, HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.TOP_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.TOP_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.TOP_BORDER }, new PdfPCell(new Phrase(" ", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER, Border = PdfPCell.TOP_BORDER } }; columnWidths = new float[] { 25f, 25f, 25f, 25f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "FUE CONSIDERADO EN ÉSTA OPORTUNIDAD", fontTitleTableNegro, null); document.Add(filiationWorker); #endregion //ServiceComponentList lab = null; #region Firma y sello Médico table = new PdfPTable(2); table.HorizontalAlignment = Element.ALIGN_RIGHT; table.WidthPercentage = 40; columnWidths = new float[] { 15f, 25f }; table.SetWidths(columnWidths); PdfPCell cellFirma = null; if (filiationData != null) { if (filiationData[0].g_Image != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(filiationData[0].g_Image, null, null, 70, 40)); } else { cellFirma = new PdfPCell(new Phrase(" ", fontColumnValue)); } } else { cellFirma = new PdfPCell(); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 70F; cell = new PdfPCell(new Phrase("FIRMA Y SELLO MÉDICO", fontColumnValue)); cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; table.AddCell(cell); table.AddCell(cellFirma); document.Add(table); #endregion // step 5: we close the document document.Close(); writer.Close(); writer.Dispose(); //RunFile(filePDF); } catch (Exception) { throw; } }
public static void CreateEmpresasSinLiquidar(string filePDF, organizationDto infoEmpresaPropietaria, string fechaInicio, string fechaFin, List <Liquidacion> NoLiquidados) { Document document = new Document(PageSize.A4, 30f, 30f, 45f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue2 = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion var estatico_1 = 15f; var alto_Celda_1 = 15f; var alto_Celda_2 = 30f; var alto_Celda_3 = 45f; var alto_Celda_4 = 60f; var alto_Celda_6 = 90f; #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var tamaño_celda = 15f; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("EMPRESAS SIN LIQUIDAR", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("DESDE " + fechaInicio + " HASTA " + fechaFin, fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 10f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 90f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region datos int nroreco = 1; decimal sumaEmpresa = 0; decimal sumaEmpresas = 0; foreach (var item in NoLiquidados) { if (item.v_EmployerName != "CLINICA SAN LORENZO S.R.L.") { cells = new List <PdfPCell>() { new PdfPCell(new Phrase("CLIENTE / EMPRESA ", fontColumnValueBold)) { BackgroundColor = BaseColor.GRAY, Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(": " + item.v_EmployerName, fontColumnValue)) { BackgroundColor = BaseColor.GRAY, Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("RUC", fontColumnValueBold)) { BackgroundColor = BaseColor.GRAY, Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(": " + item.v_EmployerRuc, fontColumnValue)) { BackgroundColor = BaseColor.GRAY, Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("DIRECCION", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(": " + item.v_EmployerDireccion, fontColumnValue)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("TELEFONO", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(": " + item.v_EmployerTelefono, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("PERSONA REFERENCIA", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(": " + item.v_EmployerRepr, fontColumnValue)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("FECHA EST. CTA. AL", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(" " + fechaFin, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); cells = new List <PdfPCell>() { new PdfPCell(new Phrase("N°", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("TRABAJADOR", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("F. EXM", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("CARGO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("EXAMEN", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("PERFIL", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("PRECIO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("USUARIO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 2f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 8f, 20f, 7, 14f, 10f, 16f, 7f, 18f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); cells = new List <PdfPCell>(); foreach (var contenido in item.Detalle) { cell = new PdfPCell(new Phrase(nroreco.ToString() + ". ", fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(contenido.Trabajador, fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(contenido.FechaExamen.ToString().Split(' ')[0], fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(contenido.Cargo, fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(contenido.Esotype, fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(contenido.Perfil, fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); decimal precio = decimal.Round((decimal)contenido.Precio, 2); string[] _Pcadena = precio.ToString().Split('.'); if (_Pcadena.Count() > 1) { cell = new PdfPCell(new Phrase(precio.ToString(), fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(precio.ToString() + ".00", fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } cell = new PdfPCell(new Phrase(contenido.UsuarioCrea.ToString(), fontColumnValue2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); sumaEmpresa += precio; nroreco++; } cell = new PdfPCell(new Phrase("TOTAL S/.", fontColumnValueBold)) { BackgroundColor = BaseColor.GRAY, Colspan = 6, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 10f }; cells.Add(cell); string[] _Pcadena2 = sumaEmpresa.ToString().Split('.'); if (_Pcadena2.Count() > 1) { cell = new PdfPCell(new Phrase(sumaEmpresa.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 10f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(sumaEmpresa.ToString() + ".00", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 10f }; cells.Add(cell); } cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 10f }; cells.Add(cell); sumaEmpresas += sumaEmpresa; cell = new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 8, HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 5f }; cells.Add(cell); sumaEmpresa = 0; nroreco = 1; columnWidths = new float[] { 8f, 20f, 7, 14f, 10f, 16f, 7f, 18f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); } } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("TOTAL EMPRESAS NO LIQUIDADAS S/.", fontColumnValueBold)) { Colspan = 6, BackgroundColor = BaseColor.GRAY, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(sumaEmpresas.ToString(), fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, }; columnWidths = new float[] { 8f, 20f, 7, 14f, 10f, 16f, 7f, 18f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); RunFile(filePDF); }
public static void CreateInforme_Otorrinolaringologico(string filePDF, PacientList datosPac, organizationDto infoEmpresaPropietaria, PacientList filiationData, List <ServiceComponentList> serviceComponent, List <DiagnosticRepositoryList> Diagnosticos, UsuarioGrabo DatosGrabo) { Document document = new Document(PageSize.A4, 40f, 40f, 40f, 50f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; document.Add(new Paragraph("\r\n")); PdfPCell cell = null; #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontTitle1)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("INFORME RADIOLÓGICO", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 25f, 50, 25f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion var tamaño_celda = 25f; string tipodoc = ""; if (datosPac.i_DocTypeId == 1) { tipodoc = "DNI"; } else if (datosPac.i_DocTypeId == 2) { tipodoc = "Pasaporte"; } else if (datosPac.i_DocTypeId == 3) { tipodoc = "Licencia de Conducir"; } else if (datosPac.i_DocTypeId == 4) { tipodoc = "Carnet de Extranjeria"; } ServiceComponentList informe_radiologico = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.INFORME_RADIOLOGICO_ID); var n_Placa = informe_radiologico.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_RADIOLOGICO_N_PLACA) == null ? "- - -" : informe_radiologico.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_RADIOLOGICO_N_PLACA).v_Value1; var informe = informe_radiologico.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_RADIOLOGICO_DESCRIPCION) == null ? "- - -" : informe_radiologico.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_RADIOLOGICO_DESCRIPCION).v_Value1; var conclusiones = informe_radiologico.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_RADIOLOGICO_CONCLUSIONES) == null ? "- - -" : informe_radiologico.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_RADIOLOGICO_CONCLUSIONES).v_Value1; #region Contenido cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \nNÚMERO DE PLACA: ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n" + n_Placa.ToString(), fontColumnValue)) { Colspan = 9, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("APELLIDOS Y NOMBRES: ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_FirstName + " " + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("EDAD: ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.Edad.ToString() + " años.", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 11, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("SEXO: ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.Genero, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 11, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("COMPAÑIA", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_FirstName + " " + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("FECHA: ", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.FechaServicio.ToString().Split(' ')[0], fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 12, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("1. ANAMNESIS: ", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("2. ANTECEDENTES: ", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("4. DIAGNÓSTICOS: ", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region conclusiones cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("5. CONCLUSIONES: ", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(conclusiones, fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("6. RECOMENDACIONES: ", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion //#region RECOMENDACIONES //cells = new List<PdfPCell>() // { // new PdfPCell(new Phrase("", fontColumnValue)){ Colspan =1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 12f, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, // new PdfPCell(new Phrase("N°", fontSubTitleNegroNegrita)){HorizontalAlignment = Element.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK , MinimumHeight = 12f,}, // new PdfPCell(new Phrase("DESCRIPCIÓN", fontSubTitleNegroNegrita)){HorizontalAlignment = Element.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 12f, }, // new PdfPCell(new Phrase("", fontColumnValue)){ Colspan =1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 12f, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, // }; //columnWidths = new float[] { 5f, 5f, 85f, 5f }; //filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); //document.Add(filiationWorker); //cells = new List<PdfPCell>(); //int nroreco = 1; //if (dx != null && dx.Count > 0) //{ // foreach (var item in dx) // { // columnWidths = new float[] { 95f }; // include = "v_RecommendationName"; // cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }; // cells.Add(cell); // cell = new PdfPCell(new Phrase(nroreco.ToString() + ". ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }; // cells.Add(cell); // table = HandlingItextSharp.GenerateTableFromList(item.Recomendations, columnWidths, include, fontColumnValue, PdfPCell.NO_BORDER, null, null); // cell = new PdfPCell(table); // cells.Add(cell); // cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }; // cells.Add(cell); // nroreco++; // } // columnWidths = new float[] { 5f, 5f, 85f, 5f }; //} //else //{ // cells.Add(new PdfPCell(new Phrase("", fontColumnValue))); // cells.Add(new PdfPCell(new Phrase("SIN RECOMENDACIONES", fontColumnValue))); // cells.Add(new PdfPCell(new Phrase("", fontColumnValue))); // columnWidths = new float[] { 5f, 90f, 5f }; //} //table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTableNegro, null); //document.Add(table); //#endregion #region Firma #region Creando celdas de tipo Imagen y validando nulls PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; PdfPCell cellFirma = null; // Firma del trabajador *************************************************** if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 80, 40)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirmaTrabajador.FixedHeight = 50F; // Huella del trabajador ************************************************** if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 30, 45)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellHuellaTrabajador.FixedHeight = 50F; // Firma del doctor Auditor ************************************************** if (DatosGrabo != null) { if (DatosGrabo.Firma != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(DatosGrabo.Firma, null, null, 120, 50)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER } } ; else { cellFirma = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 50F; } #endregion cells = new List <PdfPCell>() { //new PdfPCell(cellFirmaTrabajador){HorizontalAlignment = PdfPCell.ALIGN_CENTER}, //new PdfPCell(cellHuellaTrabajador){HorizontalAlignment = PdfPCell.ALIGN_CENTER}, //new PdfPCell(new Phrase("FIRMA Y SELLO DEL MÉDICO", fontColumnValueBold)) {Rowspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda}, //new PdfPCell(cellFirma){Rowspan=3, HorizontalAlignment = PdfPCell.ALIGN_CENTER}, //new PdfPCell(new Phrase("FIRMA DEL EXAMINADO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 12f}, //new PdfPCell(new Phrase("HUELLA DEL EXAMINADO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 12f}, //new PdfPCell(new Phrase("CON LA CUAL DECLARA QUE LA INFORMACIÓN DECLARADA ES VERAZ", fontColumnValueBold)) {Colspan=2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda}, new PdfPCell(new Phrase("\n \n \n", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(cellFirma) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 25f, 25f, 25f, 25f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateLiquidacion_EMO(string filePDF, organizationDto infoEmpresaPropietaria, List<Liquidacion> Listaliq, organizationDto empresa) { Document document = new Document(PageSize.A4, 30f, 30f, 45f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List<PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List<PdfPCell>(); string N_liquidacion = ""; foreach (var liq in Listaliq) { foreach (var item in liq.Detalle) { N_liquidacion = item.v_NroLiquidacion; } } if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var tamaño_celda = 15f; var cellsTit = new List<PdfPCell>() { new PdfPCell(new Phrase("LIQUIDACIÓN DE EXAMENES MÉDICOS OCUPACIONALES N° " + N_liquidacion, fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 20f, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.BLACK, BorderColorTop=BaseColor.WHITE}, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region DATOS cells = new List<PdfPCell>() { new PdfPCell(new Phrase("EMPRESA A FACTURAR: ", fontColumnValueBold)) { Colspan=1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.BLACK}, new PdfPCell(new Phrase(empresa.v_Name, fontColumnValue)) { Colspan=5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, new PdfPCell(new Phrase("RUC :", fontColumnValueBold)) { Colspan=1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, new PdfPCell(new Phrase(empresa.v_IdentificationNumber, fontColumnValue)) { Colspan=5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, new PdfPCell(new Phrase("DIRECCION", fontColumnValueBold)) {Colspan=1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, new PdfPCell(new Phrase(empresa.v_Address, fontColumnValue)) { Colspan=5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan=6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.BLACK, BorderColorTop=BaseColor.WHITE}, }; columnWidths = new float[] { 20f, 25f, 15f, 15f, 10F, 15F }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Parte Dinámica cells = new List<PdfPCell>(); //int tamañoTickets = 0; int nroreco = 1; decimal sumatipoExm = 0; decimal sumatipoExm_1 = 0; decimal igvPerson = 0; decimal _igvPerson = 0; decimal subTotalPerson = 0; decimal _subTotalPerson = 0; decimal totalFinal = 0; decimal totalFinal_1 = 0; foreach (var liq in Listaliq) { cell = new PdfPCell(new Phrase("TIPO EXAMEN: " + liq.Esotype, fontColumnValueBold)) { BackgroundColor=BaseColor.GRAY, Colspan=11, HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("N°", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("PACIENTE", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("EDAD", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("F. EXAMEN", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("DNI", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("CARGO", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("PERFIL", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("IGV", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("SUB TOTAL", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("TOTAL", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("REF./OBSE.", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); foreach (var item in liq.Detalle) { cell = new PdfPCell(new Phrase(nroreco.ToString() + ". ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.Trabajador , fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.Edad.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.FechaExamen.ToString().Split(' ')[0], fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.NroDocumemto, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.Cargo, fontColumnValue1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.Perfil, fontColumnValue1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); decimal _SubTotal = (decimal)item.Precio / (decimal)1.18; _SubTotal = _SubTotal + (decimal)0.00000000000001; _SubTotal = decimal.Round(_SubTotal, 2); decimal _igv =_SubTotal * (decimal)0.18; _igv = _igv + (decimal)0.000000000000000001; _igv = decimal.Round(_igv, 2); string[] _PcadenaIgv = _igv.ToString().Split('.'); if (_PcadenaIgv.Count() > 1) { cell = new PdfPCell(new Phrase(_igv.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(_igv.ToString() + ".00", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } string[] _PcadenaSubTotAL = _igv.ToString().Split('.'); if (_PcadenaSubTotAL.Count() > 1) { cell = new PdfPCell(new Phrase(_SubTotal.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(_SubTotal.ToString()+ ".00", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } decimal _Precio = (decimal)item.Precio; _Precio = _Precio + (decimal)0.0000001; _Precio = decimal.Round(_Precio, 2); string[] _Pcadena = _Precio.ToString().Split('.'); if (_Pcadena.Count() > 1) { cell = new PdfPCell(new Phrase(_Precio.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(_Precio.ToString() +".00", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } cell = new PdfPCell(new Phrase(item.CCosto, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); sumatipoExm += (decimal)item.Precio; sumatipoExm = sumatipoExm + (decimal)0.0000000000000000001; igvPerson += (decimal)_igv; igvPerson = igvPerson + (decimal)0.0000000000000000001; subTotalPerson += (decimal)_SubTotal; subTotalPerson = subTotalPerson + (decimal)0.0000000000000000000001; nroreco++; } sumatipoExm_1 = decimal.Round(sumatipoExm,2); _igvPerson = decimal.Round(igvPerson,2); _subTotalPerson = decimal.Round(subTotalPerson,2); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) {Colspan=3, HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("TOTAL EXAMEN: " + liq.Esotype + " = ", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); string[] _PcadenaigvPerson = _igvPerson.ToString().Split('.'); if (_PcadenaigvPerson.Count() > 1) { cell = new PdfPCell(new Phrase(_igvPerson.ToString(), fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(_igvPerson.ToString() +".00", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } string[] _Pcadena_subTotalPerson = _subTotalPerson.ToString().Split('.'); if (_Pcadena_subTotalPerson.Count() > 1) { cell = new PdfPCell(new Phrase(_subTotalPerson.ToString(), fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(_subTotalPerson.ToString() + ".00", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } string[] _Pcadena_sumatipoExm_1 = sumatipoExm_1.ToString().Split('.'); if (_Pcadena_sumatipoExm_1.Count() > 1) { cell = new PdfPCell(new Phrase(sumatipoExm_1.ToString(), fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(sumatipoExm_1.ToString() +".00", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); //decimal IGV = totalFinal * (decimal)0.18; //decimal subTotalFinal = totalFinal - IGV; sumatipoExm = 0; igvPerson = 0; subTotalPerson = 0; totalFinal += (decimal)sumatipoExm_1; totalFinal = totalFinal + (decimal)0.00000000000000001; } totalFinal_1 = decimal.Round(totalFinal, 2); decimal subTotalFinal = decimal.Round(totalFinal_1 / (decimal)1.18,2); decimal IGV = decimal.Round(subTotalFinal * (decimal)0.18,2); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("SUB TOTAL = S/. ", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); string[] _Pcadena_subTotalFinal = subTotalFinal.ToString().Split('.'); if (_Pcadena_subTotalFinal.Count() > 1) { cell = new PdfPCell(new Phrase(subTotalFinal.ToString(), fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(subTotalFinal.ToString() +".00", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); } cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("IGV = S/. ", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); string[] _Pcadena_IGV = IGV.ToString().Split('.'); if (_Pcadena_IGV.Count() > 1) { cell = new PdfPCell(new Phrase(IGV.ToString(), fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(IGV.ToString() + ".00", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("TOTAL LIQUIDACIÓN = S/. ", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); string[] _PcadenatotalFinal_1 = totalFinal_1.ToString().Split('.'); if (_PcadenatotalFinal_1.Count() > 1) { cell = new PdfPCell(new Phrase(totalFinal_1.ToString(), fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(totalFinal_1.ToString()+".00", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); } cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); columnWidths = new float[] { 4f, 20f, 5f, 10f, 8f, 13f, 15f, 5f, 5f, 8f, 10f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); RunFile(filePDF); }
public static void CrearHojaCotizacion(List <CotizacionProtocolo> lCotizacion, string EmpresaCliente, OrganizationList infoEmpresaPropietaria, string filePDF) { Document document = new Document(); document.SetPageSize(iTextSharp.text.PageSize.A4); //try //{NO_BORDER // step 2: we create aPA writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); //create an instance of your PDFpage class. This is the class we generated above. pdfPage page = new pdfPage(); //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class writer.PageEvent = page; // step 3: we open the document document.Open(); // step 4: we Add content to the document // we define some fonts #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; //string[] columnValues = null; string[] columnHeaders = null; PdfPTable filiationWorker = new PdfPTable(8); PdfPTable table = null; PdfPCell cell = null; #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 12, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueNegrita = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontAptitud = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region Title //List<PdfPCell> cells = null; PdfPCell CellLogo = null; //float[] columnWidths = null; cells = new List <PdfPCell>(); PdfPCell cellPhoto1 = null; //if (filiationData.b_Photo != null) // cellPhoto1 = new PdfPCell(HandlingItextSharp.GetImage(filiationData.b_Photo, 23F)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT }; //else // cellPhoto1 = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT }; if (infoEmpresaPropietaria.b_Image != null) { CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } else { CellLogo = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } columnWidths = new float[] { 100f }; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("PROFORMA SERVICIOS DE SALUD OCUPACIONAL ", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("CLÍNICA HOLOSALUD", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase(" ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); cells.Add(CellLogo); cells.Add(new PdfPCell(table)); //cells.Add(cellPhoto1); columnWidths = new float[] { 20f, 80f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); document.Add(new Paragraph("\r\n")); #endregion cells = new List <PdfPCell>() { new PdfPCell(new Phrase("PROFORMA SERVICIOS DE SALUD OCUPACIONAL", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("DETALLE DE SERVICIOS SOLICITADOS SEGÚN RM N°312-2011 MINSA EXAMENES", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("MEDICOS SOLICITADOS", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, }; columnWidths = new float[] { 100f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(filiationWorker); document.Add(new Paragraph("\r\n")); #region Parte Dinámica if (lCotizacion != null) { foreach (var item in lCotizacion) { cells = new List <PdfPCell>(); var x = item.Detalle.Sum(p => p.costo); var Igv = x * 0.18; var Total = Igv + x; //Columna Protocolo cell = new PdfPCell(new Phrase(item.ProtocoloNombre + " Precio: S/. " + x.ToString() + " I.G.V: S/." + Igv + " Total: S/." + Total.ToString(), fontColumnValueNegrita)) { HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_LEFT }; cells.Add(cell); columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); if (item.Detalle.Count > 0) { List <PdfPCell> cells1 = null; cells1 = new List <PdfPCell>(); //string Cadena = ""; foreach (var item1 in item.Detalle) { PdfPCell cell1 = null; cell1 = new PdfPCell(new Phrase(item1.ComponenteNombre, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_LEFT }; cells1.Add(cell1); string Costo = "S/." + item1.costo.ToString(); cell1 = new PdfPCell(new Phrase(Costo, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_CENTER }; cells1.Add(cell1); } columnWidths = new float[] { 50f, 50f }; PdfPTable table1 = null; columnHeaders = new string[] { "EXÁMENES", "PRECIO" }; table1 = HandlingItextSharp.GenerateTableFromCells(cells1, columnWidths, null, fontTitleTable, columnHeaders); document.Add(table1); document.Add(new Paragraph("\r\n")); } } } #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateFichaMedicaTrabajador2(PacientList filiationData, ServiceList doctoPhisicalExam, List <DiagnosticRepositoryList> diagnosticRepository, organizationDto infoEmpresaPropietaria, string filePDF) { Document document = new Document(); document.SetPageSize(iTextSharp.text.PageSize.A4); //try //{NO_BORDER // step 2: we create aPA writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); //create an instance of your PDFpage class. This is the class we generated above. pdfPage page = new pdfPage(); page.Dato = "FMT2/" + filiationData.v_FirstName + " " + filiationData.v_FirstLastName + " " + filiationData.v_SecondLastName; //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class writer.PageEvent = page; // step 3: we open the document document.Open(); // step 4: we Add content to the document // we define some fonts #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; //string[] columnValues = null; string[] columnHeaders = null; PdfPTable filiationWorker = new PdfPTable(8); PdfPTable table = null; PdfPCell cell = null; #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Arial", 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableAntecedentesOcupacionales = FontFactory.GetFont("Arial", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueAntecedentesOcupacionales = FontFactory.GetFont("Arial", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueNegrita = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontAptitud = FontFactory.GetFont("Arial", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); //Font fontTitleTableNegro = FontFactory.GetFont("Arial", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion //#region Logo PdfPCell CellLogo = null; //if (infoEmpresaPropietaria.b_Image != null) //{ // CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F)); //} //else //{ // CellLogo = new PdfPCell(new Phrase(" ", fontColumnValue)); //} //Image logo = HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 20F); //PdfPTable headerTbl = new PdfPTable(1); //headerTbl.TotalWidth = writer.PageSize.Width; //PdfPCell cellLogo = new PdfPCell(CellLogo); //cellLogo.VerticalAlignment = Element.ALIGN_TOP; //cellLogo.HorizontalAlignment = Element.ALIGN_CENTER; //cellLogo.Border = PdfPCell.NO_BORDER; //headerTbl.AddCell(cellLogo); //document.Add(headerTbl); //#endregion //document.Add(new Paragraph("\r\n")); //#region Title //Paragraph cTitle = new Paragraph("CARTA DE COMPROMISO", fontTitle1); //cTitle.Alignment = Element.ALIGN_CENTER; //document.Add(cTitle); //#endregion #region Title CellLogo = null; cells = new List <PdfPCell>(); PdfPCell cellPhoto1 = null; if (filiationData.b_Photo != null) { cellPhoto1 = new PdfPCell(HandlingItextSharp.GetImage(filiationData.b_Photo, 23F)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT } } ; else { cellPhoto1 = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT } }; if (infoEmpresaPropietaria.b_Image != null) { CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } else { CellLogo = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } columnWidths = new float[] { 100f }; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("CARTA DE COMPROMISO", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); cells.Add(CellLogo); cells.Add(new PdfPCell(table)); cells.Add(cellPhoto1); columnWidths = new float[] { 20f, 60f, 20f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #region Cabecera string XPreocupacional = "( )"; string PeriodicoAnual = "( )"; string Retiro = "( )"; if (filiationData.i_EsoTypeId == (int)Sigesoft.Common.TypeESO.PreOcupacional) { XPreocupacional = "( X )"; } else if (filiationData.i_EsoTypeId == (int)Sigesoft.Common.TypeESO.PeriodicoAnual) { PeriodicoAnual = "( X )"; } else if (filiationData.i_EsoTypeId == (int)Sigesoft.Common.TypeESO.Retiro) { Retiro = "( X )"; } string Linea1 = "YO, " + filiationData.v_OwnerName.ToUpper(); string Linea2 = "IDENTIFICADO CON DNI/CE/PASAPORTE " + filiationData.v_DocNumber + ", CON EL CARGO / PUESTO " + filiationData.v_CurrentOccupation == null ? "" : filiationData.v_CurrentOccupation; string Linea3 = "PERTENECIENTE A LA EMPRESA " + filiationData.v_FullWorkingOrganizationName.ToUpper(); string Linea4 = "EN EL CENTRO MÉDICO: " + infoEmpresaPropietaria.v_Name.ToUpper() + ", EN LA FECHA:" + filiationData.d_ServiceDate.Value.ToShortDateString(); cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase(Linea1, fontColumnValue)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_JUSTIFIED }, //fila new PdfPCell(new Phrase(Linea2, fontColumnValue)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_JUSTIFIED }, //fila new PdfPCell(new Phrase(Linea3, fontColumnValue)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_JUSTIFIED }, //fila new PdfPCell(new Phrase("HABIENDO PASADO LA EVALUACIÓN MÉDICA:", fontTitleTable)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase(XPreocupacional, fontColumnValue)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("PRE OCUPACIONAL", fontColumnValue)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(PeriodicoAnual, fontColumnValue)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("ANUAL", fontColumnValue)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(Retiro, fontColumnValue)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("DE RETIRO", fontColumnValue)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase(Linea4, fontColumnValue)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase("HE SIDO DEBIDAMENTE INFORMADO DE LOS RESULTADOS OBTENIDOS EN EL EXAMEN MÉDICO, SIENDO LOS DIAGNÓSTICOS ENCONTRADOS:", fontColumnValue)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, }; columnWidths = new float[] { 5f, 20f, 5f, 20f, 5f, 20f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(filiationWorker); #endregion #region DETALLE CONCLUSIONES cells = new List <PdfPCell>() { new PdfPCell(new Phrase("ÍTEM", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("DIAGNÓSTICOS", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("CIE10", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, }; columnWidths = new float[] { 5f, 80f, 15f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region Hallazgos y recomendaciones cells = new List <PdfPCell>(); int nro = 1; var dx = diagnosticRepository.FindAll(p => p.i_DiagnosticTypeId != (int)Sigesoft.Common.TipoDx.Normal); if (dx != null && dx.Count > 0) { //columnWidths = new float[] { 0.7f, 23.6f }; //include = "i_Item,v_RecommendationName"; foreach (var item in dx) { cell = new PdfPCell(new Phrase(nro.ToString() + ".- ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.i_DiagnosticTypeId == (int)Sigesoft.Common.TipoDx.Normal ? "---" : item.v_Dx_CIE10, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //// Crear tabla de recomendaciones para insertarla en la celda que corresponde //table = HandlingItextSharp.GenerateTableFromList(item.Recomendations, columnWidths, include, fontColumnValue); //cell = new PdfPCell(table); //cells.Add(cell); nro++; } columnWidths = new float[] { 5f, 80f, 15f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue))); columnWidths = new float[] { 100 }; } table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro); document.Add(table); #endregion #region Texto cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase("LOS MISMOS QUE ACEPTO Y POR LO TANTO ME COMPROMETO A SEGUIR LAS SIGUIENTES RECOMENDACIONES CLÍNICAS Y DE SALUD OCUPACIONAL QUE EL MÉDICO CONSIDERE.", fontColumnValue)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, }; columnWidths = new float[] { 100f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion #region Recomendaciones cells = new List <PdfPCell>() { new PdfPCell(new Phrase("ÍTEM", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("RECOMENDACIONES", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, }; columnWidths = new float[] { 5f, 95f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); document.Add(filiationWorker); cells = new List <PdfPCell>(); int nroreco = 1; if (dx != null && dx.Count > 0) { foreach (var item in dx) { columnWidths = new float[] { 95f }; include = "v_RecommendationName"; cell = new PdfPCell(new Phrase(nroreco.ToString() + ".- ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); table = HandlingItextSharp.GenerateTableFromList(item.Recomendations, columnWidths, include, fontColumnValue); cell = new PdfPCell(table); cells.Add(cell); nroreco++; } columnWidths = new float[] { 5f, 95f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue))); columnWidths = new float[] { 100 }; } table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro); document.Add(table); #endregion #region Restricciones cells = new List <PdfPCell>() { new PdfPCell(new Phrase("ÍTEM", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, new PdfPCell(new Phrase("RESTRICCIONES", fontSubTitleNegroNegrita)) { HorizontalAlignment = Element.ALIGN_CENTER }, }; columnWidths = new float[] { 5f, 95f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); document.Add(filiationWorker); cells = new List <PdfPCell>(); int nroreco1 = 1; if (dx != null && dx.Count > 0) { foreach (var item in dx) { if (item.Restrictions.Count > 0) { columnWidths = new float[] { 95f }; include = "v_RestrictionName"; cell = new PdfPCell(new Phrase(nroreco1.ToString() + ".- ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //cell = new PdfPCell(new Phrase(item.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE }; //cells.Add(cell); //cell = new PdfPCell(new Phrase(item.i_DiagnosticTypeId == (int)Sigesoft.Common.TipoDx.Normal ? "---" : item.v_Dx_CIE10, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; //cells.Add(cell); // Crear tabla de recomendaciones para insertarla en la celda que corresponde table = HandlingItextSharp.GenerateTableFromList(item.Restrictions, columnWidths, include, fontColumnValue); cell = new PdfPCell(table); cells.Add(cell); nroreco1++; } } columnWidths = new float[] { 5f, 95f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue))); columnWidths = new float[] { 100 }; } table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro); document.Add(table); #endregion #region Texto cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase("LAS QUE CUMPLIRÉ ESTRICTAMENTE CON LA FINALIDAD DE PREVENIR LA SEVERIDAD O EMPEORAMIENTO DE LOS PRESENTES CUADROS DIAGNOSTICADOS, ASÍ MISMO ME COMPROMETO A CUMPLIR CON LOS CHEQUEOS Y CONTROLES MÉDICOS OCUPACIONALES QUE EL MÉDICO DE LA CLÍNICA MENCIONADA INDIQUE.", fontColumnValue)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //fila new PdfPCell(new Phrase("FIRMO EN CONFORMIDAD CON LO ANTES EXPUESTO.", fontColumnValue)) { Colspan = 6, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, }; columnWidths = new float[] { 100f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion document.Add(new Paragraph("\r\n")); #region Firma #region Creando celdas de tipo Imagen y validando nulls // Firma del trabajador *************************************************** PdfPCell cellFirmaTrabajador = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, 20, 10)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase("Sin Firma Trabajador", fontColumnValue)); } // Huella del trabajador ************************************************** PdfPCell cellHuellaTrabajador = null; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, 20, 30)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase("Sin Huella", fontColumnValue)); } // Firma del doctor EXAMEN FISICO ************************************************** PdfPCell cellFirma = null; if (filiationData == null) { cellFirma = new PdfPCell(new Phrase("Sin Firma", fontColumnValue)); } else if (filiationData.FirmaDoctorAuditor != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaDoctorAuditor, null, null, 120, 45)); } else { cellFirma = new PdfPCell(new Phrase("Sin Firma", fontColumnValue)); } #endregion #region Crear tablas en duro (para la Firma y huella del trabajador) cells = new List <PdfPCell>(); cellFirmaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirmaTrabajador.FixedHeight = 80F; cells.Add(cellFirmaTrabajador); cells.Add(new PdfPCell(new Phrase("NOMBRE: " + filiationData.v_OwnerName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE }); cells.Add(new PdfPCell(new Phrase("D.N.I: " + filiationData.v_DocNumber, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE }); cells.Add(new PdfPCell(new Phrase("PUESTO: " + filiationData.v_CurrentOccupation, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE }); columnWidths = new float[] { 100f }; var tableFirmaTrabajador = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); //*********************************************** cells = new List <PdfPCell>(); cellHuellaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellHuellaTrabajador.FixedHeight = 80F; cells.Add(cellHuellaTrabajador); cells.Add(new PdfPCell(new Phrase("HUELLA DEL EXAMINADO", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }); columnWidths = new float[] { 100f }; var tableHuellaTrabajador = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); #endregion cells = new List <PdfPCell>(); // 1 celda vacia cells.Add(new PdfPCell(tableFirmaTrabajador)); // 1 celda vacia cells.Add(new PdfPCell(tableHuellaTrabajador)); // 2 celda cell = new PdfPCell(new Phrase("FIRMA Y SELLO MÉDICO", fontColumnValue)); cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cells.Add(cell); // 3 celda (Imagen) cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 30F; cells.Add(cellFirma); columnWidths = new float[] { 25f, 25f, 20f, 30F }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, " ", fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); } }
public static void CreateDeclaracionJurada(string filePDF, PacientList datosPac, organizationDto infoEmpresaPropietaria, PacientList filiationData, List <ServiceComponentList> serviceComponent) { Document document = new Document(PageSize.A4, 40f, 40f, 40f, 50f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 13, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("DECLARACION JURADA", fontTitle1)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 20f, 60f, 20f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion var tamaño_celda = 25f; string tipodoc = ""; if (datosPac.i_DocTypeId == 1) { tipodoc = "DNI"; } else if (datosPac.i_DocTypeId == 2) { tipodoc = "Pasaporte"; } else if (datosPac.i_DocTypeId == 3) { tipodoc = "Licencia de Conducir"; } else if (datosPac.i_DocTypeId == 4) { tipodoc = "Carnet de Extranjeria"; } #region Contenido cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n YO, ", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n" + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 16, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nIdentificado (a) con " + tipodoc + " N° ", fontColumnValue)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n" + datosPac.v_DocNumber, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\ndeclaro por medio de este documento", fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nmédico legal que me encuentro en buen estado de salud física y mental y que toda la", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\ninformación proporcionada al médico o funcionario responsable es de carácter verídico,", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n ", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\npara el cargo correspondiente.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion string[] fechaServicio = datosPac.FechaServicio.ToString().Split('/', ' '); string mes = ""; if (fechaServicio[1] == "01") { mes = "Enero"; } else if (fechaServicio[1] == "02") { mes = "Febrero"; } else if (fechaServicio[1] == "03") { mes = "Marzo"; } else if (fechaServicio[1] == "04") { mes = "Abril"; } else if (fechaServicio[1] == "05") { mes = "Mayo"; } else if (fechaServicio[1] == "06") { mes = "Junio"; } else if (fechaServicio[1] == "07") { mes = "Julio"; } else if (fechaServicio[1] == "08") { mes = "Agosto"; } else if (fechaServicio[1] == "09") { mes = "Setiembre"; } else if (fechaServicio[1] == "10") { mes = "Octubre"; } else if (fechaServicio[1] == "11") { mes = "Noviembre"; } else if (fechaServicio[1] == "12") { mes = "Diciembre"; } PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 100, 35)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 60, 80)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; #region Fecha / Firmma cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n \n \n" + infoEmpresaPropietaria.v_SectorName + ", " + fechaServicio[0] + " de " + mes + " del " + fechaServicio[2], fontColumnValue)) { Colspan = 19, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(cellFirmaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 180, BorderColor = BaseColor.WHITE }, new PdfPCell(cellHuellaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 180, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("_____________________________________", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(" Firma y Post Firma ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("N° de " + tipodoc + ": " + datosPac.v_DocNumber, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateAutorizacionLiberacionInformacionMedicaSanMartin(string filePDF, PacientList datosPac, organizationDto infoEmpresaPropietaria, PacientList filiationData) { Document document = new Document(PageSize.A4, 40f, 40f, 80f, 50f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 14, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 9, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } string[] fechaServicio = datosPac.FechaServicio.ToString().Split('/', ' '); var tamaño_celda = 20f; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("AUTORIZACION DE LIBERACION DE INFORMACION MÉDICA", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Contenido string empresageneral = filiationData.empresa_; string empresacontrata = filiationData.contrata; string empresasubcontrata = filiationData.subcontrata; string empr_Conct = ""; if (empresageneral != empresasubcontrata) { empr_Conct = empresageneral + " / " + empresacontrata + " / " + empresasubcontrata; } else { empr_Conct = empresageneral + " / " + empresacontrata; } string[] clinica = infoEmpresaPropietaria.v_Name.Split(' '); cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \nYO : ", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n" + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 17, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nIdentificado (a) con DNI / PASAPORTE / CARNE DE EXTRANJERIA N° ", fontColumnValue)) { Colspan = 14, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n" + datosPac.v_DocNumber, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\ncon domicilio ubicado en ", fontColumnValue)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n" + datosPac.v_AdressLocation, fontColumnValue)) { Colspan = 12, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nDECLARO ", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\nque en forma libre y espontanea ", fontColumnValue)) { Colspan = 7, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\nAUTORIZO ", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\na la ", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n" + clinica[0] + " " + clinica[1], fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n" + clinica[2] + " " + clinica[3], fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\na proporcionar información con respecto a mi estado de salud, resultados ", fontColumnValue)) { Colspan = 14, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n de examenes auziliares, mis resultados de evaluaciones medicas ocupacionales, contenidas ", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nen mi Historia Clínica, al responsable del Área de Salud Ocupacional de la Empresa", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n" + empr_Conct, fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \nLa presente autorización se ampara en lo dispuesto en los Artículos 5° segundo párrafo, Artículos 13°,", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n25°, 27° y 29° tercer párrafo de la Ley General de Salud N° 26842.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \nFECHA: " + fechaServicio[0] + "/" + fechaServicio[1] + "/" + fechaServicio[2], fontColumnValue)) { Colspan = 16, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 125, 50)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 55, 75)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; #region Fecha / Firmmal cells = new List <PdfPCell>() { new PdfPCell(cellFirmaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 160, BorderColor = BaseColor.WHITE }, new PdfPCell(cellHuellaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 160, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("_____________________________________", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Firma del Paciente", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("N° de DNI: " + datosPac.v_DocNumber, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateTicket(string filePDF, organizationDto infoEmpresaPropietaria, List <TicketDetalleList> detalleTicket, PacientList datosPac, hospitalizacionDto hospit, hospitalizacionhabitacionDto hospitHabit, MedicoTratanteAtenciones medico, ticketDto ticket, protocolDto protocolo) { Document document = new Document(PageSize.A4, 30f, 30f, 45f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var tamaño_celda = 15f; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("TICKET " + ticket.v_TicketId, fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region DATOS string titular = ""; if (datosPac.v_OwnerName == "") { titular = datosPac.v_FirstName + " " + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName; } else { titular = datosPac.v_OwnerName; } string n_habitac = ""; if (hospitHabit.i_HabitacionId == 1) { n_habitac = "201"; } else if (hospitHabit.i_HabitacionId == 2) { n_habitac = "202"; } else if (hospitHabit.i_HabitacionId == 3) { n_habitac = "203"; } else if (hospitHabit.i_HabitacionId == 4) { n_habitac = "204"; } else if (hospitHabit.i_HabitacionId == 5) { n_habitac = "205"; } else if (hospitHabit.i_HabitacionId == 6) { n_habitac = "206"; } else if (hospitHabit.i_HabitacionId == 7) { n_habitac = "207"; } else if (hospitHabit.i_HabitacionId == 8) { n_habitac = "208"; } else if (hospitHabit.i_HabitacionId == 9) { n_habitac = "301"; } else if (hospitHabit.i_HabitacionId == 10) { n_habitac = "302"; } else if (hospitHabit.i_HabitacionId == 11) { n_habitac = "303"; } else if (hospitHabit.i_HabitacionId == 12) { n_habitac = "304"; } else if (hospitHabit.i_HabitacionId == 13) { n_habitac = "305"; } else if (hospitHabit.i_HabitacionId == 14) { n_habitac = "306"; } else if (hospitHabit.i_HabitacionId == 15) { n_habitac = "307"; } else if (hospitHabit.i_HabitacionId == 16) { n_habitac = "308"; } else { n_habitac = "- - -"; } string med = ""; if (medico != null) { med = medico.Nombre; } else { med = "CLINICA SAN LORENZO"; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("SERViCIO: ", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(protocolo.v_Name, fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("CÓDIGO INTERNO: ", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(hospitHabit.v_HopitalizacionId, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("PACIENTE: ", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_FirstName + " " + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("TITULAR: ", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(titular, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("HIST. CLINICA : ", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_DocNumber, fontColumnValueBold1)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("CAMA : ", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(n_habitac, fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("EMPRESA: ", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_Employer, fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("INGRESO :", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(hospit.d_FechaIngreso.ToString() == null?"":hospit.d_FechaIngreso.ToString().Split(' ')[0], fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("MEDICO A CARGO: ", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(med, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 5f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 15f, 30f, 15f, 15f, 10F, 15F }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region DATOS cells = new List <PdfPCell>() { new PdfPCell(new Phrase("DETALLE", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("FECHA", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("TICKET", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("NOMBRE", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("CANT", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, }; columnWidths = new float[] { 12f, 12f, 66f, 10f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Parte Dinámica cells = new List <PdfPCell>(); int tamañoTickets = 0; string enfermera = ""; if (detalleTicket != null) { var detalletickets = detalleTicket.FindAll(p => p.d_Cantidad != 0); tamañoTickets = detalletickets.Count(); cell = new PdfPCell(new Phrase(ticket.d_Fecha.ToString().Split(' ')[0], fontColumnValue)) { Rowspan = tamañoTickets, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(ticket.i_TipoCuentaId.ToString() == "1" ? "\nSOP" : ticket.i_TipoCuentaId.ToString() == "2" ? "\nPROC - SOP" : ticket.i_TipoCuentaId.ToString() == "3" ? "\nHOSP" : ticket.i_TipoCuentaId.ToString() == "4" ? "\nI. SERV." : string.Empty, fontColumnValue)) { Rowspan = tamañoTickets, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); foreach (var item in detalleTicket) { cell = new PdfPCell(new Phrase(item.v_Descripcion, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); int cantidad = (int)item.d_Cantidad; cell = new PdfPCell(new Phrase(cantidad.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); enfermera = item.UsuarioCrea; } } columnWidths = new float[] { 12f, 12f, 66f, 10f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion #region Enfermera cells = new List <PdfPCell>(); cell = new PdfPCell(new Phrase("Enfermera: ", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 25f }; cells.Add(cell); cell = new PdfPCell(new Phrase(enfermera, fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 25f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 50f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("_______________________________________", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("_______________________________________", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("FARMACIA", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("PACIENTE: " + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + ", " + datosPac.v_FirstName + "\nDNI: " + datosPac.v_DocNumber, fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 30f }; cells.Add(cell); columnWidths = new float[] { 10f, 34f, 12f, 34f, 10f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); RunFile(filePDF); }
public static void CreateDeclaracion_Jurada_EMPO_YANACOCHA(ServiceList DataService, string filePDF, PacientList datosPac, organizationDto infoEmpresaPropietaria, PacientList filiationData, List <ServiceComponentList> serviceComponent, byte[] CuadroVacio, byte[] CuadroCheck) { Document document = new Document(PageSize.A4, 40f, 40f, 40f, 50f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 13, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("DECLARACIÓN JURADA PARA EXAMENES MÉDICOS \nPRE OCUPACIONALES", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 90f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion var tamaño_celda = 25f; string tipodoc1 = "", tipodoc2 = "", tipodoc3 = "", tipodoc4 = ""; if (datosPac.i_DocTypeId == 1) { tipodoc1 = ""; } else if (datosPac.i_DocTypeId == 2) { tipodoc2 = ""; } else if (datosPac.i_DocTypeId == 3) { tipodoc3 = ""; } else if (datosPac.i_DocTypeId == 4) { tipodoc4 = ""; } #region Contenido cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n YO, ", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 12, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n identificado con", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, //+ datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("DNI( " + tipodoc1 + " )/ Pasaporte( " + tipodoc2 + " )/CARNET DE EXTRANJERÍA( " + tipodoc4 + " ) N°", fontColumnValue)) { Colspan = 11, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("representante legal", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("de la empresa ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("mediante la presente declaro que la información presentada ante la Oficina de", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Proceso de Admisión de Minera Yanacocha SRL, respecto a los exámenes médicos", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("para la visita de mis trabajadores , es fidedigna, veraz y autorizo a comprobarla, ", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("entendiendo que la omisión o distorsión de la misma es motivo suficiente para la ", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("invalidez de mi tramite.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion string[] fechaServicio = datosPac.FechaServicio.ToString().Split('/', ' '); string mes = ""; if (fechaServicio[1] == "01") { mes = "Enero"; } else if (fechaServicio[1] == "02") { mes = "Febrero"; } else if (fechaServicio[1] == "03") { mes = "Marzo"; } else if (fechaServicio[1] == "04") { mes = "Abril"; } else if (fechaServicio[1] == "05") { mes = "Mayo"; } else if (fechaServicio[1] == "06") { mes = "Junio"; } else if (fechaServicio[1] == "07") { mes = "Julio"; } else if (fechaServicio[1] == "08") { mes = "Agosto"; } else if (fechaServicio[1] == "09") { mes = "Setiembre"; } else if (fechaServicio[1] == "10") { mes = "Octubre"; } else if (fechaServicio[1] == "11") { mes = "Noviembre"; } else if (fechaServicio[1] == "12") { mes = "Diciembre"; } PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 100, 35)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 60, 80)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; #region Fecha / Firmma cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n \n \n ........................, " + "....... de .....................del 20.....", fontColumnValue)) { Colspan = 19, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell() { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 100, BorderColor = BaseColor.WHITE }, new PdfPCell() { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 100, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("_____________________________________", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Firma", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n \n", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 50f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Title PdfPCell CellLogo = null; PdfPCell cellPhoto1 = null; if (filiationData.b_Photo != null) { cellPhoto1 = new PdfPCell(HandlingItextSharp.GetImage(filiationData.b_Photo, null, null, 80, 60)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT } } ; else { cellPhoto1 = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT } }; if (infoEmpresaPropietaria.b_Image != null) { CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 20F)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } else { CellLogo = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } PdfPCell cellConCheck = null; cellConCheck = new PdfPCell(HandlingItextSharp.GetImage(CuadroCheck)); PdfPCell cellSinCheck = null; cellSinCheck = new PdfPCell(HandlingItextSharp.GetImage(CuadroVacio)); PdfPCell PreOcupacional = cellSinCheck, Periodica = cellSinCheck, Retiro = cellSinCheck, Otros = cellSinCheck, Empresa = cellSinCheck, Contratista = cellSinCheck; if (DataService != null) { if (DataService.i_EsoTypeId == (int)Sigesoft.Common.TypeESO.PreOcupacional) { PreOcupacional = cellConCheck; } else if (DataService.i_EsoTypeId == (int)Sigesoft.Common.TypeESO.PeriodicoAnual) { Periodica = cellConCheck; } else if (DataService.i_EsoTypeId == (int)Sigesoft.Common.TypeESO.Retiro) { Retiro = cellConCheck; } else { Otros = cellConCheck; } if (DataService.i_ServiceTypeId == (int)Sigesoft.Common.ServiceType.Empresarial) { Empresa = cellConCheck; } else { Contratista = cellConCheck; } } float tamaño_celda1 = 12f; string empresageneral = filiationData.empresa_; string empresacontrata = filiationData.contrata; string empresasubcontrata = filiationData.subcontrata; string empr_Conct = ""; if (empresageneral != empresasubcontrata) { empr_Conct = empresacontrata + " / " + empresasubcontrata; } else { empr_Conct = empresacontrata; } cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue1)) { Rowspan = 2, Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("ANEXO N° 16", fontTitle2)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("EXAMEN MÉDICO", fontColumnValueBold1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue1)) { UseVariableBorders = true, MinimumHeight = tamaño_celda1, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, //fila new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("FICHA MÉDICA OCUPACIONAL", fontTitle2)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, MinimumHeight = tamaño_celda1, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("PRE-OCUPACIONAL", fontColumnValue1)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(PreOcupacional) { Border = PdfPCell.RIGHT_BORDER, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_BOTTOM }, new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, ////fila // new PdfPCell(new Phrase("", fontColumnValue1)){ Colspan =1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, // new PdfPCell(new Phrase(" ", fontColumnValue1)) {Colspan =4 ,MinimumHeight = tamaño_celda1, UseVariableBorders=true, BorderColorLeft=BaseColor.BLACK, BorderColorRight=BaseColor.BLACK, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, // //new PdfPCell(new Phrase(" ", fontColumnValue1)){Rowspan = 4, Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_RIGHT}, // new PdfPCell(new Phrase("ANUAL", fontColumnValue1)){ Border = PdfPCell.NO_BORDER ,HorizontalAlignment=PdfPCell.ALIGN_LEFT}, // new PdfPCell(Periodica){Border = PdfPCell.RIGHT_BORDER, HorizontalAlignment=PdfPCell.ALIGN_CENTER, VerticalAlignment=PdfPCell.ALIGN_CENTER }, // new PdfPCell(new Phrase("", fontColumnValue1)){ Colspan =1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.WHITE}, //fila new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue1)) { Border = PdfPCell.LEFT_BORDER }, new PdfPCell() { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_BOTTOM }, new PdfPCell(new Phrase("", fontColumnValue1)) { Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(" ", fontColumnValue1)) { Border = PdfPCell.NO_BORDER, Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("ANUAL", fontColumnValue1)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(Periodica) { Border = PdfPCell.RIGHT_BORDER, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, //fila new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("EMPRESA:", fontColumnValue1)) { Border = PdfPCell.LEFT_BORDER }, new PdfPCell(Empresa) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_BOTTOM }, new PdfPCell(new Phrase(empresageneral, fontColumnValue1)) { Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(" ", fontColumnValue1)) { Border = PdfPCell.NO_BORDER, Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("RETIRO", fontColumnValue1)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(Retiro) { Border = PdfPCell.RIGHT_BORDER, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, //fila new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("CONTRATISTA:", fontColumnValue1)) { Border = PdfPCell.LEFT_BORDER }, new PdfPCell(Contratista) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_BOTTOM }, new PdfPCell(new Phrase(empresacontrata, fontColumnValue1)) { Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(" ", fontColumnValue1)) { Border = PdfPCell.NO_BORDER, Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("REUBICACIÓN", fontColumnValue1)) { Border = PdfPCell.NO_BORDER, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(Otros) { Border = PdfPCell.RIGHT_BORDER, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, //fila new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("APELLIDOS Y NOMBRES: ", fontColumnValue1)) { Colspan = 1, Border = PdfPCell.LEFT_BORDER }, new PdfPCell(new Phrase(datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue1)) { Colspan = 2, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(" ", fontColumnValue1)) { Border = PdfPCell.NO_BORDER, Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("N° DE FICHA: " + datosPac.v_IdService, fontColumnValue1)) { Colspan = 2, Border = PdfPCell.RIGHT_BORDER }, new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("FECHA DEL EXAMEN", fontColumnValue1)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(datosPac.FechaServicio.ToString().Split(' ')[0], fontColumnValue1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, // fila new PdfPCell(new Phrase("MINERALES EXPLOTADOS O PROCESADOS", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(datosPac.v_ExploitedMineral, fontColumnValue1)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue1)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 15f, 5f, 25f, 20f, 20f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); } }
public static void CreateApendiceN2_Evaluacion_Oftalmologica_Yanacocha(PacientList filiationData, List <ServiceComponentList> serviceComponent, organizationDto infoEmpresa, PacientList datosPac, string filePDF, UsuarioGrabo DatosGrabo, List <ServiceComponentList> ExamenesServicio, List <DiagnosticRepositoryList> Diagnosticos) { Document document = new Document(PageSize.A4, 30f, 30f, 42f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion var tamaño_celda = 20f; #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresa.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresa.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("APÉNDICE N° 02: EVALUACIÓN OFTALMOLÓGICA", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #region DATOS GENERALES string[] fechaServicio = datosPac.FechaServicio.ToString().Split(' '); string preOcp = "", Ocup = "", postOcup = ""; if (filiationData.i_EsoTypeId == 1) { preOcp = "X"; } else if (filiationData.i_EsoTypeId == 2) { Ocup = "X"; } else if (filiationData.i_EsoTypeId == 3) { postOcup = "X"; } string empresageneral = filiationData.empresa_; string empresacontrata = filiationData.contrata; string empresasubcontrata = filiationData.subcontrata; string empr_Conct = ""; if (empresageneral != empresasubcontrata) { empr_Conct = empresacontrata + " / " + empresasubcontrata; } else { empr_Conct = empresacontrata; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("\nApellidos Y Nombres", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + ", " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Edad", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(datosPac.Edad.ToString() + " Años", fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Evaluación:", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Pre Ocupacional", fontColumnValue1)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("( " + preOcp + " )", fontColumnValue1)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Ocupacional", fontColumnValue1)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("( " + Ocup + " )", fontColumnValue1)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Post Ocupacional", fontColumnValue1)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("( " + postOcup + " )", fontColumnValue1)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Empresa", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(empr_Conct, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion ServiceComponentList apendice2Yanacocha = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.APENDICE_N_2_EVALUACION_OFTALMOLOGICA_YANACOCHA_ID); #region EXAMENES var vcscod = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VCSCOD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VCSCOD).v_Value1Name; var vcscoi = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VCSCOI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VCSCOI).v_Value1Name; var vcccod = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VCCCOD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VCCCOD).v_Value1Name; var vcccoi = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VCCCOI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VCCCOI).v_Value1Name; var vlscod = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VLSCOD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VLSCOD).v_Value1Name; var vlscoi = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VLSCOI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VLSCOI).v_Value1Name; var vlccod = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VLCCOD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VLCCOD).v_Value1Name; var vlccoi = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VLCCOI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_VLCCOI).v_Value1Name; var enfermedadesOculares = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_ENFERMEDADES_OCULARES) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_ENFERMEDADES_OCULARES).v_Value1; var testIshihara = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_TEST_ISHIHARA) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_TEST_ISHIHARA).v_Value1Name; var reflejosPupilares = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_REFLEJOS_PUPILARES) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_REFLEJOS_PUPILARES).v_Value1Name; var maculaOD = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_MACULA_OD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_MACULA_OD).v_Value1Name; var maculaOI = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_MACULA_OI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_MACULA_OI).v_Value1Name; var nervioOpticoOD = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_NERVIO_OPTICO_OD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_NERVIO_OPTICO_OD).v_Value1Name; var nervioOpticoOI = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_NERVIO_OPTICO_OI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_NERVIO_OPTICO_OI).v_Value1Name; var retinaOD = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_RETINA_OD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_RETINA_OD).v_Value1Name; var retinaOI = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_RETINA_OI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_RETINA_OI).v_Value1Name; var presionIntraOcOD = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_PRESION_INTRAOCULAR_OD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_PRESION_INTRAOCULAR_OD).v_Value1; var presionIntraOcOI = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_PRESION_INTRAOCULAR_OI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_PRESION_INTRAOCULAR_OI).v_Value1; var npresionIntraOcODMed = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_PRESION_INTRAOCULAR_OD) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_PRESION_INTRAOCULAR_OD).v_MeasurementUnitName; var presionIntraOcOIMed = apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_PRESION_INTRAOCULAR_OI) == null ? "FALTA LLENAR" : apendice2Yanacocha.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EVALUACION_OFTALMOLOGICA_APENDICE_N_2_YANACOCHA_PRESION_INTRAOCULAR_OI).v_MeasurementUnitName; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 15, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("OJOS", fontColumnValueBold)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("SIN CORREGIR", fontColumnValueBold)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("CORREGIDA", fontColumnValueBold)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("ENFERMEDADES OCULARES", fontColumnValueBold)) { Colspan = 5, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("OJO DERECHO", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("OJO IZQUIERDO", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("OJO DERECHO", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("OJO IZQUIERDO", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("VISIÓN DE CERCA", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(vcscod, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(vcscoi, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(vcccod, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(vcccoi, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(enfermedadesOculares, fontColumnValue)) { Colspan = 5, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("VISIÓN DE LEJOS", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(vlscod, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(vlscoi, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(vlccod, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(vlccoi, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("VISIÓN DE COLORES \n (TEST DE ISHIHARA)", fontColumnValueBold)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(testIshihara, fontColumnValue1)) { Colspan = 12, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("REFLEJOS PUPILARES", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(reflejosPupilares, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("FONDO DE OJO \n (FUNDOSCOPIA)", fontColumnValueBold)) { Colspan = 3, Rowspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("MÁCULA OD", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase(maculaOD, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("MÁCULA OI", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase(maculaOI, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("PRESIÓN INTRAOCULAR", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("NERVIO ÓPT OD", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase(nervioOpticoOD, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("NERVIO ÓPT OI", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase(nervioOpticoOI, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("OD", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(presionIntraOcOD + " " + npresionIntraOcODMed, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("RETINA OD", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase(retinaOD, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("RETINA OI", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase(retinaOI, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, new PdfPCell(new Phrase("OI", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(presionIntraOcOI + " " + presionIntraOcOIMed, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("NOMBRES Y APELLIDOS DEL MÉDICO", fontColumnValueBold)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("CMP/RNE", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(DatosGrabo.Nombre, fontColumnValueBold)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(DatosGrabo.CMP, fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Firma #region Creando celdas de tipo Imagen y validando nulls PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; PdfPCell cellFirma = null; // Firma del trabajador *************************************************** if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 80, 40)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirmaTrabajador.FixedHeight = 50F; // Huella del trabajador ************************************************** if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 30, 45)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellHuellaTrabajador.FixedHeight = 50F; // Firma del doctor Auditor ************************************************** if (DatosGrabo.Firma != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(DatosGrabo.Firma, null, null, 120, 50)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }; } else { cellFirma = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 50F; #endregion cells = new List <PdfPCell>() { new PdfPCell(cellFirmaTrabajador) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(cellHuellaTrabajador) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("FIRMA Y SELLO DEL MÉDICO", fontColumnValueBold)) { Rowspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(cellFirma) { Rowspan = 3, HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("FIRMA DEL EXAMINADO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 12f }, new PdfPCell(new Phrase("HUELLA DEL EXAMINADO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 12f }, new PdfPCell(new Phrase("CON LA CUAL DECLARA QUE LA INFORMACIÓN DECLARADA ES VERAZ", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, }; columnWidths = new float[] { 25f, 25f, 25f, 25f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(filiationWorker); #endregion #region OBSERVACIONES //var diagnosticosYanacocha = Diagnosticos.FindAll(p => p.v_ComponentId == Sigesoft.Common.Constants.APENDICE_N_2_EVALUACION_OFTALMOLOGICA_YANACOCHA_ID); //cells = new List<PdfPCell>() //{ // new PdfPCell(new Phrase("Observaciones: ", fontColumnValueBold)) {Colspan = 20,HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.BLACK, BorderColorRight=BaseColor.BLACK, BorderColorBottom=BaseColor.WHITE, BorderColorTop=BaseColor.BLACK }, // //new PdfPCell(new Phrase(observaciones, fontColumnValue)) {Colspan = 20,HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20F, UseVariableBorders=true, BorderColorLeft=BaseColor.BLACK, BorderColorRight=BaseColor.BLACK, BorderColorBottom=BaseColor.BLACK, BorderColorTop=BaseColor.WHITE }, //}; //if (diagnosticosYanacocha.Count != 0) //{ // foreach (var item in diagnosticosYanacocha) // { // cells.Add(new PdfPCell(new Phrase(item.v_DiseasesName, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20F, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }); // //cells.Add(new PdfPCell(new Phrase(item.Recomendations, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20F, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }); // foreach (var item2 in item.Recomendations) // { // cells.Add(new PdfPCell(new Phrase(item2.v_RecommendationName, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20F, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }); // } // } //} //columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; //table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); //document.Add(table); #endregion #region Hallazgos y recomendaciones cells = new List <PdfPCell>() { new PdfPCell(new Phrase("HALLAZGOS", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 13, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase("CIE 10", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 13, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase("ESPECIFICACIONES", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 13, BackgroundColor = BaseColor.GRAY }, }; columnWidths = new float[] { 20.6f, 40.6f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); document.Add(filiationWorker); cells = new List <PdfPCell>(); var filterDiagnosticRepository = Diagnosticos.FindAll(p => p.v_ComponentId == Sigesoft.Common.Constants.APENDICE_N_2_EVALUACION_OFTALMOLOGICA_YANACOCHA_ID); if (filterDiagnosticRepository != null && filterDiagnosticRepository.Count > 0) { columnWidths = new float[] { 0.7f, 23.6f }; include = "i_Item,Valor1"; foreach (var item in filterDiagnosticRepository) { if (item.v_DiseasesId == "N009-DD000000029") { cell = new PdfPCell(new Phrase("")) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } else { cell = new PdfPCell(new Phrase(item.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } ListaComun oListaComun = null; List <ListaComun> Listacomun = new List <ListaComun>(); if (item.Recomendations.Count > 0) { oListaComun = new ListaComun(); oListaComun.Valor1 = "RECOMENDACIONES"; oListaComun.i_Item = "#"; Listacomun.Add(oListaComun); } int Contador = 1; foreach (var Reco in item.Recomendations) { oListaComun = new ListaComun(); oListaComun.Valor1 = Reco.v_RecommendationName; oListaComun.i_Item = Contador.ToString(); Listacomun.Add(oListaComun); Contador++; } if (item.Restrictions.Count > 0) { oListaComun = new ListaComun(); oListaComun.Valor1 = "RESTRICCIONES"; oListaComun.i_Item = "#"; Listacomun.Add(oListaComun); } int Contador1 = 1; foreach (var Rest in item.Restrictions) { oListaComun = new ListaComun(); oListaComun.Valor1 = Rest.v_RestrictionName; oListaComun.i_Item = Contador1.ToString(); Listacomun.Add(oListaComun); Contador1++; } // Crear tabla de recomendaciones para insertarla en la celda que corresponde table = HandlingItextSharp.GenerateTableFromList(Listacomun, columnWidths, include, fontColumnValue); cell = new PdfPCell(table); cells.Add(cell); } columnWidths = new float[] { 20.6f, 40.6f }; } else { cells.Add(new PdfPCell(new Phrase("NO SE HAN REGISTRADO DATOS.", fontColumnValue))); columnWidths = new float[] { 100 }; } table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, null); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CrearOrdenServicio(Boolean MostrarPrecio, List <ServiceOrderPdf> ListaServiceOrder, OrganizationList infoEmpresaPropietaria, string EmpresaCliente, string ServiceOrderId, string Fecha, string Usuario, string filePDF) { Document document = new Document(PageSize.A4, 30f, 30f, 45f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; //string[] columnValues = null; string[] columnHeaders = null; PdfPTable filiationWorker = new PdfPTable(8); PdfPTable table = null; PdfPCell cell = null; #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueNegrita = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontAptitud = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion var tamaño_celda = 20f; #region PRIMERA PÁGINA #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } iTextSharp.text.Image imagenfirma = iTextSharp.text.Image.GetInstance("C:/Banner/GetImageText.jpg"); imagenfirma.ScalePercent(100); imagenfirma.SetAbsolutePosition(200, 200); document.Add(imagenfirma); #endregion #region Contenido cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); string[] fech = Fecha.ToString().Split(' '); string mes = null; if (fech[2] == "enero") { mes = "01"; } else if (fech[2] == "febrero") { mes = "02"; } else if (fech[2] == "marzo") { mes = "03"; } else if (fech[2] == "abril") { mes = "04"; } else if (fech[2] == "mayo") { mes = "05"; } else if (fech[2] == "junio") { mes = "06"; } else if (fech[2] == "julio") { mes = "07"; } else if (fech[2] == "agosto") { mes = "08"; } else if (fech[2] == "setiembre") { mes = "09"; } else if (fech[2] == "octubre") { mes = "10"; } else if (fech[2] == "noviembre") { mes = "11"; } else if (fech[2] == "diciembre") { mes = "12"; } string anio = fech[4]; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n" + infoEmpresaPropietaria.v_Sede + ", " + Fecha, fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, BorderColor = BaseColor.WHITE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Carta N° " + ServiceOrderId.Substring(7, 9) + "-" + mes + "-" + anio.Substring(2, 2) + "-CSLS.R.L./CAL.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Estimado (s) Sr (s). " + EmpresaCliente, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("ASUNTO: PROPUESTA ECONÓMICA PARA EXAMENES MÉDICOS OCUPACIONALES", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Estimado (s) Sr (s).", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("\n\n\t Es grato dirigirnos a Ud (s). Para saludarlo (s), y a la vez agradecer su preferencia en nuestra ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("institución.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nEn esta oportunidad nos complace hacerles llegar nuestra propuesta técnico económico de nuestros", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nservicios de Exámenes Médicos Ocupacionales (pre ocupacionales, periódicos, retiro, visita, transcripciones, ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nexámenes de altura, psicosensométrico, psicológico, otros). Además cabe señalar que nuestra propuesta", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("está sujeta a evaluación", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\n\t " + infoEmpresaPropietaria.v_Name + " agradece su rpeferencia y está a vuestra disposición para iniciar un vínculo", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("laboral duradero.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nNos despedimos quedansdo a sus gratas órdenes.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("\nAtentamente.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("\nCc. Archivo", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 50, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(filiationWorker); #endregion #region Fecha / Firmma cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 180, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Name, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 15, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Tel. 076 340201 anexo 29", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 15, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Cel. 976220538", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 15, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("*****@*****.**", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 15, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #endregion document.NewPage(); #region SEGUNDA PAGINA #region TÍTULO if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } #endregion #region empresa y servicio cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n\n", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("PROPUESTA ECONOMICA " + EmpresaCliente, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("EVALUACION MEDICO OCUPACIONAL", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("EXAMENES MÉDICOS PRE OCUPACIONAL", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(filiationWorker); cells = new List <PdfPCell>(); #region #region Parte Dinámica cells = new List <PdfPCell>(); foreach (var Cabecera in ListaServiceOrder) { cell = new PdfPCell(new Phrase(Cabecera.EmpresaCliente, fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_LEFT }; cells.Add(cell); var ListaFiltrada = Cabecera.DetalleServiceOrder.FindAll(p => p.v_Precio != 0.00); foreach (var Detalle in ListaFiltrada) { cell = new PdfPCell(new Phrase(Detalle.Componente, fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT }; cells.Add(cell); string Valor = MostrarPrecio == true?Detalle.v_Precio.ToString() == "0.01" ? "COSTO CERO" : Detalle.v_Precio.ToString() : Detalle.v_Precio.ToString() == "0.01" ? "COSTO CERO" : ""; if (Valor != "") { Valor = "S/." + Valor; } cell = new PdfPCell(new Phrase(Valor, fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }; cells.Add(cell); } cell = new PdfPCell(new Phrase(" ", fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER }; cells.Add(cell); cell = new PdfPCell(new Phrase("TOTAL: S/. ", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, Border = PdfPCell.NO_BORDER }; cells.Add(cell); cell = new PdfPCell(new Phrase(Cabecera.TotalProtocolo.ToString(), fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }; cells.Add(cell); cell = new PdfPCell(new Phrase("Los precios no incluyen I.G.V.", fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER }; cells.Add(cell); cell = new PdfPCell(new Phrase(" ", fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER }; cells.Add(cell); } columnWidths = new float[] { 50f, 50f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion #endregion #endregion #endregion document.NewPage(); #region TERCERA HOJA #region TÍTULO if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } #endregion #region Texto en duro cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n\n", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("INTERCONSULTA CON ESPECIALISTAS", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(" - OFTALMOLOGIA", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(" - OTORRINOLARINGOLOGIA", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(" - NUTRICIONISTA", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(" - MEDICINA INTERNA", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(" - CARDIOLOGIA", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(" - TRAUMATOLOGIA", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(" - NEUMOLOGIA", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(" - OTROS SEGÚN REQUERIMIENTO", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("NOTA:", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("TODOS LOS COSTOS INCLUYEN IGV", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("\nNUESTROS HORARIOS DE ATENCIÓN", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Nuestro horario de atención son las 24 horas del día, los 365 días del año en nuestra área asistencial.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("De Lunes a Sábado de 7:30 am a 12 mm, y de 3:00 pm a 7:00 pm en nuestra ára Ocupacional. ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("NÚMERO DE CUENTA:", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 10, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, //new PdfPCell(new Phrase("FRACCIONAMIENTO DE PAGO(solo aplica para tipo de examen PERIÓDICO)", fontColumnValueNegrita)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_CENTER}, //new PdfPCell(new Phrase("(Modalidad flexible)", fontColumnValueNegrita)){Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_CENTER}, //new PdfPCell(new Phrase("MONTO GLOBAL A CANCELAR", fontColumnValueNegrita)){HorizontalAlignment = PdfPCell.ALIGN_LEFT}, //new PdfPCell(new Phrase("FRACCIONAMIENTO DE PAGO", fontColumnValueNegrita)){HorizontalAlignment = PdfPCell.ALIGN_LEFT}, //new PdfPCell(new Phrase("PORCENTAJE", fontColumnValueNegrita)){HorizontalAlignment = PdfPCell.ALIGN_LEFT}, //new PdfPCell(new Phrase("100% del total a pagar (incluyendo I.G.V)", fontColumnValueNegrita)){ Rowspan= 2,HorizontalAlignment = PdfPCell.ALIGN_CENTER , VerticalAlignment = PdfPCell.ALIGN_MIDDLE}, //new PdfPCell(new Phrase("Ira cuota\n (3 días previos a la evaluación)", fontColumnValueNegrita)){HorizontalAlignment = PdfPCell.ALIGN_CENTER}, // new PdfPCell(new Phrase("50%", fontColumnValueNegrita)){HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE}, // new PdfPCell(new Phrase("2da cuota \n(30 días posteriores a la Ira. cuota contra entrega a los resiltados)", fontColumnValueNegrita)){HorizontalAlignment = PdfPCell.ALIGN_CENTER}, // new PdfPCell(new Phrase("50%", fontColumnValueNegrita)){HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE}, // new PdfPCell(new Phrase("PAGO TOTAL DE CANCELACIÓN (INCLUIDO I.G.V.)", fontColumnValueNegrita)){ Colspan= 2,HorizontalAlignment = PdfPCell.ALIGN_CENTER}, //new PdfPCell(new Phrase("100% ", fontColumnValueNegrita)){HorizontalAlignment = PdfPCell.ALIGN_CENTER}, // new PdfPCell(new Phrase(" ", fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, //new PdfPCell(new Phrase("Esperamos poder atender a su empresa recordándole que esta opción de brindar un servicio de salud de alta calidad está disponible para", fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, //new PdfPCell(new Phrase("vuestra empresa; nos despedimos quedando a sus gratas órdenes.", fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, // new PdfPCell(new Phrase(" ", fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, // new PdfPCell(new Phrase("Atentamente.", fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, // new PdfPCell(new Phrase(" ", fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, // new PdfPCell(new Phrase(" ", fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, // new PdfPCell(new Phrase(Usuario, fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, // new PdfPCell(new Phrase("Coordinadora Médico Ocupacional", fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, // new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Name, fontColumnValue)){ Colspan=3,HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; //filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(filiationWorker); cells = new List <PdfPCell>() { new PdfPCell(new Phrase("ENTIDAD BANCARIA", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("NÚMERO DE CUENTA", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("CUENTA INTERBANCARIA SOLES", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("NÚMERO DE CUENTA DOLARES", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("BANCO CONTINENTAL\n(Cuenta Corriente)", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("0011-0277-0100054539-10", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("011-277-000100054539-10", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("0011-0277-0100054547-13", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("BANCO CONTINENTAL\n(Cuenta de Ahorro)", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("0011-0277-11-0200278043", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("0011-0277-11-0200278043 11", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("-", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("BANCO DE CREDITO\n(Cuenta Corriente)", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("245-1810834-0-98", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("002 245 0018 1083 409897", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("-", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("BANCO INTERBANK\n(Cuenta Corriente)", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("702-3000888410", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("-", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("-", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("CUENTA DE DETRACCIONES", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("BANCO DE LA NACION", fontColumnValueBold1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("00-774-002413", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 25f, 25f, 25f, 25f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #endregion document.Close(); writer.Close(); writer.Dispose(); RunFile(filePDF); }
public static void CreatePago_Especialsta_Report(string monto1, string fechaInicio1, string fechaFin1, string usuarioMedico1, int usuarioPaga1, List <string> ids1, string ruta, string filePDF, organizationDto infoEmpresa) { Document document = new Document(PageSize.A5, 15f, 15f, 15f, 40f); document.SetPageSize(iTextSharp.text.PageSize.A5); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableAntecedentesOcupacionales = FontFactory.GetFont("Arial", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueAntecedentesOcupacionales = FontFactory.GetFont("Arial", 5, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); #endregion var tamaño_celda = 18f; var tamaño_celda2 = 60f; #region Conexion Sigesoft ConexionSigesoft conectaSigesoft = new ConexionSigesoft(); conectaSigesoft.opensigesoft(); #endregion #region Fecha string anioinicio = fechaInicio1.Substring(6, 4); string mesinicio = fechaInicio1.Substring(3, 2); string diainicio = fechaInicio1.Substring(0, 2); DateTime localDate = DateTime.Now; #endregion #region Title var fechain = fechaInicio1.Split(' '); var fechafin = fechaFin1.Split(' '); var rutaImg = GetApplicationConfigValue("Logo"); var imageLogo = new PdfPCell(GetImageLogo(rutaImg.ToString(), null, null, 120, 50)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }; #region Obtener usuarios var cadena1 = "select PP.v_FirstName+' '+PP.v_FirstLastName+' '+PP.v_SecondLastName, v_UserName from systemuser SU " + "Inner join person PP " + "On SU.v_PersonId=PP.v_PersonId " + "where i_SystemUserId=" + usuarioPaga1; SqlCommand comando1 = new SqlCommand(cadena1, connection: conectaSigesoft.conectarsigesoft); SqlDataReader lector1 = comando1.ExecuteReader(); String cajanombre = "", cajauser = ""; while (lector1.Read()) { cajanombre = lector1.GetValue(0).ToString(); cajauser = lector1.GetValue(1).ToString(); } lector1.Close(); #endregion cells = new List <PdfPCell>() { new PdfPCell(imageLogo) { Rowspan = 1, HorizontalAlignment = PdfPCell.ALIGN_CENTER, MinimumHeight = tamaño_celda2, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("PAGO MÉDICO ESPECIALISTA ", fontTitle1)) { Rowspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(" usuario: " + cajauser + "\r\n Desde: " + fechain[0] + "\r\n Hasta: " + fechafin[0], fontColumnValueBold)) { Rowspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 35f, 35f, 30f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region Cabecera cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Nombre del Paciente", fontColumnValueBold)) { BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = PdfPCell.ALIGN_CENTER, MinimumHeight = tamaño_celda, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Protocolo de Atención", fontColumnValueBold)) { BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Fecha", fontColumnValueBold)) { BackgroundColor = BaseColor.LIGHT_GRAY, Rowspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, }; columnWidths = new float[] { 42f, 42f, 15f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region Detalle foreach (var serviceId in ids1) { var ids = serviceId.Split('|'); foreach (var id in ids) { var r = id; #region Query var cadena = "Select PP.v_FirstName+', '+PP.v_FirstLastName+' '+PP.v_SecondLastName as Persona, " + "PR.v_Name as Protocolo, d_ServiceDate as Fecha " + "from service SR " + "Inner Join person PP " + " On SR.v_PersonId = PP.v_PersonId " + "Inner Join protocol PR " + "On SR.v_ProtocolId = PR.v_ProtocolId " + "where SR.v_ServiceId='" + id + "'"; #endregion #region Lector Open SqlCommand comando = new SqlCommand(cadena, connection: conectaSigesoft.conectarsigesoft); SqlDataReader lector = comando.ExecuteReader(); #endregion #region Llenar Detalle while (lector.Read()) { var fecha = lector.GetValue(2).ToString().Split(' '); cells = new List <PdfPCell>() { new PdfPCell(new Phrase(lector.GetValue(0).ToString(), fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(lector.GetValue(1).ToString(), fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(fecha[0].ToString(), fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, }; columnWidths = new float[] { 42f, 42f, 15f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); document.Add(filiationWorker); } lector.Close(); #endregion } } #endregion #region Recibido cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Documento emitido por:", fontColumnValueBold)) { BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Dr(a) Especialista", fontColumnValueBold)) { BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Monto a pagar:", fontColumnValueBold)) { BackgroundColor = BaseColor.LIGHT_GRAY, Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(cajanombre, fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(usuarioMedico1, fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(monto1, fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Firma Emisor:", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Recibi conforme:", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Fecha y hora" + "\rde Impresión: \r" + localDate, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda2, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, }; columnWidths = new float[] { 42f, 42f, 15f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTableNegro, null); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); RunFile(filePDF); }
public static void CreateLiquidaciones_Pendientes_Facturas_Detalle(string filePDF, organizationDto infoEmpresaPropietaria, List <LiquidacionesConsolidado> Lista, string fechaInicio, string fechaFin) { Document document = new Document(PageSize.A4, 30f, 30f, 45f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); var tamaño_celda = 15f; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("LIQUIDACIONES DE EMPRESAS PENDIENTES DE FACTURAR AL " + fechaFin, fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Parte Dinámica cells = new List <PdfPCell>(); //int tamañoTickets = 0; int nroreco = 1; decimal sumaliquidacion = 0; decimal sumatipoExm_1 = 0; foreach (var liq in Lista) { cell = new PdfPCell(new Phrase(liq.v_OrganizationName + " - " + liq.v_Ruc, fontColumnValueBold)) { BackgroundColor = BaseColor.GRAY, Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(liq.v_NroLiquidacion, fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(liq.d_creaionLiq.ToString().Split(' ')[0], fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("PACIENTE", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 12f }; cells.Add(cell); cell = new PdfPCell(new Phrase("F. EXAMEN", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 12f }; cells.Add(cell); cell = new PdfPCell(new Phrase("PRECIO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 12f }; cells.Add(cell); cell = new PdfPCell(new Phrase("USUARIO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 12f }; cells.Add(cell); cell = new PdfPCell(new Phrase("C. COSTOS", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 12f }; cells.Add(cell); foreach (var item in liq.detalle) { //cell = new PdfPCell(new Phrase(nroreco.ToString() + ". ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; //cells.Add(cell); cell = new PdfPCell(new Phrase(nroreco.ToString() + ". " + item.v_Paciente, fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.d_exam.ToString().Split(' ')[0], fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); decimal precio = (decimal)item.d_price + (decimal)0.00; precio = decimal.Round(precio, 2); cell = new PdfPCell(new Phrase(precio.ToString(), fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.v_UsuarRecord, fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.v_CenterCost, fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 13f }; cells.Add(cell); sumaliquidacion += (decimal)item.d_price; nroreco++; } nroreco = 1; sumatipoExm_1 = decimal.Round((decimal)sumaliquidacion + (decimal)0.00, 2); cell = new PdfPCell(new Phrase("TOTAL LIQUIDACION: " + liq.v_NroLiquidacion + " >>>> ", fontColumnValueBold)) { BackgroundColor = BaseColor.GRAY, Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(sumatipoExm_1.ToString(), fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); sumaliquidacion = 0; cell = new PdfPCell(new Phrase("- - -", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 8f }; cells.Add(cell); } columnWidths = new float[] { 25, 10f, 20f, 25f, 20f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); RunFile(filePDF); }
public static void CreateExoneracionPlacaTorax(PacientList filiationData, string filePDF, PacientList datosPac, organizationDto infoEmpresaPropietaria, List <ServiceComponentList> exams, List <DiagnosticRepositoryList> Diagnosticos, List <ServiceComponentList> serviceComponent) { Document document = new Document(PageSize.A4, 40f, 40f, 80f, 50f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 15, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 12, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("EXONERACIÓN DE EXAMENES DE PLACA DE TORAX P-A", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion var tamaño_celda = 24f; string tipodoc = ""; if (datosPac.i_DocTypeId == 1) { tipodoc = "DNI"; } else if (datosPac.i_DocTypeId == 2) { tipodoc = "Pasaporte"; } else if (datosPac.i_DocTypeId == 3) { tipodoc = "Licencia de Conducir"; } else if (datosPac.i_DocTypeId == 4) { tipodoc = "Carnet de Extranjeria"; } #region Contenido ServiceComponentList exoneracion_rx = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.EXCEPCIONES_RX_ID); var motivo = exoneracion_rx.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EXCEPCIONES_RX_EXO_MOTIVO) == null ? "" : exoneracion_rx.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EXCEPCIONES_RX_EXO_MOTIVO).v_Value1; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \nYO : " + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nIdentificado (a) con " + tipodoc + " N° " + datosPac.v_DocNumber + " solicito la exoneración", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("del procedimiento de Radiología (Radiografía de Torax P-A) por motivos de: ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase(motivo, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("por lo cual exonero de toda responsabilidad médico legal al personal de :" + infoEmpresaPropietaria.v_Name.Split(' ')[0] + " " + infoEmpresaPropietaria.v_Name.Split(' ')[1], fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Name.Split(' ')[2] + " " + infoEmpresaPropietaria.v_Name.Split(' ')[3] + ", como la propia institución por mi decisión de no realizarme dicho", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("procedimiento.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion string[] fechaServicio = datosPac.FechaServicio.ToString().Split('/', ' '); string mes = ""; if (fechaServicio[1] == "01") { mes = "Enero"; } else if (fechaServicio[1] == "02") { mes = "Febrero"; } else if (fechaServicio[1] == "03") { mes = "Marzo"; } else if (fechaServicio[1] == "04") { mes = "Abril"; } else if (fechaServicio[1] == "05") { mes = "Mayo"; } else if (fechaServicio[1] == "06") { mes = "Junio"; } else if (fechaServicio[1] == "07") { mes = "Julio"; } else if (fechaServicio[1] == "08") { mes = "Agosto"; } else if (fechaServicio[1] == "09") { mes = "Setiembre"; } else if (fechaServicio[1] == "10") { mes = "Octubre"; } else if (fechaServicio[1] == "11") { mes = "Noviembre"; } else if (fechaServicio[1] == "12") { mes = "Diciembre"; } PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 120, 45)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 60, 80)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; #region Fecha / Firmmal cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n \n \n " + infoEmpresaPropietaria.v_SectorName + ", " + fechaServicio[0] + " de " + mes + " del " + fechaServicio[2], fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(cellFirmaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 180, BorderColor = BaseColor.WHITE }, new PdfPCell(cellHuellaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 180, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("_____________________________________", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(" Firma del Paciente ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreatePagoMedicoAsitencial(string filePDF, organizationDto infoEmpresaPropietaria, List <LiquidacionServicios> Listaliq, string fechaInicio, string fechaFin, SystemUserList medico) { Document document = new Document(PageSize.A4, 30f, 30f, 45f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion var estatico_1 = 15f; var alto_Celda_1 = 15f; var alto_Celda_2 = 30f; var alto_Celda_3 = 45f; var alto_Celda_4 = 60f; var alto_Celda_6 = 90f; #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var tamaño_celda = 15f; var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("COMPROBANTE DE PAGO DESDE " + fechaInicio + " AL " + fechaFin + " (ASISTENCIAL)", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 90f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region datos cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 10f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("MEDICO: ", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(": " + medico.MedicoTratante, fontColumnValue)) { Colspan = 9, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("CMP", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(": " + medico.CMP, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("DIRECCION", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(": " + medico.Direccion, fontColumnValue)) { Colspan = 9, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("TELEFONO", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(": " + medico.Telefono, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 9, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("FECHA EST. CTA. AL", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(": " + fechaFin, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region DATOS cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("N°", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("FECHA", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("PACIENTE", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("TIPO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("ASGURADORA", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("SERVICIO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("PAGO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 4f, 8f, 25f, 14, 14f, 8f, 17f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Parte Dinámica cells = new List <PdfPCell>(); //int tamañoTickets = 0; int nroreco = 1; decimal comision = 0; decimal comision_1 = 0; //foreach (var liq in Listaliq) //{ foreach (var item in Listaliq) { cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(nroreco.ToString() + ". ", fontColumnValueBold)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.d_ServiceDate.ToString().Split(' ')[0], fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.Paciente, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.Tipo, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.Aseguradora, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.v_ServiceId, fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); string monto = Convert.ToString(item.r_Comision); decimal numero; decimal.TryParse(monto, out numero); numero = decimal.Round(numero, 2); cell = new PdfPCell(new Phrase(numero.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); comision += item.r_Comision; nroreco++; } comision_1 = comision; decimal numero_2 = (decimal)comision_1; numero_2 = decimal.Round(numero_2, 2); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 6, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("TOTAL S/. ", fontColumnValueBold)) { Colspan = 1, BackgroundColor = BaseColor.GRAY, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase(numero_2.ToString(), fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); comision = 0; comision_1 = 0; //} cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 9, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 30f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("*** RECIBO CONFORME MI PAGO POR LOS SERVICIOS PRESTADOS A LA " + infoEmpresaPropietaria.v_Name + ".***", fontColumnValue)) { Colspan = 7, HorizontalAlignment = PdfPCell.ALIGN_CENTER, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK, MinimumHeight = 15f }; cells.Add(cell); cell = new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = PdfPCell.ALIGN_RIGHT, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, MinimumHeight = 15f }; cells.Add(cell); columnWidths = new float[] { 5f, 4f, 8f, 25f, 14f, 14f, 17f, 10f, 5f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); RunFile(filePDF); }
public static void CreateTestSomnolencia(ServiceList DataService, organizationDto infoEmpresaPropietaria, List <ServiceComponentFieldValuesList> valores, string filePDF) { Document document = new Document(); document.SetPageSize(iTextSharp.text.PageSize.A4); // step 2: we create a writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); //holaaaaaaa //create an instance of your PDFpage class. This is the class we generated above. pdfPage page = new pdfPage(); page.FirmaTrabajador = DataService.FirmaTrabajador; page.HuellaTrabajador = DataService.HuellaTrabajador; page.Dni = DataService.v_DocNumber; page.EmpresaId = DataService.EmpresaClienteId; //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class writer.PageEvent = page; // step 3: we open the document document.Open(); // step 4: we Add content to the document // we define some fonts #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; //string[] columnValues = null; string[] columnHeaders = null; PdfPTable filiationWorker = new PdfPTable(8); PdfPTable table = null; PdfPCell cell = null; #endregion #region Title PdfPCell CellLogo = null; if (infoEmpresaPropietaria.b_Image != null) { CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 20F)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } else { CellLogo = new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } cells = new List <PdfPCell>() { //fila new PdfPCell(CellLogo) { Rowspan = 2, Colspan = 2, Border = PdfPCell.LEFT_BORDER, HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("FICHA TEST DE SOMNOLENCIA - EPWORTH", fontTitle1)) { Rowspan = 2, Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, }; columnWidths = new float[] { 15f, 5f, 30f, 25f, 20f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion var tamaño_celda = 27f; var tamaño_celda1 = 43f; #region Datos Personales cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase(" ", fontTitle1)) { Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(" ", fontTitle1)) { Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("Nombre:", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(DataService.v_Pacient, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("Sexo:", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(DataService.v_GenderName, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("Edad:", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(DataService.i_Edad.ToString(), fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("Estado Civil:", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(DataService.EstadoCivil, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("Fecha:", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(DataService.d_ServiceDate.Value.ToString("dd/MM/yyyy"), fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("Historia Clínica:", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(DataService.v_ServiceId, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, }, new PdfPCell(new Phrase("DNI:", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(DataService.v_DocNumber, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("Dirección:", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(DataService.v_AdressLocation, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(" ", fontTitle1)) { Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(" ", fontTitle1)) { Colspan = 4, HorizontalAlignment = PdfPCell.ALIGN_LEFT }, }; columnWidths = new float[] { 15f, 35f, 15f, 35f, }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #region Texto01 cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase("¿Con qué frecuencia se queda dormido en las siguientes situaciones? Incluso si no ha realizado recientemente alguna de las actividades mencionadas a continuación, trate de imaginar en qué medida le afectarían.", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_JUSTIFIED }, new PdfPCell(new Phrase("Utilice la siguiente escala y elija la cifra adecuada para cada situación. ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("0 = nunca se ha dormido. ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("1 = escasa posibilidad de dormirse. ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("2 = moderada posibilidad de dormirse. ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("3 = elevada posibilidad de dormirse. ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(" ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase(" ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #region Cuadro #region grupo 0 string p1_1 = ""; if (valores.Find(p => p.v_ComponentFieldId == "N009-MF000002144") != null) { p1_1 = valores.Find(p => p.v_ComponentFieldId == "N009-MF000002144").v_Value1Name; } var resultado = ""; var X1_1 = ""; var X1_2 = ""; var X1_3 = ""; var X1_4 = ""; var X1_5 = ""; var X1_6 = ""; var X1_7 = ""; if (p1_1 == "0") { resultado = "0"; X1_1 = "X"; } else if (p1_1 == "1") { resultado = "1"; X1_2 = "X"; } else if (p1_1 == "2") { resultado = "2"; X1_3 = "X"; } else if (p1_1 == "3") { resultado = "3"; X1_4 = "X"; } else if (p1_1 == "5") { resultado = "5"; X1_5 = "X"; } else if (p1_1 == "6") { resultado = "6"; X1_6 = "X"; } else if (p1_1 == "7") { resultado = "7"; X1_7 = "X"; } #endregion #region grupo 1 string p2_1 = ""; if (valores.Find(p => p.v_ComponentFieldId == "N009-MF000004221") != null) { p2_1 = valores.Find(p => p.v_ComponentFieldId == "N009-MF000004221").v_Value1Name; } var resultado2 = ""; var X2_1 = ""; var X2_2 = ""; var X2_3 = ""; var X2_4 = ""; var X2_5 = ""; var X2_6 = ""; var X2_7 = ""; if (p2_1 == "0") { resultado2 = "0"; X2_1 = "X"; } else if (p2_1 == "1") { resultado2 = "1"; X2_2 = "X"; } else if (p2_1 == "2") { resultado2 = "2"; X2_3 = "X"; } else if (p2_1 == "3") { resultado2 = "3"; X2_4 = "X"; } else if (p2_1 == "5") { resultado2 = "5"; X2_5 = "X"; } else if (p2_1 == "6") { resultado2 = "6"; X2_6 = "X"; } else if (p2_1 == "7") { resultado2 = "7"; X2_7 = "X"; } #endregion #region grupo 2 string p3_1 = ""; if (valores.Find(p => p.v_ComponentFieldId == "N009-MF000004222") != null) { p3_1 = valores.Find(p => p.v_ComponentFieldId == "N009-MF000004222").v_Value1Name; } var resultado3 = ""; var x3_1 = ""; var x3_2 = ""; var x3_3 = ""; var x3_4 = ""; var x3_5 = ""; var x3_6 = ""; var x3_7 = ""; if (p3_1 == "0") { resultado3 = "0"; x3_1 = "X"; } else if (p3_1 == "1") { resultado3 = "1"; x3_2 = "X"; } else if (p3_1 == "2") { resultado3 = "2"; x3_3 = "X"; } else if (p3_1 == "3") { resultado3 = "3"; x3_4 = "X"; } else if (p3_1 == "5") { resultado3 = "5"; x3_5 = "X"; } else if (p3_1 == "6") { resultado3 = "6"; x3_6 = "X"; } else if (p3_1 == "7") { resultado3 = "7"; x3_7 = "X"; } #endregion #region grupo 3 string p4_1 = ""; if (valores.Find(p => p.v_ComponentFieldId == "N009-MF000004223") != null) { p4_1 = valores.Find(p => p.v_ComponentFieldId == "N009-MF000004223").v_Value1Name; } var resultado4 = ""; var X4_1 = ""; var X4_2 = ""; var X4_3 = ""; var X4_4 = ""; var X4_5 = ""; var X4_6 = ""; var X4_7 = ""; if (p4_1 == "0") { resultado4 = "0"; X4_1 = "X"; } else if (p4_1 == "1") { resultado4 = "1"; X4_2 = "X"; } else if (p4_1 == "2") { resultado4 = "2"; X4_3 = "X"; } else if (p4_1 == "3") { resultado4 = "3"; X4_4 = "X"; } else if (p4_1 == "5") { resultado4 = "5"; X4_5 = "X"; } else if (p4_1 == "6") { resultado4 = "6"; X4_6 = "X"; } else if (p4_1 == "7") { resultado4 = "7"; X4_7 = "X"; } #endregion #region grupo 5 string p5_1 = ""; if (valores.Find(p => p.v_ComponentFieldId == "N009-MF000004224") != null) { p5_1 = valores.Find(p => p.v_ComponentFieldId == "N009-MF000004224").v_Value1Name; } var resultado5 = ""; var X5_1 = ""; var X5_2 = ""; var X5_3 = ""; var X5_4 = ""; var X5_5 = ""; var X5_6 = ""; var X5_7 = ""; if (p5_1 == "0") { resultado5 = "0"; X5_1 = "X"; } else if (p5_1 == "1") { resultado5 = "1"; X5_2 = "X"; } else if (p5_1 == "2") { resultado5 = "2"; X5_3 = "X"; } else if (p5_1 == "3") { resultado5 = "3"; X5_4 = "X"; } else if (p5_1 == "5") { resultado5 = "5"; X5_5 = "X"; } else if (p5_1 == "6") { resultado5 = "6"; X5_6 = "X"; } else if (p5_1 == "7") { resultado5 = "7"; X5_7 = "X"; } #endregion #region grupo 6 string p6_1 = ""; if (valores.Find(p => p.v_ComponentFieldId == "N009-MF000004225") != null) { p6_1 = valores.Find(p => p.v_ComponentFieldId == "N009-MF000004225").v_Value1Name; } var resultado6 = ""; var X6_1 = ""; var X6_2 = ""; var X6_3 = ""; var X6_4 = ""; var X6_5 = ""; var X6_6 = ""; var X6_7 = ""; if (p6_1 == "0") { resultado6 = "0"; X6_1 = "X"; } else if (p6_1 == "1") { resultado6 = "1"; X6_2 = "X"; } else if (p6_1 == "2") { resultado6 = "2"; X6_3 = "X"; } else if (p6_1 == "3") { resultado6 = "3"; X6_4 = "X"; } else if (p6_1 == "5") { resultado6 = "5"; X6_5 = "X"; } else if (p6_1 == "6") { resultado6 = "6"; X6_6 = "X"; } else if (p6_1 == "7") { resultado6 = "7"; X6_7 = "X"; } #endregion #region grupo 7 string p7_1 = ""; if (valores.Find(p => p.v_ComponentFieldId == "N009-MF000004226") != null) { p7_1 = valores.Find(p => p.v_ComponentFieldId == "N009-MF000004226").v_Value1Name; } var resultado7 = ""; var X7_1 = ""; var X7_2 = ""; var X7_3 = ""; var X7_4 = ""; var X7_5 = ""; var X7_6 = ""; var X7_7 = ""; if (p7_1 == "0") { resultado7 = "0"; X7_1 = "X"; } else if (p7_1 == "1") { resultado7 = "1"; X7_2 = "X"; } else if (p7_1 == "2") { resultado7 = "2"; X7_3 = "X"; } else if (p7_1 == "3") { resultado7 = "3"; X7_4 = "X"; } else if (p7_1 == "5") { resultado7 = "5"; X7_5 = "X"; } else if (p7_1 == "6") { resultado7 = "6"; X7_6 = "X"; } else if (p7_1 == "7") { resultado7 = "7"; X7_7 = "X"; } #endregion #region grupo 8 string p8_1 = ""; if (valores.Find(p => p.v_ComponentFieldId == "N009-MF000004227") != null) { p8_1 = valores.Find(p => p.v_ComponentFieldId == "N009-MF000004227").v_Value1Name; } var resultado8 = ""; var X8_1 = ""; var X8_2 = ""; var X8_3 = ""; var X8_4 = ""; var X8_5 = ""; var X8_6 = ""; var X8_7 = ""; if (p8_1 == "0") { resultado8 = "0"; X8_1 = "X"; } else if (p8_1 == "1") { resultado8 = "1"; X8_2 = "X"; } else if (p8_1 == "2") { resultado8 = "2"; X8_3 = "X"; } else if (p8_1 == "3") { resultado8 = "3"; X8_4 = "X"; } else if (p8_1 == "5") { resultado8 = "5"; X8_5 = "X"; } else if (p8_1 == "6") { resultado8 = "6"; X8_6 = "X"; } else if (p8_1 == "7") { resultado8 = "7"; X8_7 = "X"; } #endregion #region grupo resultado var resultadofinal = int.Parse(resultado.ToString()) + int.Parse(resultado2.ToString()) + int.Parse(resultado3.ToString()) + int.Parse(resultado4.ToString()) + int.Parse(resultado5.ToString()) + int.Parse(resultado6.ToString()) + int.Parse(resultado7.ToString()) + int.Parse(resultado8.ToString()); #endregion cells = new List <PdfPCell>() { //fila #region cabecera new PdfPCell(new Phrase("", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, FixedHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, FixedHeight = tamaño_celda1, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("0", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, FixedHeight = tamaño_celda1 }, new PdfPCell(new Phrase("1", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, FixedHeight = tamaño_celda1 }, new PdfPCell(new Phrase("2", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, FixedHeight = tamaño_celda1 }, new PdfPCell(new Phrase("3", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, FixedHeight = tamaño_celda1 }, #endregion #region pregunta 1 new PdfPCell(new Phrase("1", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Sentado Leyendo", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X1_1, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X1_2, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X1_3, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X1_4, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, #endregion #region pregunta 2 new PdfPCell(new Phrase("2", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Mirando TV", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X2_1, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X2_2, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X2_3, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X2_4, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, #endregion #region pregunta 3 new PdfPCell(new Phrase("3", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Sentado quieto en un lugar público ( Teatro, Cine, Sala de espera)", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(x3_1, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(x3_2, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(x3_3, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(x3_4, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, #endregion #region pregunta 4 new PdfPCell(new Phrase("4", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Viajando como pasajero ( Auto, tren, ómnibus) Durante 1 hora.", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X4_1, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X4_2, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X4_3, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X4_4, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, #endregion #region pregunta 5 new PdfPCell(new Phrase("5", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Sentado y conversando con otra persona", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X5_1, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X5_2, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X5_3, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X5_4, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, #endregion #region pregunta 6 new PdfPCell(new Phrase("6", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Luego de una comida sin alcohol", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X6_1, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X6_2, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X6_3, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X6_4, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, #endregion #region pregunta 7 new PdfPCell(new Phrase("7", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Conduciendo un auto cuando se detiene por el tráfico", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X7_1, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X7_2, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X7_3, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X7_4, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, #endregion #region pregunta 8 new PdfPCell(new Phrase("8", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Cuando se sienta a descansar por la tarde", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X8_1, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X8_2, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X8_3, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(X8_4, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, #endregion #region pregunta resultado new PdfPCell(new Phrase("Total : ", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, FixedHeight = tamaño_celda, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, Colspan = 2 }, new PdfPCell(new Phrase(resultadofinal.ToString(), fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, Colspan = 7 }, #endregion }; columnWidths = new float[] { 5f, 63f, 8f, 8f, 8f, 8f, }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Texto02 cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase(" ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase(" ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase(" ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase(" ", fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #region Puntaje var interpretacion = ""; if (int.Parse(resultadofinal.ToString()) < 8) { interpretacion = "NO PRESENTA SOMNOLENCIA"; } else if (int.Parse(resultadofinal.ToString()) > 7 && int.Parse(resultadofinal.ToString()) < 10) { interpretacion = "SOMNOLENCIA LEVE"; } else if (int.Parse(resultadofinal.ToString()) > 9 && int.Parse(resultadofinal.ToString()) < 16) { interpretacion = "SOMNOLENCIA MODERADA"; } else if (int.Parse(resultadofinal.ToString()) > 15) { interpretacion = "SOMNOLENCIA SEVERA"; } cells = new List <PdfPCell>() { //fila new PdfPCell(new Phrase("MEDICIÓN", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("INTERPRETACIÓN", fontTitle1)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase(resultadofinal.ToString(), fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(interpretacion, fontTitle2)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, }; columnWidths = new float[] { 20f, 80f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, null, fontTitleTable); document.Add(table); #endregion document.Close(); }
public static void CreateInforme_Psicologico_Resumen(PacientList filiationData, ServiceList DataService, List <ServiceComponentList> serviceComponent, organizationDto infoEmpresa, PacientList datosPac, string filePDF) { Document document = new Document(PageSize.A4, 30f, 30f, 42f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 12, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion var tamaño_celda = 18f; #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresa.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresa.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("INFORME PSICOLÓGICO", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion ServiceComponentList informe_psico_resumen = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_ID); #region DATOS GENERALES string masc = "", fem = ""; if (datosPac.Genero == "FEMENINO") { fem = "X"; } else if (datosPac.Genero == "MASCULINO") { masc = "X"; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 5f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Apellidos Y Nombres: ", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 13, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 8f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Lugar y Fecha de Nacimiento:", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_BirthPlace, fontColumnValue)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(datosPac.d_Birthdate.ToString().Split(' ')[0], fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 8f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Edad: ", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.Edad.ToString(), fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Sexo: ", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("M", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(masc, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("F", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(fem, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 8f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Grado de Instrucción: ", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.GradoInstruccion, fontColumnValue)) { Colspan = 13, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 8f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Dirección: ", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_AdressLocation, fontColumnValue)) { Colspan = 13, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 8f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("Fecha de Evaluación: ", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.FechaServicio.ToString().Split(' ')[0], fontColumnValue)) { Colspan = 13, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 8f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region MOTIVO DE CONSULTA var motivo = informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_EVALUACION) == null ? "" : informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_EVALUACION).v_Value1; var pruebas_aplicadas = informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_PRUEBAS_APLICADAS) == null ? "" : informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_PRUEBAS_APLICADAS).v_Value1; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 10f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("MOTIVO DE EVALUACIÓN:", fontTitle2)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(motivo, fontColumnValue)) { Colspan = 12, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("PRUEBAS APLICADAS:", fontTitle2)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 50f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(pruebas_aplicadas, fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 50f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 50f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 8f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region RESULTADOS var resultados = informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_RESULTADOS) == null ? "" : informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_RESULTADOS).v_Value1; var conclusiones = informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_CONCLUSIONES) == null ? "" : informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_CONCLUSIONES).v_Value1; var apto = informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_APTO) == null ? "" : informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_APTO).v_Value1; var noapto = informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_NOAPTO) == null ? "" : informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_NOAPTO).v_Value1; var observado = informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_OBSERVADO) == null ? "" : informe_psico_resumen.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.INFORME_PSICOLOGICO_RESUMEN_OBSERVADO).v_Value1; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 10f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("RESULTADOS", fontTitle2)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(resultados, fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 5f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("CONCLUSIONES", fontTitle2)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 60f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(conclusiones, fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 60f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 60f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 10f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("APTO", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(apto == "1" ?"X":apto == "0"?"":apto, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontTitle1)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("NO APTO", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(noapto == "1" ?"X":noapto == "0"?"":noapto, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontTitle1)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("OBSERVADO", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(observado == "1" ?"X":observado == "0"?"":observado, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion var psico = serviceComponent.Find(p => p.i_CategoryId == (int)Sigesoft.Common.Consultorio.Psicología); #region Firma #region Creando celdas de tipo Imagen y validando nulls PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; PdfPCell cellFirma = null; // Firma del trabajador *************************************************** if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 80, 40)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirmaTrabajador.FixedHeight = 50F; // Huella del trabajador ************************************************** if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 30, 45)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellHuellaTrabajador.FixedHeight = 50F; // Firma del doctor Auditor ************************************************** if (psico.FirmaMedico != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(psico.FirmaMedico, null, null, 120, 50)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER } } ; else { cellFirma = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 50F; #endregion cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(cellFirma) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 13f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("______________________________", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 13f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 13f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("FIRMA DEL PSICÓLOGO", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 13f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 60f, 30f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateInformeResultadosAutorizacionCoimolache(PacientList filiationData, string filePDF, PacientList datosPac, organizationDto infoEmpresaPropietaria) { Document document = new Document(PageSize.A4, 40f, 40f, 80f, 50f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 12, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); string[] fechaServicio = datosPac.FechaServicio.ToString().Split('/', ' '); string mes = ""; var tamaño_celda = 18f; if (fechaServicio[1] == "01") { mes = "Enero"; } else if (fechaServicio[1] == "02") { mes = "Febrero"; } else if (fechaServicio[1] == "03") { mes = "Marzo"; } else if (fechaServicio[1] == "04") { mes = "Abril"; } else if (fechaServicio[1] == "05") { mes = "Mayo"; } else if (fechaServicio[1] == "06") { mes = "Junio"; } else if (fechaServicio[1] == "07") { mes = "Julio"; } else if (fechaServicio[1] == "08") { mes = "Agosto"; } else if (fechaServicio[1] == "09") { mes = "Setiembre"; } else if (fechaServicio[1] == "10") { mes = "Octubre"; } else if (fechaServicio[1] == "11") { mes = "Noviembre"; } else if (fechaServicio[1] == "12") { mes = "Diciembre"; } var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("CONSENTIMIENTO INFORMADO DE EXAMEN MEDICO Y AUTORIZACIÓN DE ENTREGA DE RESULTADOS", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n " + infoEmpresaPropietaria.v_SectorName + ", " + fechaServicio[0] + " de " + mes + " del " + fechaServicio[2], fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion string tipodoc = ""; if (datosPac.i_DocTypeId == 1) { tipodoc = "DNI"; } else if (datosPac.i_DocTypeId == 2) { tipodoc = "Pasaporte"; } else if (datosPac.i_DocTypeId == 3) { tipodoc = "Licencia de Conducir"; } else if (datosPac.i_DocTypeId == 4) { tipodoc = "Carnet de Extranjeria"; } #region Contenido string empresageneral = filiationData.empresa_; string empresacontrata = filiationData.contrata; string empresasubcontrata = filiationData.subcontrata; string empr_Conct = ""; if (empresageneral != empresasubcontrata) { empr_Conct = empresacontrata + " / " + empresasubcontrata; } else { empr_Conct = empresacontrata; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \nYO, ", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n" + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nIdentificado (a) con " + tipodoc + " N° " + datosPac.v_DocNumber + ", con ocupación laboral de", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase(datosPac.v_CurrentOccupation + ", certifico que he sido inforamdo acerca de la naturaleza y propósito", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("de los exámenes ocupacionales y pruebas complementarias de la empresa", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\n" + empresacontrata, fontColumnValue1)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("Unidad :", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase(empresageneral, fontColumnValue1)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase(" solicita, :", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("y que todas mis dudas y preguntas al respecto han sido absueltas; así mismo, autorizo que los", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("resultados sean entregados al departamento médico de la empresa la cual soy trabajador.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, //new PdfPCell(new Phrase("\nTrabajador de la empresa : ", fontColumnValue)) //{ Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda , BorderColor=BaseColor.WHITE, ExtraParagraphSpace = 5.0f}, //new PdfPCell(new Phrase("\n"+empr_Conct, fontColumnValue)) //{ Colspan = 12, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda , BorderColor=BaseColor.WHITE, ExtraParagraphSpace = 5.0f}, new PdfPCell(new Phrase("\nPor tanto, en forma consciente y voluntaria doy mi consentimiento expreso, de acuerdo a lo establecido en el", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("item 6.6.2 el Documento Técnico: Protocolos de Exámenes Médicos Ocupacionales y Guías de diagnóstico de", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("los Exámenes Médicos Obligatorios por Actividad aprobado por la Resolución Ministerial N° 312-2011/MINSA,", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("para que el Centro Médico que " + empresacontrata + " designe, proceda a efectuar", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("los exámenes que correspondan en relación a los riesgos laborales propios del puesto de trabajo de", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("desempeño en la empresa; asimismo, autorizo la utilización de los resultados conforme al artículo 102° del ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("Decreto Supremo N° 002-2012-TR, Reglamento de la ley de Seguridad y Salud en el Trabajo.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("\nDe igual manera, autorizo que el Médico Ocupacional de " + empresacontrata, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("obtenga la información de mi historia clínica presente o anterior, aurotizando a que la pueda solicitar", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("directamente a la institución que corresponda, conforme al inciso a) del Artículo 25° de la Ley N° 26842,", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, new PdfPCell(new Phrase("Ley General de Salud.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 125, 50)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 55, 75)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; #region Fecha / Firmmal cells = new List <PdfPCell>() { new PdfPCell(cellFirmaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 120, BorderColor = BaseColor.WHITE }, new PdfPCell(cellHuellaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 120, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("_____________________________________", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Firma del Paciente", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("N° DNI/ Carne de Extranjería y Pasaporte: " + datosPac.v_DocNumber, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("...................", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Ley N° 26842 Art. 4 y Art.25", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateFichaPsicologicaGoldfields(PacientList filiationData, List <ServiceComponentList> serviceComponent, organizationDto infoEmpresa, PacientList datosPac, string filePDF, UsuarioGrabo DatosGrabo) { Document document = new Document(PageSize.A4, 30f, 30f, 42f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion var tamaño_celda = 11f; #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresa.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresa.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("FICHA PSICOLÓGICA OCUPACIONAL", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 15f }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region DATOS GENERALES string preOcp = "", Ocup = "", postOcup = ""; if (filiationData.i_EsoTypeId == 1) { preOcp = "X"; } else if (filiationData.i_EsoTypeId == 2) { Ocup = "X"; } else if (filiationData.i_EsoTypeId == 3) { postOcup = "X"; } string[] fechaServicio = datosPac.FechaServicio.ToString().Split(' '); string empresageneral = filiationData.empresa_; string empresacontrata = filiationData.contrata; string empresasubcontrata = filiationData.subcontrata; string empr_Conct = ""; if (empresageneral != empresasubcontrata) { empr_Conct = empresacontrata + " / " + empresasubcontrata; } else { empr_Conct = empresacontrata; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("CLÍNICA:", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(infoEmpresa.v_Name, fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Fecha de Entrevista", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(fechaServicio[0], fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("I. Datos Generales:", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase("Apellidos Y Nombres", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Edad", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(datosPac.Edad.ToString(), fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Fecha de Nacimiento:", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(datosPac.d_Birthdate.ToString().Split(' ')[0], fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Estado Civil:", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(datosPac.v_MaritalStatus, fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Empresa", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(empr_Conct, fontColumnValue)) { Colspan = 7, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Cargo", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(datosPac.v_CurrentOccupation, fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Tipo de Evaluación", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Pre Ocupacional", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(preOcp, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Ocupacional", fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(Ocup, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Post Ocupacional", fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(postOcup, fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion ServiceComponentList ficha_psico_goldfields = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_OCUPACIONAL_GOLDFIELDS); #region DATOS OCUPACIONALES //var empresa_Actual = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_EMPRESA_ACTUAL) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_EMPRESA_ACTUAL).v_Value1; var area_trabajo = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_AREA_LUGAR) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_AREA_LUGAR).v_Value1; var provincia_depart = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PROVINCIA_DEPARTAMENTO) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PROVINCIA_DEPARTAMENTO).v_Value1; var tiempo_laborando = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_TIEMPO_TOTAL_LAB) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_TIEMPO_TOTAL_LAB).v_Value1; var experiencia = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_EXPERIENCIA_PUESTO) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_EXPERIENCIA_PUESTO).v_Value1; var riesgos = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PRINCIPALES_RIESGOS) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PRINCIPALES_RIESGOS).v_Value1; var medidasSeguridad = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_MEDIDAS_SEGURIDAD) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_MEDIDAS_SEGURIDAD).v_Value1; var ingreso1 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_FECHA_INGRESO1) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_FECHA_INGRESO1).v_Value1; var empresa1 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_NOMBRE_EMPRESA1) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_NOMBRE_EMPRESA1).v_Value1; var actividad1 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_ACTIVIDAD_EMPRESA1) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_ACTIVIDAD_EMPRESA1).v_Value1; var puesto1 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PUESTO_EMPRESA1) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PUESTO_EMPRESA1).v_Value1; var tiempo1 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PERMANENCIA_TIEMPO1) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PERMANENCIA_TIEMPO1).v_Value1; var salida1 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PERMANENCIA_FECHA_SALIDA1) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PERMANENCIA_FECHA_SALIDA1).v_Value1; var cese1 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_CAUSA_CESE1) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_CAUSA_CESE1).v_Value1; var ingreso2 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_FECHA_INGRESO2) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_FECHA_INGRESO2).v_Value1; var empresa2 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_NOMBRE_EMPRESA2) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_NOMBRE_EMPRESA2).v_Value1; var actividad2 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_ACTIVIDAD_EMPRESA2) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_ACTIVIDAD_EMPRESA2).v_Value1; var puesto2 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PUESTO_EMPRESA2) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PUESTO_EMPRESA2).v_Value1; var tiempo2 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PERMANENCIA_TIEMPO2) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PERMANENCIA_TIEMPO2).v_Value1; var salida2 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PERMANENCIA_FECHA_SALIDA2) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_PERMANENCIA_FECHA_SALIDA2).v_Value1; var cese2 = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_CAUSA_CESE2) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_CAUSA_CESE2).v_Value1; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("II. Datos Ocupacionale:", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase("2.1 Empresa Actual", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("Área, lugar de trabajo", fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(area_trabajo, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Provincia, departamento", fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(provincia_depart, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Tiempo total laborando", fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(tiempo_laborando, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Experiencia en el puesto", fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(experiencia, fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Principales riesgos", fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(riesgos, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Medidas de seguridad", fontColumnValue)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase(medidasSeguridad, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("2.2 Anteriores Empresas (Experiencia Laboral): ", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE, FixedHeight = 1f }, new PdfPCell(new Phrase("Fecha de ingreso", fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Nombre de la Empresa", fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Actividad de la Empresa", fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Puesto", fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Permanencia", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Causa de cese", fontColumnValue)) { Colspan = 4, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Tiempo", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase("Fecha salida", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(ingreso1, fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(empresa1, fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(actividad1, fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(puesto1, fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(tiempo1, fontColumnValue)) { Colspan = 2, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(salida1, fontColumnValue)) { Colspan = 2, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(cese1, fontColumnValue)) { Colspan = 4, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(ingreso2, fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(empresa2, fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(actividad2, fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(puesto2, fontColumnValue)) { Colspan = 3, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(tiempo2, fontColumnValue)) { Colspan = 2, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(salida2, fontColumnValue)) { Colspan = 2, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(new Phrase(cese2, fontColumnValue)) { Colspan = 4, Rowspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region HISTORIA FAMILIAR var historia_familiar = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_HISTORIA_FAMILIAR) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_HISTORIA_FAMILIAR).v_Value1; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("III. Historia Familiar (Con quien vive actualmente, pasatiempos, actividades fuera del trabajo", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase(historia_familiar, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 20 }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region HISTORIA FAMILIAR var enfermedades_accidentes = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_ENFERMEDADES_ACCIDENTES) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_ENFERMEDADES_ACCIDENTES).v_Value1; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("IV Enfermedades y accidentes (Durante el tiempo del trabajo)", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase(enfermedades_accidentes, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 20 }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region ENFERMEDADES Y ACCIDENTES var enfermedad_salud_mental = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_ENFERMEDAD_SALUD_MENTAL) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_ENFERMEDAD_SALUD_MENTAL).v_Value1; string enfermedad_salud_mentalSINO = ""; if (enfermedad_salud_mental == "1") { enfermedad_salud_mentalSINO = "SI"; } if (enfermedad_salud_mental == "0") { enfermedad_salud_mentalSINO = "NO"; } var descripcion_salud_mental = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_DESCRIPCION_SALUD_MENTAL) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_DESCRIPCION_SALUD_MENTAL).v_Value1; var otras_enfermedades_accidentes = ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_OTRAS_ENFEREMDADES) == null ? "" : ficha_psico_goldfields.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FICHA_PSICOLOGICA_GOLDFIELDS_OTRAS_ENFEREMDADES).v_Value1; cells = new List <PdfPCell>() { new PdfPCell(new Phrase("V. Antecedentes personales", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase("a) Para ser llenado por el trabajador", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, new PdfPCell(new Phrase("Yo, " + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName + "con DNI: " + datosPac.v_DocNumber + " manifiesto que " + enfermedad_salud_mentalSINO + " se me ha identificado una", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("enfermedad de salud mental, o psiquiátrica.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n En el caso de marcar SI, describir en breve palabras el diagnostico de la enfermedad mental, y si recibió tratamiento;", fontColumnValueApendice)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("b) Otras enfermedades de salud, y/o accidentes:", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase(otras_enfermedades_accidentes, fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region ENFERMEDADES Y ACCIDENTES cells = new List <PdfPCell>() { new PdfPCell(new Phrase("VI. Antecedentes personales", fontColumnValueBold)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BackgroundColor = BaseColor.GRAY }, new PdfPCell(new Phrase("Con la firma del presente documento, confirmo y doy fe que la información brindada sobre mi salud es completa y verdadera, haciéndome", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("\nresponsable de cualquier omisión o dato incorrecto; así mismo quedo obligado a informar toda circunstancia nueva que pueda influir", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\no alterar esta información.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.BLACK, BorderColorRight = BaseColor.BLACK, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion //var psico = serviceComponent.Find(p => p.i_CategoryId == (int)Sigesoft.Common.Consultorio.Psicología); #region Firma #region Creando celdas de tipo Imagen y validando nulls PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; PdfPCell cellFirma = null; // Firma del trabajador *************************************************** if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 80, 40)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirmaTrabajador.FixedHeight = 50F; // Huella del trabajador ************************************************** if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 30, 45)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellHuellaTrabajador.FixedHeight = 50F; // Firma del doctor Auditor ************************************************** if (DatosGrabo.Firma != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(DatosGrabo.Firma, null, null, 120, 50)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER } } ; else { cellFirma = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 50F; #endregion cells = new List <PdfPCell>() { new PdfPCell(cellFirmaTrabajador) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(cellHuellaTrabajador) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("FIRMA Y SELLO DEL PSICÓLOGO", fontColumnValueBold)) { Rowspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda }, new PdfPCell(cellFirma) { Rowspan = 3, HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("FIRMA DEL EXAMINADO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 12f }, new PdfPCell(new Phrase("HUELLA DEL EXAMINADO", fontColumnValueBold)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 12f }, new PdfPCell(new Phrase("CON LA CUAL DECLARA QUE LA INFORMACIÓN DECLARADA ES VERAZ", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda }, }; columnWidths = new float[] { 25f, 25f, 25f, 25f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CrearOrdenServicio(Boolean MostrarPrecio, List <ServiceOrderPdf> ListaServiceOrder, OrganizationList infoEmpresaPropietaria, string EmpresaCliente, string Fecha, string Usuario, string filePDF) { Document document = new Document(); document.SetPageSize(iTextSharp.text.PageSize.A4); //try //{NO_BORDER // step 2: we create aPA writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); //create an instance of your PDFpage class. This is the class we generated above. pdfPage page = new pdfPage(); //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class writer.PageEvent = page; // step 3: we open the document document.Open(); // step 4: we Add content to the document // we define some fonts #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; //string[] columnValues = null; string[] columnHeaders = null; PdfPTable filiationWorker = new PdfPTable(8); PdfPTable table = null; PdfPCell cell = null; #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 12, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueNegrita = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontAptitud = FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region Logo Empresa Propietaria PdfPCell CellLogo = null; cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { CellLogo = new PdfPCell(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }; } else { CellLogo = new PdfPCell(new Phrase("sin logo ", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }; } cells.Add(CellLogo); columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); cells = new List <PdfPCell>() { new PdfPCell(new Phrase(EmpresaCliente, fontSubTitleNegroNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Sede + ", " + Fecha, fontSubTitleNegroNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #region Texto en duro cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Atte.", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("Es muy grato dirigirme a usted, saludarlos y contestar sus requerimientos. Además, ofrecerle en condiciones especiales los servicios de nuestra empresa y así iniciar el programa de salud ocupacional que brindamos.", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //new PdfPCell(new Phrase("nuestra empresa y así iniciar el programa de salud ocupacional que brindamos.", fontColumnValue)){HorizontalAlignment = PdfPCell.ALIGN_LEFT}, new PdfPCell(new Phrase("Prevenciones Ocupacionales de Salud SAC, es una empresa constituida por un staff de profesionales de salud altamente calificados, nuestra primordial misión es brindarles LA EVALUACIÓN MÉDICA OCUPACIONAL de acuerdo a ley 29783 de SEGURIDAD Y SALUD EN EL TRABAJO, dentro de la infraestructura de cada empresa a nivel nacional.", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, //new PdfPCell(new Phrase("primordial misión es brindarles LA EVALUACIÓN MÉDICA OCUPACIONAL de acuerdo a ley 29783 de SEGURIDAD Y SALUD EN", fontColumnValue)){HorizontalAlignment = PdfPCell.ALIGN_LEFT}, //new PdfPCell(new Phrase("EL TRABAJO, dentro de la infraestructura de cada empresa a nivel nacional.", fontColumnValue)){HorizontalAlignment = PdfPCell.ALIGN_LEFT}, new PdfPCell(new Phrase("Así mismo nuestras Evaluaciones Médicas Ocupacionales serán detalladas a continuación según sus referencias y a solicitud:", fontColumnValue)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase(" ", fontColumnValue)), new PdfPCell(new Phrase(" ", fontColumnValue)), }; columnWidths = new float[] { 100f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(filiationWorker); #endregion #region Parte Dinámica cells = new List <PdfPCell>(); foreach (var Cabecera in ListaServiceOrder) { cell = new PdfPCell(new Phrase(Cabecera.EmpresaCliente, fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_LEFT }; cells.Add(cell); var ListaFiltrada = Cabecera.DetalleServiceOrder.FindAll(p => p.v_Precio != 0.00); foreach (var Detalle in ListaFiltrada) { cell = new PdfPCell(new Phrase(Detalle.Componente, fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT }; cells.Add(cell); string Valor = MostrarPrecio == true?Detalle.v_Precio.ToString() == "0.01" ? "COSTO CERO" : Detalle.v_Precio.ToString() : Detalle.v_Precio.ToString() == "0.01" ? "COSTO CERO" : ""; if (Valor != "") { Valor = "S/." + Valor; } cell = new PdfPCell(new Phrase(Valor, fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }; cells.Add(cell); } cell = new PdfPCell(new Phrase(" ", fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER }; cells.Add(cell); cell = new PdfPCell(new Phrase("TOTAL: S/. ", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_RIGHT, Border = PdfPCell.NO_BORDER }; cells.Add(cell); cell = new PdfPCell(new Phrase(Cabecera.TotalProtocolo.ToString(), fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }; cells.Add(cell); cell = new PdfPCell(new Phrase("Los precios no incluyen I.G.V.", fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER }; cells.Add(cell); cell = new PdfPCell(new Phrase(" ", fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, Border = PdfPCell.NO_BORDER }; cells.Add(cell); } columnWidths = new float[] { 50f, 50f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); document.Add(filiationWorker); #endregion #region Texto en duro cells = new List <PdfPCell>() { new PdfPCell(new Phrase("FRACCIONAMIENTO DE PAGO(solo aplica para tipo de examen PERIÓDICO)", fontColumnValueNegrita)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("(Modalidad flexible)", fontColumnValueNegrita)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("MONTO GLOBAL A CANCELAR", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("FRACCIONAMIENTO DE PAGO", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("PORCENTAJE", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_LEFT }, new PdfPCell(new Phrase("100% del total a pagar (incluyendo I.G.V)", fontColumnValueNegrita)) { Rowspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("Ira cuota\n (3 días previos a la evaluación)", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("50%", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("2da cuota \n(30 días posteriores a la Ira. cuota contra entrega a los resiltados)", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("50%", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, new PdfPCell(new Phrase("PAGO TOTAL DE CANCELACIÓN (INCLUIDO I.G.V.)", fontColumnValueNegrita)) { Colspan = 2, HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase("100% ", fontColumnValueNegrita)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER }, new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase("Esperamos poder atender a su empresa recordándole que esta opción de brindar un servicio de salud de alta calidad está disponible para", fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase("vuestra empresa; nos despedimos quedando a sus gratas órdenes.", fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase("Atentamente.", fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(Usuario, fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase("Coordinadora Médico Ocupacional", fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Name, fontColumnValue)) { Colspan = 3, HorizontalAlignment = PdfPCell.ALIGN_LEFT, Border = PdfPCell.NO_BORDER }, }; columnWidths = new float[] { 40f, 40f, 20f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(filiationWorker); #endregion document.Close(); writer.Close(); writer.Dispose(); //RunFile(filePDF); }
public static void CreateLiquidacion_Carta(string filePDF, organizationDto infoEmpresaPropietaria, List <Liquidacion> Listaliq, organizationDto empresa, UsuarioGrabo usuarioFirnma, string factura) { Document document = new Document(PageSize.A4, 30f, 30f, 45f, 41f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 9, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold1 = FontFactory.GetFont("Calibri", 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); string N_liquidacion = ""; foreach (var liq in Listaliq) { foreach (var item in liq.Detalle) { N_liquidacion = item.v_NroLiquidacion; } } if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var tamaño_celda = 18f; string[] fechaEmisionCarta = DateTime.Now.ToString().Split('/', ' '); string mes = ""; if (fechaEmisionCarta[1] == "01") { mes = "Enero"; } else if (fechaEmisionCarta[1] == "02") { mes = "Febrero"; } else if (fechaEmisionCarta[1] == "03") { mes = "Marzo"; } else if (fechaEmisionCarta[1] == "04") { mes = "Abril"; } else if (fechaEmisionCarta[1] == "05") { mes = "Mayo"; } else if (fechaEmisionCarta[1] == "06") { mes = "Junio"; } else if (fechaEmisionCarta[1] == "07") { mes = "Julio"; } else if (fechaEmisionCarta[1] == "08") { mes = "Agosto"; } else if (fechaEmisionCarta[1] == "09") { mes = "Setiembre"; } else if (fechaEmisionCarta[1] == "10") { mes = "Octubre"; } else if (fechaEmisionCarta[1] == "11") { mes = "Noviembre"; } else if (fechaEmisionCarta[1] == "12") { mes = "Diciembre"; } var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase(infoEmpresaPropietaria.v_SectorName + ", " + fechaEmisionCarta[0] + " de " + mes + " del " + fechaEmisionCarta[2], fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 20f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region DATOS cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \nCARTA N° " + N_liquidacion + "-" + fechaEmisionCarta[2] + "-C.S.L./CAJ.", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValueBold)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n" + empresa.v_Name, fontColumnValueBold)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nSR(ES). " + empresa.v_ContacName, fontColumnValueBold)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("GERENTE.", fontColumnValueBold)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, //new PdfPCell(new Phrase("", fontColumnValueBold)) { Colspan=6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, UseVariableBorders=true, BorderColorLeft=BaseColor.WHITE, BorderColorRight=BaseColor.WHITE, BorderColorBottom=BaseColor.BLACK, BorderColorTop=BaseColor.WHITE}, }; columnWidths = new float[] { 5f, 30f, 10f, 10f, 15f, 15F, 15F }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion #region Contenido string N_Factura = ""; if (factura != null) { N_Factura = factura; } else { N_Factura = "- - -"; } foreach (var list in Listaliq) { foreach (var detallelist in list.Detalle) { factura = ""; } } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n Mediante la presente me dirijo a Ud. para saludarlo cordialmente y a la vez hacerle llegar la factura N° ", fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n" + N_Factura, fontColumnValueBold)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nEmitida por nuestra institución por concepto de exámenes médicos ocupacionales, y los números de cuenta en caso de", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nabono a la", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n" + infoEmpresaPropietaria.v_Name, fontColumnValueBold)) { Colspan = 5, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nen el", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nBANCO CONTINENTAL CUENTA CORRIENTE en soles N°", fontColumnValueBold)) { Colspan = 9, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n0011-0277-10-0100054539, DEL BANCO DE CREDITO CUENTA CORRIENTE en soles N° 245-1810834-0-98 y DEL", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nBANCO INTERBANK CUENTA CORRIENTE en soles N° 702-3000888410.", fontColumnValueBold)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nSe adjunta factura y detalle de liquidación N° " + N_liquidacion + " correspondiente", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nSin otro particular me despido no sin antes agradecer la atención quebrinde a la presente.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion PdfPCell cellFirma = null; if (usuarioFirnma.Firma != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(usuarioFirnma.Firma, null, null, 150, 70)) { HorizontalAlignment = PdfPCell.ALIGN_CENTER } } ; else { cellFirma = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 50F; #region Fecha / Firmma cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 3, FixedHeight = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell() { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 70, BorderColor = BaseColor.WHITE }, new PdfPCell(cellFirma) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 70, BorderColor = BaseColor.WHITE }, new PdfPCell() { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 70, BorderColor = BaseColor.WHITE }, new PdfPCell() { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, BorderColor = BaseColor.WHITE, FixedHeight = 13f }, new PdfPCell(new Phrase(usuarioFirnma.Nombre, fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 13f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell() { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, BorderColor = BaseColor.WHITE, FixedHeight = 13f }, new PdfPCell(new Phrase("ASIST. ADMINISTRATIVO", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 13f, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 40f, 30f, 40f, }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); RunFile(filePDF); }
public static void CreateConsentimientoInformadoAccesoHistoriClinica(ServiceList DataService, string filePDF, PacientList datosPac, List <DiagnosticRepositoryList> Diagnosticos, List <ServiceComponentList> serviceComponent) { Document document = new Document(PageSize.A4, 40f, 40f, 10f, 0f); // document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 12, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 11, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); iTextSharp.text.Image hudbay = iTextSharp.text.Image.GetInstance("C:/Banner/HUDBAY.png"); hudbay.ScalePercent(50); hudbay.SetAbsolutePosition(45, 760); document.Add(hudbay); iTextSharp.text.Image banner4 = iTextSharp.text.Image.GetInstance("C:/Banner/Imagen2.png"); banner4.ScalePercent(50); banner4.SetAbsolutePosition(-10, 0); document.Add(banner4); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80f }, new PdfPCell(new Phrase("CONSENTIMIENTO INFORMADO PARA \n ACCESO A LA HISTORIA CLÍNICA", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80f }, new PdfPCell(new Phrase("Formato \n\nDocumento ID : \nVersión : \nFecha : ", fontColumnValue)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80f }, }; columnWidths = new float[] { 20f, 50f, 30f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion var tamaño_celda = 20f; ServiceComponentList declaracion_jurada = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.EXCEPCIONES_RX_ID); var fecha_regla = declaracion_jurada.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EXCEPCIONES_RX_FECHA_ULTIMA_REGLA) == null ? "" : declaracion_jurada.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EXCEPCIONES_RX_FECHA_ULTIMA_REGLA).v_Value1; #region Contenido cells = new List <PdfPCell>() { new PdfPCell(new Phrase("La historia clínica es el único documento válido desde el punto de vista clínico y legal.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("\nLa Ley General de Salud del Perú menciona que toda persona usuaria de los servicios de salud tiene ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("derecho a exigir la reserva de la información relacionada con el acto médico y su historia clínica, con las ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("excepciones que la ley establece.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nEl artículo 77° del Código de Ética y Deontología del Colegio Médico del Perú señala que la elaboración, ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("diagnóstico, terapéutica y pronóstico contenidos en la historia clínica pueden ser utilizados por el médico ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("tratante para fines de investigación, docencia, mejora continua de la calidad, médico legal, gestión y ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("administración de los servicios médicos. El médico está obligado, en este caso, a mantener en reserva", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("aquellos datos que permitan la identificación del paciente. La mencionada norma establece que la ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("violación de esta disposición constituye falta ética.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nLa Gerencia de Seguridad y Salud Ocupacional de Hudbay y los Centros Médicos Autorizados de HBP,", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("mantendrán confidencial su información médica privada obtenida al proporcionarle servicios a usted a ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("menos que se autorice por ley, su información médica protegida no será utilizada ni revelada sin su ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("consentimiento. ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nEl informe médico que se entregará a su Empresa contiene información relacionada únicamente a la ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("aptitud laboral y enfermedad (es) relacionada (s) al trabajo diagnosticado(s), u otras condiciones", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("médicas que puedan afectar la seguridad en el trabajo y/o aquellas condiciones médicas que puedan", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("confundir la exposición a riesgos ocupacionales (Embarazo y/o Riesgos de Salud Reproductiva),", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("asimismo se indicará las recomendaciones y restricciones del caso. Por otro lado Usted recibirá un", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Informe Médico Ocupacional resumido de lo más importante de su evaluación realizada.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nSu información médica será protegida y no será revelada sin su consentimiento por escrito. Usted puede ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("invalidar cualquier consentimiento oral y/o escrito, enviando un documento a la Gerencia de Seguridad y ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Salud Ocupacional.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nHabiendo leído y comprendido lo anteriormente descrito, acepto el acceso a la historia clínica para los ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("fines detallados en este documento al Área de Salud Ocupacional de Hudbay.", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion string[] fechaServicio = datosPac.FechaServicio.ToString().Split(' '); string tipodoc = ""; if (datosPac.i_DocTypeId == 1) { tipodoc = "DNI"; } else if (datosPac.i_DocTypeId == 2) { tipodoc = "Pasaporte"; } else if (datosPac.i_DocTypeId == 3) { tipodoc = "Licencia de Conducir"; } else if (datosPac.i_DocTypeId == 4) { tipodoc = "Carnet de Extranjeria"; } PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; if (DataService.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(DataService.FirmaTrabajador, null, null, 100, 35)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (DataService.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(DataService.HuellaTrabajador, null, null, 50, 70)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; #region Fecha / Firmma cells = new List <PdfPCell>() { new PdfPCell(new Phrase("APELLIDOS Y NOMBRES: ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("FIRMA: ", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80, BorderColor = BaseColor.WHITE }, new PdfPCell(cellFirmaTrabajador) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80, BorderColor = BaseColor.WHITE }, new PdfPCell(cellHuellaTrabajador) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 80, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(tipodoc + " :", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_DocNumber, fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("FECHA: ", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(fechaServicio[0], fontColumnValue)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("EMPRESA: ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(DataService.v_CustomerOrganizationName, fontColumnValue)) { Colspan = 16, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 20, BorderColor = BaseColor.WHITE, ExtraParagraphSpace = 5.0f }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateAnexo3_Exoneracion_ResponsabilidadYanacocha(ServiceList DataService, string filePDF, PacientList datosPac, organizationDto infoEmpresaPropietaria, PacientList filiationData, List <ServiceComponentList> serviceComponent) { Document document = new Document(PageSize.A4, 40f, 40f, 80f, 50f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 13, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresaPropietaria.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(40, 790); document.Add(imagenEmpresa); } //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("ANEXO 3", fontTitle1)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("EXONERACION DE RESPONSABILIDAD", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 30f, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 20f, 60f, 20f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion var tamaño_celda = 25f; string tipodoc = ""; if (datosPac.i_DocTypeId == 1) { tipodoc = "DNI"; } else if (datosPac.i_DocTypeId == 2) { tipodoc = "Pasaporte"; } else if (datosPac.i_DocTypeId == 3) { tipodoc = "Licencia de Conducir"; } else if (datosPac.i_DocTypeId == 4) { tipodoc = "Carnet de Extranjeria"; } #region Contenido string empresageneral = DataService.v_CustomerOrganizationName; string empresacontrata = DataService.EmpresaEmpleadora; string empresasubcontrata = DataService.EmpresaTrabajo; string empr_Conct = ""; if (empresageneral != empresasubcontrata) { empr_Conct = empresacontrata + " / " + empresasubcontrata; } else { empr_Conct = empresacontrata; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n YO, ", fontColumnValue)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n" + datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n VISITANTE, perteneciente", fontColumnValue)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\na la Empresa ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n " + empr_Conct, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\nIdentificado (a) con " + tipodoc + " N° ", fontColumnValue)) { Colspan = 8, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n" + datosPac.v_DocNumber, fontColumnValue)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\ndeclaro haber sido", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\ndebida y ampliamente informado(a), de los riesgos de mi salud que se pueden presentar", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\ndurante mi visita a las instalaciones de MINERA YANACOCHA S.R.L.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \nAsimismo eximo de cualquier responsabilidad legal a MINERA YANACOCHA S.R.L., de lo ", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \nque pueda derivar de mi viaje a su área de operaciones.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n \n", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion string[] fechaServicio = datosPac.FechaServicio.ToString().Split('/', ' '); string mes = ""; if (fechaServicio[1] == "01") { mes = "Enero"; } else if (fechaServicio[1] == "02") { mes = "Febrero"; } else if (fechaServicio[1] == "03") { mes = "Marzo"; } else if (fechaServicio[1] == "04") { mes = "Abril"; } else if (fechaServicio[1] == "05") { mes = "Mayo"; } else if (fechaServicio[1] == "06") { mes = "Junio"; } else if (fechaServicio[1] == "07") { mes = "Julio"; } else if (fechaServicio[1] == "08") { mes = "Agosto"; } else if (fechaServicio[1] == "09") { mes = "Setiembre"; } else if (fechaServicio[1] == "10") { mes = "Octubre"; } else if (fechaServicio[1] == "11") { mes = "Noviembre"; } else if (fechaServicio[1] == "12") { mes = "Diciembre"; } PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 100, 35)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 60, 80)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; #region Fecha / Firmma cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n \n \n Lugar y Fecha: " + infoEmpresaPropietaria.v_SectorName + ", " + fechaServicio[0] + " de " + mes + " del " + fechaServicio[2], fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(cellFirmaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 180, BorderColor = BaseColor.WHITE }, new PdfPCell(cellHuellaTrabajador) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 180, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("_____________________________________", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(" Firma y Post Firma ", fontColumnValue)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_celda, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); }
public static void CreateAgendaDetallada(List <CalendarDetail> Agenda, string filePDF) { Document document = new Document(); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); var tamaño_celda = 12f; #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 7, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnHeaders = null; PdfPTable filiationWorker = new PdfPTable(8); PdfPTable table = null; PdfPCell cell = null; #endregion #region Title cells = new List <PdfPCell>() { new PdfPCell(new Phrase("AGENDA DETALLADA", fontTitle1)) { Colspan = 6, HorizontalAlignment = PdfPCell.ALIGN_CENTER, VerticalAlignment = PdfPCell.ALIGN_MIDDLE }, }; columnWidths = new float[] { 15f, 5f, 30f, 25f, 20f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTable); document.Add(table); #endregion #region Detalle cells = new List <PdfPCell>(); foreach (var servicio in Agenda) { cell = new PdfPCell(new Phrase(servicio.Pacient, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } columnWidths = new float[] { 100f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTableNegro); document.Add(table); #endregion document.Close(); }
public static void CreateHistoriaClinica(PacientList filiationData, List <ServiceComponentList> serviceComponent, organizationDto infoEmpresaPropietaria, List <PersonMedicalHistoryList> listMedicoPersonales, List <FamilyMedicalAntecedentsList> listaPatologicosFamiliares, List <NoxiousHabitsList> listaHabitoNocivos, List <DiagnosticRepositoryList> ListDiagnosticRepository, List <MedicationList> ListMedicamentos, string Recomendaciones, string filePDF) { // // step 1: creation of a document-object Document document = new Document(); //Document document = new Document(new Rectangle(500f, 300f), 10, 10, 10, 10); //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()); document.SetPageSize(iTextSharp.text.PageSize.A4); //Document document = new Document(PageSize.A4, 0, 0, 20, 20); // try { // step 2: we create a writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); // //create an instance of your PDFpage class. This is the class we generated above. pdfPage page = new pdfPage(); //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class writer.PageEvent = page; // step 3: we open the document document.Open(); // step 4: we Add content to the document // we define some fonts #region Fonts Font fontTitle1 = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontTitleTableNegro = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont(FontFactory.HELVETICA, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont(FontFactory.HELVETICA, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont(FontFactory.HELVETICA, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); #endregion #region Logo Image logo = HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 30F); PdfPTable headerTbl = new PdfPTable(1); headerTbl.TotalWidth = writer.PageSize.Width; PdfPCell cellLogo = new PdfPCell(logo); cellLogo.VerticalAlignment = Element.ALIGN_TOP; cellLogo.HorizontalAlignment = Element.ALIGN_CENTER; cellLogo.Border = PdfPCell.NO_BORDER; headerTbl.AddCell(cellLogo); document.Add(headerTbl); #endregion #region Title Paragraph cTitle = new Paragraph("HISTORIA CLÍNICA", fontTitle2); //Paragraph cTitle2 = new Paragraph(customerOrganizationName, fontTitle2); cTitle.Alignment = Element.ALIGN_CENTER; //cTitle2.Alignment = Element.ALIGN_CENTER; document.Add(cTitle); //document.Add(cTitle2); #endregion #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; //PdfPTable header1 = new PdfPTable(2); //header1.HorizontalAlignment = Element.ALIGN_CENTER; //header1.WidthPercentage = 100; ////header1.TotalWidth = 500; ////header1.LockedWidth = true; // Esto funciona con TotalWidth //float[] widths = new float[] { 150f, 200f}; //header1.SetWidths(widths); //Rectangle rec = document.PageSize; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; //header1.TotalWidth = 500; //header1.LockedWidth = true; // Esto funciona con TotalWidth float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); //header2.SetWidthPercentage(widths1, rec); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; //header1.TotalWidth = 500; //header1.LockedWidth = true; // Esto funciona con TotalWidth float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; #endregion // Salto de linea document.Add(new Paragraph("\r\n")); #region Datos Empresa Propietaria cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Dirección: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Address, fontColumnValue)), new PdfPCell(new Phrase("Teléfono: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(infoEmpresaPropietaria.v_PhoneNumber, fontColumnValue)), new PdfPCell(new Phrase("Email: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(infoEmpresaPropietaria.v_Mail, fontColumnValue)), }; columnWidths = new float[] { 17f, 17f, 17f, 17f, 17f, 17f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, null, fontTitleTableNegro, null); document.Add(filiationWorker); #endregion // Salto de linea document.Add(new Paragraph("\r\n")); #region Cabecera del Reporte var xFuncionesVitales = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.FUNCIONES_VITALES_ID); var FrecCar = ""; var FrecResp = ""; var PResionArterial = ""; var PResionDias = ""; var Temperatura = ""; if (xFuncionesVitales != null || xFuncionesVitales.ServiceComponentFields.Count == 0) { PResionArterial = xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAS_ID) == null ? "" : xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAS_ID).v_Value1; PResionDias = xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAD_ID) == null ? "" : xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_PAD_ID).v_Value1; FrecCar = xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_FREC_CARDIACA_ID) == null ? "" : xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_FREC_CARDIACA_ID).v_Value1; FrecResp = xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_FREC_RESPIRATORIA_ID) == null ? "" : xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_FREC_RESPIRATORIA_ID).v_Value1; Temperatura = xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_TEMPERATURA_ID) == null ? "" : xFuncionesVitales.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.FUNCIONES_VITALES_TEMPERATURA_ID).v_Value1; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Código: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_IdService, fontColumnValue)), new PdfPCell(new Phrase("Fecha: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.d_ServiceDate.Value.ToShortDateString(), fontColumnValue)), new PdfPCell(new Phrase("Emp. Seguro: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_DocNumber, fontColumnValue)) { Colspan = 3 }, new PdfPCell(new Phrase("Paciente: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_FirstName + " " + filiationData.v_FirstLastName + " " + filiationData.v_SecondLastName, fontColumnValue)) { Colspan = 7 }, new PdfPCell(new Phrase("Dirección: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_AdressLocation, fontColumnValue)) { Colspan = 7 }, new PdfPCell(new Phrase("Sexo: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_SexTypeName, fontColumnValue)), new PdfPCell(new Phrase("Teléfono: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_TelephoneNumber, fontColumnValue)), new PdfPCell(new Phrase("DNI: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_DocNumber, fontColumnValue)), new PdfPCell(new Phrase("Edad: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.i_Age.ToString() + "años", fontColumnValue)), new PdfPCell(new Phrase("F.C: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(FrecCar + " (Lat/min)", fontColumnValue)), new PdfPCell(new Phrase("F.R: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(FrecResp + " (Resp/min)", fontColumnValue)), new PdfPCell(new Phrase("P.A: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(PResionArterial + " (mmHg)", fontColumnValue)), new PdfPCell(new Phrase("T.: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(Temperatura + " C°", fontColumnValue)), new PdfPCell(new Phrase("T. Emfermedad: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.TiempoEnfermedad, fontColumnValue)), new PdfPCell(new Phrase("Inicio: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.InicioEnfermedad, fontColumnValue)), new PdfPCell(new Phrase("curso: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.CursoEnfermedad, fontColumnValue)) { Colspan = 3 }, new PdfPCell(new Phrase("Signos y Síntomas: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_MainSymptom, fontColumnValue)) { Colspan = 7 }, new PdfPCell(new Phrase("Enfermedad Actual(Motivo): ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_Story, fontColumnValue)) { Colspan = 7 }, }; columnWidths = new float[] { 12.5f, 12.5f, 12.5f, 12.5f, 12.5f, 12.5f, 12.5f, 12.5f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region Antecedentes Personales cells = new List <PdfPCell>(); if (listMedicoPersonales != null && listMedicoPersonales.Count > 0) { foreach (var item in listMedicoPersonales) { //Columna DX cell = new PdfPCell(new Phrase(item.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //Columna FECHA INICIO cell = new PdfPCell(new Phrase(item.d_StartDate.Value.ToShortDateString(), fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //Columna DETALLE cell = new PdfPCell(new Phrase(item.v_TreatmentSite, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } columnWidths = new float[] { 33f, 33f, 33f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue)) { Colspan = 8, HorizontalAlignment = PdfPCell.ALIGN_LEFT }); columnWidths = new float[] { 33f, 33f, 33f }; } columnHeaders = new string[] { "Diagnóstico", "Fecha Inicio", "Detalle" }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "ANTECEDENTES PERSONALES", fontTitleTableNegro, columnHeaders); document.Add(table); #endregion #region Antecedentes Familiares cells = new List <PdfPCell>(); if (listaPatologicosFamiliares != null && listaPatologicosFamiliares.Count > 0) { foreach (var item in listaPatologicosFamiliares) { //Columna Grupo Familiar cell = new PdfPCell(new Phrase(item.v_TypeFamilyName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //Columna DX cell = new PdfPCell(new Phrase(item.v_DiseaseName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //Columna DETALLE cell = new PdfPCell(new Phrase(item.v_Comment, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } columnWidths = new float[] { 33f, 33f, 33f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue)) { Colspan = 8, HorizontalAlignment = PdfPCell.ALIGN_LEFT }); columnWidths = new float[] { 33f, 33f, 33f }; } columnHeaders = new string[] { "Grupo Familiar", "Diagnostico", "Detalle" }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "ANTECEDENTES FAMILIARES", fontTitleTableNegro, columnHeaders); document.Add(table); #endregion #region Antecedentes Habitos Noscivos cells = new List <PdfPCell>(); if (listaHabitoNocivos != null && listaHabitoNocivos.Count > 0) { foreach (var item in listaHabitoNocivos) { //Columna Hábito cell = new PdfPCell(new Phrase(item.v_NoxiousHabitsName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //Columna Frecuencia cell = new PdfPCell(new Phrase(item.v_FrecuenciaHabito, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //Columna Comentario cell = new PdfPCell(new Phrase(item.v_Comment, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } columnWidths = new float[] { 33f, 33f, 33f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue)) { Colspan = 8, HorizontalAlignment = PdfPCell.ALIGN_LEFT }); columnWidths = new float[] { 33f, 33f, 33f }; } columnHeaders = new string[] { "Hábito", "Frecuencia", "Comentartio" }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "HÁBITOS NOSCIVOS", fontTitleTableNegro, columnHeaders); document.Add(table); #endregion var xExamenFisico = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.EXAMEN_FISICO_ID); string ValorExamenFisico = ""; if (xExamenFisico != null) { ValorExamenFisico = xExamenFisico.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EXAMEN_FISICO_HALLAZGOS_ID).v_Value1; } else { ValorExamenFisico = ""; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Examen Físico: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(ValorExamenFisico, fontColumnValue)), }; columnWidths = new float[] { 12.5f, 88.5f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, null, fontTitleTableNegro, null); document.Add(filiationWorker); #region Diagnósticos cells = new List <PdfPCell>(); if (ListDiagnosticRepository != null && ListDiagnosticRepository.Count > 0) { foreach (var item in ListDiagnosticRepository) { //Columna DX cell = new PdfPCell(new Phrase(item.v_DiseasesName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); //Columna XIE10 cell = new PdfPCell(new Phrase(item.v_Cie10, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } columnWidths = new float[] { 66f, 33f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue)) { Colspan = 8, HorizontalAlignment = PdfPCell.ALIGN_LEFT }); columnWidths = new float[] { 66f, 33f }; } columnHeaders = new string[] { "Diagnósticos", "CIE10" }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "DIAGNÓSTICOS", fontTitleTableNegro, columnHeaders); document.Add(table); #endregion #region Resultados cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Resultados: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(filiationData.v_ExaAuxResult, fontColumnValue)), }; columnWidths = new float[] { 12.5f, 88.5f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, null, fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region Medicación cells = new List <PdfPCell>(); if (ListMedicamentos != null && ListMedicamentos.Count > 0) { foreach (var item in ListMedicamentos) { cell = new PdfPCell(new Phrase(item.v_GenericName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.v_PresentationName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.v_Doses, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); cell = new PdfPCell(new Phrase(item.v_ViaName, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }; cells.Add(cell); } columnWidths = new float[] { 25f, 25f, 25f, 25f }; } else { cells.Add(new PdfPCell(new Phrase("No se han registrado datos.", fontColumnValue)) { Colspan = 8, HorizontalAlignment = PdfPCell.ALIGN_LEFT }); columnWidths = new float[] { 25f, 25f, 25f, 25f }; } columnHeaders = new string[] { "Fármaco", "Presentación", "Dosis", "Vía" }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "MEDICACIÓN Y RECETA", fontTitleTableNegro, columnHeaders); document.Add(table); #endregion #region Reomendaciones cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Recomendaciones: ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_RIGHT }, new PdfPCell(new Phrase(Recomendaciones, fontColumnValue)), }; columnWidths = new float[] { 20f, 80f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, null, fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region Firma #region Creando celdas de tipo Imagen y validando nulls // Firma del trabajador *************************************************** PdfPCell cellFirmaTrabajador = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, 20, 20)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase("Sin Firma Trabajador", fontColumnValue)); } // Huella del trabajador ************************************************** PdfPCell cellHuellaTrabajador = null; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, 15, 15)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase("Sin Huella", fontColumnValue)); } // Firma del doctor Auditor ************************************************** PdfPCell cellFirma = null; if (filiationData.FirmaMedico != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaMedico, 25, 25)); } else { cellFirma = new PdfPCell(new Phrase("Sin Firma", fontColumnValue)); } #endregion #region Crear tablas en duro (para la Firma y huella del trabajador) cells = new List <PdfPCell>(); cellFirmaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirmaTrabajador.FixedHeight = 70F; cells.Add(cellFirmaTrabajador); cells.Add(new PdfPCell(new Phrase("Firma del Examinado", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }); columnWidths = new float[] { 100f }; var tableFirmaTrabajador = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); //*********************************************** cells = new List <PdfPCell>(); cellHuellaTrabajador.HorizontalAlignment = Element.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = Element.ALIGN_MIDDLE; cellHuellaTrabajador.FixedHeight = 70F; cells.Add(cellHuellaTrabajador); cells.Add(new PdfPCell(new Phrase("Huella del Examinado", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER, VerticalAlignment = Element.ALIGN_MIDDLE }); columnWidths = new float[] { 100f }; var tableHuellaTrabajador = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, "", fontTitleTable); #endregion cells = new List <PdfPCell>(); // 1 celda vacia cells.Add(new PdfPCell(tableFirmaTrabajador)); // 1 celda vacia cells.Add(new PdfPCell(tableHuellaTrabajador)); // 2 celda cell = new PdfPCell(new Phrase("Firma y Sello Médico", fontColumnValue)) { Rowspan = 2 }; cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; cells.Add(cell); // 3 celda (Imagen) cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 70F; cells.Add(cellFirma); cells.Add(new PdfPCell(new Phrase("Con la cual declara que la información declarada es veraz", fontColumnValue)) { Colspan = 2, HorizontalAlignment = Element.ALIGN_LEFT, VerticalAlignment = Element.ALIGN_MIDDLE }); cells.Add(new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 2 }); columnWidths = new float[] { 25f, 25f, 20f, 30F }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, " ", fontTitleTable); document.Add(table); #endregion // step 5: we close the document document.Close(); writer.Close(); writer.Dispose(); //RunFile(filePDF); } catch (Exception) { throw; } }
public static void CreateLaboratorioReport(PacientList filiationData, List <ServiceComponentList> serviceComponent, organizationDto infoEmpresaPropietaria, string filePDF) { // // step 1: creation of a document-object Document document = new Document(); //Document document = new Document(new Rectangle(500f, 300f), 10, 10, 10, 10); //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()); document.SetPageSize(iTextSharp.text.PageSize.A4); //Document document = new Document(PageSize.A4, 0, 0, 20, 20); // try { // step 2: we create a writer that listens to the document PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); // //create an instance of your PDFpage class. This is the class we generated above. pdfPage page = new pdfPage(); //set the PageEvent of the pdfWriter instance to the instance of our PDFPage class writer.PageEvent = page; // step 3: we open the document document.Open(); // step 4: we Add content to the document // we define some fonts #region Fonts Font fontTitle1 = FontFactory.GetFont(FontFactory.HELVETICA, 18, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont(FontFactory.HELVETICA, 12, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontTitleTableNegro = FontFactory.GetFont(FontFactory.HELVETICA, 10, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont(FontFactory.HELVETICA, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont(FontFactory.HELVETICA, 9, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont(FontFactory.HELVETICA, 8, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); #endregion #region Logo Image logo = HandlingItextSharp.GetImage(infoEmpresaPropietaria.b_Image, 20F); PdfPTable headerTbl = new PdfPTable(1); headerTbl.TotalWidth = writer.PageSize.Width; PdfPCell cellLogo = new PdfPCell(logo); cellLogo.VerticalAlignment = Element.ALIGN_TOP; cellLogo.HorizontalAlignment = Element.ALIGN_CENTER; cellLogo.Border = PdfPCell.NO_BORDER; headerTbl.AddCell(cellLogo); document.Add(headerTbl); #endregion #region Title Paragraph cTitle = new Paragraph("EXAMENES ESPECIALES", fontTitle2); //Paragraph cTitle2 = new Paragraph(customerOrganizationName, fontTitle2); cTitle.Alignment = Element.ALIGN_CENTER; //cTitle2.Alignment = Element.ALIGN_CENTER; document.Add(cTitle); //document.Add(cTitle2); #endregion #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.White); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; //PdfPTable header1 = new PdfPTable(2); //header1.HorizontalAlignment = Element.ALIGN_CENTER; //header1.WidthPercentage = 100; ////header1.TotalWidth = 500; ////header1.LockedWidth = true; // Esto funciona con TotalWidth //float[] widths = new float[] { 150f, 200f}; //header1.SetWidths(widths); //Rectangle rec = document.PageSize; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; //header1.TotalWidth = 500; //header1.LockedWidth = true; // Esto funciona con TotalWidth float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); //header2.SetWidthPercentage(widths1, rec); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; //header1.TotalWidth = 500; //header1.LockedWidth = true; // Esto funciona con TotalWidth float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; #endregion // Salto de linea document.Add(new Paragraph("\r\n")); #region Datos personales del trabajador cells = new List <PdfPCell>() { new PdfPCell(new Phrase("Paciente: ", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_FirstName + " " + filiationData.v_FirstLastName + " " + filiationData.v_SecondLastName, fontColumnValue)), new PdfPCell(new Phrase("Empresa: ", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_FullWorkingOrganizationName, fontColumnValue)), new PdfPCell(new Phrase("Puesto: ", fontColumnValue)), new PdfPCell(new Phrase(filiationData.v_CurrentOccupation, fontColumnValue)), new PdfPCell(new Phrase("Fecha Atención: ", fontColumnValue)), new PdfPCell(new Phrase(filiationData.d_ServiceDate.Value.ToShortDateString(), fontColumnValue)), }; columnWidths = new float[] { 20f, 70f }; filiationWorker = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, PdfPCell.NO_BORDER, "I. DATOS PERSONALES", fontTitleTableNegro, null); document.Add(filiationWorker); #endregion #region EXAMENES ESPECIALES cells = new List <PdfPCell>(); // Subtitulo ****************** cell = new PdfPCell(new Phrase("EXAMENES ESPECIALES", fontSubTitleNegroNegrita)) { Colspan = 5, BackgroundColor = subTitleBackGroundColor, HorizontalAlignment = Element.ALIGN_CENTER, }; cells.Add(cell); //***************************************** var xBKDirecto = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.BK_DIRECTO_ID); var xExamenElisa = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.EXAMEN_ELISA_ID); var xHepatitisA = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.HEPATITIS_A_ID); var xHepatitisC = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.HEPATITIS_C_ID); var xVdrl = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.VDRL_ID); var xSubUnidad = serviceComponent.Find(p => p.v_ComponentId == Sigesoft.Common.Constants.SUB_UNIDAD_BETA_CUALITATIVO_ID); if (xBKDirecto != null) { var MuestraBKDirecto = xBKDirecto.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.BK_DIRECTO_MICROBIOLOGICO_MUESTRA); var ColoracionBKDirecto = xBKDirecto.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.BK_DIRECTO_MICROBIOLOGICO_COLORACION); var ResultadosBKDirecto = xBKDirecto.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.BK_DIRECTO_MICROBIOLOGICO_RESULTADOS); // 1era fila cells.Add(new PdfPCell(new Phrase("BK - DIRECTO", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("MUSTRA", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(MuestraBKDirecto.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("COLORACIÓN", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(ColoracionBKDirecto.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RESULTADOS", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(ResultadosBKDirecto.v_Value1, fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_LEFT }); } if (xExamenElisa != null) { var ResultadoExamenElisa = xExamenElisa.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EXAMEN_ELISA_REACTIVOS_EXAMEN_ELISA); var DeseableExamenElisa = xExamenElisa.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EXAMEN_ELISA__REACTIVOS_EXAMEN_ELISA_DESEABLE); var ObsExamenElisa = xExamenElisa.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.EXAMEN_ELISA__REACTIVOS_EXAMEN_ELISA_OBSERVACION); // 1era fila cells.Add(new PdfPCell(new Phrase("EXAMEN DE ELISA", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RESULTADO", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(ResultadoExamenElisa.v_Value1Name, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("DESEABLE", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(DeseableExamenElisa.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("OBSERVACIÓN", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(ObsExamenElisa.v_Value1, fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_LEFT }); } if (xHepatitisA != null) { var ResultadoHepatitisA = xHepatitisA.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEPATITIS_A_REACTIVOS_HEPATITIS_A); var DeseableHepatitisA = xHepatitisA.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEPATITIS_A_REACTIVOS_HEPATITIS_A_DESEABLE); var ObsHepatitisA = xHepatitisA.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEPATITIS_A_REACTIVOS_HEPATITIS_A_OBSERVACION); // 1era fila cells.Add(new PdfPCell(new Phrase("HEPATITIS A", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RESULTADO", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(ResultadoHepatitisA.v_Value1Name, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("DESEABLE", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(DeseableHepatitisA.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("OBSERVACIÓN", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(ObsHepatitisA.v_Value1, fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_LEFT }); } if (xHepatitisC != null) { var ResultadoHepatitisC = xHepatitisC.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEPATITIS_C_REACTIVOS_HEPATITIS_C); var DesableHepatitisC = xHepatitisC.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEPATITIS_C_REACTIVOS_HEPATITIS_C_DESEABLE); var ObsHepatitisC = xHepatitisC.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.HEPATITIS_C_REACTIVOS_HEPATITIS_C_OBSERVACION); // 1era fila cells.Add(new PdfPCell(new Phrase("HEPATITIS C", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RESULTADO", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(ResultadoHepatitisC.v_Value1Name, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("DESEABLE", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(DesableHepatitisC.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("OBSERVACIÓN", fontColumnValue))); cells.Add(new PdfPCell(new Phrase(ObsHepatitisC.v_Value1, fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_LEFT }); } if (xSubUnidad != null) { var ResultadoSubUnidad = xHepatitisC.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.SUB_UNIDAD_BETA_CUALITATIVO_RESULTADO); var DesableSubUnidad = xHepatitisC.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.SUB_UNIDAD_BETA_CUALITATIVO_DESEABLE); var ObsSubUnidad = xHepatitisC.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.SUB_UNIDAD_BETA_CUALITATIVO_OBSERVACION); // 1era fila cells.Add(new PdfPCell(new Phrase("Sub Unidad Beta Culaitativo", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RESULTADO", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(ResultadoSubUnidad.v_Value1Name, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("DESEABLE", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(ResultadoSubUnidad.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("OBSERVACIÓN", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(ResultadoSubUnidad.v_Value1, fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_LEFT }); } if (xVdrl != null) { var ResultadoVdrl = xVdrl.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.VDRL_REACTIVOS_VDRL); var DeseableVdrl = xVdrl.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.VDRL_REACTIVOS_VDRL_DESEABLE); var ObservacionVdrl = xVdrl.ServiceComponentFields.Find(p => p.v_ComponentFieldsId == Sigesoft.Common.Constants.VDRL_REACTIVOS_VDRL); // 1era fila cells.Add(new PdfPCell(new Phrase("VDRL", fontTitleTableNegro))); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(" ", fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("RESULTADO", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(ResultadoVdrl.v_Value1Name, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase("DESEABLE", fontTitleTableNegro)) { HorizontalAlignment = Element.ALIGN_CENTER }); cells.Add(new PdfPCell(new Phrase(DeseableVdrl.v_Value1, fontColumnValue)) { HorizontalAlignment = Element.ALIGN_CENTER }); } columnWidths = new float[] { 20f, 20f, 20f, 20f, 20f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths); document.Add(table); #endregion #region Imprimir todos los examenes de laboratorio string[] orderPrint = new string[] { Sigesoft.Common.Constants.HEMOGRAMA_COMPLETO_ID, Sigesoft.Common.Constants.EXAMEN_COMPLETO_DE_ORINA_ID, Sigesoft.Common.Constants.GRUPO_Y_FACTOR_SANGUINEO_ID, Sigesoft.Common.Constants.GLUCOSA_ID, Sigesoft.Common.Constants.COLESTEROL_ID, Sigesoft.Common.Constants.COLESTEROL_HDL_ID, Sigesoft.Common.Constants.COLESTEROL_LDL_ID, Sigesoft.Common.Constants.COLESTEROL_VLDL_ID, Sigesoft.Common.Constants.CREATININA_ID, Sigesoft.Common.Constants.ACIDO_URICO_ID, Sigesoft.Common.Constants.ANTIGENO_PROSTATICO_ID, Sigesoft.Common.Constants.PLOMO_SANGRE_ID, Sigesoft.Common.Constants.TGO_ID, Sigesoft.Common.Constants.TGP_ID, Sigesoft.Common.Constants.UREA_ID, Sigesoft.Common.Constants.AGLUTINACIONES_LAMINA_ID, Sigesoft.Common.Constants.EXAMEN_ELISA_ID, Sigesoft.Common.Constants.HEPATITIS_A_ID, Sigesoft.Common.Constants.HEPATITIS_C_ID, Sigesoft.Common.Constants.VDRL_ID, Sigesoft.Common.Constants.PARASITOLOGICO_SIMPLE_ID, Sigesoft.Common.Constants.PARASITOLOGICO_SERIADO_ID, Sigesoft.Common.Constants.BK_DIRECTO_ID, Sigesoft.Common.Constants.TOXICOLOGICO_COCAINA_MARIHUANA_ID, }; #endregion //Capturar la firma del medico que grabo en laboratorio var lab = serviceComponent.Find(p => p.i_CategoryId == (int)Sigesoft.Common.Consultorio.Laboratorio); ReportBuilderReportForLaboratorioReport(serviceComponent, orderPrint, fontTitleTable, fontSubTitleNegroNegrita, fontColumnValue, subTitleBackGroundColor, document); // Salto de linea document.Add(new Paragraph("\r\n")); #region Firma y sello Médico table = new PdfPTable(2); table.HorizontalAlignment = Element.ALIGN_RIGHT; table.WidthPercentage = 40; columnWidths = new float[] { 15f, 25f }; table.SetWidths(columnWidths); PdfPCell cellFirma = null; if (lab != null) { if (lab.FirmaMedico != null) { cellFirma = new PdfPCell(HandlingItextSharp.GetImage(lab.FirmaMedico, 25, 25)); } else { cellFirma = new PdfPCell(new Phrase("Sin Foto", fontColumnValue)); } } else { cellFirma = new PdfPCell(); } cellFirma.HorizontalAlignment = Element.ALIGN_CENTER; cellFirma.VerticalAlignment = Element.ALIGN_MIDDLE; cellFirma.FixedHeight = 70F; cell = new PdfPCell(new Phrase("Firma y Sello Médico", fontColumnValue)); cell.HorizontalAlignment = Element.ALIGN_CENTER; cell.VerticalAlignment = Element.ALIGN_MIDDLE; table.AddCell(cell); table.AddCell(cellFirma); document.Add(table); #endregion // step 5: we close the document document.Close(); writer.Close(); writer.Dispose(); //RunFile(filePDF); } catch (DocumentException) { throw; } catch (IOException) { throw; } }
public static void CreateEntregaExamenMedicoOcipacional(PacientList filiationData, ServiceList DataService, List <ServiceComponentList> serviceComponent, organizationDto infoEmpresa, PacientList datosPac, string filePDF) { Document document = new Document(PageSize.A4, 30f, 30f, 45f, 38f); document.SetPageSize(iTextSharp.text.PageSize.A4); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(filePDF, FileMode.Create)); pdfPage page = new pdfPage(); writer.PageEvent = page; document.Open(); #region Declaration Tables var subTitleBackGroundColor = new BaseColor(System.Drawing.Color.Gray); string include = string.Empty; List <PdfPCell> cells = null; float[] columnWidths = null; string[] columnValues = null; string[] columnHeaders = null; PdfPTable header2 = new PdfPTable(6); header2.HorizontalAlignment = Element.ALIGN_CENTER; header2.WidthPercentage = 100; float[] widths1 = new float[] { 16.6f, 18.6f, 16.6f, 16.6f, 16.6f, 16.6f }; header2.SetWidths(widths1); PdfPTable companyData = new PdfPTable(6); companyData.HorizontalAlignment = Element.ALIGN_CENTER; companyData.WidthPercentage = 100; float[] widthscolumnsCompanyData = new float[] { 16.6f, 16.6f, 16.6f, 16.6f, 16.6f, 16.6f }; companyData.SetWidths(widthscolumnsCompanyData); PdfPTable filiationWorker = new PdfPTable(4); PdfPTable table = null; PdfPCell cell = null; document.Add(new Paragraph("\r\n")); #endregion #region Fonts Font fontTitle1 = FontFactory.GetFont("Calibri", 13, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitle2 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTable = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontTitleTableNegro = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontSubTitle = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.White)); Font fontSubTitleNegroNegrita = FontFactory.GetFont("Calibri", 6, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue1 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValue2 = FontFactory.GetFont("Calibri", 10, iTextSharp.text.Font.NORMAL, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueBold = FontFactory.GetFont("Calibri", 8, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); Font fontColumnValueApendice = FontFactory.GetFont("Calibri", 5, iTextSharp.text.Font.BOLD, new BaseColor(System.Drawing.Color.Black)); #endregion #region TÍTULO cells = new List <PdfPCell>(); if (infoEmpresa.b_Image != null) { iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(infoEmpresa.b_Image)); imagenEmpresa.ScalePercent(25); imagenEmpresa.SetAbsolutePosition(45, 718); document.Add(imagenEmpresa); } //if (filiationData.logoCliente != null) //{ // iTextSharp.text.Image imagenEmpresa = iTextSharp.text.Image.GetInstance(HandlingItextSharp.GetImage(filiationData.logoCliente)); // imagenEmpresa.ScalePercent(20); // imagenEmpresa.SetAbsolutePosition(40, 795); // document.Add(imagenEmpresa); //} //iTextSharp.text.Image imagenMinsa = iTextSharp.text.Image.GetInstance("C:/Banner/Minsa.png"); //imagenMinsa.ScalePercent(10); //imagenMinsa.SetAbsolutePosition(400, 785); //document.Add(imagenMinsa); var cellsTit = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 60f }, new PdfPCell(new Phrase("ENTREGA DE EXAMEN MEDICO OCUPACIONAL", fontTitle2)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 60f }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 60f }, new PdfPCell(new Phrase("", fontTitle1)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f }, new PdfPCell(new Phrase("", fontTitle1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f }, new PdfPCell(new Phrase("", fontTitle2)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f }, new PdfPCell(new Phrase("Página 1 de 1", fontColumnValue1)) { HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f }, }; columnWidths = new float[] { 25f, 15f, 30f, 15f, 25f }; table = HandlingItextSharp.GenerateTableFromCells(cellsTit, columnWidths, null, fontTitleTable); document.Add(table); #endregion var tamaño_cuerpo = 25f; #region Contenido string preOcp = "", Ocup = "", postOcup = ""; if (filiationData.i_EsoTypeId == 1) { preOcp = "X"; } else if (filiationData.i_EsoTypeId == 2) { Ocup = "X"; } else if (filiationData.i_EsoTypeId == 3) { postOcup = "X"; } cells = new List <PdfPCell>() { new PdfPCell(new Phrase("", fontTitle1)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, BorderColor = BaseColor.WHITE, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.WHITE, BorderColorTop = BaseColor.BLACK }, new PdfPCell(new Phrase("ENTREGA E INFORME DE EXAMEN MEDICO OCUPACIONAL", fontTitle1)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = 25f, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\nLA EMPRESA,", fontColumnValueBold)) { Colspan = 2, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("\n" + filiationData.v_FullWorkingOrganizationName, fontColumnValue)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("\n; por medio del presente documento,", fontColumnValue)) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("deja constancia que el área de Salud Ocupacional, ha hecho entrega del informe del Examen Médico", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Ocupacional en Físico, Pre ocupacional ( " + preOcp + " ), Periódico ( " + Ocup + " ) Retiro (" + postOcup + " ) ", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Al Señor (a): ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_FirstLastName + " " + datosPac.v_SecondLastName + " " + datosPac.v_FirstName, fontColumnValue)) { Colspan = 15, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("Identificado con DNI N° ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_DocNumber, fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(", Puesto de Trabajo ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.v_CurrentOccupation, fontColumnValue)) { Colspan = 7, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("destinado al Proyecto: ", fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(filiationData.v_NombreProtocolo, fontColumnValue)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase(" CR:", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("; así mismo se ha informado detalladamente los resultados obtenidos en el examen médico ocupacional", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED_ALL, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("realizado el día: ", fontColumnValue)) { Colspan = 3, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase(datosPac.FechaServicio.ToString().Split(' ')[0], fontColumnValue)) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, UseVariableBorders = true, BorderColorLeft = BaseColor.WHITE, BorderColorRight = BaseColor.WHITE, BorderColorBottom = BaseColor.BLACK, BorderColorTop = BaseColor.WHITE }, new PdfPCell(new Phrase("; indicando al trabajador que cumpla con las recomendaciones", fontColumnValue)) { Colspan = 11, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("médicas respectivas y se compromete a cumplirlas de acuerdo a las indicaciones respectivas.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_JUSTIFIED, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("El trabajador firma en señal de conformidad de todo lo escrito previamente.", fontColumnValue)) { Colspan = 18, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue)) { Colspan = 1, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 2f, 6f, 5f, 5f, 6f, 5f, 6f, 5f, 5f, 5f, 5f, 5f, 6f, 5f, 6f, 5f, 6f, 5f, 5f, 2f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion string[] fechaImpresion = DateTime.Now.ToString().Split('/', ' '); string mes = ""; if (fechaImpresion[1] == "01") { mes = "Enero"; } else if (fechaImpresion[1] == "02") { mes = "Febrero"; } else if (fechaImpresion[1] == "03") { mes = "Marzo"; } else if (fechaImpresion[1] == "04") { mes = "Abril"; } else if (fechaImpresion[1] == "05") { mes = "Mayo"; } else if (fechaImpresion[1] == "06") { mes = "Junio"; } else if (fechaImpresion[1] == "07") { mes = "Julio"; } else if (fechaImpresion[1] == "08") { mes = "Agosto"; } else if (fechaImpresion[1] == "09") { mes = "Setiembre"; } else if (fechaImpresion[1] == "10") { mes = "Octubre"; } else if (fechaImpresion[1] == "11") { mes = "Noviembre"; } else if (fechaImpresion[1] == "12") { mes = "Diciembre"; } PdfPCell cellFirmaTrabajador = null; PdfPCell cellHuellaTrabajador = null; PdfPCell cellFirmaMedico = null; if (filiationData.FirmaTrabajador != null) { cellFirmaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.FirmaTrabajador, null, null, 100, 40)); } else { cellFirmaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (filiationData.HuellaTrabajador != null) { cellHuellaTrabajador = new PdfPCell(HandlingItextSharp.GetImage(filiationData.HuellaTrabajador, null, null, 40, 60)); } else { cellHuellaTrabajador = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellHuellaTrabajador.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellHuellaTrabajador.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; if (DataService.FirmaMedicoMedicina != null) { cellFirmaMedico = new PdfPCell(HandlingItextSharp.GetImage(DataService.FirmaMedicoMedicina, null, null, 100, 40)); } else { cellFirmaMedico = new PdfPCell(new Phrase(" ", fontColumnValue)); } cellFirmaMedico.HorizontalAlignment = PdfPCell.ALIGN_CENTER; cellFirmaMedico.VerticalAlignment = PdfPCell.ALIGN_MIDDLE; #region Fecha / Firmmal cells = new List <PdfPCell>() { new PdfPCell(new Phrase("\n \n \n \n " + infoEmpresa.v_SectorName + ", " + fechaImpresion[0] + " de " + mes + " del " + fechaImpresion[2], fontColumnValue2)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, MinimumHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("", fontColumnValue2)) { Colspan = 20, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = 50f, BorderColor = BaseColor.WHITE }, new PdfPCell(cellFirmaMedico) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 80, BorderColor = BaseColor.WHITE }, new PdfPCell(cellFirmaTrabajador) { Colspan = 6, HorizontalAlignment = iTextSharp.text.Element.ALIGN_RIGHT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 80, BorderColor = BaseColor.WHITE }, new PdfPCell(cellHuellaTrabajador) { Colspan = 4, HorizontalAlignment = iTextSharp.text.Element.ALIGN_LEFT, VerticalAlignment = iTextSharp.text.Element.ALIGN_BOTTOM, FixedHeight = 80, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("___________________________________", fontColumnValue2)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("___________________________________", fontColumnValue2)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("PERSONAL MEDICO RESPONSABLE ", fontColumnValue2)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, new PdfPCell(new Phrase("FIRMA DEL TRABAJADOR", fontColumnValue2)) { Colspan = 10, HorizontalAlignment = iTextSharp.text.Element.ALIGN_CENTER, VerticalAlignment = iTextSharp.text.Element.ALIGN_MIDDLE, FixedHeight = tamaño_cuerpo, BorderColor = BaseColor.WHITE }, }; columnWidths = new float[] { 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f, 5f }; table = HandlingItextSharp.GenerateTableFromCells(cells, columnWidths, null, fontTitleTable); document.Add(table); #endregion document.Close(); writer.Close(); writer.Dispose(); }