Exemplo n.º 1
0
 function Gerar()
 {
     $this->titulo = "Detalhe do valor";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $cod_diaria_valores = @$_GET['cod_diaria_valores'];
     $db = new clsBanco();
     $db2 = new clsBanco();
     $db->Consulta("SELECT cod_diaria_valores, ref_funcionario_cadastro, ref_cod_diaria_grupo, estadual, p100, p75, p50, p25, data_vigencia FROM pmidrh.diaria_valores WHERE cod_diaria_valores='{$cod_diaria_valores}'");
     if ($db->ProximoRegistro()) {
         list($cod_diaria_valores, $ref_funcionario_cadastro, $ref_cod_diaria_grupo, $estadual, $p100, $p75, $p50, $p25, $data_vigencia) = $db->Tupla();
         $objPessoa = new clsPessoa_($ref_funcionario_cadastro);
         $detalhePessoa = $objPessoa->detalhe();
         $this->addDetalhe(array("Ultimo Editor", $detalhePessoa["nome"]));
         $nome_grupo = $db2->CampoUnico("SELECT desc_grupo FROM pmidrh.diaria_grupo WHERE cod_diaria_grupo = '{$ref_cod_diaria_grupo}'");
         $this->addDetalhe(array("Grupo", $nome_grupo));
         $estadual = $estadual ? "Sim" : "Nãe";
         $this->addDetalhe(array("Estadual", $estadual));
         $p100 = number_format($p100, 2, ",", ".");
         $this->addDetalhe(array("100%", $p100));
         $p75 = number_format($p75, 2, ",", ".");
         $this->addDetalhe(array("75%", $p75));
         $p50 = number_format($p50, 2, ",", ".");
         $this->addDetalhe(array("50%", $p50));
         $p25 = number_format($p25, 2, ",", ".");
         $this->addDetalhe(array("25%", $p25));
         $data_vigencia = date("d/m/Y", strtotime($data_vigencia));
         $this->addDetalhe(array("Data de vigência", $data_vigencia));
         $this->url_editar = "diaria_valores_cad.php?cod_diaria_valores={$cod_diaria_valores}";
     } else {
         $this->addDetalhe(array("Erro", "Codigo de diaria-valor invalido"));
     }
     $this->url_novo = "diaria_valores_cad.php";
     $this->url_cancelar = "diaria_valores_lst.php";
     $this->largura = "100%";
 }
 function Gerar()
 {
     $db = new clsBanco();
     $this->titulo = "Detalhe doa Empresa";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $cod_empresa = @$_GET['cod_empresa'];
     $db->Consulta("SELECT cod_compras_editais_empresa, cnpj, nm_empresa, email, data_hora, endereco, ref_sigla_uf, cidade, bairro, telefone, fax, cep, nome_contato FROM compras_editais_empresa WHERE cod_compras_editais_empresa = '{$cod_empresa}'");
     $db->ProximoRegistro();
     list($cod_compras_editais_empresa, $cnpj, $nm_empresa, $email, $data_hora, $endereco, $ref_sigla_uf, $cidade, $bairro, $telefone, $fax, $cep, $nome_contato) = $db->Tupla();
     if ($ref_sigla_uf) {
         $ref_sigla_uf = $db->CampoUnico("SELECT nome FROM public.uf WHERE sigla_uf = '{$ref_sigla_uf}'");
     }
     $this->addDetalhe(array("Nome", $nm_empresa));
     $this->addDetalhe(array("CNPJ", $cnpj));
     $this->addDetalhe(array("e-mail", $email));
     $this->addDetalhe(array("Endereco", $endereco));
     $this->addDetalhe(array("Estado", $ref_sigla_uf));
     $this->addDetalhe(array("Cidade", $cidade));
     $this->addDetalhe(array("Bairro", $bairro));
     $this->addDetalhe(array("Cep", $cep));
     $this->addDetalhe(array("Telefone", $telefone));
     $this->addDetalhe(array("Fax", $fax));
     $this->addDetalhe(array("Nome para contato", $nome_contato));
     $this->addDetalhe(array("Data de cadastro", date("d/m/Y H:i", strtotime(substr($data_hora, 0, 19)))));
     $this->url_novo = "licitacoes_edital_empresa_cad.php";
     $this->url_editar = "licitacoes_edital_empresa_cad.php?cod_empresa={$cod_empresa}";
     $this->url_cancelar = "licitacoes_edital_empresa_lst.php";
     $this->largura = "100%";
 }
 function Gerar()
 {
     $db = new clsBanco();
     $db2 = new clsBanco();
     $this->titulo = "Editais - Empresas";
     $this->campoTexto("busca_nome", "Empresa", $_GET["busca_nome"], 50, 255);
     $where = "";
     if (isset($_GET["busca_nome"])) {
         $where = " WHERE nm_empresa LIKE '%{$_GET["busca_nome"]}%'";
     }
     $this->addCabecalhos(array("Empresa", "CNPJ ou CPF", "e-mail"));
     $total = $db->CampoUnico("SELECT count(0) FROM compras_editais_empresa {$where}");
     $limite = 20;
     $inicio_limite = @$_GET["pos_atual"] * $limite;
     $limit = " LIMIT {$inicio_limite}, {$limite}";
     $db->Consulta("SELECT cod_compras_editais_empresa, cnpj, nm_empresa, email, data_hora FROM compras_editais_empresa {$where} ORDER BY nm_empresa ASC {$limit}");
     while ($db->ProximoRegistro()) {
         list($cod_compras_editais_empresa, $cnpj, $nm_empresa, $email, $data_hora) = $db->Tupla();
         $this->addLinhas(array("<a href='licitacoes_edital_empresa_det.php?cod_empresa={$cod_compras_editais_empresa}'><img src='imagens/noticia.jpg' border=0>{$nm_empresa}</a>", "<a href='licitacoes_edital_empresa_det.php?cod_empresa={$cod_compras_editais_empresa}'>{$cnpj}</a>", $email));
     }
     $this->paginador("licitacoes_edital_empresa_lst.php?", $total, $limite, @$_GET['pos_atual']);
     $this->acao = "go(\"licitacoes_edital_empresa_cad.php\")";
     $this->nome_acao = "Novo";
     $this->largura = "100%";
 }
Exemplo n.º 4
0
 function Gerar()
 {
     $this->titulo = "Di&aacute;rias";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->addCabecalhos(array("Grupo", "Vig&ecirc;ncia", "Estadual", "100%", "75%", "50%", "25%"));
     $where = "";
     $gruda = "";
     if (!empty($_GET['ref_sec'])) {
         $where .= "";
     }
     $db = new clsBanco();
     $db2 = new clsBanco();
     $total = $db->UnicoCampo("SELECT count(0) FROM pmidrh.diaria_valores {$where}");
     // Paginador
     $limite = 20;
     $iniciolimit = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $limite - $limite : 0;
     $objPessoa = new clsPessoaFisica();
     $sql = "SELECT cod_diaria_valores, ref_cod_diaria_grupo, data_vigencia, estadual, p100, p75, p50, p25 FROM pmidrh.diaria_valores {$where} ORDER BY data_vigencia DESC, estadual ASC, ref_cod_diaria_grupo ASC";
     $db->Consulta($sql);
     while ($db->ProximoRegistro()) {
         list($cod_diaria_valores, $ref_cod_diaria_grupo, $data_vigencia, $estadual, $p100, $p75, $p50, $p25) = $db->Tupla();
         $nome_grupo = $db2->CampoUnico("SELECT desc_grupo FROM pmidrh.diaria_grupo WHERE cod_diaria_grupo = '{$ref_cod_diaria_grupo}'");
         $data_vigencia = date("d/m/Y", strtotime($data_vigencia));
         if (strlen($nome_grupo) > 40) {
             $nome_grupo = substr($nome_grupo, 0, 37);
         }
         $estadual = $estadual ? "Sim" : "Não";
         $this->addLinhas(array("<a href='diaria_valores_det.php?cod_diaria_valores={$cod_diaria_valores}'><img src='imagens/noticia.jpg' border=0>{$nome_grupo}</a>", "<a href='diaria_valores_det.php?cod_diaria_valores={$cod_diaria_valores}'>{$data_vigencia}</a>", "<a href='diaria_valores_det.php?cod_diaria_valores={$cod_diaria_valores}'>{$estadual}</a>", "<a href='diaria_valores_det.php?cod_diaria_valores={$cod_diaria_valores}'>" . number_format($p100, 2, ",", ".") . "</a>", "<a href='diaria_valores_det.php?cod_diaria_valores={$cod_diaria_valores}'>" . number_format($p75, 2, ",", ".") . "</a>", "<a href='diaria_valores_det.php?cod_diaria_valores={$cod_diaria_valores}'>" . number_format($p50, 2, ",", ".") . "</a>", "<a href='diaria_valores_det.php?cod_diaria_valores={$cod_diaria_valores}'>" . number_format($p25, 2, ",", ".") . "</a>"));
     }
     // Paginador
     $this->addPaginador2("diaria_valores_lst.php", $total, $_GET, $this->nome, $limite);
     $this->acao = "go(\"diaria_valores_cad.php\")";
     $this->nome_acao = "Novo";
     $this->largura = "100%";
 }
 function Gerar()
 {
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $db = new clsBanco();
     $db2 = new clsBanco();
     $objAgenda = new clsAgenda($this->pessoa_logada, $this->pessoa_logada);
     $this->cod_agenda = $objAgenda->getCodAgenda();
     $this->envia_alerta = $objAgenda->getEnviaAlerta();
     $this->nm_agenda = $objAgenda->getNome();
     $this->campoOculto("cod_agenda", $this->cod_agenda);
     $this->campoLista("envia_alerta", "Envia Alerta", array("N&atilde;o", "Sim"), $this->envia_alerta);
     $db->Consulta("SELECT ref_cod_agenda FROM agenda_responsavel WHERE ref_ref_cod_pessoa_fj = '{$this->pessoa_logada}' AND principal = 1");
     if ($db->ProximoRegistro()) {
         list($this->agenda_display) = $db->Tupla();
     } else {
         $this->agenda_display = $this->cod_agenda;
     }
     $agendas = array();
     $agendas[$this->cod_agenda] = "Minha agenda: {$this->nm_agenda}";
     $db->Consulta("SELECT ref_cod_agenda, principal FROM agenda_responsavel WHERE ref_ref_cod_pessoa_fj = '{$this->pessoa_logada}'");
     while ($db->ProximoRegistro()) {
         list($cod_agenda, $principal) = $db->Tupla();
         $agendas[$cod_agenda] = $db2->CampoUnico("SELECT nm_agenda FROM agenda WHERE cod_agenda = '{$cod_agenda}'");
         if ($principal) {
             $this->agenda_display = $cod_agenda;
         }
     }
     $this->campoLista("agenda_display", "Agenda exibida na pagina principal", $agendas, $this->agenda_display);
 }
 function renderHTML()
 {
     $relatorio = new relatorios("Relatório de Patch de Software", 210, false, "Patch de Software", "A4", "Prefeitura de Itajaí\nServidores\nRua Tijucas, 511 - Centro\nCEP. 88304-020 - Itajaí - SC");
     //tamanho do retangulo, tamanho das linhas.
     $relatorio->novaPagina();
     $this->cod_software_patch = $_GET['cod_software_patch'];
     $obj_patch = new clsPmicontrolesisSoftwarePatch($this->cod_software_patch);
     $det_patch = $obj_patch->detalhe();
     if (!$det_patch) {
         die("<center>Não foi possível encontrar o Patch solicitado</center>");
     }
     $obj_soft = new clsPmicontrolesisSoftware($det_patch['ref_cod_software']);
     $det_soft = $obj_soft->detalhe();
     $data_patch = dataFromPgToBr($det_patch['data_patch'], 'Y-d-m');
     $data_patch_ = dataFromPgToBr($det_patch['data_patch'], 'd/m/Y');
     $db = new clsBanco();
     $consulta = " SELECT data_patch\n\t\t\t\t        FROM pmicontrolesis.software_patch\n\t\t\t   \t       WHERE ativo = true\n\t\t\t\t         AND ref_cod_software = 1\n\t\t\t\t\t\tORDER BY data_patch DESC\n\t\t\t\t\t\t      OFFSET 1\n\t\t\t\t\t\t      LIMIT 1";
     $data_patch_anterior = $db->CampoUnico($consulta);
     $data_patch_anterior_ = dataFromPgToBr($data_patch_anterior, 'm/d/Y');
     $data_patch_anterior = dataFromPgToBr($data_patch_anterior, 'Y-d-m');
     $where_and = "";
     if ($data_patch_anterior) {
         $where_and = "  AND ( to_char(data_cadastro,'yyyy-mm-dd') > '{$data_patch_anterior}'\n\t\t\t\t\t         OR to_char(data_exclusao,'yyyy-mm-dd')   > '{$data_patch_anterior}'\n\t\t\t\t\t\t    )";
     }
     $consulta = "SELECT *\n\t\t\t\t\t   FROM pmicontrolesis.software_alteracao\n\t\t\t\t\t  WHERE ativo = true\n\t\t\t\t\t    AND ( to_char(data_cadastro,'yyyy-mm-dd')    <= '{$data_patch}'\n\t\t\t\t\t          OR to_char(data_exclusao,'yyyy-mm-dd') <= '{$data_patch}'\n\t\t\t\t\t\t    )\n\t\t\t\t\t\t{$where_and}";
     $db->Consulta($consulta);
     $periodo = $data_patch_ ? "      ALTERAÇÕES:{$data_patch_anterior_}-{$data_patch_}" : "";
     $opcoes_motivo = array('i' => 'Inserção', 'a' => 'Alteração', 'e' => 'Exclusão');
     $opcoes_tipo = array('s' => 'Script', 'b' => 'Banco');
     if ($db->Num_Linhas()) {
         $i = 0;
         $total = $db->Num_Linhas();
         $relatorio->novalinha(array("SISTEMA:  {$det_soft['nm_software']}{$periodo}        DATA PATCH:  {$data_patch_}"), 0, 13, true, "arial", false, "#d3d3d3", "#d3d3d3", "#000000");
         while ($db->ProximoRegistro()) {
             $registro = $db->Tupla();
             $registro['motivo'] = $opcoes_motivo[$registro['motivo']];
             $registro['tipo'] = $opcoes_tipo[$registro['tipo']];
             $num_linhas = 6 + (int) strlen($registro['descricao']) / 85;
             $data = $registro['data_exclusao'] ? dataFromPgToBr($registro['data_exclusao']) : dataFromPgToBr($registro['data_cadastro']);
             $relatorio->novalinha(array("Descrição de alterações:  {$registro['descricao']}\nMotivo Alteração: {$registro['motivo']}\nTipo Alteração:{$registro['tipo']}\nScript/Banco:{$registro['script_banco']}\nData: {$data}"), 0, $num_linhas * 10, false, "arial", false, "#ffffff", "#ffffff", "#ffffff", false, false, null, null, 'justify');
             $i++;
             if ($i < $total) {
                 $relatorio->novalinha(array(""), 0, 5, false, false, false, false, false, false, true);
             }
         }
         $link = $relatorio->fechaPdf();
     } else {
         $this->campoRotulo("aviso", "Aviso", "Nenhuma Registro neste relat&oacute;rio.");
     }
     echo "<script>window.onload=function(){parent.EscondeDiv('LoadImprimir');window.location='download.php?filename=" . $link . "'}</script>";
     echo "<html><center>Se o download não iniciar automaticamente <br /><a target='_blank' href='" . $link . "' style='font-size: 16px; color: #000000; text-decoration: underline;'>clique aqui!</a><br><br>\n\t\t\t<span style='font-size: 10px;'>Para visualizar os arquivos PDF, é necessário instalar o Adobe Acrobat Reader.<br>\n\n\t\t\tClique na Imagem para Baixar o instalador<br><br>\n\t\t\t<a href=\"http://www.adobe.com.br/products/acrobat/readstep2.html\" target=\"new\"><br><img src=\"imagens/acrobat.gif\" width=\"88\" height=\"31\" border=\"0\"></a>\n\t\t\t</span>\n\t\t\t</center>";
 }
