Ejemplo n.º 1
0
  public void salvarRecibo(byte[] arquivo, Baixa baixa) {
    if (baixa.getCaixa() == null) {
      return;
    }

    String caminho =
        ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext())
            .getRealPath(
                "/Cliente/"
                    + ControleUsuarioBean.getCliente()
                    + "/"
                    + "Arquivos/recibo/"
                    + baixa.getCaixa().getCaixa()
                    + "/"
                    + DataHoje.converteData(baixa.getDtBaixa()).replace("/", "-"));
    Diretorio.criar(
        "Arquivos/recibo/"
            + baixa.getCaixa().getCaixa()
            + "/"
            + DataHoje.converteData(baixa.getDtBaixa()).replace("/", "-"));

    String path_arquivo =
        caminho
            + "/"
            + String.valueOf(baixa.getUsuario().getId())
            + "_"
            + String.valueOf(baixa.getId())
            + ".pdf";
    File file_arquivo = new File(path_arquivo);

    if (file_arquivo.exists()) {
      path_arquivo =
          caminho
              + "/"
              + String.valueOf(baixa.getUsuario().getId())
              + "_"
              + String.valueOf(baixa.getId())
              + "_(2).pdf";
    }

    try {
      File fl = new File(path_arquivo);
      FileOutputStream out = new FileOutputStream(fl);
      out.write(arquivo);
      out.flush();
      out.close();
    } catch (IOException e) {
      System.out.println(e);
    }
  }
Ejemplo n.º 2
0
  public String getFotoResourceArquivo() {
    if (this.id != -1) {
      String foto = "";
      foto =
          "cliente/"
              + ControleUsuarioBean.getCliente().toLowerCase()
              + "/imagens/sispessoa/"
              + this.id
              + "/documento/"
              + this.fotoArquivo
              + ".png";
      File f =
          new File(
              ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext())
                      .getRealPath("")
                  + "resources/"
                  + foto);

      if (f.exists()) {
        return foto;
      }
    }
    return "";
  }
