List of usage examples for com.lowagie.text Font TIMES_ROMAN
int TIMES_ROMAN
To view the source code for com.lowagie.text Font TIMES_ROMAN.
Click Source Link
From source file:tk.diginspect.main.SoOFSignatories.java
public void createPDF() { doc = new Document(PageSize.A4); try {// w ww .j ava2 s .com String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/RFO"; File dir = new File(path); if (!dir.exists()) { dir.mkdirs(); } String strFinalname, strFilename2, strFilenames; String filename = sp.getString("EstablishmentName", null); String strfilename = filename.replaceAll("\\W+", "-"); String inspector = sp.getString("FDRO1", null); String inspby = inspector.replaceAll("\\W+", "-"); File file = new File(dir, strfilename + "-" + strFile + "-" + inspby + ".pdf"); strFilename2 = strfilename + "-" + strFile + "-" + inspby; strFilenames = strFilename2 + ".pdf"; strFinalname = path + "/" + strFilenames; savePreferences("fileName", strFinalname); FileOutputStream fOut = new FileOutputStream(file); PdfWriter.getInstance(doc, fOut); doc.open(); FDALetterhead(); // General Info Table float[] table1columnWidths = { 1f, 1f, 1f, 1f }; PdfPTable table1 = new PdfPTable(table1columnWidths); table1.setWidthPercentage(110f); table1.setSpacingAfter(20f); insertCell(table1, "INSPECTION REPORT", Element.ALIGN_CENTER, 4, "#8EBAFF", 1, 0); insertCell(table1, "Name of Establishment", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("EstablishmentName", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Plant/Office Address", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PlantOfficeAddress", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Warehouse Address", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("WarehouseAddress", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Owner", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("Owner", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Telephone Number", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("TelNumber", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Fax No", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("FaxNumber", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Classification", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); String Classification = sp.getString("MainClass", null) + ", " + sp.getString("SecClass", null) + ", " + sp.getString("ThirdClass", null) + ", " + sp.getString("FourthClass", ""); insertCell(table1, Classification, Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Product/s:", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("Products", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Manner of Notification", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("Notification", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Purpose of Inspection", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("Inspection", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Registered Pharmacist / Authorized Representative / Person", Element.ALIGN_LEFT, 4, "#8EBAFF", 1, 0); insertCell(table1, "Name", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PharmacistName", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Reg. No. (PRC-ID)", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PrcID", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Date Issued", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PrcDateIssued", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Validity", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PrcValidity", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Position", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("PharmacistPosition", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Person/s Interviewed", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("InterviewedName", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Position", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("InterviewedPosition", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "License to Operate", Element.ALIGN_LEFT, 4, "#8EBAFF", 1, 0); insertCell(table1, "Number", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("LTONumber", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Renewal", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("LTORenewalDate", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Validity", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("LTOValidity", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Payment of Appropriate Fee", Element.ALIGN_LEFT, 4, "#8EBAFF", 1, 0); insertCell(table1, "OR Number", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("ORNum", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Amount", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell(table1, "Php " + sp.getString("ORAmount", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "Date of Payment", Element.ALIGN_LEFT, 0, "#8EBAFF", 1, 0); insertCell(table1, sp.getString("ORDate", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 0); insertCell(table1, "RSN", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 1); insertCell(table1, sp.getString("RSN", "N/A"), Element.ALIGN_LEFT, 3, "#FFFFFF", 1, 1); doc.add(table1); footer(); // 2nd Page doc.newPage(); FDALetterhead(); PdfPTable table2 = new PdfPTable(1); table2.setWidthPercentage(110f); table2.setSpacingAfter(20f); insertCell(table2, "Observation Findings:", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 0); insertCell1(table2, sp.getString("ObservationFindings", ""), 1, 1, 600f); doc.add(table2); footer(); // 3rd Page doc.newPage(); FDALetterhead(); PdfPTable table3 = new PdfPTable(1); table3.setWidthPercentage(110f); table3.setSpacingAfter(20f); insertCell(table3, "Directives:", Element.ALIGN_LEFT, 1, "#8EBAFF", 1, 1); nested(table3, 0.1f, 2f, R.string.directives1, sp.getBoolean("Directives1", false), Element.ALIGN_LEFT); nested(table3, 0.1f, 2f, R.string.directives2, sp.getBoolean("Directives2", false), Element.ALIGN_LEFT); nested(table3, 0.2f, 2f, R.string.directives3, sp.getBoolean("Directives3", false), Element.ALIGN_RIGHT); nested(table3, 0.2f, 2f, R.string.directives4, sp.getBoolean("Directives4", false), Element.ALIGN_RIGHT); nested(table3, 0.1f, 2f, R.string.directives5, sp.getBoolean("Directives5", false), Element.ALIGN_LEFT); nested(table3, 0.1f, 2f, R.string.directives6, sp.getBoolean("Directives6", false), Element.ALIGN_LEFT); nested(table3, 0.1f, 2f, R.string.directives7, sp.getBoolean("Directives7", false), Element.ALIGN_LEFT); String Directives8 = getResources().getString(R.string.directives8); PdfPCell cellDirectives8 = new PdfPCell(new Paragraph(Font.TIMES_ROMAN, Directives8)); cellDirectives8.setPaddingLeft(50); cellDirectives8.setPaddingTop(5); cellDirectives8.setPaddingBottom(5); cellDirectives8.setPaddingRight(5); cellDirectives8.setBorderWidthTop(0); cellDirectives8.setBorderWidthBottom(0); table3.addCell(cellDirectives8); String Directives = sp.getString("Directives8", null); boolean Directives9 = false, Directives10 = false; if (Directives.equals(R.string.directives9)) { Directives9 = true; Directives10 = false; } else if (Directives.equals(R.string.directives10)) { Directives9 = false; Directives10 = true; } else { Directives9 = false; Directives10 = false; } nested(table3, 0.3f, 2f, R.string.directives9, Directives9, Element.ALIGN_RIGHT); nested(table3, 0.3f, 2f, R.string.directives10, Directives10, Element.ALIGN_RIGHT); insertCell(table3, "Inspected By:", Element.ALIGN_CENTER, 1, "#8EBAFF", 1, 0); PdfPTable signature1 = new PdfPTable(2); sig(signature1, "FDRO1"); sig(signature1, "FDRO2"); insertCell(signature1, sp.getString("FDRO1", null), Element.ALIGN_CENTER, 1, "#FFFFFF", 0, 0); insertCell(signature1, sp.getString("FDRO2", null), Element.ALIGN_CENTER, 1, "#FFFFFF", 0, 0); insertCell(signature1, "Food-Drug Regulation Officer", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 0); insertCell(signature1, "Food-Drug Regulation Officer", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 0); insertCell(signature1, "Date: " + dateStarted, Element.ALIGN_LEFT, 1, "#FFFFFF", 1, 0); insertCell(signature1, "Time: " + timeS, Element.ALIGN_LEFT, 1, "#FFFFFF", 1, 0); sig(signature1, "EstRep1"); sig(signature1, "EstRep2"); insertCell(signature1, sp.getString("EstRep1", null), Element.ALIGN_CENTER, 1, "#FFFFFF", 0, 0); insertCell(signature1, sp.getString("EstRep2", null), Element.ALIGN_CENTER, 1, "#FFFFFF", 0, 0); insertCell(signature1, "Establishments Representative", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 1); insertCell(signature1, "Establishments Representative", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 1); PdfPCell nesthousing1 = new PdfPCell(signature1); table3.addCell(nesthousing1); doc.add(table3); footer(); // 4th Page doc.newPage(); FDALetterhead(); PdfPTable table4 = new PdfPTable(1); table4.setWidthPercentage(110f); table4.setSpacingAfter(20f); insertCell(table4, "(FDA USE ONLY)", Element.ALIGN_CENTER, 1, "#8EBAFF", 1, 1); insertCell(table4, "Compliance Made by the Company", Element.ALIGN_LEFT, 1, "#FFFFFF", 0, 0); nested(table4, 0.1f, 2f, R.string.CAPA, false, Element.ALIGN_LEFT); nested(table4, 0.2f, 2f, R.string.Accepted, false, Element.ALIGN_RIGHT); nested(table4, 0.2f, 2f, R.string.NotAccepted, false, Element.ALIGN_RIGHT); insertCell(table4, "Recommendation (to Licensing) :", Element.ALIGN_LEFT, 1, "#FFFFFF", 0, 0); insertCell1(table4, "", 0, 0, 100f); PdfPTable signature2 = new PdfPTable(2); insertCell1(signature2, "", 0, 0, 50f); insertCell1(signature2, "", 0, 0, 50f); insertCell(signature2, "Print Name & Signature of FDRO/s", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 0); insertCell(signature2, "Date", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 0); insertCell(signature2, "Reviewed by:", Element.ALIGN_LEFT, 2, "#8EBAFF", 1, 1); insertCell1(signature2, "", 0, 0, 50f); insertCell1(signature2, "", 0, 0, 50f); insertCell(signature2, "Print Name & Signature of Team Leader/Supervisor", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 1); insertCell(signature2, "Date", Element.ALIGN_CENTER, 1, "#FFFFFF", 1, 1); PdfPCell nesthousing2 = new PdfPCell(signature2); table4.addCell(nesthousing2); doc.add(table4); footer(); } catch (DocumentException de) { Log.e("PDFCreator", "DocumentException:" + de); } catch (FileNotFoundException e) { Log.e("PDFCreator", "ioException:" + e); } finally { doc.close(); } }
From source file:tk.diginspect.main.SoOFSignatories.java
private void insertCell(PdfPTable table, String text, int align, int colspan, String color, float BorderWidthTop, float BorderWidthBottom) { PdfPCell cell = new PdfPCell(new Paragraph(Font.TIMES_ROMAN, text)); cell.setHorizontalAlignment(align);/*from www. j ava2 s . co m*/ cell.setColspan(colspan); cell.setBackgroundColor(WebColors.getRGBColor(color)); cell.setPadding(5); cell.setBorderWidthTop(BorderWidthTop); cell.setBorderWidthBottom(BorderWidthBottom); table.addCell(cell); }
From source file:tk.diginspect.main.SoOFSignatories.java
private void insertCell1(PdfPTable table, String text, float borderWidthTop, float borderWidthBottom, float fixedHeight) { PdfPCell cell = new PdfPCell(new Paragraph(Font.TIMES_ROMAN, text)); cell.setBackgroundColor(WebColors.getRGBColor("#FFFFFF")); cell.setPadding(5);//from w ww .j a v a 2 s .co m cell.setBorderWidthTop(borderWidthTop); cell.setBorderWidthBottom(borderWidthBottom); cell.setFixedHeight(fixedHeight); table.addCell(cell); }
From source file:tk.diginspect.main.SoOFSignatories.java
private void nested(PdfPTable table, float column1, float column2, int directives, boolean checkmark, int align) { float[] nestedcolumnWidths = { column1, column2 }; PdfPTable nested = new PdfPTable(nestedcolumnWidths); if (checkmark == true) { Checked(nested, align, R.drawable.checked); } else if (checkmark == false) { Checked(nested, align, R.drawable.unchecked); }/*from w ww. j av a 2 s . co m*/ String Directives = getResources().getString(directives); PdfPCell cell = new PdfPCell(new Paragraph(Font.TIMES_ROMAN, Directives)); cell.setPadding(5); cell.setBorderWidth(0); nested.addCell(cell); PdfPCell nesthousing = new PdfPCell(nested); nesthousing.setBorderWidthTop(0); nesthousing.setBorderWidthBottom(0); table.addCell(nesthousing); }
From source file:tk.diginspect.main.SoOFSignatories.java
private void footer() { Paragraph footer = new Paragraph(Font.TIMES_ROMAN, "Summary of Observations/Findings"); try {//from w w w.j ava 2s . c o m doc.add(footer); } catch (DocumentException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
From source file:util.PDFconverter.java
public static void createPDF(String[] header, String[][] data, String path, String tittle, float[] columnWidths) { try {/*from ww w. j av a2 s . c o m*/ Document doc = new Document(); PdfWriter.getInstance(doc, new FileOutputStream(path)); doc.open(); doc.setPageSize(PageSize.A4); doc.setMargins(10, 10, 10, 10); Font litle = new Font(Font.COURIER, 7, Font.NORMAL); Font norm = new Font(Font.TIMES_ROMAN, 8, Font.NORMAL); Font normBold = new Font(Font.TIMES_ROMAN, 8, Font.BOLD); Font TitleFont = new Font(Font.TIMES_ROMAN, 12, Font.BOLD); doc.add(Chunk.NEWLINE); Paragraph judul = new Paragraph(tittle, TitleFont); judul.setAlignment(Element.ALIGN_CENTER); doc.add(judul); // Paragraph tgl = new Paragraph("tanggal " + tanggal + "\n", TitleFont); // tgl.setAlignment(Element.ALIGN_CENTER); // doc.add(tgl); doc.add(Chunk.NEWLINE); PdfPTable table = new PdfPTable(header.length); table.setWidthPercentage(100f); for (String head : header) { table.addCell(new PdfPCell(new Phrase(head, normBold))); } for (String[] obj : data) { for (int i = 0; i < header.length; i++) { table.addCell(new PdfPCell(new Phrase(obj[i], norm))); } } //float[] columnWidths = new float[] {10f, 20f, 30f, 10f}; table.setWidths(columnWidths); doc.add(table); // Paragraph stamp = new Paragraph(new Chunk("this report has generated with QCMS by " + System.getProperty("user.name") + " on " + new Date(), litle)); // stamp.setAlignment(Element.ALIGN_BOTTOM); // stamp.setAlignment(Element.ALIGN_CENTER); // doc.add(stamp); // // Paragraph tanda = new Paragraph(new Chunk("Mengetahui,", norm)); // tanda.setSpacingBefore(100); // tanda.setAlignment(Element.ALIGN_RIGHT); // tanda.setAlignment(Element.ALIGN_BOTTOM); // doc.add(tanda); // // Paragraph nama = new Paragraph(new Chunk("MANAGER Dept.RnQ", norm)); // nama.setSpacingBefore(30); // nama.setAlignment(Element.ALIGN_RIGHT); // nama.setAlignment(Element.ALIGN_BOTTOM); // doc.add(nama); doc.close(); } catch (DocumentException | FileNotFoundException ex) { Logger.getLogger(PDFconverter.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:vistas.reportes.procesos.rptTardanzaTotal.java
public void crearPdf(String nombreFile, List<String> dnis, Date fechaInicio, Date fechaFin, String oficina, String tipo, String usuario) throws IOException, DocumentException { Document documento = new Document(PageSize.A4.rotate()); PdfWriter.getInstance(documento, new FileOutputStream(nombreFile)); documento.open();/* w w w.j a v a2s . c o m*/ Image cabecera = Image.getInstance("img/cabecera.png"); cabecera.setAlignment(1); documento.add(cabecera); String nombreGrupoOficina = ""; if (tipo == "O") { nombreGrupoOficina = "OFICINA: "; } else { nombreGrupoOficina = "GRUPO HORARIO: "; } Font font = new Font(Font.TIMES_ROMAN, 10, Font.BOLD); Chunk nombreReporte = new Chunk("REPORTE DE CONSOLIDADO DE TARDANZA", font); Chunk labelOficina = new Chunk(nombreGrupoOficina, font); Chunk labelMes = new Chunk("MES: ", font); Chunk labelUsuario = new Chunk("USUARIO: ", font); Chunk nombreOficina = new Chunk(oficina, new Font(Font.TIMES_ROMAN, 10)); Chunk nombreMes = new Chunk(ReporteUtil.obtenerNombreMes(fechaInicio).toUpperCase(), new Font(Font.TIMES_ROMAN, 10)); Chunk nombreUsuario = new Chunk(usuario.toUpperCase(), new Font(Font.TIMES_ROMAN, 10)); documento.add(new Paragraph(nombreReporte)); documento.add(ReporteUtil.darEspaciado(15)); documento.add(new Paragraph(ReporteUtil.unirChunks(labelOficina, nombreOficina))); documento.add(ReporteUtil.darEspaciado(15)); documento.add(new Paragraph(ReporteUtil.unirChunks(labelMes, nombreMes))); documento.add(ReporteUtil.darEspaciado(15)); documento.add(new Paragraph(ReporteUtil.unirChunks(labelUsuario, nombreUsuario))); documento.add(ReporteUtil.darEspaciado(20)); PdfPTable tabla = new rptTardanzaTotal().crearTabla(dnis, fechaInicio, fechaFin); documento.add(tabla); documento.close(); try { File path = new File(nombreFile); Desktop.getDesktop().open(path); } catch (IOException ex) { ex.printStackTrace(); } }
From source file:vistas.reportes.procesos.rptTardanzaTotal.java
public PdfPTable crearTabla(List<String> dnis, Date fechaInicio, Date fechaFin) throws DocumentException { /**//from www . j a va 2s .c o m * Procesamiento para info para generar tablas */ //List<RegistroAsistencia> registros = rg.buscarXEmpleadoXFecha1(dnis, fechaInicio, fechaFin); Calendar fechaInicioC = Calendar.getInstance(); Calendar fechaFinC = Calendar.getInstance(); fechaInicioC.setTime(fechaInicio); fechaFinC.setTime(fechaFin); // Dias contados desde un inicio y fin fecha ArrayList<Integer> listaDias = new ArrayList<>(); while (fechaInicioC.getTime().compareTo(fechaFinC.getTime()) <= 0) { if (!ReporteUtil.isDiaLaboral(fechaInicioC.getTime())) { fechaInicioC.add(Calendar.DATE, 1); continue; } listaDias.add(fechaInicioC.get(Calendar.DATE)); fechaInicioC.add(Calendar.DATE, 1); } System.out.println("Numero de dias a agregar: " + listaDias.size()); for (Integer listaDia : listaDias) { System.out.println("Dia numero: " + listaDia); } /** * Procesamiento para elaborar tabla con datos */ //agrege una columna mas (Descuento sin goce) int nroColumnas = listaDias.size() + 5; PdfPTable tabla = new PdfPTable(nroColumnas); tabla.setWidthPercentage(100); //Asignamos los tamaos a las columnas //MOdifique para tomar en cuenta la nueva columna de dewscuento int[] widthColumna = new int[nroColumnas]; for (int i = 0; i < nroColumnas; i++) { if (i == 0) { widthColumna[i] = 6; } else if (i == (nroColumnas - 1) || i == (nroColumnas - 2) || i == (nroColumnas - 3) || i == (nroColumnas - 4)) { widthColumna[i] = 2; } else { widthColumna[i] = 1; } } tabla.setWidths(widthColumna); //Definimos celdas iniciales Font fontCabecera = new Font(Font.TIMES_ROMAN, 10, Font.BOLD); Font fontCelda = new Font(Font.TIMES_ROMAN, 9); PdfPCell h1 = new PdfPCell(new Phrase("Nombre del empleado", fontCabecera)); h1.setHorizontalAlignment(3); h1.setGrayFill(0.7f); h1.setRowspan(2); h1.setColspan(1); tabla.addCell(h1); PdfPCell h2 = new PdfPCell(new Phrase("Das Hbiles", fontCabecera)); h2.setHorizontalAlignment(1); h2.setGrayFill(0.7f); h2.setColspan(nroColumnas - 5); tabla.addCell(h2); PdfPCell h3 = new PdfPCell(new Phrase("Minutos Tardanza", fontCabecera)); h3.setHorizontalAlignment(3); h3.setGrayFill(0.7f); h3.setColspan(1); h3.setRowspan(2); tabla.addCell(h3); //Agregado de columna de descuento sin goce PdfPCell h4 = new PdfPCell(new Phrase("Faltas", fontCabecera)); h4.setHorizontalAlignment(3); h4.setGrayFill(0.7f); h4.setColspan(1); h4.setRowspan(2); tabla.addCell(h4); PdfPCell h5 = new PdfPCell(new Phrase("Licencias S.G", fontCabecera)); h5.setHorizontalAlignment(3); h5.setGrayFill(0.7f); h5.setColspan(1); h5.setRowspan(2); tabla.addCell(h5); PdfPCell h6 = new PdfPCell(new Phrase("Descuento Total", fontCabecera)); h6.setHorizontalAlignment(3); h6.setGrayFill(0.7f); h6.setColspan(1); h6.setRowspan(2); tabla.addCell(h6); PdfPCell diaColumna = new PdfPCell(); for (int i = 0; i < (nroColumnas - 5); i++) { String celda = (listaDias.get(i).toString()); diaColumna.setPhrase(new Phrase(celda, fontCabecera)); diaColumna.setHorizontalAlignment(1); tabla.addCell(diaColumna); } Calendar cal = Calendar.getInstance(); List<ReporteAsistenciaBean> listaAsistencia = rac.analisisAsistencia(fechaInicio, fechaFin, dnis, false, false); List<Integer> conteoDias = new ArrayList<>(); int minutosTarde = 0; int minutosDescuentoPermisos = 0; int diasDescuento = 0; boolean banderaNombre = true; PdfPCell celdaNombre = new PdfPCell(); for (String dni : dnis) { List<ReporteAsistenciaBean> registrosDni = new ArrayList<>(); for (ReporteAsistenciaBean registro : listaAsistencia) { if (dni.equals(registro.getDni())) { registrosDni.add(registro); } } for (ReporteAsistenciaBean registro : registrosDni) { if (banderaNombre) { if (dni.equals(registro.getDni())) { celdaNombre.setPhrase(new Phrase(registro.getNombre(), fontCelda)); celdaNombre.setHorizontalAlignment(0); tabla.addCell(celdaNombre); banderaNombre = false; } } for (Integer dia : listaDias) { cal.setTime(registro.getFechaRegistro()); if (cal.get(Calendar.DAY_OF_MONTH) == dia) { if (!registro.getEstado().equals("FALTA")) { if (registro.getMinTardanza() != null) { int numero = registro.getMinTardanza(); String celda = "" + numero; celdaNombre.setPhrase(new Phrase(celda, fontCelda)); celdaNombre.setHorizontalAlignment(1); tabla.addCell(celdaNombre); minutosTarde += registro.getMinTardanza(); } } else if (registro.getEstado().equals("FALTA")) { if (registro.getMinTardanza() != null) { int numero = registro.getMinTardanza(); String celda = "" + numero; celdaNombre.setPhrase(new Phrase(celda, fontCelda)); celdaNombre.setHorizontalAlignment(1); tabla.addCell(celdaNombre); diasDescuento += 1; } } conteoDias.add(dia); break; } else { if (conteoDias.contains(dia)) { } else { String celda = "n.r"; celdaNombre.setPhrase(new Phrase(celda, fontCelda)); celdaNombre.setHorizontalAlignment(1); tabla.addCell(celdaNombre); conteoDias.add(dia); } } } } //Minutos tarde String hora1 = ""; if (minutosTarde < 60) { hora1 = minutosTarde + " min"; } else if (minutosTarde >= 60 && minutosTarde < 480) { int resto = minutosTarde % 60; int totalH = (minutosTarde - resto) / 60; hora1 = totalH + " h " + resto + " min"; } else if (minutosTarde >= 480) { int restoHoras = minutosTarde % 480; int totalD = (minutosTarde - restoHoras) / 480; int restoMinutos = restoHoras % 60; int totalH = (restoHoras - restoMinutos) / 60; hora1 = totalD + " d " + totalH + " h " + restoMinutos + " m"; } celdaNombre.setPhrase(new Phrase(hora1, fontCelda)); celdaNombre.setHorizontalAlignment(1); tabla.addCell(celdaNombre); //Dias con falta String hora2 = ""; int minutosT = diasDescuento * 480; if (minutosT < 60) { hora2 = minutosT + " min"; } else if (minutosT >= 60 && minutosT < 480) { int resto = minutosT % 60; int totalH = (minutosT - resto) / 60; hora2 = totalH + " h " + resto + " min"; } else if (minutosT >= 480) { int restoHoras = minutosT % 480; int totalD = (minutosT - restoHoras) / 480; int restoMinutos = restoHoras % 60; int totalH = (restoHoras - restoMinutos) / 60; hora2 = totalD + " d " + totalH + " h " + restoMinutos + " m"; } celdaNombre.setPhrase(new Phrase(hora2, fontCelda)); celdaNombre.setHorizontalAlignment(1); tabla.addCell(celdaNombre); //Licencia sin goce minutosDescuentoPermisos = rac.minutosSinGocePorPermisos(dni, fechaInicio, fechaFin); String hora = ""; if (minutosDescuentoPermisos < 60) { hora = minutosDescuentoPermisos + " min"; } else if (minutosDescuentoPermisos >= 60 && minutosDescuentoPermisos < 480) { int resto = minutosDescuentoPermisos % 60; int totalH = (minutosDescuentoPermisos - resto) / 60; hora = totalH + " h " + resto + " min"; } else if (minutosDescuentoPermisos >= 480) { int restoHoras = minutosDescuentoPermisos % 480; int totalD = (minutosDescuentoPermisos - restoHoras) / 480; int restoMinutos = restoHoras % 60; int totalH = (restoHoras - restoMinutos) / 60; hora = totalD + " d " + totalH + " h " + restoMinutos + " m"; } celdaNombre.setPhrase(new Phrase(hora, fontCelda)); celdaNombre.setHorizontalAlignment(1); tabla.addCell(celdaNombre); //Total String horaT = ""; int tiempoTotal = minutosTarde + minutosT + minutosDescuentoPermisos; if (tiempoTotal < 60) { horaT = tiempoTotal + " min"; } else if (tiempoTotal >= 60 && tiempoTotal < 480) { int resto = tiempoTotal % 60; int totalH = (tiempoTotal - resto) / 60; horaT = totalH + " h " + resto + " min"; } else if (tiempoTotal >= 480) { int restoHoras = tiempoTotal % 480; int totalD = (tiempoTotal - restoHoras) / 480; int restoMinutos = restoHoras % 60; int totalH = (restoHoras - restoMinutos) / 60; horaT = totalD + " d " + totalH + " h " + restoMinutos + " m"; } celdaNombre.setPhrase(new Phrase(horaT, fontCelda)); celdaNombre.setHorizontalAlignment(1); tabla.addCell(celdaNombre); registrosDni.clear(); banderaNombre = true; minutosTarde = 0; minutosDescuentoPermisos = 0; minutosT = 0; diasDescuento = 0; } return tabla; }