Exemplo n.º 7
0
 function Gerar()
 {
     @session_start();
     $id_pessoa = $_SESSION['id_pessoa'];
     @session_write_close();
     $this->titulo = "Detalhe do Menu";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $cod_menu = @$_GET['cod_menu'];
     $obj_menu_suspenso = new clsMenuSuspenso();
     $lista = $obj_menu_suspenso->lista(false, false, false, false, false, false, false, false, $cod_menu, false, false, "cod_menu ASC, ord_menu ASC");
     if ($lista) {
         $tabela = "<style> .tds{ padding-left:5px; padding-right:5px; }</style>";
         $tabela .= "<table border='0' cellpadding='1' cellspacing='3' width='100%'>";
         $tabela .= "<tr  bgcolor='#B3BABF'><td class='tds'>Ordem</td><td class='tds'>Menu Pai</td><td class='tds'nowrap>Submenu</td><td class='tds'>Título</td><td class='tds'>Ícone</td><td class='tds'>Caminho</td><td class='tds'>Supre</td></tr>";
         foreach ($lista as $menu) {
             $ref_cod_menu_pai = $menu['ref_cod_menu_pai'];
             $obj_menu_suspenso2 = new clsMenuSuspenso($ref_cod_menu_pai);
             $detalhe = $obj_menu_suspenso2->detalhe();
             $ds_menu_pai = $detalhe['tt_menu'];
             $ref_cod_menu_submenu = $menu['ref_cod_menu_submenu'];
             if ($ref_cod_menu_submenu) {
                 $db = new clsBanco();
                 $ds_menu_submenu = $db->CampoUnico("SELECT nm_submenu FROM menu_submenu WHERE cod_sistema = 2 AND cod_menu_submenu = {$ref_cod_menu_submenu}");
             }
             $suprime_menu = $menu['suprime_menu'];
             if ($suprime_menu == 1) {
                 $ds_suprime_menu = 'Sim';
             } else {
                 $ds_suprime_menu = 'Não';
             }
             $ObjImagem = new clsPortalImagem($menu[4]);
             $detalheImagem = $ObjImagem->detalhe();
             if ($detalheImagem) {
                 $ico_menu = "<img src='imagens/banco_imagens/{$detalheImagem['caminho']}' alt='' title='' width='12' height='12'>";
             } else {
                 $ico_menu = "S/";
             }
             $titulo = $menu['tt_menu'];
             $ordem = $menu['ord_menu'];
             $caminho = $menu['caminho'];
             $alvo = $menu['alvo'];
             $tabela .= "<tr><td class='tds' align='right'>{$ordem}</td><td class='tds' align='right'>{$ds_menu_pai}</td><td class='tds'>{$ds_menu_submenu}</td><td class='tds'>{$titulo}</td><td class='tds'align='center'>{$ico_menu}</td><td class='tds'>{$caminho}<td class='tds'align='center'>{$ds_suprime_menu}</td></tr>";
         }
         $tabela .= "</table>";
     }
     $this->addDetalhe(array("Menu", $tabela));
     //$this->url_novo = "menu_suspenso_cad.php";
     $this->url_editar = "menu_suspenso_cad.php?cod_menu={$cod_menu}";
     $this->url_cancelar = "menu_suspenso_lst.php";
     $this->largura = "100%";
 }
 function Novo()
 {
     $db = new clsBanco();
     /*
      * INFORMAÇÕES DO BANCO DE DADOS
      */
     $banco_matricula = $db->CampoUnico("SELECT matricula FROM portal.funcionario WHERE ref_cod_pessoa_fj='{$_SESSION['id_pessoa']}'");
     $banco_senha = $db->CampoUnico("SELECT senha FROM portal.funcionario WHERE ref_cod_pessoa_fj='{$_SESSION['id_pessoa']}'");
     $banco_data_nasc = $db->CampoUnico("SELECT data_nasc FROM cadastro.fisica WHERE idpes='{$_SESSION['id_pessoa']}'");
     $banco_cpf = $db->CampoUnico("SELECT cpf FROM cadastro.fisica_cpf WHERE idpes='{$_SESSION['id_pessoa']}'");
     /*
      * COMPARA DADOS
      */
     $this->senha_intranet = md5($this->senha_intranet);
     $banco_data_nasc = dataToBrasil($banco_data_nasc);
     $banco_cpf = int2CPF($banco_cpf);
     /*echo "Banco: {$banco_matricula} - {$banco_senha} - {$banco_cpf} - {$banco_data_nasc}<br>";
     		echo "User: {$this->matricula} - {$this->senha_intranet} - {$this->cpf} - {$this->data_nasc}<br>";*/
     if ($banco_matricula == $this->matricula && $banco_senha == $this->senha_intranet && $banco_data_nasc == $this->data_nasc && $banco_cpf == $this->cpf) {
         //$banco_data_nasc == $this->data_nasc &&
         $autorizado = true;
     } else {
         $autorizado = false;
     }
     /*
      * NEGA OU AUTORIZA VISUALIZAÇÃO
      */
     if ($autorizado) {
         session_start();
         $_SESSION['autorizado_holerite'] = true;
         $_SESSION['matricula_user'] = $banco_matricula;
         header("Location: pmidrh_holerite_lst.php");
         die("era pra ter ido...");
     }
     header("Location: pmidrh_holerite_habilita.php?erro=1");
 }
 function Gerar()
 {
     @session_start();
     $_SESSION["campo"] = isset($_GET["campo"]) ? $_GET["campo"] : $_SESSION["campo"];
     $this->__nome = "form1";
     @session_write_close();
     $this->titulo = "Categorias";
     // Paginador
     $limite = 7;
     $iniciolimit = $_GET["pagina_{$this->__nome}"] ? $_GET["pagina_{$this->__nome}"] * $limite - $limite : 0;
     //***
     // INICIO FILTROS
     //***
     $nm_categoria = $_GET["nm_categoria"];
     $this->campoTexto("titulo", "T&iacute;tulo", $_GET["titulo"], 40, 255);
     //***
     // FIM FILTROS
     //***
     $this->addCabecalhos(array("Data", "T&iacute;tulo", "Criador"));
     $db = new clsBanco();
     if (!empty($_GET["titulo"])) {
         $where = " where n.titulo ilike '%{$_GET["titulo"]}%'";
     }
     $total = $db->CampoUnico("SELECT count(*) FROM not_portal n {$where}");
     $db->Consulta("SELECT n.ref_ref_cod_pessoa_fj, cod_not_portal, n.data_noticia, n.titulo, n.descricao FROM not_portal n {$where} ORDER BY n.data_noticia DESC LIMIT {$iniciolimit},{$limite}");
     $objPessoa = new clsPessoaFisica();
     while ($db->ProximoRegistro()) {
         list($cod_pessoa, $id_noticia, $data, $titulo, $descricao) = $db->Tupla();
         list($nome) = $objPessoa->queryRapida($cod_pessoa, "nome");
         $data = date('d/m/Y', strtotime(substr($data, 0, 19)));
         $campo = @$_GET['campo'];
         if (strlen($titulo) >= 40) {
             $titulo = substr($titulo, 0, 40) . "...";
         }
         $func = "javascript:enviar('{$_SESSION["campo"]}','{$id_noticia}','{$titulo}','div_dinamico_0')";
         $this->addLinhas(array("<a href='javascript:void(0);' onclick=\"{$func}\">{$data}</a>", "<a href='javascript:void(0);' onclick=\"{$func}\">{$titulo}</a>", "<a href='javascript:void(0);' onclick=\"{$func}\">{$nome}</a>"));
     }
     $this->largura = "100%";
     $this->addPaginador2("acoes_pesquisa_noticia.php", $total, $_GET, $this->__nome, $limite);
     @session_write_close();
 }