Ejemplo n.º 3
0
  public void upload(FileUploadEvent event) {
    UUID uuidX = UUID.randomUUID();
    String nameTemp = uuidX.toString().replace("-", "_");
    ServletContext servletContext =
        (ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext();

    nameFile = nameTemp;

    if (fisica == null && juridica == null) {
      String path =
          servletContext.getRealPath("")
              + "resources/cliente/"
              + ControleUsuarioBean.getCliente().toLowerCase()
              + "/imagens/"
              + savePath
              + "/"
              + nameTemp
              + ".png";
      File file = new File(path);
      try {
        FileUtils.writeByteArrayToFile(file, event.getFile().getContents());
      } catch (IOException e) {
        e.getMessage();
      }
    } else {
      if (!Diretorio.criar(
          "imagens/pessoa", true)) { // PASTA ex. resources/cliente/sindical/imagens/pessoa
        return;
      }

      if (fisica != null) {
        String path =
            servletContext.getRealPath("")
                + "resources/cliente/"
                + ControleUsuarioBean.getCliente().toLowerCase()
                + "/imagens/pessoa/"
                + fisica.getPessoa().getId()
                + "/"
                + nameTemp
                + ".png";
        File file = new File(path);
        try {
          FileUtils.writeByteArrayToFile(file, event.getFile().getContents());
        } catch (IOException e) {
          e.getMessage();
        }

        // CASO QUEIRA REMOVER A FOTO ANTERIOR
        //                    File fotoAntiga = new
        // File(servletContext.getRealPath("")+"resources/cliente/" +
        // ControleUsuarioBean.getCliente().toLowerCase() + "/imagens/pessoa/" + pessoa.getId() +
        // "/" + fisica.getFoto() + ".png");
        //                    if (fotoAntiga.exists()) {
        //                        FileUtils.deleteQuietly(fotoAntiga);
        //                    }
        fisica.setFoto(nameTemp);
        new Dao().update(fisica, true);
      } else {
        String path =
            servletContext.getRealPath("")
                + "resources/cliente/"
                + ControleUsuarioBean.getCliente().toLowerCase()
                + "/imagens/pessoa/"
                + juridica.getPessoa().getId()
                + "/"
                + nameTemp
                + ".png";
        File file = new File(path);
        try {
          FileUtils.writeByteArrayToFile(file, event.getFile().getContents());
        } catch (IOException e) {
          e.getMessage();
        }

        // CASO QUEIRA REMOVER A FOTO ANTERIOR
        //                    File fotoAntiga = new
        // File(servletContext.getRealPath("")+"resources/cliente/" +
        // ControleUsuarioBean.getCliente().toLowerCase() + "/imagens/pessoa/" + pessoa.getId() +
        // "/" + juridica.getFoto() + ".png");
        //                    if (fotoAntiga.exists()) {
        //                        FileUtils.deleteQuietly(fotoAntiga);
        //                    }
        juridica.setFoto(nameTemp);
        new Dao().update(juridica, true);
      }
    }

    PF.closeDialog("dlg_photo_upload");
  }
Ejemplo n.º 4
0
  public String recibo(int id_movimento) {
    MovimentoDB db = new MovimentoDBToplink();
    Movimento movimento = db.pesquisaCodigo(id_movimento);
    try {
      Collection vetor = new ArrayList();
      Juridica sindicato =
          (Juridica) (new SalvarAcumuladoDBToplink()).pesquisaCodigo(1, "Juridica");
      PessoaEnderecoDB dbp = new PessoaEnderecoDBToplink();
      // MovimentosReceberSocialDB dbs = new MovimentosReceberSocialDBToplink();

      PessoaEndereco pe = dbp.pesquisaEndPorPessoaTipo(1, 2);
      String formas[] = new String[10];

      // PESQUISA FORMA DE PAGAMENTO
      List<FormaPagamento> fp = db.pesquisaFormaPagamento(movimento.getBaixa().getId());
      float soma_dinheiro = 0;
      for (int i = 0; i < fp.size(); i++) {
        // 4 - CHEQUE
        if (fp.get(i).getTipoPagamento().getId() == 4) {
          formas[i] =
              fp.get(i).getTipoPagamento().getDescricao()
                  + ": R$ "
                  + Moeda.converteR$Float(fp.get(i).getValor())
                  + " (B: "
                  + fp.get(i).getChequeRec().getBanco()
                  + " Ag: "
                  + fp.get(i).getChequeRec().getAgencia()
                  + " C: "
                  + fp.get(i).getChequeRec().getConta()
                  + " CH: "
                  + fp.get(i).getChequeRec().getCheque()
                  + ")";
          // 5 - CHEQUE PRÉ
        } else if (fp.get(i).getTipoPagamento().getId() == 5) {
          formas[i] =
              fp.get(i).getTipoPagamento().getDescricao()
                  + ": R$ "
                  + Moeda.converteR$Float(fp.get(i).getValor())
                  + " (B: "
                  + fp.get(i).getChequeRec().getBanco()
                  + " Ag: "
                  + fp.get(i).getChequeRec().getAgencia()
                  + " C: "
                  + fp.get(i).getChequeRec().getConta()
                  + " CH: "
                  + fp.get(i).getChequeRec().getCheque()
                  + " P: "
                  + fp.get(i).getChequeRec().getVencimento()
                  + ")";
          // QUALQUER OUTRO
        } else {
          formas[i] =
              fp.get(i).getTipoPagamento().getDescricao()
                  + ": R$ "
                  + Moeda.converteR$Float(fp.get(i).getValor());
          if (fp.get(i).getTipoPagamento().getId() == 3) {
            soma_dinheiro = soma_dinheiro + fp.get(i).getValor();
          }
        }
      }
      String lblVencimento = "";
      String vencimento = "";
      DataHoje dataHoje = new DataHoje();
      List<Movimento> lista = db.listaMovimentoBaixaOrder(movimento.getBaixa().getId());
      for (int i = 0; i < lista.size(); i++) {
        // tem casos de ter responsaveis diferentes, resultando em empresas conveniadas diferentes
        Guia gu = db.pesquisaGuias(lista.get(i).getLote().getId());
        String conveniada = "", mensagemConvenio = "";
        if (gu.getId() != -1) {
          if (gu.getPessoa() != null) {
            conveniada = gu.getPessoa().getNome();
          }
        }

        if (lista.get(i).getLote().getRotina().getId() == 132) {
          if (lista.get(i).getServicos().isValidadeGuias()
              && !lista.get(i).getServicos().isValidadeGuiasVigente()) {
            lblVencimento = "Validade";
            vencimento =
                dataHoje.incrementarDias(
                    lista.get(i).getServicos().getValidade(), lista.get(i).getLote().getEmissao());
          } else if (lista.get(i).getServicos().isValidadeGuias()
              && lista.get(i).getServicos().isValidadeGuiasVigente()) {
            lblVencimento = "Validade";
            vencimento = DataHoje.converteData(DataHoje.lastDayOfMonth(DataHoje.dataHoje()));
          } else {
            lblVencimento = "Validade";
            vencimento = "";
          }

          // MOSTRANDO MENSAGEM APENAS SE VIER DA PAGINA EMISSÃO DE GUIAS --- by rogerinho
          // 17/03/2015 -- chamado 579
          mensagemConvenio = lista.get(i).getLote().getHistorico();
        } else {
          lblVencimento = "Vencimento";
          vencimento = lista.get(i).getVencimento();
        }

        vetor.add(
            new ParametroRecibo(
                ((ServletContext)
                        FacesContext.getCurrentInstance().getExternalContext().getContext())
                    .getRealPath(
                        "/Cliente/"
                            + ControleUsuarioBean.getCliente()
                            + "/Imagens/LogoCliente.png"),
                sindicato.getPessoa().getNome(),
                pe.getEndereco().getDescricaoEndereco().getDescricao(),
                pe.getEndereco().getLogradouro().getDescricao(),
                pe.getNumero(),
                pe.getComplemento(),
                pe.getEndereco().getBairro().getDescricao(),
                pe.getEndereco().getCep().substring(0, 5)
                    + "-"
                    + pe.getEndereco().getCep().substring(5),
                pe.getEndereco().getCidade().getCidade(),
                pe.getEndereco().getCidade().getUf(),
                sindicato.getPessoa().getTelefone1(),
                sindicato.getPessoa().getEmail1(),
                sindicato.getPessoa().getSite(),
                sindicato.getPessoa().getDocumento(),
                lista.get(i).getPessoa().getNome(), // RESPONSÁVEL
                String.valueOf(lista.get(i).getPessoa().getId()), // ID_RESPONSAVEL
                String.valueOf(lista.get(i).getBaixa().getId()), // ID_BAIXA
                lista.get(i).getBeneficiario().getNome(), // BENEFICIÁRIO
                lista.get(i).getServicos().getDescricao(), // SERVICO
                vencimento, // VENCIMENTO
                new BigDecimal(lista.get(i).getValorBaixa()), // VALOR BAIXA
                lista.get(i).getBaixa().getUsuario().getLogin(),
                lista.get(i).getBaixa().getBaixa(),
                DataHoje.horaMinuto(),
                formas[0],
                formas[1],
                formas[2],
                formas[3],
                formas[4],
                formas[5],
                formas[6],
                formas[7],
                formas[8],
                formas[9],
                (conveniada.isEmpty()) ? "" : "Empresa Conveniada: " + conveniada,
                lblVencimento,
                mensagemConvenio,
                lista.get(i).getPessoa().getDocumento(),
                Moeda.converteR$Float(soma_dinheiro + lista.get(i).getBaixa().getTroco()),
                Moeda.converteR$Float(lista.get(i).getBaixa().getTroco())));
      }

      File fl =
          new File(
              ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext())
                  .getRealPath("/Relatorios/RECIBO.jasper"));
      JasperReport jasper = (JasperReport) JRLoader.loadObject(fl);

      JRBeanCollectionDataSource dtSource = new JRBeanCollectionDataSource(vetor);
      JasperPrint print = JasperFillManager.fillReport(jasper, null, dtSource);

      boolean printPdf = true;

      if (printPdf) {
        byte[] arquivo = JasperExportManager.exportReportToPdf(print);
        salvarRecibo(arquivo, lista.get(0).getBaixa());
        HttpServletResponse res =
            (HttpServletResponse)
                FacesContext.getCurrentInstance().getExternalContext().getResponse();
        res.setContentType("application/pdf");
        res.setHeader("Content-disposition", "inline; filename=\"" + "recibo" + ".pdf\"");
        res.getOutputStream().write(arquivo);
        res.getCharacterEncoding();

        FacesContext.getCurrentInstance().responseComplete();
      } else {
        // CASO QUEIRA IMPRIMIR EM HTML HTMLPRINT PRINTHTML IMPRIMIRRECIBOHTML TOHTML
        if (lista.get(0).getBaixa().getCaixa() == null) {
          return null;
        }

        String caminho =
            ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext())
                .getRealPath(
                    "/Cliente/"
                        + ControleUsuarioBean.getCliente()
                        + "/"
                        + "Arquivos/recibo/"
                        + lista.get(0).getBaixa().getCaixa().getCaixa()
                        + "/"
                        + DataHoje.converteData(lista.get(0).getBaixa().getDtBaixa())
                            .replace("/", "-"));
        Diretorio.criar(
            "Arquivos/recibo/"
                + lista.get(0).getBaixa().getCaixa().getCaixa()
                + "/"
                + DataHoje.converteData(lista.get(0).getBaixa().getDtBaixa()).replace("/", "-"));

        String path_arquivo =
            caminho
                + String.valueOf(lista.get(0).getBaixa().getUsuario().getId())
                + "_"
                + String.valueOf(lista.get(0).getBaixa().getId())
                + ".html";
        File file_arquivo = new File(path_arquivo);

        String n =
            String.valueOf(lista.get(0).getBaixa().getUsuario().getId())
                + "_"
                + String.valueOf(lista.get(0).getBaixa().getId())
                + ".html";
        if (file_arquivo.exists()) {
          path_arquivo =
              caminho
                  + String.valueOf(lista.get(0).getBaixa().getUsuario().getId())
                  + "_"
                  + String.valueOf(lista.get(0).getBaixa().getId())
                  + "_(2).html";
          n =
              String.valueOf(lista.get(0).getBaixa().getUsuario().getId())
                  + "_"
                  + String.valueOf(lista.get(0).getBaixa().getId())
                  + "_(2).html";
        }
        JasperExportManager.exportReportToHtmlFile(print, path_arquivo);

        Download download =
            new Download(n, caminho, "text/html", FacesContext.getCurrentInstance());
        download.baixar();

        //                String reportPath =JasperRunManager.runReportToHtmlFile(fl.getPath(),
        // null, dtSource);
        //                File reportHtmlFile = new File(reportPath);
        //                FileInputStream fis = new FileInputStream(reportHtmlFile);
        //                byte[] arquivo =  new byte[(int)reportHtmlFile.length()];
        //                fis.read(arquivo);
        //                HttpServletResponse res = (HttpServletResponse)
        // FacesContext.getCurrentInstance().getExternalContext().getResponse();
        //                res.setHeader("Content-Disposition","inline; filename=myReport.html");
        //                res.setContentType("text/html");
        //                res.setContentLength(arquivo.length);
        //                res.getOutputStream().write(arquivo);
        //                res.getCharacterEncoding();
        //
        //                FacesContext.getCurrentInstance().responseComplete();

        //                FacesContext.getCurrentInstance().responseComplete();
        //                HttpServletResponse response = (HttpServletResponse)
        // FacesContext.getCurrentInstance().getExternalContext().getResponse();
        //
        // response.sendRedirect("http://localhost:8080/Sindical/Cliente/Sindical/Arquivos/recibo/0/16-06-2015/1_683382.html");
        // FacesContext.getCurrentInstance().getExternalContext().redirect("/Sindical/baixaGeral.jsf");

      }

    } catch (JRException | IOException ex) {
      ex.getMessage();
    }

    return null;
  }
  public void imprimirCarteirinhaSemDependente() {
    Fisica fisica = new Fisica();
    Juridica sindicato = new Juridica();
    FisicaDao db = new FisicaDao();
    PessoaEndereco pesEndereco,
        pesDestinatario,
        pesEndEmpresa,
        pesEndSindicato = new PessoaEndereco();
    PessoaEnderecoDao dbEnd = new PessoaEnderecoDao();
    PessoaEmpresa pesEmpresa = new PessoaEmpresa();
    PessoaEmpresaDao dbEmp = new PessoaEmpresaDao();
    String dados[] = new String[32];
    try {
      FacesContext faces = FacesContext.getCurrentInstance();
      HttpServletResponse response = (HttpServletResponse) faces.getExternalContext().getResponse();
      Collection listaSocios = new ArrayList();

      File fl =
          new File(
              ((ServletContext) faces.getExternalContext().getContext())
                  .getRealPath(
                      "/Cliente/"
                          + ControleUsuarioBean.getCliente()
                          + "/Relatorios/FICHACADASTRO.jasper"));
      JasperReport jasper = (JasperReport) JRLoader.loadObject(fl);

      sindicato = (Juridica) new Dao().find(new Juridica(), 1);
      pesEndSindicato = dbEnd.pesquisaEndPorPessoaTipo(sindicato.getPessoa().getId(), 2);

      for (int i = 0; i < listaSoc.size(); i++) {
        if ((Boolean) ((DataObject) listaSoc.get(i)).getArgumento0()) {
          fisica =
              db.pesquisaFisicaPorPessoa(
                  ((Socios) ((DataObject) listaSoc.get(i)).getArgumento1())
                      .getServicoPessoa()
                      .getPessoa()
                      .getId());
          pesEndereco = dbEnd.pesquisaEndPorPessoaTipo(fisica.getPessoa().getId(), 1);
          pesEmpresa = dbEmp.pesquisaPessoaEmpresaPorFisica(fisica.getId());
          if (pesEmpresa.getId() != -1) {
            pesEndEmpresa =
                dbEnd.pesquisaEndPorPessoaTipo(pesEmpresa.getJuridica().getPessoa().getId(), 2);
          } else {
            pesEndEmpresa = new PessoaEndereco();
          }

          pesDestinatario = dbEnd.pesquisaEndPorPessoaTipo(fisica.getPessoa().getId(), 1);

          try {
            dados[0] = pesEndereco.getEndereco().getLogradouro().getDescricao();
            dados[1] = pesEndereco.getEndereco().getDescricaoEndereco().getDescricao();
            dados[2] = pesEndereco.getNumero();
            dados[3] = pesEndereco.getComplemento();
            dados[4] = pesEndereco.getEndereco().getBairro().getDescricao();
            dados[5] = pesEndereco.getEndereco().getCidade().getCidade();
            dados[6] = pesEndereco.getEndereco().getCidade().getUf();
            dados[7] = pesEndereco.getEndereco().getCep();
          } catch (Exception e) {
            dados[0] = "";
            dados[1] = "";
            dados[2] = "";
            dados[3] = "";
            dados[4] = "";
            dados[5] = "";
            dados[6] = "";
            dados[7] = "";
          }
          try {
            dados[8] = pesDestinatario.getEndereco().getLogradouro().getDescricao();
            dados[9] = pesDestinatario.getEndereco().getDescricaoEndereco().getDescricao();
            dados[10] = pesDestinatario.getNumero();
            dados[11] = pesDestinatario.getComplemento();
            dados[12] = pesDestinatario.getEndereco().getBairro().getDescricao();
            dados[13] = pesDestinatario.getEndereco().getCidade().getCidade();
            dados[14] = pesDestinatario.getEndereco().getCidade().getUf();
            dados[15] = pesDestinatario.getEndereco().getCep();
            dados[26] = pesDestinatario.getPessoa().getDocumento();
            dados[27] = pesDestinatario.getPessoa().getNome();
          } catch (Exception e) {
            dados[8] = "";
            dados[9] = "";
            dados[10] = "";
            dados[11] = "";
            dados[12] = "";
            dados[13] = "";
            dados[14] = "";
            dados[15] = "";
            dados[26] = "";
            dados[27] = "";
          }
          try {
            dados[16] = pesEmpresa.getJuridica().getPessoa().getNome();
            dados[17] = pesEmpresa.getJuridica().getPessoa().getTelefone1();
            dados[18] = pesEmpresa.getFuncao().getProfissao();
            dados[19] = pesEndEmpresa.getEndereco().getDescricaoEndereco().getDescricao();
            dados[20] = pesEndEmpresa.getNumero();
            dados[21] = pesEndEmpresa.getComplemento();
            dados[22] = pesEndEmpresa.getEndereco().getBairro().getDescricao();
            dados[23] = pesEndEmpresa.getEndereco().getCidade().getCidade();
            dados[24] = pesEndEmpresa.getEndereco().getCidade().getUf();
            dados[25] = pesEndEmpresa.getEndereco().getCep();
            dados[28] = pesEmpresa.getAdmissao();
            dados[29] = pesEmpresa.getJuridica().getPessoa().getDocumento();
            dados[30] = pesEmpresa.getJuridica().getFantasia();
            dados[31] = pesEndEmpresa.getEndereco().getLogradouro().getDescricao();
            dados[32] = pesEmpresa.getCodigo();
          } catch (Exception e) {
            dados[16] = "";
            dados[17] = "";
            dados[18] = "";
            dados[19] = "";
            dados[20] = "";
            dados[21] = "";
            dados[22] = "";
            dados[23] = "";
            dados[24] = "";
            dados[25] = "";
            dados[28] = "";
            dados[29] = "";
            dados[30] = "";
            dados[31] = "";
            dados[32] = "";
          }

          try {
            listaSocios.add(
                new FichaSocial(
                    0,
                    ((Socios) ((DataObject) listaSoc.get(i)).getArgumento1()).getId(),
                    ((Socios) ((DataObject) listaSoc.get(i)).getArgumento1())
                        .getMatriculaSocios()
                        .getNrMatricula(),
                    ((Socios) ((DataObject) listaSoc.get(i)).getArgumento1())
                        .getServicoPessoa()
                        .getEmissao(),
                    null,
                    ((Socios) ((DataObject) listaSoc.get(i)).getArgumento1())
                        .getMatriculaSocios()
                        .getCategoria()
                        .getGrupoCategoria()
                        .getGrupoCategoria(),
                    ((Socios) ((DataObject) listaSoc.get(i)).getArgumento1())
                        .getMatriculaSocios()
                        .getCategoria()
                        .getCategoria(),
                    fisica.getPessoa().getNome(),
                    fisica.getSexo(),
                    fisica.getNascimento(),
                    fisica.getNaturalidade(),
                    fisica.getNacionalidade(),
                    fisica.getRg(),
                    fisica.getPessoa().getDocumento(),
                    fisica.getCarteira(),
                    fisica.getSerie(),
                    fisica.getEstadoCivil(),
                    fisica.getPai(),
                    fisica.getMae(),
                    fisica.getPessoa().getTelefone1(),
                    fisica.getPessoa().getTelefone3(),
                    fisica.getPessoa().getEmail1(),
                    dados[0],
                    dados[1],
                    dados[2],
                    dados[3],
                    dados[4],
                    dados[5],
                    dados[6],
                    dados[7],
                    false,
                    dados[26],
                    dados[27],
                    dados[8],
                    dados[9],
                    dados[10],
                    dados[11],
                    dados[12],
                    dados[13],
                    dados[14],
                    dados[15],
                    dados[16],
                    dados[17],
                    null, // fax
                    dados[28],
                    dados[18],
                    dados[19],
                    dados[20],
                    dados[21],
                    dados[22],
                    dados[23],
                    dados[24],
                    dados[25],
                    ((ServletContext) faces.getExternalContext().getContext())
                        .getRealPath("/Imagens/LogoCliente.png"),
                    "", // obs
                    ((Socios) ((DataObject) listaSoc.get(i)).getArgumento1())
                        .getParentesco()
                        .getParentesco(),
                    sindicato.getPessoa().getNome(),
                    pesEndSindicato.getEndereco().getDescricaoEndereco().getDescricao(),
                    pesEndSindicato.getNumero(),
                    pesEndSindicato.getComplemento(),
                    pesEndSindicato.getEndereco().getBairro().getDescricao(),
                    pesEndSindicato.getEndereco().getCidade().getCidade(),
                    pesEndSindicato.getEndereco().getCidade().getUf(),
                    pesEndSindicato.getEndereco().getCep(),
                    sindicato.getPessoa().getDocumento(),
                    "",
                    ((ServletContext) faces.getExternalContext().getContext())
                        .getRealPath("/Imagens/LogoCliente.png"),
                    getFotoSocio(((Socios) ((DataObject) listaSoc.get(i)).getArgumento1())),
                    sindicato.getPessoa().getEmail1(),
                    sindicato.getPessoa().getSite(),
                    sindicato.getPessoa().getTelefone1(),
                    ((ServletContext) faces.getExternalContext().getContext())
                        .getRealPath(
                            "/Cliente/"
                                + ControleUsuarioBean.getCliente()
                                + "/Relatorios/FICHACADASTRO.jasper"),
                    dados[29],
                    fisica.getPessoa().getRecadastroString(),
                    dados[30],
                    pesEndSindicato.getEndereco().getLogradouro().getDescricao(),
                    dados[31],
                    "",
                    dados[32],
                    fisica.getPis()));

          } catch (Exception erro) {
            System.err.println("O arquivo não foi gerado corretamente! Erro: " + erro.getMessage());
            continue;
          }
        }
      }
      JRBeanCollectionDataSource dtSource = new JRBeanCollectionDataSource(listaSocios);
      JasperPrint print = JasperFillManager.fillReport(jasper, null, dtSource);
      byte[] arquivo = JasperExportManager.exportReportToPdf(print);
      response.setContentType("application/pdf");
      response.setContentLength(arquivo.length);
      ServletOutputStream saida = response.getOutputStream();
      saida.write(arquivo, 0, arquivo.length);
      saida.flush();
      saida.close();

      FacesContext.getCurrentInstance().responseComplete();
      Download download =
          new Download(
              "Ficha Social " + fisica.getPessoa().getId() + ".pdf",
              ((ServletContext) FacesContext.getCurrentInstance().getExternalContext().getContext())
                  .getRealPath("/socios.jsf"),
              "application/pdf",
              FacesContext.getCurrentInstance());
      download.baixar();
    } catch (Exception erro) {
      System.err.println("O arquivo não foi gerado corretamente! Erro: " + erro.getMessage());
    }
  }