List of usage examples for com.itextpdf.text.pdf PdfPCell setColspan
public void setColspan(int colspan)
From source file:pdf.GeradorPDF.java
private PdfPTable createTable(Pagamento pagamento, DadosEspecificos dados) throws DocumentException { int colunas = 7 + pagamento.getBeneficios().size(); PdfPTable table = new PdfPTable(colunas); PdfPCell cell; cell = new PdfPCell(new Phrase("Cmpus: " + pagamento.getTurma().getCampusOfertante() + " Ms: " + pagamento.getMes() + " Planilha: " + dados.getNroPanilha())); cell.setColspan(colunas); table.addCell(cell);/*from w ww . j a va 2 s .c om*/ cell = new PdfPCell(new Phrase("Nome do curso: " + pagamento.getTurma().getCurso().getNome() + " Cdigo SISTEC: " + dados.getSistec() + " LC: " + dados.getLc())); cell.setColspan(colunas); table.addCell(cell); SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy"); cell = new PdfPCell(new Phrase("Data de inicio do curso: " + df.format(pagamento.getTurma().getDataInicioAulas()).replace("00:00:00", "") + " Fim previsto do curso: " + df.format(pagamento.getTurma().getDataTerminoAulas()).replace("00:00:00", ""))); cell.setColspan(colunas); table.addCell(cell); table.addCell("Nome"); table.addCell("CPF"); table.addCell("Banco"); table.addCell("Agncia"); table.addCell("Conta"); for (Beneficio b : pagamento.getBeneficios()) { table.addCell(b.getTipo() + " R$"); } table.addCell("Faltas R$"); table.addCell("Valor Total R$"); double totalFaltas = 0.0, totalBeneficio = 0.0, valorBeneficio; for (Aluno aluno : pagamento.getAlunos()) { if (aluno.isRecece()) { table.addCell(aluno.getNome()); table.addCell(aluno.getCpf()); table.addCell(aluno.getContaBancaria().getNomeBanco()); table.addCell(aluno.getContaBancaria().getAgencia() + ""); table.addCell(aluno.getContaBancaria().getNumeroConta() + ""); for (Beneficio beneficio : pagamento.getBeneficios()) { valorBeneficio = (pagamento.getDiasLetivos() - aluno.getFaltas()) * beneficio.getValor(); table.addCell("R$ " + valorBeneficio); } table.addCell("R$ " + aluno.getValorDescontado()); totalFaltas += aluno.getValorDescontado(); table.addCell("R$ " + aluno.getValorRecebido()); } } table.addCell("Total"); table.addCell(""); table.addCell(""); table.addCell(""); table.addCell(""); for (Beneficio b : pagamento.getBeneficios()) { try { totalBeneficio = new PagamentoDAO().recuperarTotalPagoPorBeneficio(b.getId(), pagamento.getId()); } catch (SQLException ex) { Logger.getLogger(GeradorPDF.class.getName()).log(Level.SEVERE, null, ex); } table.addCell("R$ " + totalBeneficio); } table.addCell("R$ " + totalFaltas); table.addCell("R$ " + pagamento.getValorAPagarPorTurma()); float[] columnWidths = new float[0]; if (colunas == 9) { columnWidths = new float[] { 27f, 18f, 8f, 10f, 13f, 15f, 15f, 13f, 15f }; } else if (colunas == 8) { columnWidths = new float[] { 27f, 18f, 9f, 12f, 13f, 15f, 13f, 17f }; } table.setWidths(columnWidths); return table; }
From source file:pdf.PDFDesign.java
private PdfPCell createEuro_6_Cell(Item item) throws DocumentException { PdfPTable table = new PdfPTable(1); table.setWidthPercentage(100f);//from w w w.j a v a 2 s . c o m PdfPCell cell; Paragraph p; cell = new PdfPCell(); p = new Paragraph(); p.setFont(new Font(droidsans, 13, Font.NORMAL, color)); String t = item.getTitle(); String[] split = t.split("//"); for (String split1 : split) { p.add(split1 + "\n"); } cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setPhrase(p); cell.setColspan(2); cell.setFixedHeight(30f); cell.setBorder(0); table.addCell(cell); cell = new PdfPCell(); p = new Paragraph(); p.setFont(new Font(droidsans, 11, Font.NORMAL, color)); p.add(item.getAmount() + "" + item.getUnit()); cell.setPhrase(p); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorder(0); table.addCell(cell); table.addCell(createEuro_6_InnerPrice(item)); cell = new PdfPCell(); p = new Paragraph(); p.setFont(new Font(droidsans, 11, Font.NORMAL, color)); p.add("Cena za 1" + item.getXUnit() + ": " + item.getUnitPrice() + item.getCurrency() + "/" + item.getSecondUnitPrice() + item.getSecondCurrency()); cell.setPhrase(p); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setVerticalAlignment(Element.ALIGN_MIDDLE); cell.setBorder(0); table.addCell(cell); PdfPCell finalCell = new PdfPCell(table); finalCell.setFixedHeight(cellHeight);//175f finalCell.setBorderColor(BaseColor.GRAY); return finalCell; }
From source file:PDF.Reportes.java
public static ArrayList<PdfPTable> tablaAspAula(String usuario, String contra, String horario, int opc) throws DocumentException { ArrayList<PdfPTable> tablas = new ArrayList(); // IngresoAbd bd = new IngresoAbd(usuario, contra); List<Beans.Reportes> reportes = ReportesDAO.AspPAula(usuario, contra, horario, opc); PdfPTable table = new PdfPTable(2); // reportes = bd.AspPAula(horario, opc); PdfPCell cell; String carrera = "", fecha = ""; if (reportes.isEmpty()) { cell = new PdfPCell( new Phrase("Lo sentimos, por el momento an no existe informacin para este reporte.")); cell.setColspan(5); table.addCell(cell);//from w w w .j a v a 2s.c o m tablas.add(table); } else if (reportes.get(0).getCodError() != 0) { if (reportes.get(0).getCodError() == -1) { cell = new PdfPCell(new Phrase(Constants.ERROR1)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -2) { cell = new PdfPCell(new Phrase(Constants.ERROR3)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -3) { cell = new PdfPCell(new Phrase(Constants.ERROR2)); cell.setColspan(5); table.addCell(cell); } tablas.add(table); } else { table = new PdfPTable(5); BaseColor color = new BaseColor(217, 217, 217); BaseColor colorB = new BaseColor(0, 0, 0); cell = new PdfPCell(new Phrase("Ficha(5)", FontFactory.getFont("arial", 12, colorB))); cell.setMinimumHeight(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); cell = new PdfPCell(new Phrase("Folio Ceneval(6)", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); cell = new PdfPCell(new Phrase("Nombre(7)", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); // cell = new PdfPCell(new Phrase("Nombre carrera", FontFactory.getFont("arial", 12, colorB))); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setBackgroundColor(color); // cell.setBorderColor(colorB); // table.addCell(cell); cell = new PdfPCell(new Phrase("Asistencia(8)", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); cell.setColspan(2); table.addCell(cell); // cell = new PdfPCell(new Phrase("Firma", FontFactory.getFont("arial", 12, colorB))); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setBackgroundColor(color); // cell.setBorderColor(colorB); // table.addCell(cell); for (int i = 0; i < reportes.size(); i++) { cell = new PdfPCell(new Phrase(reportes.get(i).getFicha())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(reportes.get(i).getFolio())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(reportes.get(i).getNombre(), FontFactory.getFont("arial", 10))); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); carrera = reportes.get(i).getNom_carrera(); // cell = new PdfPCell(new Phrase(reportes.get(i).getAsist())); table.addCell(cell); cell = new PdfPCell(new Phrase(reportes.get(i).getFirma())); table.addCell(cell); fecha = reportes.get(i).getFecha(); if ((i % 34 == 0 || (i + 1) == reportes.size()) && i != 0) { table.setWidthPercentage(110); table.setWidths(new int[] { 25, 30, 120, 15, 15 }); tablas.add(table); table = new PdfPTable(5); } } String datos[] = horario.split(" "); String edificio = datos[0]; String aula = ""; if (edificio.length() == 2) { edificio = datos[0].charAt(0) + ""; aula = datos[0].charAt(1) + ""; } if (edificio.length() == 4) { edificio = datos[0].charAt(0) + "" + datos[0].charAt(1); aula = "" + datos[0].charAt(3); } if (edificio.length() == 5) { edificio = datos[0].charAt(0) + "" + datos[0].charAt(1); aula = "" + datos[0].charAt(3) + datos[0].charAt(4); } PdfPTable tableH = new PdfPTable(7); tableH.setTotalWidth(500); cell.setMinimumHeight(20); cell = new PdfPCell(new Phrase("CARRERA:(1)", FontFactory.getFont("arial", 11))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(2); tableH.addCell(cell); cell = new PdfPCell(new Phrase(carrera)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(5); tableH.addCell(cell); cell = new PdfPCell(new Phrase("FECHA DE EXAMEN:(2)", FontFactory.getFont("arial", 11))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(2); tableH.addCell(cell); cell = new PdfPCell(new Phrase(fecha)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); cell = new PdfPCell(new Phrase("EDIFICIO:(3)", FontFactory.getFont("arial", 11))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); cell = new PdfPCell(new Phrase(edificio)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); cell = new PdfPCell(new Phrase("AULA:(4)", FontFactory.getFont("arial", 11))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); cell = new PdfPCell(new Phrase(aula)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); tablas.add(tableH); } return tablas; }
From source file:PDF.Reportes.java
public static ArrayList<PdfPTable> firmasAspAula(String usuario, String contra, String horario, int opc) throws DocumentException { ArrayList<PdfPTable> tablas = new ArrayList(); // IngresoAbd bd = new IngresoAbd(usuario, contra); List<Beans.Reportes> reportes; PdfPTable table = new PdfPTable(2); reportes = ReportesDAO.AspPAula(usuario, contra, horario, opc); // reportes = bd.AspPAula(horario, opc); String carrera = "", fecha = ""; if (reportes.isEmpty()) { PdfPCell cell; cell = new PdfPCell( new Phrase("Lo sentimos, por el momento an no existe informacin para este reporte.")); cell.setColspan(5); table.addCell(cell);/*from w ww. j a va2 s . c o m*/ tablas.add(table); } else if (reportes.get(0).getCodError() != 0) { PdfPCell cell; if (reportes.get(0).getCodError() == -1) { cell = new PdfPCell(new Phrase(Constants.ERROR1)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -2) { cell = new PdfPCell(new Phrase(Constants.ERROR3)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -3) { cell = new PdfPCell(new Phrase(Constants.ERROR2)); cell.setColspan(5); table.addCell(cell); } tablas.add(table); } else { PdfPCell cell; table = new PdfPTable(6); BaseColor color = new BaseColor(217, 217, 217); BaseColor colorB = new BaseColor(0, 0, 0); cell = new PdfPCell(new Phrase("Ficha(5)", FontFactory.getFont("arial", 12, colorB))); cell.setMinimumHeight(10); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); cell = new PdfPCell(new Phrase("Folio Ceneval(6)", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); cell = new PdfPCell(new Phrase("Nombre(7)", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); // cell = new PdfPCell(new Phrase("Nombre carrera", FontFactory.getFont("arial", 12, colorB))); // cell.setHorizontalAlignment(Element.ALIGN_CENTER); // cell.setBackgroundColor(color); // cell.setBorderColor(colorB); // table.addCell(cell); cell = new PdfPCell(new Phrase("Asistencia(8)", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); cell.setColspan(2); table.addCell(cell); cell = new PdfPCell(new Phrase("Firma(9)", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); for (int i = 0; i < reportes.size(); i++) { cell = new PdfPCell(new Phrase(reportes.get(i).getFicha())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(reportes.get(i).getFolio())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(reportes.get(i).getNombre(), FontFactory.getFont("arial", 10))); cell.setHorizontalAlignment(Element.ALIGN_LEFT); table.addCell(cell); carrera = reportes.get(i).getNom_carrera(); // cell = new PdfPCell(new Phrase(reportes.get(i).getAsist())); table.addCell(cell); cell = new PdfPCell(new Phrase(reportes.get(i).getFirma())); table.addCell(cell); table.addCell(cell); fecha = reportes.get(i).getFecha(); if ((i % 34 == 0 || (i + 1) == reportes.size()) && i != 0) { table.setWidthPercentage(110); table.setWidths(new int[] { 25, 30, 90, 15, 15, 30 }); tablas.add(table); table = new PdfPTable(6); } } String datos[] = horario.split(" "); String edificio = datos[0]; String aula = ""; if (edificio.length() == 2) { edificio = datos[0].charAt(0) + ""; aula = datos[0].charAt(1) + ""; } if (edificio.length() == 4) { edificio = datos[0].charAt(0) + "" + datos[0].charAt(1); aula = "" + datos[0].charAt(3); } if (edificio.length() == 5) { edificio = datos[0].charAt(0) + "" + datos[0].charAt(1); aula = "" + datos[0].charAt(3) + datos[0].charAt(4); } PdfPTable tableH = new PdfPTable(7); tableH.setTotalWidth(500); cell.setMinimumHeight(20); cell = new PdfPCell(new Phrase("CARRERA:(1)", FontFactory.getFont("arial", 11))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(2); tableH.addCell(cell); cell = new PdfPCell(new Phrase(carrera)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(5); tableH.addCell(cell); cell = new PdfPCell(new Phrase("FECHA DE EXAMEN:(2)", FontFactory.getFont("arial", 11))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setColspan(2); tableH.addCell(cell); cell = new PdfPCell(new Phrase(fecha)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); cell = new PdfPCell(new Phrase("EDIFICIO:(3)", FontFactory.getFont("arial", 11))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); cell = new PdfPCell(new Phrase(edificio)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); cell = new PdfPCell(new Phrase("AULA:(4)", FontFactory.getFont("arial", 11))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); cell = new PdfPCell(new Phrase(aula)); cell.setHorizontalAlignment(Element.ALIGN_CENTER); tableH.addCell(cell); tablas.add(tableH); } return tablas; }
From source file:PDF.Reportes.java
public static PdfPTable noaltaCen(String usuario, String contra) throws DocumentException { PdfPTable table = new PdfPTable(5); // IngresoAbd bd = new IngresoAbd(usuario, contra); List<Beans.Reportes> reportes; reportes = ReportesDAO.noAltaCen(usuario, contra); // reportes = bd.noAltaCen(); if (reportes.isEmpty()) { PdfPCell cell; cell = new PdfPCell( new Phrase("Lo sentimos, por el momento an no existe informacin para este reporte.")); cell.setColspan(5); table.addCell(cell);/* w w w .j av a 2 s . c o m*/ } else if (reportes.get(0).getCodError() != 0) { PdfPCell cell; if (reportes.get(0).getCodError() == -1) { cell = new PdfPCell(new Phrase(Constants.ERROR1)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -2) { cell = new PdfPCell(new Phrase(Constants.ERROR3)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -3) { cell = new PdfPCell(new Phrase(Constants.ERROR2)); cell.setColspan(5); table.addCell(cell); } // cell = new PdfPCell(new Phrase(reportes.get(0).getMsjError())); } else { BaseColor color = new BaseColor(69, 161, 240); BaseColor colorB = new BaseColor(255, 255, 255); PdfPCell cell; cell = new PdfPCell(new Phrase("Preficha", FontFactory.getFont("arial", 12, colorB))); cell.setBackgroundColor(color); cell.setBorderColor(colorB); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Ref. Bancaria", FontFactory.getFont("arial", 12, colorB))); cell.setBackgroundColor(color); cell.setBorderColor(colorB); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Correo", FontFactory.getFont("arial", 12, colorB))); cell.setBackgroundColor(color); cell.setBorderColor(colorB); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("Usuario", FontFactory.getFont("arial", 12, colorB))); cell.setBackgroundColor(color); cell.setBorderColor(colorB); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase("ltima Act.", FontFactory.getFont("arial", 12, colorB))); cell.setBackgroundColor(color); cell.setBorderColor(colorB); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); for (Beans.Reportes reporte : reportes) { cell = new PdfPCell(new Phrase(reporte.getPreficha())); cell.setBorderColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase(reporte.getReferencia())); cell.setBorderColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase(reporte.getCorreo())); cell.setBorderColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase(reporte.getUsuario())); cell.setBorderColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase(reporte.getUl_act().substring(0, 10))); cell.setBorderColor(color); table.addCell(cell); } table.setWidthPercentage(110); table.setWidths(new int[] { 50, 55, 100, 56, 56 }); } return table; }
From source file:PDF.Reportes.java
public static PdfPTable procesoCon(String usuario, String contra) throws DocumentException { // IngresoAbd bd = new IngresoAbd(usuario, contra); List<Beans.Reportes> reportes; reportes = ReportesDAO.procesoCon(usuario, contra); // reportes = bd.procesoCon(); PdfPTable table = new PdfPTable(2); if (reportes.isEmpty()) { PdfPCell cell; cell = new PdfPCell( new Phrase("Lo sentimos, por el momento an no existe informacin para este reporte.")); cell.setColspan(5); table.addCell(cell);/*w w w . java2 s . c o m*/ } else if (reportes.get(0).getCodError() != 0) { PdfPCell cell; if (reportes.get(0).getCodError() == -1) { cell = new PdfPCell(new Phrase(Constants.ERROR1)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -2) { cell = new PdfPCell(new Phrase(Constants.ERROR3)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -3) { cell = new PdfPCell(new Phrase(Constants.ERROR2)); cell.setColspan(5); table.addCell(cell); } // cell = new PdfPCell(new Phrase(reportes.get(0).getMsjError())); } else { BaseColor color = new BaseColor(69, 161, 240); BaseColor colorB = new BaseColor(255, 255, 255); PdfPCell cell; cell = new PdfPCell(new Phrase("Carrera", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderColor(colorB); cell.setBackgroundColor(color); table.addCell(cell); cell = new PdfPCell( new Phrase("No. de pre procesos concluidos", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderColor(colorB); cell.setBackgroundColor(color); table.addCell(cell); int total = 0; for (Beans.Reportes reporte : reportes) { cell = new PdfPCell(new Phrase(reporte.getNombre(), FontFactory.getFont("arial", 8))); cell.setBorderColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase(reporte.getPreproc())); cell.setBorderColor(color); cell.setHorizontalAlignment(Element.ALIGN_CENTER); total = total + Integer.parseInt(reporte.getPreproc()); table.addCell(cell); } cell = new PdfPCell(new Phrase("Total", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderColor(colorB); cell.setBackgroundColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase(Integer.toString(total), FontFactory.getFont("arial", 12))); cell.setBorderColor(color); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); table.setWidthPercentage(110); } return table; }
From source file:PDF.Reportes.java
public static PdfPTable statusfichas(String usuario, String contra) throws DocumentException { // IngresoAbd bd = new IngresoAbd(usuario, contra); List<Beans.Reportes> reportes; reportes = ReportesDAO.statusFichas(usuario, contra); // reportes = bd.statusFichas(); PdfPTable table = new PdfPTable(4); if (reportes.isEmpty()) { PdfPCell cell; cell = new PdfPCell( new Phrase("Lo sentimos, por el momento an no existe informacin para este reporte.")); cell.setColspan(5); table.addCell(cell);//from w w w. j a v a 2s.co m } else if (reportes.get(0).getCodError() != 0) { PdfPCell cell; if (reportes.get(0).getCodError() == -1) { cell = new PdfPCell(new Phrase(Constants.ERROR1)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -2) { cell = new PdfPCell(new Phrase(Constants.ERROR3)); cell.setColspan(5); table.addCell(cell); } if (reportes.get(0).getCodError() == -3) { cell = new PdfPCell(new Phrase(Constants.ERROR2)); cell.setColspan(5); table.addCell(cell); } // cell = new PdfPCell(new Phrase(reportes.get(0).getMsjError())); } else { BaseColor color = new BaseColor(69, 161, 240); BaseColor colorB = new BaseColor(255, 255, 255); PdfPCell cell; cell = new PdfPCell(new Phrase("Carrera", FontFactory.getFont("arial", 12, colorB))); cell.setBorderColor(colorB); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase("Prefichas", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); cell = new PdfPCell(new Phrase("Prefichas pagadas", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); cell = new PdfPCell(new Phrase("Pre proceso concluido", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); int totalP = 0; int totalPp = 0; int totalPr = 0; for (Beans.Reportes reporte : reportes) { cell = new PdfPCell(new Phrase(reporte.getNombre(), FontFactory.getFont("arial", 8))); cell.setBorderColor(color); cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(reporte.getPreficha())); cell.setBorderColor(color); totalP = Integer.parseInt(reporte.getPreficha()) + totalP; cell.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell); cell = new PdfPCell(new Phrase(reporte.getPrefpagadas())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderColor(color); totalPp = Integer.parseInt(reporte.getPrefpagadas()) + totalPp; table.addCell(cell); cell = new PdfPCell(new Phrase(reporte.getPreproc())); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderColor(color); totalPr = Integer.parseInt(reporte.getPreproc()) + totalPr; table.addCell(cell); } cell = new PdfPCell(new Phrase("Totales", FontFactory.getFont("arial", 12, colorB))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBackgroundColor(color); cell.setBorderColor(colorB); table.addCell(cell); cell = new PdfPCell(new Phrase(Integer.toString(totalP), FontFactory.getFont("arial", 12))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase(Integer.toString(totalPp), FontFactory.getFont("arial", 12))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderColor(color); table.addCell(cell); cell = new PdfPCell(new Phrase(Integer.toString(totalPr), FontFactory.getFont("arial", 12))); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setBorderColor(color); table.addCell(cell); table.setWidthPercentage(110); table.setWidths(new int[] { 50, 50, 100, 100 }); } return table; }
From source file:PDF.Reporte_Final.java
private PdfPTable tablaEvaluador_profe() throws Exception { PdfPTable tabla_evaluador = new PdfPTable(5); tabla_evaluador.setWidths(new int[] { 2, 2, 3, 2, 3 }); int anio = 0, anio_fin = 0; PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Tabla de evaluadores con los " + "profesores asignados", encabezadost)); PdfPCell evaluador = new PdfPCell(new Phrase("Nmero de empleado de evaluador")); PdfPCell profesor = new PdfPCell(new Phrase("Nmero de empleado de profesor")); PdfPCell Ruta_alm = new PdfPCell(new Phrase("Puntaje total asignado")); PdfPCell Puntos = new PdfPCell(new Phrase("Fecha de evaluacin")); PdfPCell Observaciones = new PdfPCell(new Phrase("Periodo Correspondiente")); //PdfPCell celda=new PdfPCell(); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); tabla_evaluador.addCell(Titulo_tabla); evaluador.setHorizontalAlignment(Element.ALIGN_CENTER); evaluador.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(evaluador);/*from www. j av a 2 s .c o m*/ profesor.setHorizontalAlignment(Element.ALIGN_CENTER); profesor.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(profesor); Ruta_alm.setHorizontalAlignment(Element.ALIGN_CENTER); Ruta_alm.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(Ruta_alm); Puntos.setHorizontalAlignment(Element.ALIGN_CENTER); Puntos.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(Puntos); Observaciones.setHorizontalAlignment(Element.ALIGN_CENTER); Observaciones.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_evaluador.addCell(Observaciones); /*Aqui van las consultas de las Actividades del profesor*/ ResultSet rb = lb.executeQuery("SELECT * FROM evaluador_evalua_profesor"); while (rb.next()) { tabla_evaluador.addCell(rb.getString("id_usuario_ev")); tabla_evaluador.addCell(rb.getString("id_usuario_prof"));//Add the type of every type pub tabla_evaluador.addCell(rb.getString("puntaje_final")); tabla_evaluador.addCell(rb.getString("fecha_ev")); if (rb.getInt("periodo") == 1) { anio = 2017; anio_fin = 2018; } else if (rb.getInt("periodo") == 2) { anio = 2018; anio_fin = 2019; } else if (rb.getInt("periodo") == 3) { anio = 2019; anio_fin = 2020; } else if (rb.getInt("periodo") == 4) { anio = 2020; anio_fin = 2021; } tabla_evaluador.addCell(anio + " - " + anio_fin); } return tabla_evaluador; }
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_num_prof() throws Exception { PdfPTable tabla_num = new PdfPTable(2); tabla_num.setWidths(new int[] { 2, 2 }); String periodo = ""; PdfPCell Titulo_tabla = new PdfPCell( new Phrase("Nmero total de evaluadores y profesores " + "participantes", encabezadost)); PdfPCell evaluador = new PdfPCell(new Phrase("Nmero de evaluadores")); PdfPCell profesor = new PdfPCell(new Phrase("Nmero de profesores")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); tabla_num.addCell(Titulo_tabla);//from w w w. java 2s .com evaluador.setHorizontalAlignment(Element.ALIGN_CENTER); evaluador.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(evaluador); profesor.setHorizontalAlignment(Element.ALIGN_CENTER); profesor.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(profesor); /*Aqui van las consultas de las Actividades del profesor*/ int i = 0; ResultSet re = lb.executeQuery("SELECT * FROM evaluador"), rp; String numberAsString;// = Integer.toString(number); while (re.next()) { i++; periodo = re.getString("periodo_actual"); } //System.out.println(i); numberAsString = Integer.toString(i); tabla_num.addCell(numberAsString); i = 0; rp = lb.executeQuery("SELECT * FROM profesor WHERE periodo = " + periodo); while (rp.next()) { i++; } //System.out.println(numberAsString); numberAsString = Integer.toString(i); tabla_num.addCell(numberAsString); return tabla_num; }
From source file:PDF.Reporte_Final.java
private PdfPTable tabla_evaluador() throws Exception { PdfPTable tabla_num = new PdfPTable(2); tabla_num.setWidths(new int[] { 2, 2 }); PdfPCell Titulo_tabla = new PdfPCell(new Phrase("Actividades aceptadas por evaluador", encabezadost)); PdfPCell evaluador = new PdfPCell(new Phrase("Nmero de empleado del evaluador")); PdfPCell actividades = new PdfPCell(new Phrase("Nmero de actividades aceptadas")); Titulo_tabla.setHorizontalAlignment(Element.ALIGN_CENTER); Titulo_tabla.setVerticalAlignment(Element.ALIGN_MIDDLE); Titulo_tabla.setBackgroundColor(new BaseColor(153, 0, 76)); Titulo_tabla.setColspan(5); Titulo_tabla.setExtraParagraphSpace(15f); tabla_num.addCell(Titulo_tabla);//from w w w .j ava 2s. c o m evaluador.setHorizontalAlignment(Element.ALIGN_CENTER); evaluador.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(evaluador); actividades.setHorizontalAlignment(Element.ALIGN_CENTER); actividades.setVerticalAlignment(Element.ALIGN_MIDDLE); tabla_num.addCell(actividades); /*Aqui van las consultas de las Actividades del profesor*/ int[] evaluador_num = new int[100]; int[][] profesor_num = new int[300][300]; String numberAsString, numberAsString2; int eva = 0, prof = 0, num_prof = 0, i = 0, n = 0, aux, suma_act = 0; ResultSet rs, ra; rs = lb.executeQuery("SELECT * FROM evaluador_evalua_profesor"); while (rs.next()) { if (i == 0) aux = 1; else aux = i; if (evaluador_num[aux - 1] != rs.getInt("id_usuario_ev")) { evaluador_num[i] = rs.getInt("id_usuario_ev"); i++; } else { System.out.println("Ya existe"); } } //We get evaluators for (int e = 0; e < i; e++) { aux = getAccepted_Activities(evaluador_num[e]); numberAsString = Integer.toString(evaluador_num[e]); tabla_num.addCell(numberAsString); numberAsString2 = Integer.toString(aux); tabla_num.addCell(numberAsString2); } return tabla_num; }