Exemplo n.º 10
0
 function Gerar()
 {
     @session_start();
     $_SESSION["campo"] = isset($_GET["campo"]) ? $_GET["campo"] : $_SESSION["campo"];
     $_SESSION["campo1"] = isset($_GET["campo1"]) ? $_GET["campo1"] : $_SESSION["campo1"];
     $_SESSION["campo2"] = isset($_GET["campo2"]) ? $_GET["campo2"] : $_SESSION["campo2"];
     $_SESSION["campo3"] = isset($_GET["campo3"]) ? $_GET["campo3"] : $_SESSION["campo3"];
     $this->nome = "form1";
     $this->titulo = "Fotos";
     $this->addCabecalhos(array("Selecionar", "Data", "T&iacute;tulo", "Criador"));
     //***
     // INICIO FILTROS
     //***
     $this->campoTexto("titulo", "T&iacute;tulo", $_GET["titulo"], 40, 255);
     //***
     // FIM FILTROS
     //***
     $limite = 10;
     $iniciolimit = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $limite - $limite : 0;
     $objPessoa = new clsPessoaFisica();
     $db = new clsBanco();
     if (!empty($_GET["titulo"])) {
         $where = " and f.titulo ilike '%{$_GET["titulo"]}%' ";
     }
     $total = $db->CampoUnico("SELECT COUNT(0) FROM pmicontrolesis.foto_evento f,cadastro.pessoa p WHERE f.ref_ref_cod_pessoa_fj = p.idpes {$where}");
     $db->Consulta("SELECT f.ref_ref_cod_pessoa_fj, \n\t\t       \t\t\t\t  f.cod_foto_evento, \n\t\t\t\t\t\t      to_char(f.data_foto,'dd/mm/yyyy'),\n\t\t\t\t\t\t      f.titulo, \n\t\t\t\t\t\t      f.descricao, \n\t\t\t\t\t\t      f.caminho,\n\t\t\t\t\t\t      p.nome\n\t\t\t\t\t     FROM pmicontrolesis.foto_evento     f,\n\t\t\t\t\t          cadastro.pessoa p\n\t\t\t\t\t    WHERE f.ref_ref_cod_pessoa_fj = p.idpes\n\t\t\t\t\t    {$where}\t\t    \n\t\t\t\t\t ORDER BY f.data_foto DESC\n\t\t\t\t        LIMIT {$iniciolimit},{$limite}");
     while ($db->ProximoRegistro()) {
         list($cod_pessoa, $id_foto, $data, $titulo, $descricao, $caminho, $nome) = $db->Tupla();
         $campo = @$_SESSION["campo"];
         $campo3 = @$_SESSION["campo3"];
         if (strpos($campo3, "acoes") == 1) {
             $onclick = "javascript:enviar(\"{$_SESSION["campo1"]}\",\"{$id_foto}\",\"{$titulo}\",\"div_dinamico_0\")";
         } else {
             $onclick = "javascript:retorna(\"{$this->nome}\", \"{$campo}\", \"{$id_foto}\");";
         }
         $this->addLinhas(array("<center><a href='javascript:void(0);' onclick='{$onclick}'><img src='fotos/small/{$caminho}' border=0></a></center>", $data, $titulo, $nome . " " . $sobrenome));
     }
     $this->addPaginador2("add_fotos_evento.php", $total, $_GET, $this->nome, $limite);
     $this->largura = "100%";
 }
Exemplo n.º 11
0
 /**
  * @todo Refatorar a lógica para uma classe na camada de domínio.
  */
 function Novo()
 {
     session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     session_write_close();
     $db = new clsBanco();
     $db2 = new clsBanco();
     // Seleciona o maior ano letivo da escola em andamento
     $ano = $db2->CampoUnico(sprintf("\n      SELECT MAX(ano) FROM pmieducar.escola_ano_letivo\n      WHERE ref_cod_escola = '%d' AND andamento = 1", $this->ref_cod_escola));
     // Caso a escola não tenha um ano letivo, usa o ano da data do servidor web
     if (!is_numeric($ano)) {
         $ano = date('Y');
     }
     // Seleciona todos os alunos que foram aprovados na turma/série/curso/escola informados
     $db->Consulta(sprintf("\n      SELECT\n        cod_matricula, ref_cod_aluno\n      FROM\n        pmieducar.matricula m, pmieducar.matricula_turma\n      WHERE\n        aprovado = '1' AND m.ativo = '1' AND ref_ref_cod_escola = '%d' AND\n        ref_ref_cod_serie='%d' AND ref_cod_curso = '%d' AND\n        cod_matricula = ref_cod_matricula AND ref_cod_turma = '%d'", $this->ref_cod_escola, $this->ref_ref_cod_serie, $this->ref_cod_curso, $this->ref_cod_turma));
     while ($db->ProximoRegistro()) {
         list($cod_matricula, $ref_cod_aluno) = $db->Tupla();
         // Seleciona a série da sequência de séries
         $prox_mod = $db2->campoUnico(sprintf("SELECT\n          ref_serie_destino\n        FROM\n          pmieducar.sequencia_serie\n        WHERE\n          ref_serie_origem = '%d' AND ativo = '1'", $this->ref_ref_cod_serie));
         // Seleciona o código do curso da série de sequência
         $ref_cod_curso = $db2->CampoUnico(sprintf("SELECT ref_cod_curso FROM pmieducar.serie WHERE cod_serie = %d", $prox_mod));
         if (is_numeric($prox_mod)) {
             // Atualiza a matrícula atual do aluno, para evitar que seja listada no cadastro deste
             $db2->Consulta(sprintf("UPDATE pmieducar.matricula SET ultima_matricula = '0' WHERE cod_matricula = '%d'", $cod_matricula));
             // Cria uma nova matrícula
             $db2->Consulta(sprintf("\n          INSERT INTO pmieducar.matricula\n            (ref_ref_cod_escola, ref_ref_cod_serie, ref_usuario_cad, ref_cod_aluno, aprovado, data_cadastro, ano, ref_cod_curso, ultima_matricula)\n          VALUES\n            ('%d', '%d', '%d', '%d', '3', 'NOW()', '%d', '%d', '1')", $this->ref_cod_escola, $prox_mod, $this->pessoa_logada, $ref_cod_aluno, $ano, $ref_cod_curso));
         }
     }
     // Seleciona todos os alunos que foram reprovados na turma/série/curso/escola informados
     $db->Consulta(sprintf("\n      SELECT\n        cod_matricula, ref_cod_aluno, ref_ref_cod_serie\n      FROM\n        pmieducar.matricula, pmieducar.matricula_turma\n      WHERE\n        aprovado = '2' AND ref_ref_cod_escola = '%d' AND ref_ref_cod_serie='%d' AND cod_matricula = ref_cod_matricula AND ref_cod_turma = '%d'", $this->ref_cod_escola, $this->ref_ref_cod_serie, $this->ref_cod_turma));
     // Cria uma nova matrícula para cada aluno reprovado na mesma série/curso/escola informados
     while ($db->ProximoRegistro()) {
         list($cod_matricula, $ref_cod_aluno, $ref_cod_serie) = $db->Tupla();
         $db2->Consulta(sprintf("UPDATE pmieducar.matricula SET ultima_matricula = '0'\n        WHERE cod_matricula = '%d'", $cod_matricula));
         $db2->Consulta(sprintf("INSERT INTO pmieducar.matricula\n          (ref_ref_cod_escola, ref_ref_cod_serie, ref_usuario_cad, ref_cod_aluno, aprovado, data_cadastro, ano, ref_cod_curso, ultima_matricula)\n        VALUES\n          ('%d', '%d', '%d', '%d', '3', 'NOW()', '%d', '%d', '1')", $this->ref_cod_escola, $ref_cod_serie, $this->pessoa_logada, $ref_cod_aluno, $ano, $this->ref_cod_curso));
     }
     $this->mensagem = "Rematrícula efetuada com sucesso!";
     return TRUE;
 }
