tabla.setWidths(widths);
for (int i = 0; i < headers.length; i++) {
String header = headers[i];
PdfPCell cell = new PdfPCell();
cell.setGrayFill(0.9f);
cell.setPhrase(new Phrase(header.toUpperCase(), new Font(
FontFamily.HELVETICA, 10, Font.BOLD)));
tabla.addCell(cell);
}
tabla.completeRow();
while (iteFallas.hasNext()) {
FallaLN falla = iteFallas.next();
PdfPCell cell0 = new PdfPCell();
PdfPCell cell1 = new PdfPCell();
PdfPCell cell2 = new PdfPCell();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String fecha = sdf.format(falla.getFecha());
cell0.setPhrase(new Phrase(fecha, new Font(
FontFamily.HELVETICA, 8, Font.NORMAL)));
cell1.setPhrase(new Phrase(falla.getEquipoNombre(),
new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
cell2.setPhrase(new Phrase(falla.getProblema(), new Font(
FontFamily.HELVETICA, 8, Font.NORMAL)));
tabla.addCell(cell0);
tabla.addCell(cell1);
tabla.addCell(cell2);
tabla.completeRow();
}
} else if (tipo.equals("1")) {// novedad
if (texto.trim().length() > 0) {
novedadList = ReporteLNBO.reporteNovedades(fechaini,
fechater, texto, idEquipo);
} else {
novedadList = ReporteLNBO.reporteNovedadesSinTexto(
fechaini, fechater, idEquipo);
}
Iterator<BitacoraLN> iteNovedadesfallas = novedadList
.iterator();
String[] headers = new String[] { "Fecha", "Usuario", "Turno",
"Equipo", "Novedad" };
tabla = new PdfPTable(headers.length);
tabla.setWidthPercentage(100);
float[] widths = new float[] { 2f, 2f, 1f,2f, 5f };
tabla.setWidths(widths);
for (int i = 0; i < headers.length; i++) {
String header = headers[i];
PdfPCell cell = new PdfPCell();
cell.setGrayFill(0.9f);
cell.setPhrase(new Phrase(header.toUpperCase(), new Font(
FontFamily.HELVETICA, 10, Font.BOLD)));
tabla.addCell(cell);
}
tabla.completeRow();
while (iteNovedadesfallas.hasNext()) {
BitacoraLN bitacora = iteNovedadesfallas.next();
PdfPCell cell0 = new PdfPCell();
PdfPCell cell1 = new PdfPCell();
PdfPCell cell2 = new PdfPCell();
PdfPCell cell3 = new PdfPCell();
PdfPCell cell4 = new PdfPCell();
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
String fecha = sdf.format(bitacora.getFecha());
cell0.setPhrase(new Phrase(fecha, new Font(
FontFamily.HELVETICA, 8, Font.NORMAL)));
if (bitacora.getUsuarioNombre() != null) {
cell1.setPhrase(new Phrase(bitacora.getUsuarioNombre(),
new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
} else {
cell1.setPhrase(new Phrase("", new Font(
FontFamily.HELVETICA, 8, Font.NORMAL)));
}
cell2.setPhrase(new Phrase(bitacora.getTurnoNombre(),
new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
cell3.setPhrase(new Phrase(bitacora.getEquipoNombre(),
new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
cell4.setPhrase(new Phrase(bitacora.getComentario().getValue(),
new Font(FontFamily.HELVETICA, 8, Font.NORMAL)));
tabla.addCell(cell0);
tabla.addCell(cell1);
tabla.addCell(cell2);
tabla.addCell(cell3);