List of usage examples for com.itextpdf.text Font Font
public Font(final FontFamily family, final float size, final int style)
From source file:be.kcbj.placemat.Placemat.java
License:Open Source License
private Chunk generateFittedChunk(String text, int style) { float size = 9 - (text.length() - 10f) / 5f; return new Chunk(text, new Font(Font.FontFamily.HELVETICA, size, style)); }
From source file:be.thomasmore.service.CreatePDFServiceImp.java
@Override public void createPDF(List<Score> scores) { try {/*w w w. jav a 2s . co m*/ OutputStream file = new FileOutputStream(new File("D:\\Desktop\\Scores.pdf")); Document document = new Document(); PdfWriter.getInstance(document, file); document.open(); document.add(new Paragraph("Scores")); document.add(new Paragraph(new Date().toString())); document.addAuthor("Projectgroep 4"); document.addCreator("Projectgroep 4"); document.addTitle("ScoreTracker"); //Create Paragraph Paragraph paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD)); //New line paragraph.add(new Paragraph(" ")); paragraph.add("Scores"); paragraph.add(new Paragraph(" ")); document.add(paragraph); //Create a table in PDF PdfPTable pdftabel = new PdfPTable(4); PdfPCell cell1 = new PdfPCell(new Phrase("Student")); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); pdftabel.addCell(cell1); cell1 = new PdfPCell(new Phrase("Vak")); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); pdftabel.addCell(cell1); cell1 = new PdfPCell(new Phrase("Test")); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); pdftabel.addCell(cell1); cell1 = new PdfPCell(new Phrase("Score")); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); pdftabel.addCell(cell1); pdftabel.setHeaderRows(1); for (Score score : scores) { pdftabel.addCell(score.getStudent().getNaam()); pdftabel.addCell(score.getTest().getVak().getNaam()); pdftabel.addCell(score.getTest().getNaam()); int resultaat = score.getScore(); pdftabel.addCell(resultaat + " / " + score.getTest().getTotaal()); } document.add(pdftabel); document.addCreationDate(); document.close(); file.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:be.thomasmore.service.CreatePDFServiceImp.java
@Override public void createPDFVoorStudent(ArrayList<ArrayList<Score>> puntenlijst, List<Double> gemiddeldelijst, Double totaalGemiddelde) { try {/* w w w.ja v a 2 s. com*/ OutputStream file = new FileOutputStream(new File("D:\\Desktop\\Scores.pdf")); Document document = new Document(); PdfWriter.getInstance(document, file); document.open(); document.add(new Paragraph("Scores")); document.add(new Paragraph(puntenlijst.get(0).get(0).getStudent().getNaam())); document.add(new Paragraph(new Date().toString())); document.addAuthor("Projectgroep 4"); document.addCreator("Projectgroep 4"); document.addTitle("ScoreTracker"); //Create Paragraph Paragraph paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD)); //New line paragraph.add(new Paragraph(" ")); paragraph.add("Scores"); paragraph.add(new Paragraph(" ")); document.add(paragraph); for (int i = 0; i < puntenlijst.size(); i++) { //Create a table in PDF PdfPTable pdftabel = new PdfPTable(2); //vak invullen paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD)); paragraph.add(new Paragraph(puntenlijst.get(i).get(0).getTest().getVak().getNaam())); document.add(paragraph); PdfPCell cell1 = new PdfPCell(new Phrase("Test")); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); pdftabel.addCell(cell1); cell1 = new PdfPCell(new Phrase("Score")); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); pdftabel.addCell(cell1); pdftabel.setHeaderRows(1); for (Score score : puntenlijst.get(i)) { pdftabel.addCell(score.getTest().getNaam()); int resultaat = score.getScore(); pdftabel.addCell(resultaat + " / " + score.getTest().getTotaal()); } document.add(pdftabel); //gemmidelde per vak invoeren paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD)); paragraph.add(new Paragraph("Gemiddelde: " + gemiddeldelijst.get(i).toString())); document.add(paragraph); } paragraph = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD)); paragraph.add(new Paragraph("Algemeen gemiddelde: " + totaalGemiddelde)); document.add(paragraph); document.addCreationDate(); document.close(); file.close(); } catch (Exception e) { e.printStackTrace(); } }
From source file:br.com.tcc.view.BairroView.java
/** * Evento responsvel por fechar o sistema * @param evt /*from w w w .j a v a 2 s . co m*/ */ private void btnFecharActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFecharActionPerformed Document documento = new Document(); try { OutputStream outputStream = new FileOutputStream( "C:\\Users\\Leonardo P Souza\\Desktop\\Relat\\Registro Bairros.pdf"); PdfWriter.getInstance(documento, outputStream); documento.open(); Font fonte = new Font(Font.FontFamily.TIMES_ROMAN, 36, Font.BOLD); Paragraph paragrafo = new Paragraph("Relatrio da Bairro", fonte); paragrafo.setAlignment(Element.ALIGN_CENTER); documento.add(paragrafo); Paragraph paragrafoLista = new Paragraph(bairroList.toString()); documento.add(paragrafoLista); documento.close(); } catch (FileNotFoundException ex) { Logger.getLogger(MovimentoVendaView.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(MovimentoVendaView.class.getName()).log(Level.SEVERE, null, ex); } dispose(); }
From source file:br.com.tcc.view.FormaPagamentoView.java
private void btnImprimirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImprimirActionPerformed int row = tblRegistro.getSelectedRow(); int id = vendaRegistroList.get(row).getId(); Connection con = new ConnectionFactory().getConnection(); try {//from w w w.j av a2 s . c o m Statement stmt = con.createStatement(); ResultSet query = stmt.executeQuery( "SELECT produto.descricao, vendadetalhe.qtde, vendadetalhe.vlrUnitario, vendadetalhe.vlrTotal from vendadetalhe as vendadetalhe INNER JOIN produto as produto ON (vendadetalhe.idProduto = produto.ID) where idVendaRegistro = " + id); Document documento = new Document(); SimpleDateFormat horaformatada = new SimpleDateFormat("HH:mm:ss"); Date horaAtual = new Date(); hora = horaformatada.format(horaAtual); Date data = new Date(); // mes = ""+Data.getMonth();//0 a 11 dia = "" + data.getDate(); ano = "" + (1900 + data.getYear()); switch (data.getMonth()) { case 0: mes = "Janeiro"; break; case 1: mes = "Fevereiro"; break; case 2: mes = "Maro"; break; case 3: mes = "Abril"; break; case 4: mes = "Maio"; break; case 5: mes = "Junho"; break; case 6: mes = "Julho"; break; case 7: mes = "Agosto"; break; case 8: mes = "Setembro"; break; case 9: mes = "Outubro"; break; case 10: mes = "Novembro"; break; case 11: mes = "Dezembro"; break; } try { OutputStream outputStream = new FileOutputStream( "C:\\Users\\Leonardo P Souza\\Desktop\\Relat\\Registro da venda " + txtCodigo.getText() + ".pdf"); PdfWriter.getInstance(documento, outputStream); documento.open(); Font fonte = new Font(Font.FontFamily.TIMES_ROMAN, 36, Font.BOLD); Font fonteItem = new Font(Font.FontFamily.COURIER, 28, Font.BOLD); Paragraph cabecalho = new Paragraph("AGRO EMPRESARIAL - SISTEMA DE GERENCIAMENTO\n" + "RUA GONALVES CHAVES, 602 PELOTAS/RS\n" + "FONE:(53) 3232-3232 BAIRRO: CENTRO\n" + "CNPJ: 12.345.678/1011-12\n" + "-------------------------------------------\n" + dia + "/" + mes + "/" + ano + " " + hora + " COD: " + txtCodigo.getText()); cabecalho.setAlignment(Element.ALIGN_CENTER); documento.add(cabecalho); Paragraph paragrafo = new Paragraph("Relatrio da Venda", fonte); paragrafo.setAlignment(Element.ALIGN_CENTER); documento.add(paragrafo); Paragraph paragrafoCliente = new Paragraph("Cliente: " + cbxCliente.getSelectedItem().toString()); documento.add(paragrafoCliente); Paragraph paragrafoFuncionario = new Paragraph( "Funcionrio: " + cbxFuncionario.getSelectedItem().toString()); documento.add(paragrafoFuncionario); Paragraph paragrafoPagamento = new Paragraph( "Tipo de Pagamento: " + cbxTipoPagamento.getSelectedItem().toString()); documento.add(paragrafoPagamento); // Paragraph paragrafoParcela = new Paragraph("Parcelas: " + cbxParcelas.getSelectedItem().toString()); // documento.add(paragrafoParcela); // Paragraph paragrafoValor = new Paragraph("Valor R$: " + txtTotal.getText()); // documento.add(paragrafoValor); if (cbxTipoPagamento.getSelectedItem().toString().equals(" vista") || cbxTipoPagamento.getSelectedItem().toString().equals("C. Debito")) { Paragraph paragrafoValor = new Paragraph("Valor R$: " + txtCompra.getText()); documento.add(paragrafoValor); Paragraph paragrafoAVista = new Paragraph("Valor vista: " + txtTotal.getText()); documento.add(paragrafoAVista); } else { Paragraph paragrafoValor = new Paragraph("Valor R$: " + txtTotal.getText()); documento.add(paragrafoValor); int parcela = Integer.parseInt(cbxParcelas.getSelectedItem().toString()); double valorParcelas = Double.parseDouble(txtTotal.getText()); double total = valorParcelas / parcela; Paragraph paragrafoVezes = new Paragraph( cbxParcelas.getSelectedItem().toString() + " parcelas de R$: " + total); documento.add(paragrafoVezes); } Paragraph quebraLinha = new Paragraph("\n\n"); documento.add(quebraLinha); //we have two columns in our table PdfPTable LogTable = new PdfPTable(4); // Ttulo para a tabela Paragraph tableHeader = new Paragraph("Relatrio de Entrada de Estoque"); PdfPCell header = new PdfPCell(tableHeader); // Definindo que o header vai ocupar as 2 colunas header.setColspan(4); // Definindo alinhamento do header header.setHorizontalAlignment(Paragraph.ALIGN_CENTER); // Adicionando o header tabela Font fonte2 = new Font(Font.FontFamily.HELVETICA, 7, Font.BOLD, BaseColor.BLACK); Font fonteDados = new Font(Font.FontFamily.TIMES_ROMAN, 6, Font.NORMAL, BaseColor.BLACK); LogTable.addCell(header); LogTable.addCell(new Paragraph("Produto ", fonte2)); LogTable.addCell(new Paragraph("Quantidade", fonte2)); LogTable.addCell(new Paragraph("Valor Unitrio", fonte2)); LogTable.addCell(new Paragraph("Valor Total", fonte2)); //create a cell object // PdfPCell table_cell; while (query.next()) { String produto = query.getString("produto.descricao"); LogTable.addCell(new Paragraph(produto, fonteDados)); String quantidade = query.getString("qtde"); LogTable.addCell(new Paragraph(quantidade, fonteDados)); String vlrSugerido = query.getString("vlrUnitario"); LogTable.addCell(new Paragraph(vlrSugerido, fonteDados)); String vlrTotal = query.getString("vlrTotal"); LogTable.addCell(new Paragraph(vlrTotal, fonteDados)); } /* Attach report table to PDF */ documento.add(LogTable); // Paragraph paragrafoItemVenda = new Paragraph("Produtos da venda", fonteItem); // paragrafoItemVenda.setAlignment(Element.ALIGN_CENTER); // documento.add(paragrafoItemVenda); // Paragraph cabecalhoItemVenda = new Paragraph("Produto Qtde. Vlr Unit. Vlr Total"); // documento.add(cabecalhoItemVenda); // vendaDetalheQuery = entityManager.createQuery("from Vendadetalhe where idVendaRegistro=" + txtCodigo.getText()); // Paragraph paragrafoLista = new Paragraph(vendaDetalheQuery.getResultList().toString().substring(1, vendaDetalheQuery.getResultList().toString().length() - 1)); // documento.add(paragrafoLista); documento.close(); String file; file = "C:\\Users\\Leonardo P Souza\\Desktop\\Relat\\Registro da venda " + txtCodigo.getText() + ".pdf"; Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + file); } catch (FileNotFoundException ex) { Logger.getLogger(MovimentoVendaView.class.getName()).log(Level.SEVERE, null, ex); } catch (DocumentException ex) { Logger.getLogger(MovimentoVendaView.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(FormaPagamentoView.class.getName()).log(Level.SEVERE, null, ex); } } catch (SQLException ex) { Logger.getLogger(FormaPagamentoView.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:br.edu.unipampa.recipemanager.pdf.CreatePDF.java
public boolean newPdf(List<MenuRecipe> menuRecipe, String month, String responsibleName) { double valueMonth = 0; try {//from w w w. j a v a 2 s . c o m Document doc = new Document(PageSize.A4, 72, 72, 72, 72); OutputStream os = new FileOutputStream(namePdf(menuRecipe)); PdfWriter.getInstance(doc, os); doc.open(); Paragraph p; Font f = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD); p = new Paragraph("Ms: " + month, f); doc.add(p); f = new Font(Font.FontFamily.COURIER, 14, Font.ITALIC); for (MenuRecipe menu : menuRecipe) { valueMonth += menu.priceMenu(); p.setSpacingBefore(5); p.setSpacingAfter(5); p = new Paragraph(menu.toString(), f); doc.add(p); } p = new Paragraph("Preo total de todos os cardpios: " + valueMonth, f); doc.add(p); f = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD); p = new Paragraph("_____________________________________\n" + responsibleName, f); p.setSpacingAfter(15); p.setAlignment(Element.ALIGN_RIGHT); doc.add(p); doc.close(); os.close(); return true; } catch (Exception e) { return false; } }
From source file:br.unisc.video_locadora.controll.Generator_PDF.java
public void geraRelatorio() throws DocumentException, FileNotFoundException { // Cria um novo documento com tamanho e margens definidas pelo usurio // new Document(tamanho da pgina, margem esquerda, margem direita, // margem topo, margem rodap); Document doc = new Document(PageSize.A4, 10, 10, 10, 10); try {/* w ww. ja va 2 s . c o m*/ JFileChooser jFileChooser = new JFileChooser(); //seta para selecionar apenas arquivos jFileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); //desabilita todos os tipos de arquivos jFileChooser.setAcceptAllFileFilterUsed(false); //filtra por extensao jFileChooser.setFileFilter(new FileFilter() { @Override public String getDescription() { return "Extenso PDF"; } @Override public boolean accept(File f) { return f.getName().toLowerCase().endsWith("pdf"); } }); //mostra janela para salvar int acao = jFileChooser.showSaveDialog(null); //executa acao conforme opcao selecionada if (acao == JFileChooser.APPROVE_OPTION) { //escolheu arquivo System.out.println(jFileChooser.getSelectedFile().getAbsolutePath()); PdfWriter.getInstance(doc, new FileOutputStream(jFileChooser.getSelectedFile().getAbsolutePath() + ".pdf")); doc.open(); listaF = f.buscaFilme(""); // Definindo uma fonte, com tamanho 20 e negrito Font f = new Font(Font.FontFamily.COURIER, 30, Font.BOLD); Font f2 = new Font(Font.FontFamily.HELVETICA, 20, Font.BOLD); // adicionando um pargrafo ao documento com a fonte acima Paragraph pa = new Paragraph("Relatrio", f); // Setando o alinhamento p/ o centro pa.setAlignment(Paragraph.ALIGN_CENTER); // Definindo pa.setSpacingAfter(50); doc.add(pa); //doc.add(new Paragraph(" ")); // Criando uma tabela com 4 colunas PdfPTable table = new PdfPTable(7); // Ttulo para a tabela Paragraph tableHeader = new Paragraph("Todos os Ttulos", f2); PdfPCell header = new PdfPCell(tableHeader); // Definindo que o header vai ocupar as 4 colunas header.setColspan(7); // Definindo alinhamento do header header.setHorizontalAlignment(Paragraph.ALIGN_CENTER); // Adicionando o header tabela table.addCell(header); List<String> list = new ArrayList<>(); list.add("Id"); list.add("Ttulo"); list.add("Ano"); list.add("Diretor"); list.add("Gnero"); list.add("Linguagem"); list.add("Locado"); for (Filmes p : listaF) { list.add(String.valueOf(p.getId())); list.add(p.getTitulo()); list.add(String.valueOf(p.getAno())); list.add(p.getDiretor()); list.add(p.getGenero()); list.add(p.getIdioma()); list.add(p.getLocado()); } for (String s : list) { table.addCell(s); } doc.add(table); /* doc.add(new Paragraph(" ID | Nome | Idade | Cidade")); for (Pessoa p : lista) { doc.add(new Paragraph(p.getId() + " | " + p.getNome() + " | " + p.getIdade() + " | " + p.getCidade())); }*/ } } catch (FileNotFoundException | DocumentException e) { System.err.println(e.getMessage()); } doc.close(); }
From source file:cashiermode.PrintRecieptPdf.java
public static void printPdf() { Document transPdf = null;/*w w w.j a v a 2 s .co m*/ PdfWriter writer = null; // NumberFormat fmt = NumberFormat.getPercentInstance(); // DecimalFormat fmt1 = new DecimalFormat("0.0"); Font font1 = new Font(Font.FontFamily.HELVETICA, 3, Font.NORMAL); Font font2 = new Font(Font.FontFamily.TIMES_ROMAN, 7); Font font3 = new Font(Font.FontFamily.COURIER, 8, Font.NORMAL); Font font4 = new Font(Font.FontFamily.COURIER, 9, Font.BOLD); try { transPdf = new Document(); File file = new File("Report.pdf"); System.out.println("File crearted"); writer = PdfWriter.getInstance(transPdf, new FileOutputStream(file)); transPdf.open(); transPdf.setMargins(0, 5, 0, 2); } catch (FileNotFoundException | DocumentException ex) { } try { transPdf.add(new Paragraph( " TERM TWO ACCADEMIC REPORT FORM", font3)); transPdf.add(new Paragraph( "NAME : ADM NO: FORM ", font3)); transPdf.add( new Paragraph("FORM POS OUT OF CLASS POS OUT OF ", font3)); PdfPTable table = new PdfPTable(10); // 4 column table.setWidthPercentage(100); table.setSpacingBefore(10f); table.setSpacingAfter(10f); PdfPCell cell0 = new PdfPCell(new Paragraph("SUBJECT", font2)); PdfPCell cell1 = new PdfPCell(new Paragraph("CAT1", font2)); PdfPCell cell2 = new PdfPCell(new Paragraph("CAT2", font2)); PdfPCell cell3 = new PdfPCell(new Paragraph("EXAM", font2)); PdfPCell cell4 = new PdfPCell(new Paragraph("TOTAL", font2)); PdfPCell cell5 = new PdfPCell(new Paragraph("GRADE", font2)); PdfPCell cell6 = new PdfPCell(new Paragraph("PNTS", font2)); PdfPCell cell7 = new PdfPCell(new Paragraph("POS", font2)); PdfPCell cell8 = new PdfPCell(new Paragraph("RMK", font2)); PdfPCell cell9 = new PdfPCell(new Paragraph("SIGN", font2)); // cell2.setColspan(2); table.addCell(cell0); table.addCell(cell1); table.addCell(cell2); table.addCell(cell3); table.addCell(cell4); table.addCell(cell5); table.addCell(cell6); table.addCell(cell7); table.addCell(cell8); table.addCell(cell9); for (int i = 0; i < 11; i++) { // cell0 = new PdfPCell(new Paragraph(mysubs[i], font2)); cell1 = new PdfPCell(new Paragraph("", font2)); cell2 = new PdfPCell(new Paragraph("", font2)); cell3 = new PdfPCell(new Paragraph("", font2)); cell4 = new PdfPCell(new Paragraph("", font2)); cell5 = new PdfPCell(new Paragraph("", font2)); cell6 = new PdfPCell(new Paragraph("", font2)); cell7 = new PdfPCell(new Paragraph("", font2)); cell8 = new PdfPCell(new Paragraph("", font2)); cell9 = new PdfPCell(new Paragraph("", font2)); table.addCell(cell0); table.addCell(cell1); table.addCell(cell2); table.addCell(cell3); table.addCell(cell4); table.addCell(cell5); table.addCell(cell6); table.addCell(cell7); table.addCell(cell8); table.addCell(cell9); } transPdf.add(table); Paragraph p = new Paragraph( "Closing Date Next Term Begins On ", font3); p.setSpacingBefore(185f); transPdf.add(p); transPdf.add(new Paragraph( "Outstanding Fee Next Term Fee Total ", font3)); transPdf.add(new Paragraph( "Feedback Sign Date ", font3)); transPdf.add(new Paragraph(" Parent/Guardian", font3)); Paragraph lastp = new Paragraph("Closing date is on 27/14/2005", font3); lastp.setSpacingAfter(0f); transPdf.add(lastp); //transPdf.newPage(); } catch (DocumentException ex) { System.err.println("NOT YET.." + ex.getMessage()); } transPdf.close(); }
From source file:cimav.restrh.services.JustificacionREST.java
@GET @Path("pdficar") @Produces("application/pdf") public Response pdficar(@DefaultValue("0") @QueryParam("id") Integer id_param) { Justificacion justi = (Justificacion) JustificacionREST.this.find(id_param); String diasCorresponde = "corresponde a " + justi.getNumDiasPlazo() + " das"; if (justi.getNumDiasPlazo() == 1) { diasCorresponde = "corresponde a un da"; }//w w w. j a v a 2 s . c om // <editor-fold defaultstate="collapsed" desc="Constantes de texto"> HashMap<String, String> mapa = new HashMap(); mapa.put("texto1_I", "No existan bienes o servicios alternativos o sustitutos tcnicamente razonables, o bien, que en el " + "mercado slo existe un posible oferente, o se trate de una persona que posee la titularidad o el " + "licenciamiento exclusivo de patentes, derechos de autor, u otros derechos exclusivos, o por " + "tratarse de obras de arte."); mapa.put("texto1_III", "Existan circunstancias que puedan provocar prdidas o costos adicionales importantes, " + "cuantificados y justificados."); mapa.put("texto1_XIV", "Se trate de los servicios prestados por una persona fsica a que se refiere la fraccin " + "VII del artculo 3 de esta Ley, siempre que stos sean realizados por ella misma sin " + "requerir de la utilizacin de ms de un especialista o tcnico."); mapa.put("texto1_XV", "Se trate de servicios de mantenimiento de bienes en los que no sea posible precisar " + "su alcance, establecer las cantidades de trabajo o determinar las especificaciones " + "correspondientes."); mapa.put("texto1_XVII", "Se trate de equipos especializados, sustancias y materiales de origen qumico, fsico " + "qumico o bioqumico para ser utilizadas en actividades experimentales requeridas " + "en proyectos de investigacin cientfica y desarrollo tecnolgico, siempre que dichos " + "proyectos se encuentren autorizados por quien determine el titular de la dependencia " + "o el rgano de gobierno de la entidad."); mapa.put("plazo_0", "El plazo en que se requiere el suministro de los " + justi.getBienServicioTxt() + ", corresponde al periodo del " + justi.getFechaInicio().getDayOfMonth() + " de " + justi.getFechaInicio().getMonth().getDisplayName(TextStyle.FULL, new Locale("es", "ES")) + " de " + justi.getFechaInicio().getYear() + " y hasta el " + justi.getFechaTermino().getDayOfMonth() + " de " + justi.getFechaTermino().getMonth().getDisplayName(TextStyle.FULL, new Locale("es", "ES")) + " de " + justi.getFechaTermino().getYear() + ". Las condiciones en las que se " + "entregarn los " + justi.getBienServicioTxt() + " son las siguientes:\n\n " + justi.getCondicionesPago()); mapa.put("plazo_1", "La fecha en que se requiere el suministro de los " + justi.getBienServicioTxt() + ", corresponde al da " + justi.getFechaTermino().getDayOfMonth() + " de " + justi.getFechaTermino().getMonth().getDisplayName(TextStyle.FULL, new Locale("es", "ES")) + " de " + justi.getFechaTermino().getYear() + ". Las condiciones en las que se " + "entregarn los " + justi.getBienServicioTxt() + " son las siguientes:\n\n " + justi.getCondicionesPago()); mapa.put("plazo_2", "El plazo en que se requiere el suministro de los " + justi.getBienServicioTxt() + ", " + diasCorresponde + " despus de la elaboracin de este documento." + " Las condiciones en las que se " + "entregarn los " + justi.getBienServicioTxt() + " son las siguientes:\n\n " + justi.getCondicionesPago()); mapa.put("nota_1", "Asimismo se hace constar mediante el sello y firma del responsable del rea de " + "Almacn, la No Existencia de Bienes o Nivel de Inventario que demuestra que se " + "cumpli con lo establecido en el artculo 27 del RLAASP."); mapa.put("transparencia_unico", "Para la integracin del procedimiento de contratacin por adjudicacin directa, los servidores " + "pblicos de las reas requirentes han tenido acceso de manera oportuna, clara y completa de " + "las caractersticas requeridas de los " + justi.getBienServicioTxt() + " con el fin de demostrar que es " + "el nico proveedor que proporciona los " + justi.getBienServicioTxt() + " que se pretenden contratar, en " + "el entendido que para garantizar la transparencia del procedimiento de contratacin, la " + "informacin respectiva ser incorporada al Sistema de Compras Gubernamentales " + "(CompraNet), en los trminos de las disposiciones legales aplicables, " + "Lo anterior de acuerdo con lo establecido en el numeral 4.2.4 (ADJUDICACIN DIRECTA) y " + "numeral 4.2.4.1.1 (Verificar Acreditamiento de Excepcin) del Acuerdo por el que se modifica el " + "Manual Administrativo de Aplicacin General en Materia de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico, publicado en el Diario Oficial de la Federacin el 21 de noviembre " + "de 2012."); mapa.put("transparencia_no_unico", "Todas las personas que han presentado cotizacin para la integracin del procedimiento de " + "contratacin por adjudicacin directa, han tenido acceso de manera oportuna, clara y completa " + "de las caractersticas requeridas de los " + justi.getBienServicioTxt() + ", en el entendido que para " + "garantizar la transparencia del procedimiento de contratacin, la informacin respectiva ser " + "incorporada al Sistema de Compras Gubernamentales (CompraNet), en los trminos de las " + "disposiciones legales aplicables. " + "Lo anterior de acuerdo con lo establecido en el numeral 4.2.4 (ADJUDICACIN DIRECTA) y " + "numeral 4.2.4.1.1 (Verificar Acreditamiento de Excepcin) del Acuerdo por el que se modifica el " + "Manual Administrativo de Aplicacin General en Materia de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico, publicado en el Diario Oficial de la Federacin el 21 de noviembre " + "de 2012."); // </editor-fold> StreamingOutput streamingOutput = new StreamingOutput() { public void write(OutputStream outputStream) throws IOException, WebApplicationException { try { String masIva = ""; if (justi.getIva() != 0) { masIva = " ms IVA"; } String datosBanco = ""; if (justi.getDatosBanco() != null) { datosBanco = ", datos bancarios: " + justi.getDatosBanco(); } //Create Document instance. Document document = new Document(); PdfWriter.getInstance(document, outputStream); document.addAuthor("Generador adquisiciones | " + justi.getEmpleado().getCuentaCimav()); String fileName1 = (justi.getRequisicion() + "-" + justi.getEmpleado().getCuentaCimav()) .replace(" ", "").replace(",", ""); document.addTitle("Justificacin: " + fileName1); document.addSubject("Justificacin de Requisicin"); document.open(); Paragraph parrafo = new Paragraph("Centro de Investigacin en Materiales Avanzados S. C.", new Font(Font.FontFamily.TIMES_ROMAN, 17, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); document.add(parrafo); parrafo = new Paragraph( "JUSTIFICACIN PARA ACREDITAR Y FUNDAR PROCEDIMIENTOS DE " + "CONTRATACIN POR ADJUDICACIN DIRECTA, COMO EXCEPCIN AL DE " + "LICITACIN PBLICA EN EL SUPUESTO DEL ARTICULO 41 FRACCION " + justi.getRomano() + " DE LA " + "LEY DE ADQUISICIONES, ARRENDAMIENTOS Y SERVICIOS DEL SECTOR " + "PBLICO.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); parrafo = new Paragraph("COMIT DE ADQUISICIONES, ARRENDAMIENTOS Y SERVICIOS"); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setSpacingBefore(20); parrafo.setIndentationLeft(80); parrafo.setIndentationRight(80); document.add(parrafo); parrafo = new Paragraph("P R E S E N T E:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setIndentationLeft(30); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph("Oficio nmero: ", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setIndentationLeft(300); parrafo.setAlignment(Element.ALIGN_JUSTIFIED_ALL); parrafo.setLeading(15); parrafo.setSpacingBefore(20); Chunk frase = new Chunk(justi.getRequisicion() + "\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk( "Asunto: Se emite justificacin por la que se " + "acredita y funda la contratacin por adjudicacin directa que se indica.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk( "En cumplimiento a lo establecido en el segundo prrafo del artculo 40 de la Ley de " + "Adquisiciones, Arrendamientos y Servicios del Sector Pblico, as como en el artculo 71 del " + "Reglamento de la Ley de Adquisiciones, Arrendamientos y Servicios del Sector Pblico, y con el " + "carcter de Titular del ?rea Requirente, por este conducto hago constar el acreditamiento del o " + "de los criterios, razones, fundamentos y motivos para no llevar a cabo el procedimiento de " + "licitacin pblica y celebrar la contratacin a travs del procedimiento de adjudicacin directa en " + "los trminos establecidos en el artculo 41 Fraccin " + justi.getRomano() + " de la Ley de Adquisiciones, " + "Arrendamientos y Servicios del Sector Pblico", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.add(frase); /* frase = new Chunk("Las dependencias y " + "entidades, bajo su responsabilidad, podrn contratar adquisiciones, arrendamientos y " + "servicios, sin sujetarse al procedimiento de licitacin pblica, a travs de los " + "procedimientos de invitacin a cuando menos tres personas o de adjudicacin directa, " + "cuando:\n" + mapa.get("texto1_" + justi.getRomano()), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.add(frase); */ document.add(parrafo); parrafo = new Paragraph("Para tal efecto presento la siguiente informacin:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(60); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); parrafo = new Paragraph("I.- DESCRIPCIN DE LOS " + justi.getBienServicioTxt().toUpperCase(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setSpacingAfter(10); document.add(parrafo); parrafo = new Paragraph( "El/Los " + justi.getBienServicioTxt() + " que se pretende contratar, son los siguientes:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setIndentationLeft(30); document.add(parrafo); parrafo = new Paragraph(justi.getDescripcion(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setSpacingBefore(20); parrafo.setLeading(15); parrafo.setIndentationLeft(30); document.add(parrafo); parrafo = new Paragraph( "II.- PLAZOS Y CONDICIONES DEL SUMINISTRO DE LOS " + justi.getBienServicioTxt().toUpperCase(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph(mapa.get("plazo_" + justi.getPlazo()), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setSpacingBefore(20); parrafo.setLeading(15); parrafo.setIndentationLeft(30); document.add(parrafo); parrafo = new Paragraph("III.- RESULTADO DE LA INVESTIGACIN DE MERCADO", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph( "La Investigacin de Mercado fue realizada en los trminos de los artculos 28, 29 y 30 del " + "Reglamento de la Ley de Adquisiciones, Arrendamientos y Servicios del Sector Pblico, en " + "forma conjunta por el ?rea Requirente y el ?rea Contratante, en la cual se verific previo al " + "inicio del procedimiento de contratacin, la existencia de oferta, en la cantidad, calidad y " + "oportunidad requeridas; la existencia de proveedores a nivel nacional o internacional con " + "posibilidad de cumplir con las necesidades de la contratacin, conocer el precio prevaleciente al " + "momento de llevar a cabo la Investigacin de mercado as como en la informacin disponible " + "en el Sistema informtico denominado COMPRANET:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setSpacingBefore(20); parrafo.setSpacingAfter(20); parrafo.setLeading(15); parrafo.setIndentationLeft(30); document.add(parrafo); PdfPTable table = new PdfPTable(2); // 3 columns. table.setWidths(new int[] { 100, 50 }); if (justi.getEsUnico()) { PdfPCell cell1 = new PdfPCell( new Paragraph("PROVEEDOR", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); PdfPCell cell2 = new PdfPCell(new Paragraph("IMPORTE SIN IVA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell1.setBorder(PdfPCell.NO_BORDER); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell1); table.addCell(cell2); cell1 = new PdfPCell(new Paragraph(justi.getProveedorUno().toUpperCase(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2 = new PdfPCell(new Paragraph(montoFormatComas(justi.getMontoUno(), justi), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell1.setBorder(PdfPCell.NO_BORDER); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell1); table.addCell(cell2); document.add(table); /* Si es nico, no lleva motivo de seleccin parrafo = new Paragraph(justi.getMotivoSeleccion().toUpperCase(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setSpacingBefore(20); parrafo.setLeading(15); parrafo.setIndentationLeft(30); document.add(parrafo); */ parrafo = new Paragraph( "Concluyendo que en conjunto es la nica oferta en cuanto a obtener las mejores condiciones, calidad, " + "precio, oportunidad y financiamiento, por ser el nico proveedor que proporcione los " + justi.getBienServicioTxt() + " que se pretende contratar la de " + justi.getProveedorUno().toUpperCase() + ". La referida " + "Investigacin de Mercado se acompaa a la presente justificacin para determinar que el " + "procedimiento de contratacin por adjudicacin directa es el idneo.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setSpacingBefore(20); parrafo.setLeading(15); parrafo.setIndentationLeft(30); document.add(parrafo); } else { PdfPCell cell1 = new PdfPCell( new Paragraph("PROVEEDOR", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); PdfPCell cell2 = new PdfPCell(new Paragraph("IMPORTE SIN IVA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell1.setBorder(PdfPCell.NO_BORDER); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell1); table.addCell(cell2); cell1 = new PdfPCell(new Paragraph(justi.getProveedorUno().toUpperCase(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell2 = new PdfPCell(new Paragraph(montoFormatComas(justi.getMontoUno(), justi), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell1.setBorder(PdfPCell.NO_BORDER); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell1); table.addCell(cell2); cell1 = new PdfPCell(new Paragraph(justi.getProveedorDos().toUpperCase(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2 = new PdfPCell(new Paragraph(montoFormatComas(justi.getMontoDos(), justi), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell1.setBorder(PdfPCell.NO_BORDER); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell1); table.addCell(cell2); if (justi.getProveedorTres() != null && justi.getProveedorTres().trim().length() > 0) { cell1 = new PdfPCell(new Paragraph(justi.getProveedorTres().toUpperCase(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2 = new PdfPCell(new Paragraph(montoFormatComas(justi.getMontoTres(), justi), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); cell1.setBorder(PdfPCell.NO_BORDER); cell2.setBorder(PdfPCell.NO_BORDER); table.addCell(cell1); table.addCell(cell2); } document.add(table); parrafo = new Paragraph("Motivo de la seleccin: " + justi.getMotivoSeleccion(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setIndentationLeft(30); document.add(parrafo); parrafo = new Paragraph( "Siendo la oferta que en conjunto presenta las mejores condiciones en cuanto a calidad, precio, oportunidad " + "y financiamiento, la de " + justi.getProveedorUno().toUpperCase() + ". " + "La referida Investigacin de Mercado se acompaa a la presente justificacin para determinar " + "que el procedimiento de contratacin por adjudicacin directa es el idneo.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingBefore(20); parrafo.setLeading(15); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setIndentationLeft(30); document.add(parrafo); } parrafo = new Paragraph("IV.- PROCEDIMIENTO DE CONTRATACIN PROPUESTO", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk( "El procedimiento de contratacin propuesto es el de adjudicacin directa, en virtud de que en el " + "presente caso la adjudicacin se llevara a cabo conforme la fraccin " + justi.getRomano() + " del artculo 41 el cual " + "menciona que este tipo de adjudicacin se puede llevar a cabo siempre y cuando: \n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.add(frase); frase = new Chunk(mapa.get("texto1_" + justi.getRomano()), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.add(frase); frase = new Chunk(" Actualizndose el supuesto de excepcin a la licitacin pblica " + "establecido en la fraccin " + justi.getRomano() + " del artculo 41 de la Ley de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico, en relacin con lo establecido en el artculo 72 de su Reglamento.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.add(frase); document.add(parrafo); parrafo = new Paragraph("IV.1. MOTIVACIN Y FUNDAMENTACIN LEGAL:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setSpacingBefore(20); parrafo.setIndentationLeft(30); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(60); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk("A)", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk(" MOTIVOS: ", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk("La contratacin de los " + justi.getBienServicioTxt() + " objeto de la presente justificacin " + "es necesaria para satisfacer los requerimientos del proyecto identificado por: " + justi.getProyecto() + ". " + justi.getRazonCompra() + "." + " \nPor lo anterior, la " + "contratacin propuesta se adeca al supuesto de excepcin establecido en la Ley " + "de Adquisiciones, Arrendamientos y Servicios del Sector Pblico en su artculo 41, " + "fraccin " + justi.getRomano() + "; adems de que se renen los requisitos previstos en el artculo 72 del " + "Reglamento de la Ley de Adquisiciones, Arrendamientos y Servicios del Sector " + "Pblico, tal y como se desprende de la informacin presentada en esta justificacin, " + "as como de la Investigacin de Mercado; " + "por lo que resulta procedente la contratacin bajo el procedimiento de adjudicacin " + "directa previsto en el artculo 26, fraccin III de la Ley antes mencionada.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(60); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk("B)", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk(" FUNDAMENTOS: ", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk("La contratacin se encuentra debidamente fundada en el artculo " + "134 de la Constitucin Poltica de los Estados Unidos Mexicanos; en los artculos 26 " + "fraccin III, 40 y 41 fraccin " + justi.getRomano() + " de la Ley de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico; as como en los artculos 71 y 72 del Reglamento de la " + "Ley de Adquisiciones, Arrendamientos y Servicios del Sector Pblico.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); parrafo = new Paragraph("V.- MONTO ESTIMADO Y FORMA DE PAGO PROPUESTO:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph("V.1. MONTO ESTIMADO:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setSpacingBefore(20); parrafo.setIndentationLeft(30); document.add(parrafo); DecimalFormat decimalFormat = new DecimalFormat("0.00"); parrafo = new Paragraph("El monto estimado de la contratacin es la cantidad de " + montoFormatComas(justi.getSubTotal(), justi) + " (" + new Numero_a_Letra().Convertir(decimalFormat.format(justi.getSubTotal()), true) + " " + /*codigoDivisa(justi)*/ justi.getMoneda().getCode() + ")" + masIva + ", mismo que " + "result el ms conveniente de acuerdo con la Investigacin de Mercado" + ", mediante la cual se verific previo al inicio del procedimiento " + "de contratacin, la existencia de oferta de los " + justi.getBienServicioTxt() + " en la cantidad, " + "calidad y oportunidad requeridos en los trminos del artculo 28 del Reglamento de la Ley de " + "Adquisiciones, Arrendamientos y Servicios del Sector Pblico.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); table = new PdfPTable(3); // 3 columns. table.setWidths(new int[] { 30, 10, 10 }); PdfPCell cell1 = new PdfPCell( new Paragraph("Subtotal:", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); PdfPCell cell2 = new PdfPCell(new Paragraph(montoFormatComas(justi.getSubTotal(), justi), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); PdfPCell cell0 = new PdfPCell( new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0.setBorder(PdfPCell.NO_BORDER); table.addCell(cell0); cell1.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(Element.ALIGN_RIGHT); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell1); table.addCell(cell2); cell1 = new PdfPCell( new Paragraph("Iva:", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2 = new PdfPCell(new Paragraph(montoFormatComas(justi.getIva(), justi), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0 = new PdfPCell(new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0.setBorder(PdfPCell.NO_BORDER); table.addCell(cell0); cell1.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(Element.ALIGN_RIGHT); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell1); table.addCell(cell2); cell1 = new PdfPCell( new Paragraph("Total:", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell2 = new PdfPCell(new Paragraph(montoFormatComas(justi.getImporte(), justi), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell0 = new PdfPCell(new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0.setBorder(PdfPCell.NO_BORDER); table.addCell(cell0); cell1.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(Element.ALIGN_RIGHT); cell2.setBorder(PdfPCell.NO_BORDER); cell2.setHorizontalAlignment(Element.ALIGN_RIGHT); table.addCell(cell1); table.addCell(cell2); document.add(table); parrafo = new Paragraph("V.1. FORMA DE PAGO PROPUESTA:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setSpacingBefore(20); parrafo.setIndentationLeft(30); document.add(parrafo); parrafo = new Paragraph("El monto total ser pagado en " + justi.getNumPagos() + " pago/s de " + montoFormatComas(justi.getSubTotal() / justi.getNumPagos(), justi) + " (" + new Numero_a_Letra().Convertir( decimalFormat.format(justi.getSubTotal() / (justi.getNumPagos())).toString(), true) + " " + /*codigoDivisa(justi)*/ justi.getMoneda().getCode() + ")" + masIva + ". Los pagos se realizarn previa verificacin de la entrega y calidad de los " + justi.getBienServicioTxt() + " as como previo envo en formatos .pdf y .xml del Comprobante Fiscal " + "Digital por Internet (CFDI) correspondiente que rena los requisitos fiscales respectivos. Los " + "pagos se efectuarn mediante " + justi.getFormaPago(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); parrafo = new Paragraph("VI.- PERSONA PROPUESTA PARA LA ADJUDICACIN DIRECTA:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph( "Por lo anteriormente expuesto y fundado, se propone a " + justi.getProveedorUno().toUpperCase() + ", con domicilio ubicado en " + justi.getDomicilio() + ", Registro Federal de Contribuyentes: " + justi.getRfc() + ", correo electrnico: " + justi.getCorreo() + " y nmero telefnico " + justi.getTelefono() + datosBanco, new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); parrafo = new Paragraph( "VII.- ACREDITAMIENTO DEL O LOS CRITERIOS EN LOS QUE SE FUNDA Y MOTIVA LA " + "SELECCIN DEL PROCEDIMIENTO DE EXCEPCIN A LA LICITACIN PBLICA:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setLeading(15); parrafo.setIndentationLeft(30); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph( "El procedimiento de contratacin por adjudicacin directa es el idneo, al actualizarse el " + "supuesto de excepcin al procedimiento de licitacin pblica previsto en el artculo 41, fraccin " + justi.getRomano() + " de la Ley de Adquisiciones, Arrendamientos y Servicios del Sector Pblico, aunado a que se " + "corrobor la capacidad y experiencia de la persona propuesta, quien por ser proveedor nico " + "present las mejores condiciones en cuanto a precio, calidad, financiamiento, oportunidad y " + "dems circunstancias pertinentes a efecto de asegurar a esta Entidad las mejores condiciones " + "para su contratacin, tal y como se acredita con la informacin presentada en esta justificacin, " + "as como con la Investigacin de Mercado.\n\n" + "El acreditamiento del o los criterios en los que se funda la excepcin de licitacin pblica, son " + "los siguientes:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk(" - Economa\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk( "Con la Investigacin de Mercado se establecieron precios y dems condiciones de calidad, " + "financiamiento y oportunidad, respecto de los " + justi.getBienServicioTxt() + " requeridos, con lo cual " + "se asegura cumplir con los principios del artculo 134 de la Constitucin Poltica de los Estados " + "Unidos Mexicanos y de la Ley de Adquisiciones, Arrendamientos y Servicios del Sector Pblico, " + "en cuanto a precio, calidad, financiamiento, oportunidad y dems circunstancias pertinentes, por " + "lo que el procedimiento de adjudicacin directa permite en contraposicin al procedimiento de " + "licitacin pblica, obtener con mayor oportunidad los " + justi.getBienServicioTxt() + " requeridos al " + "menor costo econmico para el CIMAV, S.C. segn lo detallado en la investigacin de mercado " + "que se realiz, generando ahorro de recursos por estar proponiendo la adjudicacin al " + "proveedor nico cuya propuesta se considera aceptable en cuanto a su solvencia. " + "Lo anterior de acuerdo con lo establecido en el numeral 4.2.4 (ADJUDICACIN DIRECTA) y " + "numeral 4.2.4.1.1 (Verificar Acreditamiento de Excepcin) del Acuerdo por el que se modifica el " + "Manual Administrativo de Aplicacin General en Materia de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico, publicado en el Diario Oficial de la Federacin el 21 de noviembre " + "de 2012.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk(" - Eficacia\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk( "Con el procedimiento de contratacin por adjudicacin directa, se lograr obtener con " + "oportunidad los " + justi.getBienServicioTxt() + " atendiendo a las caractersticas requeridas en " + "contraposicin con el procedimiento de licitacin pblica, dado que se reducen tiempos y se " + "generan economas; aunado a que la persona propuesta cuenta con experiencia y capacidad " + "para satisfacer las necesidades requeridas, adems de que es el nico que ofrece las mejores " + "condiciones disponibles en cuanto a precio, calidad y oportunidad, con lo que se lograra el " + "cumplimiento de los objetivos y resultados deseados en el tiempo requerido, situacin que se " + "puede demostrar en base a la investigacin de mercado. " + "Lo anterior de acuerdo con lo establecido en el numeral 4.2.4 (ADJUDICACIN DIRECTA) y " + "numeral 4.2.4.1.1 (Verificar Acreditamiento de Excepcin) del Acuerdo por el que se modifica el " + "Manual Administrativo de Aplicacin General en Materia de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico, publicado en el Diario Oficial de la Federacin el 21 de noviembre " + "de 2012.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk(" - Eficiencia\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk( "Con el procedimiento de adjudicacin directa, a diferencia del procedimiento de licitacin " + "pblica, se logra el uso racional de recursos con los que cuenta la Entidad para realizar la " + "contratacin, obteniendo las mejores condiciones de precio, calidad y oportunidad, evitando la " + "prdida de tiempo y recursos al Estado, lo cual se demuestra con la investigacin de mercado " + "que se realiz, quedando evidencia de su resultado ya que los recursos disponibles con los que " + "cuenta el CIMAV se aplican conforme a los lineamientos de racionalidad y austeridad " + "presupuestaria. " + "Lo anterior de acuerdo con lo establecido en el numeral 4.2.4 (ADJUDICACIN DIRECTA) y " + "numeral 4.2.4.1.1 (Verificar Acreditamiento de Excepcin) del Acuerdo por el que se modifica el " + "Manual Administrativo de Aplicacin General en Materia de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico, publicado en el Diario Oficial de la Federacin el 21 de noviembre " + "de 2012.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk(" - Imparcialidad\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk( "El tipo de adjudicacin que se propone, se llev a cabo sin prejuicios ni situaciones que " + "pudieran afectar la imparcialidad, y sin que medie algn inters personal de los servidores " + "pblicos involucrados en la contratacin o de cualquier otra ndole que pudiera otorgar " + "condiciones ventajosas a alguna persona, en relacin con los dems ni limitar la libre " + "participacin, esto debido a que es proveedor nico, dicha situacin queda demostrada " + "conforme al resultado que se da con base a la investigacin de mercado. " + "Lo anterior de acuerdo con lo establecido en el numeral 4.2.4 (ADJUDICACIN DIRECTA) y " + "numeral 4.2.4.1.1 (Verificar Acreditamiento de Excepcin) del Acuerdo por el que se modifica el " + "Manual Administrativo de Aplicacin General en Materia de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico, publicado en el Diario Oficial de la Federacin el 21 de noviembre " + "de 2012.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk(" - Honradez\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk( "La seleccin del procedimiento de adjudicacin directa tiene como nico fin contratar bajo " + "las mejores condiciones los " + justi.getBienServicioTxt() + " requeridos, actuando con rectitud, " + "responsabilidad e integridad y con apego estricto al marco jurdico aplicable, evitando as " + "incurrir en actos de corrupcin y conflictos de inters, ya que por parte de los servidores " + "pblicos que intervinieron en este procedimiento quedo evidenciado que no se ha favorecido a " + "persona alguna interesada en la contratacin ya que en base a la investigacin de mercado " + "queda demostrado que es proveedor nico.\n\n" + "Lo anterior de acuerdo con lo establecido en el numeral 4.2.4 (ADJUDICACIN DIRECTA) y " + "numeral 4.2.4.1.1 (Verificar Acreditamiento de Excepcin) del Acuerdo por el que se modifica el " + "Manual Administrativo de Aplicacin General en Materia de Adquisiciones, Arrendamientos y " + "Servicios del Sector Pblico, publicado en el Diario Oficial de la Federacin el 21 de noviembre " + "de 2012.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); if (justi.getEsUnico()) { parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk(" - Transparencia\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk(mapa.get("transparencia_unico"), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); } else { parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); frase = new Chunk(" - Transparencia\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.add(frase); frase = new Chunk(mapa.get("transparencia_no_unico"), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.add(frase); document.add(parrafo); } parrafo = new Paragraph("VIII.- LUGAR Y FECHA DE EMISIN:", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setLeading(15); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph("En la Ciudad de Chihuahua, Estado de Chihuahua a los " + justi.getFechaElaboracion().getDayOfMonth() + " das del mes de " + justi.getFechaElaboracion().getMonth().getDisplayName(TextStyle.FULL, new Locale("es", "ES")) + " de " + justi.getFechaElaboracion().getYear() + ", se emite la presente justificacin para los efectos legales a que haya lugar.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setLeading(15); parrafo.setIndentationLeft(30); parrafo.setSpacingBefore(20); document.add(parrafo); parrafo = new Paragraph( "En cumplimiento a lo establecido en el penltimo prrafo del artculo 71 del Reglamento " + "de la Ley de Adquisiciones, Arrendamientos y Servicios del Sector Pblico, se acompaa a la " + "presente como ANEXO DOS?, la Requisicin o Solicitud de Contratacin (Requisicin) A la " + "cual se deber anexar, mediante sello del departamento de Presupuesto, la Constancia con la " + "que se acredita la existencia de recursos para iniciar el procedimiento de contratacin.", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setLeading(15); parrafo.setIndentationLeft(30); parrafo.setSpacingBefore(20); document.add(parrafo); if (justi.getEsUnico()) { parrafo = new Paragraph(mapa.get("nota_1"), new Font(Font.FontFamily.TIMES_ROMAN, 13, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); parrafo.setLeading(15); parrafo.setIndentationLeft(30); parrafo.setSpacingBefore(20); document.add(parrafo); } parrafo = new Paragraph("ATENTAMENTE", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setLeading(15); parrafo.setSpacingBefore(60); document.add(parrafo); parrafo = new Paragraph( justi.getAutoriza().getName() + "\n" + justi.getAutorizaCargo().toUpperCase(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setLeading(15); parrafo.setSpacingBefore(60); document.add(parrafo); document.close(); outputStream.close(); } catch (DocumentException ex) { Logger.getLogger(JustificacionREST.class.getName()).log(Level.SEVERE, null, ex); } } }; ResponseBuilder response = Response.ok(streamingOutput); String fileName = ("inline; filename=" + justi.getRequisicion() + "-" + justi.getEmpleado().getCuentaCimav() + ".pdf").replace(" ", "").replace(",", "-"); response.header("Content-Disposition", fileName); return response.build(); }
From source file:cimav.restrh.services.JustificacionREST.java
private Response tablaMercado(Integer id_param) { Justificacion justif = (Justificacion) JustificacionREST.this.find(id_param); StreamingOutput streamingOutput = new StreamingOutput() { public void write(OutputStream outputStream) throws IOException, WebApplicationException { try { //Create Document instance. Document document = new Document(); PdfWriter.getInstance(document, outputStream); document.addAuthor("Generador adquisiciones | " + justif.getEmpleado().getCuentaCimav()); String fileName1 = (justif.getRequisicion() + "-" + justif.getEmpleado().getCuentaCimav()) .replace(" ", "").replace(",", ""); document.addTitle("Justificacin: " + fileName1); document.addSubject("Justificacin de Requisicin"); document.open();/*from w ww.j a v a 2s. com*/ //Titulo del documento Paragraph parrafo = new Paragraph("Centro de Investigacin en Materiales Avanzados S. C.", new Font(Font.FontFamily.TIMES_ROMAN, 17, Font.BOLD)); parrafo.setAlignment(Element.ALIGN_CENTER); parrafo.setSpacingAfter(20); document.add(parrafo); PdfPTable table = new PdfPTable(3); // 3 columns. table.setWidths(new int[] { 30, 50, 100 }); PdfPCell cell0 = new PdfPCell( new Paragraph("Fecha:", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); PdfPCell cell1 = new PdfPCell(new Paragraph( justif.getFechaInicio().getDayOfMonth() + " de " + justif.getFechaInicio().getMonth().getDisplayName(TextStyle.FULL, new Locale("es", "ES")) + " de " + justif.getFechaInicio().getYear(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); PdfPCell cell2 = new PdfPCell( new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0.setBorder(PdfPCell.BOX); cell1.setBorder(PdfPCell.BOX); cell2.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell0); table.addCell(cell1); table.addCell(cell2); cell0 = new PdfPCell(new Paragraph("No. de Requisicin:", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell1 = new PdfPCell(new Paragraph(justif.getRequisicion(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2 = new PdfPCell(new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0.setBorder(PdfPCell.BOX); cell1.setBorder(PdfPCell.BOX); cell2.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell0); table.addCell(cell1); table.addCell(cell2); cell0 = new PdfPCell(new Paragraph("Procedimiento:", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell1 = new PdfPCell(new Paragraph("Adjudicacin Directa", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2 = new PdfPCell(new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0.setBorder(PdfPCell.BOX); cell1.setBorder(PdfPCell.BOX); cell2.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell0); table.addCell(cell1); table.addCell(cell2); cell0 = new PdfPCell(new Paragraph("Origen de los bienes:", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell1 = new PdfPCell(new Paragraph(justif.esNacional(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2 = new PdfPCell(new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0.setBorder(PdfPCell.BOX); cell1.setBorder(PdfPCell.BOX); cell2.setBorder(PdfPCell.NO_BORDER); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell0); table.addCell(cell1); table.addCell(cell2); document.add(table); parrafo = new Paragraph("", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); table = new PdfPTable(5);// 5 columns. table.setWidthPercentage(90); //table size % table.setWidths(new int[] { 'a', 'a', 'a', 'a', 'a' }); cell0 = new PdfPCell( new Paragraph("PARTIDA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell1 = new PdfPCell( new Paragraph("DESCIPCIMAV", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell2 = new PdfPCell( new Paragraph("PROVEEDOR No. 1", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); PdfPCell cell3 = new PdfPCell( new Paragraph("PROVEEDOR No.2", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); PdfPCell cell4 = new PdfPCell( new Paragraph("PROVEEDOR No.3", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell0.setBorder(PdfPCell.BOX); cell1.setBorder(PdfPCell.BOX); cell2.setBorder(PdfPCell.BOX); cell3.setBorder(PdfPCell.BOX); cell4.setBorder(PdfPCell.BOX); cell0.setHorizontalAlignment(Element.ALIGN_CENTER); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell3.setHorizontalAlignment(Element.ALIGN_CENTER); cell4.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell0); table.addCell(cell1); table.addCell(cell2); table.addCell(cell3); table.addCell(cell4); cell0 = new PdfPCell( new Paragraph("Partida #1", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD))); cell1 = new PdfPCell(new Paragraph(justif.getDescripcion(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell0.setBorder(PdfPCell.BOX); cell1.setBorder(PdfPCell.BOX); cell0.setHorizontalAlignment(Element.ALIGN_CENTER); cell0.setVerticalAlignment(Element.ALIGN_MIDDLE); cell1.setHorizontalAlignment(Element.ALIGN_CENTER); cell1.setVerticalAlignment(Element.ALIGN_MIDDLE); cell0.setRowspan(2); cell1.setRowspan(2); table.addCell(cell0); table.addCell(cell1); cell2 = new PdfPCell(new Paragraph(justif.getProveedorUno(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell(new Paragraph(justif.getProveedorDos(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell(new Paragraph(justif.getProveedorTres(), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell2.setBorder(PdfPCell.BOX); cell3.setBorder(PdfPCell.BOX); cell4.setBorder(PdfPCell.BOX); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell3.setHorizontalAlignment(Element.ALIGN_CENTER); cell4.setHorizontalAlignment(Element.ALIGN_CENTER); table.addCell(cell2); table.addCell(cell3); table.addCell(cell4); if (justif.getMontoUno() <= 1 && justif.getMontoDos() <= 1 && justif.getMontoTres() <= 1) { cell2 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); } else if (justif.getMontoUno() <= 1 && justif.getMontoDos() <= 1) { cell2 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoTres(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); } else if (justif.getMontoUno() <= 1 && justif.getMontoTres() <= 1) { cell2 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoDos(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); } else if (justif.getMontoDos() <= 1 && justif.getMontoTres() <= 1) { cell2 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoUno(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); } else if (justif.getMontoUno() <= 1) { cell2 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoDos(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoTres(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); } else if (justif.getMontoDos() <= 1) { cell2 = new PdfPCell(new Paragraph( "Subtotal: " + justif.getSubTotal() + "\n" + "IVA: " + justif.getIva() + "\n" + "Total:" + "\n" + montoFormatComas(justif.getImporte(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoTres(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); } else if (justif.getMontoTres() <= 1) { cell2 = new PdfPCell(new Paragraph( "Subtotal: " + justif.getSubTotal() + "\n" + "IVA: " + justif.getIva() + "\n" + "Total:" + "\n" + montoFormatComas(justif.getImporte(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoDos(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell( new Paragraph("NO APLICA", new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); } else { cell2 = new PdfPCell(new Paragraph( "Subtotal: " + justif.getSubTotal() + "\n" + "IVA: " + justif.getIva() + "\n" + "Total:" + "\n" + montoFormatComas(justif.getImporte(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell3 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoDos(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); cell4 = new PdfPCell(new Paragraph(montoFormatComas(justif.getMontoTres(), justif), new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.NORMAL))); } cell2.setBorder(PdfPCell.BOX); cell3.setBorder(PdfPCell.BOX); cell4.setBorder(PdfPCell.BOX); cell2.setHorizontalAlignment(Element.ALIGN_CENTER); cell2.setVerticalAlignment(Element.ALIGN_MIDDLE); cell3.setHorizontalAlignment(Element.ALIGN_CENTER); cell3.setVerticalAlignment(Element.ALIGN_MIDDLE); cell4.setHorizontalAlignment(Element.ALIGN_CENTER); cell4.setVerticalAlignment(Element.ALIGN_MIDDLE); table.addCell(cell2); table.addCell(cell3); table.addCell(cell4); document.add(table); parrafo = new Paragraph( "Tal como lo establece el artculo 29 " + "del Reglamento de la Ley de Adquisiciones, " + "Arrendamientos y Servicios del Sector Pblico," + " la investigacin de mercado arrojo los siguientes resultados:\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(20); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(10); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); parrafo = new Paragraph( "Fraccin I, determinamos la existencia de oferta de los bienes requeridos.\n" + "Fraccin II, verificamos existencias de los mismos con los proveedores que nos proporcionaron cotizacin formal.\n" + "Fraccin III, conocimos los precios que prevalecan en el mercado nacional.\n", new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setIndentationLeft(50); parrafo.setLeading(15); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); parrafo = new Paragraph( "A travs de la investigacin de mercado realizada, " + "concluimos que la mejor opcin de compra es la oferta del proveedor" + " " + justif.getProveedorUno(), new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL)); parrafo.setSpacingAfter(10); parrafo.setIndentationLeft(30); parrafo.setLeading(15); parrafo.setSpacingBefore(20); parrafo.setAlignment(Element.ALIGN_JUSTIFIED); document.add(parrafo); document.close(); outputStream.close(); } catch (DocumentException ex) { Logger.getLogger(JustificacionREST.class.getName()).log(Level.SEVERE, null, ex); } } }; ResponseBuilder response = Response.ok(streamingOutput); String fileName = ("inline; filename=" + justif.getRequisicion() + "-" + justif.getEmpleado().getCuentaCimav() + ".pdf").replace(" ", "").replace(",", "-"); response.header("Content-Disposition", fileName); return response.build(); }