Exemplo n.º 12
0
 function Gerar()
 {
     @session_start();
     $_SESSION["campo"] = $_GET["campo"] ? $_GET["campo"] : $_SESSION["campo"];
     $this->nome = "form1";
     $this->titulo = "Not&iacute;cias";
     $this->addCabecalhos(array("Selecionar", "Data", "T&iacute;tulo", "Criador"));
     $objPessoa = new clsPessoaFisica();
     $db = new clsBanco();
     $limite = 10;
     $iniciolimit = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $limite - $limite : 0;
     $total = $db->CampoUnico("SELECT count(*) FROM not_portal");
     $db->Consulta("SELECT n.ref_ref_cod_pessoa_fj, cod_not_portal, n.data_noticia, n.titulo, n.descricao FROM not_portal n ORDER BY n.data_noticia DESC LIMIT {$iniciolimit},{$limite}");
     while ($db->ProximoRegistro()) {
         list($cod_pessoa, $id_noticia, $data, $titulo, $descricao) = $db->Tupla();
         list($nome) = $objPessoa->queryRapida($cod_pessoa, "nome");
         $data = date('d/m/Y', strtotime(substr($data, 0, 19)));
         $campo = @$_GET['campo'];
         $this->addLinhas(array("<center><a href='javascript:void(0);' onclick='javascript:retorna(\"{$this->nome}\", \"{$campo}\", \"{$id_noticia}\")'><img  width='20' height='20' src='imagens/noticia.jpg' border=0>", $data, $titulo, $nome . " " . $sobrenome));
     }
     $this->addPaginador2("add_noticias.php", $total, $_GET, $this->nome, $limite);
     $this->largura = "100%";
 }
 /**
  * Retorna uma lista de registros filtrados de acordo com os parâmetros.
  * @return array
  */
 function lista($int_ref_cod_matricula = NULL, $int_ref_cod_serie = NULL, $int_ref_cod_escola = NULL, $int_ref_cod_disciplina = NULL, $int_ref_usuario_exc = NULL, $int_ref_usuario_cad = NULL, $int_ref_cod_tipo_dispensa = NULL, $date_data_cadastro_ini = NULL, $date_data_cadastro_fim = NULL, $date_data_exclusao_ini = NULL, $date_data_exclusao_fim = NULL, $int_ativo = NULL, $str_observacao = NULL)
 {
     $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}";
     $filtros = '';
     $whereAnd = ' WHERE ';
     if (is_numeric($int_ref_cod_matricula)) {
         $filtros .= "{$whereAnd} ref_cod_matricula = '{$int_ref_cod_matricula}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_ref_cod_serie)) {
         $filtros .= "{$whereAnd} ref_cod_serie = '{$int_ref_cod_serie}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_ref_cod_escola)) {
         $filtros .= "{$whereAnd} ref_cod_escola = '{$int_ref_cod_escola}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_ref_cod_disciplina)) {
         $filtros .= "{$whereAnd} ref_cod_disciplina = '{$int_ref_cod_disciplina}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_ref_usuario_exc)) {
         $filtros .= "{$whereAnd} ref_usuario_exc = '{$int_ref_usuario_exc}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_ref_usuario_cad)) {
         $filtros .= "{$whereAnd} ref_usuario_cad = '{$int_ref_usuario_cad}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_ref_cod_tipo_dispensa)) {
         $filtros .= "{$whereAnd} ref_cod_tipo_dispensa = '{$int_ref_cod_tipo_dispensa}'";
         $whereAnd = ' AND ';
     }
     if (is_string($date_data_cadastro_ini)) {
         $filtros .= "{$whereAnd} data_cadastro >= '{$date_data_cadastro_ini}'";
         $whereAnd = ' AND ';
     }
     if (is_string($date_data_cadastro_fim)) {
         $filtros .= "{$whereAnd} data_cadastro <= '{$date_data_cadastro_fim}'";
         $whereAnd = ' AND ';
     }
     if (is_string($date_data_exclusao_ini)) {
         $filtros .= "{$whereAnd} data_exclusao >= '{$date_data_exclusao_ini}'";
         $whereAnd = ' AND ';
     }
     if (is_string($date_data_exclusao_fim)) {
         $filtros .= "{$whereAnd} data_exclusao <= '{$date_data_exclusao_fim}'";
         $whereAnd = ' AND ';
     }
     if (is_null($int_ativo) || $int_ativo) {
         $filtros .= "{$whereAnd} ativo = '1'";
         $whereAnd = ' AND ';
     } else {
         $filtros .= "{$whereAnd} ativo = '0'";
         $whereAnd = ' AND ';
     }
     if (is_string($str_observacao)) {
         $filtros .= "{$whereAnd} observacao LIKE '%{$str_observacao}%'";
         $whereAnd = ' AND ';
     }
     $db = new clsBanco();
     $countCampos = count(explode(',', $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return FALSE;
 }
 /**
  * Retorna uma lista filtrados de acordo com os parametros
  * 
  * @param integer int_ano
  * @param integer int_num_entidade
  * @param string str_valor
  *
  * @return array
  */
 function lista($int_ano = null, $int_num_entidade = null, $str_valor = null)
 {
     $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}";
     $filtros = "";
     $whereAnd = " WHERE ";
     if (is_numeric($int_cod_aplicacao)) {
         $filtros .= "{$whereAnd} cod_aplicacao = '{$int_cod_aplicacao}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ano)) {
         $filtros .= "{$whereAnd} ano = '{$int_ano}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_num_entidade)) {
         $filtros .= "{$whereAnd} num_entidade = '{$int_num_entidade}'";
         $whereAnd = " AND ";
     }
     if (is_string($str_valor)) {
         $filtros .= "{$whereAnd} valor LIKE '%{$str_valor}%'";
         $whereAnd = " AND ";
     }
     $db = new clsBanco();
     $countCampos = count(explode(",", $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return false;
 }
Exemplo n.º 15
0
 /**
  * Retorna uma lista filtrados de acordo com os parametros
  *
  * @return array
  */
 function listaPesquisaCliente($int_cod_cliente = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_idpes = null, $int_login = null, $str_senha = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $str_nm_cliente = null, $int_ref_cod_biblioteca = null)
 {
     $sql = "SELECT {$this->_campos_lista}, ct.ref_cod_biblioteca, p.nome FROM {$this->_tabela} c, {$this->_schema}cliente_tipo_cliente ctc, {$this->_schema}cliente_tipo ct, cadastro.pessoa p";
     $filtros = "";
     $whereAnd = " WHERE c.cod_cliente = ctc.ref_cod_cliente AND ctc.ref_cod_cliente_tipo = ct.cod_cliente_tipo AND c.ref_idpes = p.idpes AND";
     if (is_numeric($int_cod_cliente)) {
         $filtros .= "{$whereAnd} c.cod_cliente = '{$int_cod_cliente}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_exc)) {
         $filtros .= "{$whereAnd} c.ref_usuario_exc = '{$int_ref_usuario_exc}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_cad)) {
         $filtros .= "{$whereAnd} c.ref_usuario_cad = '{$int_ref_usuario_cad}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_idpes)) {
         $filtros .= "{$whereAnd} c.ref_idpes = '{$int_ref_idpes}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_login)) {
         $filtros .= "{$whereAnd} c.login = '******'";
         $whereAnd = " AND ";
     }
     if (is_string($str_senha)) {
         $filtros .= "{$whereAnd} c.senha = '{$str_senha}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_ini)) {
         $filtros .= "{$whereAnd} c.data_cadastro >= '{$date_data_cadastro_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_fim)) {
         $filtros .= "{$whereAnd} c.data_cadastro <= '{$date_data_cadastro_fim}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_ini)) {
         $filtros .= "{$whereAnd} c.data_exclusao >= '{$date_data_exclusao_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_fim)) {
         $filtros .= "{$whereAnd} c.data_exclusao <= '{$date_data_exclusao_fim}'";
         $whereAnd = " AND ";
     }
     if (is_null($int_ativo) || $int_ativo) {
         $filtros .= "{$whereAnd} c.ativo = '1'";
         $whereAnd = " AND ";
     } else {
         $filtros .= "{$whereAnd} c.ativo = '0'";
         $whereAnd = " AND ";
     }
     if (is_string($str_nm_cliente)) {
         $filtros .= "{$whereAnd} p.nome LIKE '%{$str_nm_cliente}%'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_biblioteca)) {
         $filtros .= "{$whereAnd} ct.ref_cod_biblioteca = '{$int_ref_cod_biblioteca}'";
         $whereAnd = " AND ";
     }
     $db = new clsBanco();
     $countCampos = count(explode(",", $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} c, {$this->_schema}cliente_tipo_cliente ctc, {$this->_schema}cliente_tipo ct, cadastro.pessoa p {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return false;
 }
 /**
  * Retorna um character dizendo se o servidor está afastado (campo sequencial) ou não (0)
  *
  * @return array
  */
 function afastado($int_ref_cod_servidor = null, $int_ref_cod_instituicao = null)
 {
     if (is_numeric($int_ref_cod_servidor) && is_numeric($int_ref_cod_instituicao)) {
         $db = new clsBanco();
         return $db->CampoUnico("SELECT CASE WHEN MAX( sa.sequencial ) > 0 THEN MAX( sa.sequencial )\n\t\t\t\t\t\t\t\t\t\t    ELSE 0\n\t\t\t\t\t\t\t\t\t\t    END\n\t\t\t\t\t\t\t\t\t   FROM pmieducar.servidor_afastamento sa\n\t\t\t\t\t\t\t\t\t  WHERE sa.ref_cod_servidor \t   = {$int_ref_cod_servidor}\n\t\t\t\t\t\t\t\t\t\tAND sa.ref_ref_cod_instituicao = {$int_ref_cod_instituicao}\n\t\t\t\t\t\t\t\t\t\tAND (sa.data_retorno            IS NULL\n\t\t\t\t\t\t\t\t\t\t   OR sa.data_retorno          > NOW() )\n\t\t\t\t\t\t\t\t\t\tAND sa.ativo                   = 1");
     }
     return false;
 }
 /**
  * Retorna a maior data dos modulos de uma escola e ano
  *
  * @return array
  */
 function maiorData($ref_ano, $ref_ref_cod_escola)
 {
     if (is_numeric($ref_ano) && is_numeric($ref_ref_cod_escola)) {
         $db = new clsBanco();
         $resultado = $db->CampoUnico("SELECT\n\t\t\t\t\t\t\t\tMAX( data_fim )\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tpmieducar.ano_letivo_modulo\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tref_ano = '{$ref_ano}'\n\t\t\t\t\t\t\t\tAND ref_ref_cod_escola = '{$ref_ref_cod_escola}'");
         return $resultado;
     }
     return false;
 }
 function dadosAlunosNaoEnturmados($ref_cod_escola = NULL, $ref_cod_serie = NULL, $ref_cod_curso = NULL, $int_ano = NULL, $verificar_multiseriado = FALSE, $semestre = NULL)
 {
     if (is_numeric($int_ano) && (is_numeric($ref_cod_escola) || is_numeric($ref_cod_serie) || is_numeric($ref_cod_curso))) {
         $db = new clsBanco();
         $complemento_sql = '';
         if ($verificar_multiseriado) {
             $complemento_sql = ", m.ref_ref_cod_escola\n                  , m.cod_matricula";
         }
         $sql = "\n      SELECT\n        a.cod_aluno\n        , p.nome\n        , m.ref_ref_cod_serie\n        , s.ref_cod_curso\n        , s.nm_serie\n        , c.nm_curso\n        , f.sexo\n        , f.data_nasc\n        , a.tipo_responsavel\n        {$complemento_sql}\n      FROM\n        pmieducar.matricula m\n        , pmieducar.aluno a\n        , cadastro.pessoa p\n        , cadastro.fisica f\n        , pmieducar.curso c\n        , pmieducar.serie s\n      WHERE\n        m.cod_matricula NOT IN\n        (\n          SELECT\n            ref_cod_matricula\n          FROM\n            pmieducar.matricula_turma mt\n            , pmieducar.turma t\n          WHERE\n            t.cod_turma = mt.ref_cod_turma\n            AND mt.ativo = '1'\n            AND m.ref_cod_curso = t.ref_cod_curso\n            AND m.ref_ref_cod_serie = t.ref_ref_cod_serie\n        )\n        AND a.ref_idpes = p.idpes\n        AND p.idpes = f.idpes\n        AND a.cod_aluno = m.ref_cod_aluno\n        AND m.ref_ref_cod_serie = s.cod_serie\n        AND s.ref_cod_curso = c.cod_curso\n        AND m.ativo = '1'\n        AND m.ano = '{$int_ano}'\n        AND m.aprovado IN (1,2,3)\n        AND m.ultima_matricula = '1'";
         if ($ref_cod_curso) {
             $sql .= " AND m.ref_cod_curso = '{$ref_cod_curso}'";
         }
         if ($ref_cod_serie) {
             $sql .= " AND m.ref_ref_cod_serie = '{$ref_cod_serie}'";
         }
         if ($ref_cod_escola) {
             $sql .= " AND m.ref_ref_cod_escola = '{$ref_cod_escola}'";
         }
         if (is_numeric($semestre)) {
             $sql .= " AND m.semestre = {$semestre} ";
         }
         $db->Consulta($sql . $this->getOrderby());
         $resultado = array();
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             if ($verificar_multiseriado) {
                 if (is_numeric($tupla["ref_ref_cod_serie"]) && is_numeric($tupla["ref_ref_cod_escola"]) && is_numeric($tupla["cod_matricula"])) {
                     $sql = "SELECT\n                  1\n                FROM\n                  pmieducar.matricula_turma mt,\n                  pmieducar.turma t\n                WHERE\n                  mt.ativo = 1\n                  AND t.ativo = 1\n                  AND t.ref_ref_cod_serie_mult = {$tupla["ref_ref_cod_serie"]}\n                  AND t.ref_ref_cod_escola = {$tupla["ref_ref_cod_escola"]}\n                  AND t.cod_turma = mt.ref_cod_turma\n                  AND mt.ref_cod_matricula = {$tupla["cod_matricula"]}";
                     $db3 = new clsBanco();
                     $aluno_esta_enturmado = $db3->CampoUnico($sql);
                 }
                 if (!is_numeric($aluno_esta_enturmado)) {
                     $resultado[] = $tupla;
                 }
             } else {
                 $resultado[] = $tupla;
             }
         }
         return $resultado;
     }
     return FALSE;
 }
Exemplo n.º 19
0
 /**
  * Retorna uma lista de registros filtrados de acordo com os parâmetros.
  *
  * @param int     $int_idmun
  * @param string  $str_geom
  * @param string  $str_nome
  * @param int     $int_idpes_rev
  * @param string  $date_data_rev_ini
  * @param string  $date_data_rev_fim
  * @param string  $str_origem_gravacao
  * @param int     $int_idpes_cad
  * @param string  $date_data_cad_ini
  * @param string  $date_data_cad_fim
  * @param string  $str_operacao
  * @param int     $int_idsis_rev
  * @param int     $int_idsis_cad
  * @param int     $zona_localizacao
  * @return array
  */
 function lista($int_idmun = NULL, $str_geom = NULL, $str_nome = NULL, $int_idpes_rev = NULL, $date_data_rev_ini = NULL, $date_data_rev_fim = NULL, $str_origem_gravacao = NULL, $int_idpes_cad = NULL, $date_data_cad_ini = NULL, $date_data_cad_fim = NULL, $str_operacao = NULL, $int_idsis_rev = NULL, $int_idsis_cad = NULL, $int_idpais = NULL, $str_sigla_uf = NULL, $int_idbai = NULL, $zona_localizacao = NULL)
 {
     $select = ', m.nome AS nm_municipio, m.sigla_uf, u.nome AS nm_estado, u.idpais, p.nome AS nm_pais ';
     $from = 'b, public.municipio m, public.uf u, public.pais p ';
     $sql = sprintf('SELECT %s %s FROM %s %s', $this->_campos_lista, $select, $this->_tabela, $from);
     $whereAnd = ' AND ';
     $filtros = ' WHERE b.idmun = m.idmun AND m.sigla_uf = u.sigla_uf AND u.idpais = p.idpais ';
     if (is_numeric($int_idmun)) {
         $filtros .= "{$whereAnd} b.idmun = '{$int_idmun}'";
         $whereAnd = ' AND ';
     }
     if (is_string($str_geom)) {
         $filtros .= "{$whereAnd} b.geom LIKE '%{$str_geom}%'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_idbai)) {
         $filtros .= "{$whereAnd} b.idbai = '{$int_idbai}'";
         $whereAnd = ' AND ';
     }
     if (is_string($str_nome)) {
         $filtros .= "{$whereAnd} b.nome LIKE '%{$str_nome}%'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_idpes_rev)) {
         $filtros .= "{$whereAnd} b.idpes_rev = '{$int_idpes_rev}'";
         $whereAnd = ' AND ';
     }
     if (is_string($date_data_rev_ini)) {
         $filtros .= "{$whereAnd} b.data_rev >= '{$date_data_rev_ini}'";
         $whereAnd = ' AND ';
     }
     if (is_string($date_data_rev_fim)) {
         $filtros .= "{$whereAnd} b.data_rev <= '{$date_data_rev_fim}'";
         $whereAnd = ' AND ';
     }
     if (is_string($str_origem_gravacao)) {
         $filtros .= "{$whereAnd} b.origem_gravacao LIKE '%{$str_origem_gravacao}%'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_idpes_cad)) {
         $filtros .= "{$whereAnd} b.idpes_cad = '{$int_idpes_cad}'";
         $whereAnd = ' AND ';
     }
     if (is_string($date_data_cad_ini)) {
         $filtros .= "{$whereAnd} b.data_cad >= '{$date_data_cad_ini}'";
         $whereAnd = ' AND ';
     }
     if (is_string($date_data_cad_fim)) {
         $filtros .= "{$whereAnd} b.data_cad <= '{$date_data_cad_fim}'";
         $whereAnd = ' AND ';
     }
     if (is_string($str_operacao)) {
         $filtros .= "{$whereAnd} b.operacao LIKE '%{$str_operacao}%'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_idsis_rev)) {
         $filtros .= "{$whereAnd} b.idsis_rev = '{$int_idsis_rev}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_idsis_cad)) {
         $filtros .= "{$whereAnd} b.idsis_cad = '{$int_idsis_cad}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($zona_localizacao)) {
         $filtros .= "{$whereAnd} b.zona_localizacao = '{$zona_localizacao}'";
         $whereAnd = ' AND ';
     }
     if (is_numeric($int_idpais)) {
         $filtros .= "{$whereAnd} p.idpais = '{$int_idpais}'";
         $whereAnd = ' AND ';
     }
     if (is_string($str_sigla_uf)) {
         $filtros .= "{$whereAnd} u.sigla_uf = '{$str_sigla_uf}'";
         $whereAnd = ' AND ';
     }
     $db = new clsBanco();
     $countCampos = count(explode(', ', $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico(sprintf('SELECT COUNT(0) FROM %s %s %s', $this->_tabela, $from, $filtros));
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla['_total'] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return FALSE;
 }
 $lst_matricula_turma = $obj_matricula_turma->dadosAlunosNaoEnturmados($ref_cod_escola, $ref_ref_cod_serie, $ref_cod_curso, $ano, true, $semestre);
 if (is_array($lst_matricula_turma)) {
     $total = count($lst_matricula_turma);
     $relatorio = new relatorios("RELAÇÃO DOS ALUNOS NÃO ENTURMADOS   -   Ano {$ano}                                    Total de Alunos = {$total}", 120, false, "i-Educar", "A4", "Prefeitura COBRA Tecnologia\nSecretaria da Educação\n\n" . date("d/m/Y"), "#515151");
     $relatorio->setMargem(20, 20, 50, 50);
     $relatorio->exibe_produzido_por = false;
     $relatorio->novalinha(array("Cód. Aluno", "Nome do Aluno", "Data Nascimento", "Nome do Responsável"), 0, 16, true, "arial", array(75, 175, 100), "#515151", "#d3d3d3", "#FFFFFF", false, true);
     $cod_curso = 0;
     $cod_serie = 0;
     $db = new clsBanco();
     foreach ($lst_matricula_turma as $matriculas) {
         if ($cod_serie != $matriculas['ref_ref_cod_serie']) {
             $cod_curso = $matriculas['ref_cod_curso'];
             $cod_serie = $matriculas['ref_ref_cod_serie'];
             $consulta = "SELECT count(1)\n\t\t\t\t\t\t\t\t\t\t   FROM pmieducar.matricula m\n\t\t\t\t\t\t\t\t\t\t  WHERE m.ativo  = 1\n\t\t\t\t\t\t\t\t\t\t    AND ultima_matricula = 1\n\t\t\t\t\t\t\t\t\t\t    AND m.aprovado IN (1,2,3)\n\t\t\t\t\t\t\t\t\t\t    AND ano = {$ano}\n\t\t\t\t\t\t\t\t\t\t\tAND ref_cod_curso = {$cod_curso}\n\t\t\t\t\t\t\t\t\t\t\tAND ref_ref_cod_escola = {$ref_cod_escola}\n\t\t\t\t\t\t\t\t\t\t\tAND ref_ref_cod_serie = {$cod_serie}\n\t\t\t\t\t\t\t\t\t\t\tAND NOT EXISTS ( SELECT DISTINCT 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   FROM pmieducar.matricula_turma mt\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  WHERE mt.ref_cod_matricula = m.cod_matricula\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    AND mt.ativo = 1 )\n\t\t\t\t\t\t\t\t\t\t";
             $total_alunos = (int) $db->CampoUnico($consulta);
             $relatorio->novalinha(array("{$matriculas['nm_curso']}  -  {$matriculas['nm_serie']}              Total Alunos:{$total_alunos}"), 0, 16, true, "arial", array(400), "#515151", "#d3d3d3", "#FFFFFF", false, true);
         } else {
             if ($cod_curso != $matriculas['ref_cod_curso']) {
                 $cod_curso = $matriculas['ref_cod_curso'];
                 $cod_serie = $matriculas['ref_ref_cod_serie'];
                 $consulta = "SELECT count(1)\n\t\t\t\t\t\t\t\t\t\t   FROM pmieducar.matricula m\n\t\t\t\t\t\t\t\t\t\t  WHERE m.ativo  = 1\n\t\t\t\t\t\t\t\t\t\t    AND ultima_matricula = 1\n\t\t\t\t\t\t\t\t\t\t    AND m.aprovado IN (1,2,3)\n\t\t\t\t\t\t\t\t\t\t    AND ano = {$ano}\n\t\t\t\t\t\t\t\t\t\t\tAND ref_cod_curso = {$cod_curso}\n\t\t\t\t\t\t\t\t\t\t\tAND ref_ref_cod_escola = {$ref_cod_escola}\n\t\t\t\t\t\t\t\t\t\t\tAND ref_ref_cod_serie = {$cod_serie}\n\t\t\t\t\t\t\t\t\t\t\tAND NOT EXISTS ( SELECT DISTINCT 1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t   FROM pmieducar.matricula_turma mt\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t  WHERE mt.ref_cod_matricula = m.cod_matricula\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t    AND mt.ativo = 1 )\n\t\t\t\t\t\t\t\t\t\t";
                 $total_alunos = (int) $db->CampoUnico($consulta);
                 $relatorio->novalinha(array("{$matriculas['nm_curso']}  -  {$matriculas['nm_serie']}              Total Alunos:{$total_alunos}"), 0, 16, true, "arial", array(400), "#515151", "#d3d3d3", "#FFFFFF", false, true);
             }
         }
         $obj_aluno = new clsPmieducarAluno($matriculas['cod_aluno']);
         $det_aluno = $obj_aluno->getResponsavelAluno();
         if ($matriculas['data_nasc']) {
             $matriculas['data_nasc'] = dataFromPgToBr($matriculas['data_nasc']);
         }
 /**
  * Retorna uma lista filtrados de acordo com os parametros
  *
  * @return array
  */
 function lista($int_ref_cod_escola = null, $int_ano = null, $int_ref_usuario_cad = null, $int_ref_usuario_exc = null, $int_num_dias = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null)
 {
     $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}";
     $filtros = "";
     $whereAnd = " WHERE ";
     if (is_numeric($int_ref_cod_escola)) {
         $filtros .= "{$whereAnd} ref_cod_escola = '{$int_ref_cod_escola}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ano)) {
         $filtros .= "{$whereAnd} ano = '{$int_ano}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_cad)) {
         $filtros .= "{$whereAnd} ref_usuario_cad = '{$int_ref_usuario_cad}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_exc)) {
         $filtros .= "{$whereAnd} ref_usuario_exc = '{$int_ref_usuario_exc}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_num_dias)) {
         $filtros .= "{$whereAnd} num_dias = '{$int_num_dias}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_ini)) {
         $filtros .= "{$whereAnd} data_cadastro >= '{$date_data_cadastro_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_fim)) {
         $filtros .= "{$whereAnd} data_cadastro <= '{$date_data_cadastro_fim}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_ini)) {
         $filtros .= "{$whereAnd} data_exclusao >= '{$date_data_exclusao_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_fim)) {
         $filtros .= "{$whereAnd} data_exclusao <= '{$date_data_exclusao_fim}'";
         $whereAnd = " AND ";
     }
     if (is_null($int_ativo) || $int_ativo) {
         $filtros .= "{$whereAnd} ativo = '1'";
         $whereAnd = " AND ";
     } else {
         $filtros .= "{$whereAnd} ativo = '0'";
         $whereAnd = " AND ";
     }
     $db = new clsBanco();
     $countCampos = count(explode(",", $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return false;
 }
 /**
  * Retorna uma lista filtrados de acordo com os parametros
  *
  * @return array
  */
 function lista($int_ref_cod_biblioteca = null, $int_dia = null)
 {
     $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}";
     $filtros = "";
     $whereAnd = " WHERE ";
     if (is_numeric($int_ref_cod_biblioteca)) {
         $filtros .= "{$whereAnd} ref_cod_biblioteca = '{$int_ref_cod_biblioteca}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_dia)) {
         $filtros .= "{$whereAnd} dia = '{$int_dia}'";
         $whereAnd = " AND ";
     }
     $db = new clsBanco();
     $countCampos = count(explode(",", $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return false;
 }
Exemplo n.º 23
0
 function Excluir()
 {
     if (is_numeric($this->cod_diaria_grupo)) {
         $db = new clsBanco();
         $ref_cod_diaria = $db->CampoUnico("SELECT ref_cod_diaria_grupo FROM pmidrh.diaria WHERE ref_cod_diaria_grupo = {$this->cod_diaria_grupo}");
         $ref_cod_diaria_valores = $db->CampoUnico("SELECT ref_cod_diaria_grupo FROM pmidrh.diaria_valores WHERE ref_cod_diaria_grupo = {$this->cod_diaria_grupo}");
         if (!isset($ref_cod_diaria)) {
             if (!isset($ref_cod_diaria_valores)) {
                 $db->Consulta("DELETE FROM pmidrh.diaria_grupo WHERE cod_diaria_grupo = {$this->cod_diaria_grupo}");
                 header("location: diaria_grupo_lst.php");
                 die;
                 return true;
             } else {
                 $this->mensagem = "Código da diária está sendo utilizado na tabela diaria_valores.";
             }
         } else {
             $this->mensagem = "Código da diária está sendo utilizado na tabela diaria.";
         }
     }
     return false;
 }
 function getSequencialFechamento($matriculaId, $turmaId, $dataEnturmacao)
 {
     $db = new clsBanco();
     $possui_fechamento = $db->CampoUnico("SELECT data_fechamento FROM pmieducar.turma WHERE cod_turma = {$turmaId}");
     if (is_string($possui_fechamento)) {
         if (strtotime($possui_fechamento) < strtotime($dataEnturmacao)) {
             return $db->CampoUnico("SELECT MAX(sequencial_fechamento)+1 FROM {$this->_tabela} where ref_cod_turma = {$turmaId}");
         } else {
             return 0;
         }
     } else {
         return 0;
     }
 }
 /**
  * Retorna uma lista filtrados de acordo com os parametros
  *
  * @return array
  */
 function lista_com_acervos($int_cod_exemplar = null, $int_ref_cod_fonte = null, $int_ref_cod_motivo_baixa = null, $int_ref_cod_acervo = null, $int_ref_cod_situacao = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_permite_emprestimo = null, $int_preco = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $date_data_aquisicao_ini = null, $date_data_aquisicao_fim = null, $int_ref_exemplar_tipo = null, $str_titulo_livro = null, $int_ref_cod_biblioteca = null, $int_ref_cod_instituicao = null, $int_ref_cod_escola = null, $int_ref_cod_acervo_colecao = null, $int_ref_cod_acervo_editora = null, $tombo)
 {
     $sql = "SELECT {$this->_campos_lista}, a.ref_cod_biblioteca, a.titulo FROM {$this->_tabela} e, {$this->_schema}acervo a, {$this->_schema}biblioteca b";
     $whereAnd = " AND";
     $filtros = " WHERE e.ref_cod_acervo = a.cod_acervo AND a.ref_cod_biblioteca = b.cod_biblioteca ";
     if (is_numeric($int_cod_exemplar)) {
         $filtros .= "{$whereAnd} e.cod_exemplar = '{$int_cod_exemplar}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_fonte)) {
         $filtros .= "{$whereAnd} e.ref_cod_fonte = '{$int_ref_cod_fonte}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_motivo_baixa)) {
         $filtros .= "{$whereAnd} e.ref_cod_motivo_baixa = '{$int_ref_cod_motivo_baixa}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_acervo)) {
         $filtros .= "{$whereAnd} e.ref_cod_acervo = '{$int_ref_cod_acervo}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_situacao)) {
         $filtros .= "{$whereAnd} e.ref_cod_situacao = '{$int_ref_cod_situacao}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_exc)) {
         $filtros .= "{$whereAnd} e.ref_usuario_exc = '{$int_ref_usuario_exc}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_cad)) {
         $filtros .= "{$whereAnd} e.ref_usuario_cad = '{$int_ref_usuario_cad}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_permite_emprestimo)) {
         $filtros .= "{$whereAnd} e.permite_emprestimo = '{$int_permite_emprestimo}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_preco)) {
         $filtros .= "{$whereAnd} e.preco = '{$int_preco}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_ini)) {
         $filtros .= "{$whereAnd} e.data_cadastro >= '{$date_data_cadastro_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_fim)) {
         $filtros .= "{$whereAnd} e.data_cadastro <= '{$date_data_cadastro_fim}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_ini)) {
         $filtros .= "{$whereAnd} e.data_exclusao >= '{$date_data_exclusao_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_fim)) {
         $filtros .= "{$whereAnd} e.data_exclusao <= '{$date_data_exclusao_fim}'";
         $whereAnd = " AND ";
     }
     if (is_null($int_ativo) || $int_ativo) {
         $filtros .= "{$whereAnd} e.ativo = '1'";
         $whereAnd = " AND ";
     } else {
         $filtros .= "{$whereAnd} e.ativo = '0'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_aquisicao_ini)) {
         $filtros .= "{$whereAnd} e.data_aquisicao >= '{$date_data_aquisicao_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_aquisicao_fim)) {
         $filtros .= "{$whereAnd} e.data_aquisicao <= '{$date_data_aquisicao_fim}'";
         $whereAnd = " AND ";
     }
     if (is_string($str_titulo_livro)) {
         $filtros .= "{$whereAnd} to_ascii(a.titulo) LIKE to_ascii('%{$str_titulo_livro}%')";
         $whereAnd = " AND ";
     }
     if (is_numeric($tombo)) {
         $filtros .= "{$whereAnd} e.tombo = {$tombo}";
         $whereAnd = " AND ";
     }
     /**
      * INICIO  - PESQUISAS EXTRAS
      */
     $whereAnd2 = " AND ";
     $filtros_extra = null;
     if (is_numeric($int_ref_exemplar_tipo)) {
         $filtros_extra .= "{$whereAnd} a.ref_cod_exemplar_tipo = {$int_ref_exemplar_tipo}";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_biblioteca)) {
         $filtros_extra .= "{$whereAnd} a.ref_cod_biblioteca = {$int_ref_cod_biblioteca}";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_instituicao)) {
         $filtros_extra .= "{$whereAnd} b.ref_cod_instituicao = {$int_ref_cod_instituicao}";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_escola)) {
         $filtros_extra .= "{$whereAnd} b.ref_cod_escola = {$int_ref_cod_escola}";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_acervo_colecao)) {
         $filtros_extra .= "{$whereAnd} a.ref_cod_acervo_colecao = {$int_ref_cod_acervo_colecao}";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_acervo_editora)) {
         $filtros_extra .= "{$whereAnd} a.ref_cod_acervo_editora = {$int_ref_cod_acervo_editora}";
         $whereAnd = " AND ";
     }
     if ($filtros_extra) {
         $filtros .= "{$whereAnd} exists (SELECT 1 FROM pmieducar.acervo a where a.cod_acervo = e.ref_cod_acervo {$filtros_extra} )";
     }
     /**
      * FIM  - PESQUISAS EXTRAS
      */
     $db = new clsBanco();
     $countCampos = count(explode(",", $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} e, {$this->_schema}acervo a, {$this->_schema}biblioteca b {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return false;
 }
 /**
  * Retorna uma lista de registros filtrados de acordo com os parâmetros.
  * @return array
  */
 function lista($cod_tipo_veiculo = NULL, $descricao = NULL)
 {
     $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}";
     $filtros = "";
     $whereAnd = " WHERE ";
     if (is_numeric($cod_tipo_veiculo)) {
         $filtros .= "{$whereAnd} cod_tipo_veiculo = '{$cod_tipo_veiculo}'";
         $whereAnd = " AND ";
     }
     if (is_string($descricao)) {
         $filtros .= "{$whereAnd} TO_ASCII(LOWER(descricao)) LIKE TO_ASCII(LOWER('%{$descricao}%'))";
         $whereAnd = " AND ";
     }
     $db = new clsBanco();
     $countCampos = count(explode(',', $this->_campos_lista)) + 2;
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return FALSE;
 }
 /**
  * Retorna uma lista filtrados de acordo com os parametros
  *
  * @return array
  */
 function lista($int_ref_cod_aluno = null, $int_sequencial = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $str_nm_serie = null, $int_ano = null, $int_carga_horaria = null, $int_dias_letivos = null, $str_escola = null, $str_escola_cidade = null, $str_escola_uf = null, $str_observacao = null, $int_aprovado = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_faltas_globalizadas = null, $int_ref_cod_instituicao = null, $int_origem = null, $int_extra_curricular = null, $int_ref_cod_matricula = null, $int_frequencia = null)
 {
     $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}";
     $filtros = "";
     $whereAnd = " WHERE ";
     if (is_numeric($int_ref_cod_aluno)) {
         $filtros .= "{$whereAnd} ref_cod_aluno = '{$int_ref_cod_aluno}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_sequencial)) {
         $filtros .= "{$whereAnd} sequencial = '{$int_sequencial}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_exc)) {
         $filtros .= "{$whereAnd} ref_usuario_exc = '{$int_ref_usuario_exc}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_cad)) {
         $filtros .= "{$whereAnd} ref_usuario_cad = '{$int_ref_usuario_cad}'";
         $whereAnd = " AND ";
     }
     if (is_string($str_nm_serie)) {
         $filtros .= "{$whereAnd} nm_serie = '{$str_nm_serie}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_instituicao)) {
         $filtros .= "{$whereAnd} ref_cod_instituicao = '{$int_ref_cod_instituicao}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_origem)) {
         $filtros .= "{$whereAnd} origem = '{$int_origem}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_extra_curricular)) {
         $filtros .= "{$whereAnd} extra_curricular = '{$int_extra_curricular}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_matricula)) {
         $filtros .= "{$whereAnd} ref_cod_matricula = '{$int_ref_cod_matricula}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ano)) {
         $filtros .= "{$whereAnd} ano = '{$int_ano}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_carga_horaria)) {
         $filtros .= "{$whereAnd} carga_horaria = '{$int_carga_horaria}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_dias_letivos)) {
         $filtros .= "{$whereAnd} dias_letivos = '{$int_dias_letivos}'";
         $whereAnd = " AND ";
     }
     if (is_string($str_escola)) {
         $filtros .= "{$whereAnd} escola LIKE '%{$str_escola}%'";
         $whereAnd = " AND ";
     }
     if (is_string($str_escola_cidade)) {
         $filtros .= "{$whereAnd} escola_cidade LIKE '%{$str_escola_cidade}%'";
         $whereAnd = " AND ";
     }
     if (is_string($str_escola_uf)) {
         $filtros .= "{$whereAnd} escola_uf LIKE '%{$str_escola_uf}%'";
         $whereAnd = " AND ";
     }
     if (is_string($str_observacao)) {
         $filtros .= "{$whereAnd} observacao LIKE '%{$str_observacao}%'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_aprovado)) {
         $filtros .= "{$whereAnd} aprovado = '{$int_aprovado}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_ini)) {
         $filtros .= "{$whereAnd} data_cadastro >= '{$date_data_cadastro_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_fim)) {
         $filtros .= "{$whereAnd} data_cadastro <= '{$date_data_cadastro_fim}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_ini)) {
         $filtros .= "{$whereAnd} data_exclusao >= '{$date_data_exclusao_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_fim)) {
         $filtros .= "{$whereAnd} data_exclusao <= '{$date_data_exclusao_fim}'";
         $whereAnd = " AND ";
     }
     if (!is_null($int_ativo)) {
         if ($int_ativo) {
             $filtros .= "{$whereAnd} ativo = '1'";
             $whereAnd = " AND ";
         } else {
             $filtros .= "{$whereAnd} ativo = '0'";
             $whereAnd = " AND ";
         }
     }
     if (is_numeric($int_faltas_globalizadas)) {
         $filtros .= "{$whereAnd} faltas_globalizadas = '{$int_faltas_globalizadas}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_frequencia)) {
         $filtros .= "{$whereAnd} frequencia = '{$int_frequencia}'";
         $whereAnd = " AND ";
     }
     $db = new clsBanco();
     $countCampos = count(explode(",", $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}");
     //		echo $sql;
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return false;
 }
 /**
  * Retorna uma lista filtrados de acordo com os parametros
  * (Modificação da lista2, agora trazendo somente turmas do ano atual)
  * @return array
  */
 function lista3($int_cod_turma = null, $int_ref_usuario_exc = null, $int_ref_usuario_cad = null, $int_ref_ref_cod_serie = null, $int_ref_ref_cod_escola = null, $int_ref_cod_infra_predio_comodo = null, $str_nm_turma = null, $str_sgl_turma = null, $int_max_aluno = null, $int_multiseriada = null, $date_data_cadastro_ini = null, $date_data_cadastro_fim = null, $date_data_exclusao_ini = null, $date_data_exclusao_fim = null, $int_ativo = null, $int_ref_cod_turma_tipo = null, $time_hora_inicial_ini = null, $time_hora_inicial_fim = null, $time_hora_final_ini = null, $time_hora_final_fim = null, $time_hora_inicio_intervalo_ini = null, $time_hora_inicio_intervalo_fim = null, $time_hora_fim_intervalo_ini = null, $time_hora_fim_intervalo_fim = null, $int_ref_cod_curso = null, $int_ref_cod_instituicao = null, $int_ref_cod_regente = null, $int_ref_cod_instituicao_regente = null, $int_ref_ref_cod_escola_mult = null, $int_ref_ref_cod_serie_mult = null, $int_qtd_min_alunos_matriculados = null, $visivel = null, $turma_turno_id = null, $tipo_boletim = null, $ano = null)
 {
     $sql = "SELECT {$this->_campos_lista},c.nm_curso,s.nm_serie,i.nm_instituicao FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c, {$this->_schema}instituicao i ";
     $filtros = "";
     $whereAnd = " WHERE t.ref_cod_curso = c.cod_curso AND c.ref_cod_instituicao = i.cod_instituicao AND ";
     if (is_numeric($int_cod_turma)) {
         $filtros .= "{$whereAnd} t.cod_turma = '{$int_cod_turma}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_exc)) {
         $filtros .= "{$whereAnd} t.ref_usuario_exc = '{$int_ref_usuario_exc}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_usuario_cad)) {
         $filtros .= "{$whereAnd} t.ref_usuario_cad = '{$int_ref_usuario_cad}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_ref_cod_serie)) {
         $filtros .= "{$whereAnd} t.ref_ref_cod_serie = '{$int_ref_ref_cod_serie}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_ref_cod_escola)) {
         $filtros .= "{$whereAnd} t.ref_ref_cod_escola = '{$int_ref_ref_cod_escola}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_infra_predio_comodo)) {
         $filtros .= "{$whereAnd} t.ref_cod_infra_predio_comodo = '{$int_ref_cod_infra_predio_comodo}'";
         $whereAnd = " AND ";
     }
     if (is_string($str_nm_turma)) {
         $filtros .= "{$whereAnd} t.nm_turma LIKE '%{$str_nm_turma}%'";
         $whereAnd = " AND ";
     }
     if (is_string($str_sgl_turma)) {
         $filtros .= "{$whereAnd} t.sgl_turma LIKE '%{$str_sgl_turma}%'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_max_aluno)) {
         $filtros .= "{$whereAnd} t.max_aluno = '{$int_max_aluno}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_multiseriada)) {
         $filtros .= "{$whereAnd} t.multiseriada = '{$int_multiseriada}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_ini)) {
         $filtros .= "{$whereAnd} t.data_cadastro >= '{$date_data_cadastro_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_cadastro_fim)) {
         $filtros .= "{$whereAnd} t.data_cadastro <= '{$date_data_cadastro_fim}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_ini)) {
         $filtros .= "{$whereAnd} t.data_exclusao >= '{$date_data_exclusao_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_exclusao_fim)) {
         $filtros .= "{$whereAnd} t.data_exclusao <= '{$date_data_exclusao_fim}'";
         $whereAnd = " AND ";
     }
     if (is_null($int_ativo) || $int_ativo) {
         $filtros .= "{$whereAnd} t.ativo = '1'";
         $whereAnd = " AND ";
     } else {
         $filtros .= "{$whereAnd} t.ativo = '0'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_turma_tipo)) {
         $filtros .= "{$whereAnd} t.ref_cod_turma_tipo = '{$int_ref_cod_turma_tipo}'";
         $whereAnd = " AND ";
     }
     if ($time_hora_inicial_ini) {
         $filtros .= "{$whereAnd} t.hora_inicial >= '{$time_hora_inicial_ini}'";
         $whereAnd = " AND ";
     }
     if ($time_hora_inicial_fim) {
         $filtros .= "{$whereAnd} t.hora_inicial <= '{$time_hora_inicial_fim}'";
         $whereAnd = " AND ";
     }
     if ($time_hora_final_ini) {
         $filtros .= "{$whereAnd} t.hora_final >= '{$time_hora_final_ini}'";
         $whereAnd = " AND ";
     }
     if ($time_hora_final_fim) {
         $filtros .= "{$whereAnd} t.hora_final <= '{$time_hora_final_fim}'";
         $whereAnd = " AND ";
     }
     if ($time_hora_inicio_intervalo_ini) {
         $filtros .= "{$whereAnd} t.hora_inicio_intervalo >= '{$time_hora_inicio_intervalo_ini}'";
         $whereAnd = " AND ";
     }
     if ($time_hora_inicio_intervalo_fim) {
         $filtros .= "{$whereAnd} t.hora_inicio_intervalo <= '{$time_hora_inicio_intervalo_fim}'";
         $whereAnd = " AND ";
     }
     if ($time_hora_fim_intervalo_ini) {
         $filtros .= "{$whereAnd} t.hora_fim_intervalo >= '{$time_hora_fim_intervalo_ini}'";
         $whereAnd = " AND ";
     }
     if ($time_hora_fim_intervalo_fim) {
         $filtros .= "{$whereAnd} t.hora_fim_intervalo <= '{$time_hora_fim_intervalo_fim}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_regente)) {
         $filtros .= "{$whereAnd} t.ref_cod_regente = '{$int_ref_cod_regente}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_instituicao_regente)) {
         $filtros .= "{$whereAnd} t.ref_cod_instituicao_regente = '{$int_ref_cod_instituicao_regente}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_instituicao)) {
         $filtros .= "{$whereAnd} t.ref_cod_instituicao = '{$int_ref_cod_instituicao}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_curso)) {
         $filtros .= "{$whereAnd} t.ref_cod_curso = '{$int_ref_cod_curso}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_ref_cod_escola_mult)) {
         $filtros .= "{$whereAnd} t.ref_ref_cod_escola_mult = '{$int_ref_ref_cod_escola_mult}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_ref_cod_serie_mult)) {
         $filtros .= "{$whereAnd} t.int_ref_ref_cod_serie_mult = '{$int_ref_ref_cod_serie_mult}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_qtd_min_alunos_matriculados)) {
         $filtros .= "{$whereAnd} (SELECT COUNT(0) FROM pmieducar.matricula_turma WHERE ref_cod_turma = t.cod_turma) >= '{$int_qtd_min_alunos_matriculados}' ";
         $whereAnd = " AND ";
     }
     if (is_bool($visivel)) {
         if ($visivel) {
             $filtros .= "{$whereAnd} t.visivel = TRUE";
             $whereAnd = " AND ";
         } else {
             $filtros .= "{$whereAnd} t.visivel = FALSE";
             $whereAnd = " AND ";
         }
     } elseif (is_array($visivel) && count($visivel)) {
         $filtros .= "{$whereAnd} t.visivel IN (" . implode(",", $visivel) . ")";
         $whereAnd = " AND ";
     } else {
         $filtros .= "{$whereAnd} t.visivel = TRUE";
         $whereAnd = " AND ";
     }
     if (is_numeric($turma_turno_id)) {
         $filtros .= "{$whereAnd} t.turma_turno_id = '{$turma_turno_id}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($tipo_boletim)) {
         $filtros .= "{$whereAnd} t.tipo_boletim = '{$tipo_boletim}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($ano)) {
         $filtros .= "{$whereAnd} t.ano = '{$ano}'";
         $whereAnd = " AND ";
     }
     // Retirar OR quando todas turmas tiverem a coluna ANO definido.
     $filtros .= "{$whereAnd} t.ano = ( SELECT ano FROM pmieducar.escola_ano_letivo enl WHERE enl.ref_cod_escola = t.ref_ref_cod_escola AND andamento = 1)";
     $db = new clsBanco();
     $countCampos = count(explode(",", $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} t left outer join {$this->_schema}serie s on (t.ref_ref_cod_serie = s.cod_serie), {$this->_schema}curso c , {$this->_schema}instituicao i {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return false;
 }
 function Gerar()
 {
     global $coreExt;
     @session_start();
     $_SESSION['campo1'] = $_GET['campo1'] ? $_GET['campo1'] : $_SESSION['campo1'];
     $_SESSION['campo2'] = $_GET['campo2'] ? $_GET['campo2'] : $_SESSION['campo2'];
     $_SESSION['campo3'] = $_GET['campo3'] ? $_GET['campo3'] : $_SESSION['campo3'];
     $_SESSION['campo4'] = $_GET['campo4'] ? $_GET['campo4'] : $_SESSION['campo4'];
     $_SESSION['campo5'] = $_GET['campo5'] ? $_GET['campo5'] : $_SESSION['campo5'];
     $_SESSION['campo6'] = $_GET['campo6'] ? $_GET['campo6'] : $_SESSION['campo6'];
     $_SESSION['campo7'] = $_GET['campo7'] ? $_GET['campo7'] : $_SESSION['campo7'];
     $_SESSION['campo8'] = $_GET['campo8'] ? $_GET['campo8'] : $_SESSION['campo8'];
     $_SESSION['campo9'] = $_GET['campo9'] ? $_GET['campo9'] : $_SESSION['campo9'];
     $_SESSION['campo10'] = $_GET['campo10'] ? $_GET['campo10'] : $_SESSION['campo10'];
     $_SESSION['campo11'] = $_GET['campo11'] ? $_GET['campo11'] : $_SESSION['campo11'];
     $_SESSION['campo12'] = $_GET['campo12'] ? $_GET['campo12'] : $_SESSION['campo12'];
     $_SESSION['campo13'] = $_GET['campo13'] ? $_GET['campo13'] : $_SESSION['campo13'];
     $_SESSION['campo14'] = $_GET['campo14'] ? $_GET['campo14'] : $_SESSION['campo14'];
     $this->nome = 'form1';
     $this->funcao_js = sprintf('cv_libera_campos(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\')', $_SESSION['campo10'], $_SESSION['campo11'], $_SESSION['campo7'], $_SESSION['campo1'], $_SESSION['campo12'], $_SESSION['campo4'], $_SESSION['campo9'], $_SESSION['campo14']);
     $this->titulo = 'Endereço';
     // Paginador
     $limite = 7;
     $iniciolimit = $_GET['pagina_' . $this->nome] ? $_GET['pagina_' . $this->nome] * $limite - $limite : 0;
     // Filtros
     $this->campoTexto('nm_bairro', 'Bairro', $_GET['nm_bairro'], 40, 255);
     $this->campoCep('nr_cep', 'CEP', $_GET['nr_cep']);
     $this->campoTexto('nm_logradouro', 'Logradouro', $_GET['nm_logradouro'], 50, 255);
     $this->campoTexto('cidade', 'Cidade', $_GET['cidade'], 60, 60);
     $obj_uf = new clsUf(FALSE, FALSE, 1);
     $lst_uf = $obj_uf->lista(FALSE, FALSE, FALSE, FALSE, FALSE, 'sigla_uf');
     $array_uf;
     foreach ($lst_uf as $uf) {
         $array_uf[$uf['sigla_uf']] = $uf['nome'];
     }
     if (!$_GET['ref_sigla_uf']) {
         $_GET['ref_sigla_uf'] = $coreExt['Config']->app->locale->province;
     }
     $this->campoLista('ref_sigla_uf', 'UF', $array_uf, $_GET['ref_sigla_uf'], '', FALSE, '');
     $this->addCabecalhos(array('Bairro', 'CEP', 'Logradouro', 'UF', 'Cidade'));
     $select = '
   SELECT
     c.idlog, c.cep, c.idbai, u.sigla_uf, m.nome, t.idtlog, m.idmun, b.zona_localizacao
   FROM
     urbano.cep_logradouro_bairro c, public.bairro b, public.logradouro l,
     public.municipio m, public.uf u, urbano.tipo_logradouro t
   WHERE
     c.idlog = l.idlog AND
     c.idbai = b.idbai AND
     l.idmun = b.idmun AND
     l.idmun = m.idmun AND
     l.idtlog = t.idtlog AND
     m.sigla_uf = u.sigla_uf';
     $select_count = '
   SELECT
     COUNT(*)
   FROM
     urbano.cep_logradouro_bairro c, public.bairro b, public.logradouro l,
     public.municipio m, public.uf u, urbano.tipo_logradouro t
   WHERE
     c.idlog = l.idlog AND
     c.idbai = b.idbai AND
     l.idmun = b.idmun AND
     l.idmun = m.idmun AND
     l.idtlog = t.idtlog AND
     m.sigla_uf = u.sigla_uf';
     if ($_GET['nm_bairro'] || $_GET['nr_cep'] || $_GET['nm_logradouro'] || $_GET['ref_sigla_uf'] || $_GET['cidade']) {
         if ($_GET['nr_cep']) {
             $num_cep = idFederal2int($_GET['nr_cep']);
             $select .= sprintf(' AND c.cep ILIKE \'%%%s%%\'', $num_cep);
             $select_count .= sprintf(' AND c.cep ILIKE \'%%%s%%\'', $num_cep);
         }
         if ($_GET['nm_bairro']) {
             $select .= sprintf(' AND b.nome ILIKE \'%%%s%%\'', $_GET['nm_bairro']);
             $select_count .= sprintf(' AND b.nome ILIKE \'%%%s%%\'', $_GET['nm_bairro']);
         }
         if ($_GET['nm_logradouro']) {
             $select .= sprintf(' AND l.nome ILIKE \'%%%s%%\'', $_GET['nm_logradouro']);
             $select_count .= sprintf(' AND l.nome ILIKE \'%%%s%%\'', $_GET['nm_logradouro']);
         }
         if ($_GET['ref_sigla_uf']) {
             $select .= sprintf(' AND u.sigla_uf ILIKE \'%%%s%%\'', $_GET['ref_sigla_uf']);
             $select_count .= sprintf(' AND u.sigla_uf ILIKE \'%%%s%%\'', $_GET['ref_sigla_uf']);
         }
         if ($_GET['cidade']) {
             $select .= sprintf(' AND m.nome ILIKE \'%%%s%%\'', $_GET['cidade']);
             $select_count .= sprintf(' AND m.nome ILIKE \'%%%s%%\'', $_GET['cidade']);
         }
     }
     $select .= sprintf(' LIMIT %s OFFSET %s', $limite, $iniciolimit);
     $db = new clsBanco();
     $total = $db->CampoUnico($select_count);
     $db->Consulta($select);
     while ($db->ProximoRegistro()) {
         list($idlog, $cep, $idbai, $uf, $cidade, $descricao, $id_mun, $zona) = array('', '', '', '', '', '', '', '');
         list($idlog, $cep, $idbai, $uf, $cidade, $descricao, $id_mun, $zona) = $db->Tupla();
         $logradouro = new clsLogradouro($idlog);
         $detalhe_logradouro = $logradouro->detalhe();
         $bairro = new clsBairro($idbai);
         $detalhe_bairro = $bairro->detalhe();
         $cep2 = int2CEP($cep);
         $s_end = '0';
         $descricao = urlencode($descricao);
         if ($_GET['param']) {
             $url = sprintf('<a href="javascript:void(0);" onclick="setaCamposOuvidoria(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\')">%%s</a>', $cep, $cep2, $uf, $uf, $id_mun, $cidade, $detalhe_bairro['idbai'], $detalhe_bairro['nome'], $descricao, $descricao, $detalhe_logradouro['idlog'], $detalhe_logradouro['nome']);
             $this->addLinhas(array(sprintf($url, $detalhe_bairro['nome']), sprintf($url, $cep2), sprintf($url, $detalhe_logradouro["nome"]), sprintf($url, $uf), sprintf($url, $cidade)));
         } else {
             $url = sprintf('<a href="javascript:void(0);" onclick="cv_set_campo(\'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\', \'%s\');">%%s</a>', $_SESSION['campo1'], $detalhe_bairro["nome"], $_SESSION['campo2'], $detalhe_bairro["idbai"], $_SESSION['campo3'], $cep, $_SESSION['campo4'], $detalhe_logradouro["nome"], $_SESSION['campo5'], $detalhe_logradouro["idlog"], $_SESSION['campo6'], $uf, $_SESSION['campo7'], $cidade, $_SESSION['campo8'], $descricao, $_SESSION['campo9'], $s_end, $_SESSION['campo10'], $cep2, $_SESSION['campo11'], $uf, $_SESSION['campo12'], $_SESSION['campo13'], $id_mun, $_SESSION['campo14'], $zona);
             $this->addLinhas(array(sprintf($url, $detalhe_bairro['nome']), sprintf($url, $cep2), sprintf($url, $detalhe_logradouro['nome']), sprintf($url, $uf), sprintf($url, $cidade)));
         }
     }
     $this->largura = '100%';
     $this->addPaginador2('educar_pesquisa_cep_log_bairro.php', $total, $_GET, $this->nome, $limite);
     if ($_GET['param']) {
         $this->rodape = '
     <table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
       <tr width="100%">
         <td>
           <div align="center">[ <a href="javascript:void(0);" onclick="liberaCamposOuvidoria()">Cadastrar Novo Endereço</a> ]</div>
         </td>
       </tr>
     </table>';
     } else {
         $this->rodape = sprintf('
     <table border="0" cellspacing="0" cellpadding="0" width="100%%" align="center">
       <tr width="100%%">
         <td>
           <div align="center">[ <a href="javascript:void(0);" onclick="%s">Cadastrar Novo Endereço</a> ]</div>
         </td>
       </tr>
     </table>', $this->funcao_js);
     }
     @session_write_close();
 }
 /**
  * Retorna uma lista filtrados de acordo com os parametros
  *
  * @return array
  */
 function lista($int_cod_servidor_titulo = null, $int_ref_cod_formacao = null, $date_data_vigencia_homolog_ini = null, $date_data_vigencia_homolog_fim = null, $date_data_publicacao_ini = null, $date_data_publicacao_fim = null)
 {
     $sql = "SELECT {$this->_campos_lista} FROM {$this->_tabela}";
     $filtros = "";
     $whereAnd = " WHERE ";
     if (is_numeric($int_cod_servidor_titulo)) {
         $filtros .= "{$whereAnd} cod_servidor_titulo = '{$int_cod_servidor_titulo}'";
         $whereAnd = " AND ";
     }
     if (is_numeric($int_ref_cod_formacao)) {
         $filtros .= "{$whereAnd} ref_cod_formacao = '{$int_ref_cod_formacao}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_vigencia_homolog_ini)) {
         $filtros .= "{$whereAnd} data_vigencia_homolog >= '{$date_data_vigencia_homolog_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_vigencia_homolog_fim)) {
         $filtros .= "{$whereAnd} data_vigencia_homolog <= '{$date_data_vigencia_homolog_fim}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_publicacao_ini)) {
         $filtros .= "{$whereAnd} data_publicacao >= '{$date_data_publicacao_ini}'";
         $whereAnd = " AND ";
     }
     if (is_string($date_data_publicacao_fim)) {
         $filtros .= "{$whereAnd} data_publicacao <= '{$date_data_publicacao_fim}'";
         $whereAnd = " AND ";
     }
     $db = new clsBanco();
     $countCampos = count(explode(",", $this->_campos_lista));
     $resultado = array();
     $sql .= $filtros . $this->getOrderby() . $this->getLimite();
     $this->_total = $db->CampoUnico("SELECT COUNT(0) FROM {$this->_tabela} {$filtros}");
     $db->Consulta($sql);
     if ($countCampos > 1) {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $tupla["_total"] = $this->_total;
             $resultado[] = $tupla;
         }
     } else {
         while ($db->ProximoRegistro()) {
             $tupla = $db->Tupla();
             $resultado[] = $tupla[$this->_campos_lista];
         }
     }
     if (count($resultado)) {
         return $resultado;
     }
     return false;
 }