Beispiel #1
0
 function Gerar()
 {
     $this->titulo = "Diárias";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $this->addCabecalhos(array("Secretaria", "Funcionário", "Partida", "Chegada", "Valor", "Nº Diária"));
     if ($_GET['ref_cod_setor']) {
         $this->ref_cod_setor = @$_GET['ref_cod_setor'];
     }
     $lst_setores = array("" => "Selecione");
     $obj_setor = new clsSetor();
     $lst_setor = $obj_setor->lista(null, null, null, null, null, null, null, null, null, null, 0);
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $linha) {
             $lst_setores[$linha["cod_setor"]] = $linha["nm_setor"];
         }
     }
     $this->campoLista("ref_cod_setor", "Secretaria", $lst_setores, $this->ref_cod_setor, "", false, "", "", false, false);
     $where = "";
     $gruda = "";
     $where = " WHERE ativo = 't' ";
     if (!empty($_GET['ref_cod_setor'])) {
         $where .= " AND ref_cod_setor = {$this->ref_cod_setor}";
     }
     $db = new clsBanco();
     $db2 = new clsBanco();
     $total = $db->UnicoCampo("SELECT count(0) FROM pmidrh.diaria {$where}");
     // Paginador
     $limite = 15;
     $iniciolimit = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $limite - $limite : 0;
     $strLimit = " LIMIT {$iniciolimit}, {$limite}";
     $objPessoa = new clsPessoaFisica();
     $sql = "SELECT cod_diaria, ref_funcionario, data_partida, data_chegada, COALESCE(vl100,0) + COALESCE(vl75,0) + COALESCE(vl50,0) + COALESCE(vl25,0) AS valor, ref_cod_setor, num_diaria, data_pedido  FROM pmidrh.diaria {$where} ORDER BY num_diaria ASC {$strLimit}";
     $db->Consulta($sql);
     while ($db->ProximoRegistro()) {
         list($cod_diaria, $idpes, $data_partida, $data_chegada, $valor, $ref_cod_setor, $num_diaria, $data_pedido) = $db->Tupla();
         $data_chegada = date("d/m/Y H:i", strtotime($data_chegada));
         $data_partida = date("d/m/Y H:i", strtotime($data_partida));
         if ($ref_cod_setor) {
             $obj_setor = new clsSetor($ref_cod_setor);
             $det_setor = $obj_setor->detalhe();
             $secretaria = $det_setor['nm_setor'];
         } else {
             $secretaria = "";
         }
         list($nome) = $objPessoa->queryRapida($idpes, "nome");
         if (strlen($nome) > 40) {
             $nome = substr($nome, 0, 37);
         }
         $valor = number_format($valor, 2, ",", ".");
         $data = dataFromPgToBr($data_pedido);
         $data = explode("/", $data);
         $num_diaria = sprintf("%06d", $num_diaria);
         $this->addLinhas(array("<a href='diaria_det.php?cod_diaria={$cod_diaria}'><img src='imagens/noticia.jpg' border=0>{$secretaria}</a>", "<a href='diaria_det.php?cod_diaria={$cod_diaria}'>{$nome}</a>", "<a href='diaria_det.php?cod_diaria={$cod_diaria}'>{$data_partida}</a>", "<a href='diaria_det.php?cod_diaria={$cod_diaria}'>{$data_chegada}</a>", "<a href='diaria_det.php?cod_diaria={$cod_diaria}'>{$valor}</a>", "<a href='diaria_det.php?cod_diaria={$cod_diaria}'>{$num_diaria}/{$data[2]}</a>"));
     }
     // Paginador
     $this->addPaginador2("diaria_lst.php", $total, $_GET, $this->nome, $limite);
     $this->acao = "go(\"diaria_cad.php\")";
     $this->nome_acao = "Novo";
     $this->largura = "100%";
 }
 function Gerar()
 {
     @session_start();
     $id_pessoa = $_SESSION['id_pessoa'];
     @session_write_close();
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet", false);
     $this->addCabecalhos(array("Nome do setor"));
     $this->titulo = "Cadastro de Secretaria Respons&aacute;vel";
     // Filtros de Busca
     $setores = array('' => 'Selecione');
     $obj_setor = new clsSetor();
     $obj_setor_lista = $obj_setor->lista(null, null, null, null, null, null, null, null, null, 1, 0, null, null, "nm_setor", null, null, null, null, null, null, $cod_setor);
     if ($obj_setor_lista) {
         foreach ($obj_setor_lista as $secretaria) {
             $setores[$secretaria["cod_setor"]] = $secretaria["sgl_setor"];
         }
     }
     $this->campoLista("setor", "Setor", $setores, $_GET["setor"], '', false, '', '', '', true);
     // Paginador
     $limite = 10;
     $iniciolimit = $_GET["pagina_{$this->__nome}"] ? $_GET["pagina_{$this->__nome}"] * $limite - $limite : 0;
     $Objsetors = new clsPmiacoesSecretariaResponsavel();
     $Objsetors->setLimite($limite, $iniciolimit);
     $Listasetors = $Objsetors->lista($_GET["setor"]);
     if ($Listasetors) {
         foreach ($Listasetors as $setor) {
             $objSetor = new clsSetor();
             $niveis = $objSetor->getNiveis($setor['ref_cod_setor']);
             $strNivel = "";
             $gruda = "";
             sort($niveis);
             if ($niveis) {
                 foreach ($niveis as $nivel) {
                     $objSetor = new clsSetor($nivel);
                     $detalhe = $objSetor->detalhe();
                     $strNivel .= " {$gruda} {$detalhe['sgl_setor']}";
                     $gruda = "&gt;";
                 }
             }
             $this->addLinhas(array("<img src='imagens/noticia.jpg' border=0> <a href='acoes_setor_det.php?cod_setor={$setor['ref_cod_setor']}'>{$strNivel}</a>"));
             $total = $setor['_total'];
         }
     }
     // Paginador
     $this->addPaginador2("acoes_setor_lst.php", $total, $_GET, $this->__nome, $limite);
     $this->acao = "go(\"acoes_setor_cad.php\")";
     $this->nome_acao = "Novo";
     // Define Largura da Página
     $this->largura = "100%";
 }
 function Gerar()
 {
     $this->titulo = "Detalhe";
     $setor = @$_GET['cod_setor'];
     $objSetor = new clsSetor();
     $niveis = $objSetor->getNiveis($setor);
     $strNivel = "";
     $gruda = "";
     sort($niveis);
     if ($niveis) {
         foreach ($niveis as $nivel) {
             $objSetor = new clsSetor($nivel);
             $detalhe = $objSetor->detalhe();
             $strNivel .= " {$gruda} {$detalhe['sgl_setor']}";
             $gruda = ">";
         }
     }
     $this->addDetalhe(array("Secretaria", $strNivel));
     $this->url_novo = "acoes_setor_cad.php";
     $this->url_editar = "acoes_setor_cad.php?cod_setor={$setor}";
     $this->url_cancelar = "acoes_setor_lst.php";
     $this->largura = "100%";
 }
 function detAcoes($cod_acao_governo)
 {
     $existe = false;
     $obj_categoria = new clsPmiacoesAcaoGovernoCategoria();
     $obj_categoria->_campos_lista = "ref_cod_categoria";
     $lista_categoria = $obj_categoria->lista(null, $cod_acao_governo);
     $tabela = "<table border=0 cellpadding=2 width='100%'>";
     if ($lista_categoria) {
         $existe = true;
         $tabela .= "<tr bgcolor={$cor}><td colspan='2'><b>Categorias</b></td></tr><tr><td>";
         $tabela .= "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" align=\"left\" width='50%'>";
         $tabela .= "<tr bgcolor='#A1B3BD'><th>Categoria</th><th width='70'>Excluir</th></tr>";
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         foreach ($lista_categoria as $categoria) {
             $obj_nm_categoria = new clsPmiacoesCategoria($categoria);
             $det_categoria = $obj_nm_categoria->detalhe();
             $tabela .= "<tr bgcolor='{$cor}'><td style='padding-left:20px'><img src=\"imagens/noticia.jpg\" border='0'> {$det_categoria['nm_categoria']}</td><td><a href='acoes_categoria.php?cod_acao_governo={$cod_acao_governo}&remover_categoria={$categoria}&display=inline' ><img src=\"imagens/nvp_bola_xis.gif\" border=0 style='padding-left:10px;'></a></td></tr>";
         }
         $tabela .= "</table></td></tr>";
     }
     $obj_setores = new clsPmiacoesAcaoGovernoSetor();
     $obj_setores->_campos_lista = "ref_cod_setor";
     $lista_setores = $obj_setores->lista($cod_acao_governo);
     if ($lista_setores) {
         $existe = true;
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         $tabela .= "<tr bgcolor={$cor}><td colspan='2'><b>Setores</b></td></tr><tr><td>";
         $tabela .= "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" align=\"left\" width='50%'>";
         $tabela .= "<tr bgcolor='#A1B3BD'><th>Setor</th><th width='70'>Excluir</th></tr>";
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         foreach ($lista_setores as $setores) {
             $obj_nm_setor = new clsSetor($setores);
             $det_setor = $obj_nm_setor->detalhe();
             $tabela .= "<tr bgcolor='{$cor}'><td style='padding-left:20px'><img src=\"imagens/noticia.jpg\" border='0'> {$det_setor['sgl_setor']}</td><td><a href='acoes_setor.php?cod_acao_governo={$cod_acao_governo}&remover_setor={$setores}&display=inline' ><img src=\"imagens/nvp_bola_xis.gif\" border=0 style='padding-left:10px;'></a></td></tr>";
         }
         $tabela .= "</table></td></tr>";
     }
     //fotos
     $obj_fotos = new clsPmiacoesAcaoGovernoFoto();
     $obj_fotos->_campos_lista = "cod_acao_governo_foto, nm_foto, caminho, to_char(data_foto,'dd/mm/yyyy') as data_foto";
     $lista_fotos = $obj_fotos->lista(null, null, $cod_acao_governo);
     if ($lista_fotos) {
         $existe = true;
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         $tabela .= "<tr bgcolor={$cor}><td colspan='2'><b>Fotos</b></td></tr><tr><td>";
         $tabela .= "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" align=\"left\" width='100%'>";
         $tabela .= "<tr bgcolor='#A1B3BD'><th>Foto</th><th>Data</th><th width='100%'>T�tulo</th><th width='70'>Excluir</th></tr>";
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         foreach ($lista_fotos as $foto) {
             $data = $foto["data_foto"];
             $tabela .= "<tr bgcolor={$cor} align='center'><td><a href='javascript:void(0)' onclick='openfotoAcoes(\"arquivos/acoes/fotos/big/{$foto["caminho"]}\")' alt='Clique na imagem para maximizar'><img src='arquivos/acoes/fotos/small/{$foto["caminho"]}' border='0'></a></td><td width='20'>{$data}</td><td align='left'>{$foto["nm_foto"]}</td><td align='center'><a href='acoes_foto.php?cod_acao_governo={$cod_acao_governo}&remover_foto={$foto["cod_acao_governo_foto"]}&display=inline' ><img src=\"imagens/nvp_bola_xis.gif\" border=0 style='padding-left:10px;'></a></td></tr>";
         }
         $tabela .= "</table></td></tr>";
     }
     //arquivos
     $obj_fotos = new clsPmiacoesAcaoGovernoArquivo();
     $obj_fotos->_campos_lista = "cod_acao_governo_arquivo,nm_arquivo, caminho_arquivo";
     $lista_fotos = $obj_fotos->lista(null, null, $cod_acao_governo);
     if ($lista_fotos) {
         $existe = true;
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         $tabela .= "<tr bgcolor={$cor}><td colspan='2'><b>Arquivos</b></td></tr><tr><td>";
         $tabela .= "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" align=\"left\" width='50%'>";
         $tabela .= "<tr bgcolor='#A1B3BD'><th width='60%'>Nome</th><th>Arquivo</th><th width='70'>Excluir</th></tr>";
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         foreach ($lista_fotos as $foto) {
             $data = date("d/m/Y", strtotime(substr($foto["data_foto"], 0, 19)));
             $tabela .= "<tr bgcolor={$cor} align='center'><td align='left' width='80%'>{$foto["nm_arquivo"]}</td><td><a href='{$foto["caminho_arquivo"]}'\" target=\"_blank\"><img src='imagens/nvp_icon_download.gif' border='0' align='bottom'><br>Visualizar</td><td align='center'><a href='acoes_arquivo.php?cod_acao_governo={$cod_acao_governo}&remover_arquivo={$foto["cod_acao_governo_arquivo"]}&display=inline' ><img src=\"imagens/nvp_bola_xis.gif\" border=0 style='padding-left:10px;'></a></td></tr>";
         }
         $tabela .= "</table></td></tr>";
     }
     $obj_noticias = new clsPmiacoesAcaoGovernoNoticia();
     $obj_noticias->_campos_lista = "ref_cod_not_portal";
     $lista_noticias = $obj_noticias->lista($cod_acao_governo);
     if ($lista_noticias) {
         $existe = true;
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         $tabela .= "<tr bgcolor={$cor}><td colspan='2'><b>Noticias Portal</b></td></tr>";
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         $noticias_in = implode(",", $lista_noticias);
         $db = new clsBanco();
         $db->Consulta("SELECT n.data_noticia, n.titulo, n.cod_not_portal FROM not_portal n where  n.cod_not_portal in({$noticias_in}) ORDER BY n.data_noticia DESC {$limit}");
         $tabela .= "<tr><td colspan='2'><table border=0 cellpadding=2 width='100%'>";
         $tabela .= "<tr bgcolor='#A1B3BD' align='center'><td style='padding-left:20px'> <b>Data</b> </td><td><b>Titulo</b></td><td width='70'><b>Excluir</b></td></tr>";
         while ($db->ProximoRegistro()) {
             list($data, $titulo, $id_noticia) = $db->Tupla();
             $data = date("d/m/Y", strtotime(substr($data, 0, 19)));
             $tabela .= "<tr bgcolor='{$cor}'><td style='padding-left:20px' width='100'><img src=\"imagens/noticia.jpg\" border='0'> {$data} </td><td>{$titulo}</td><td align='center'><a href='acoes_noticia.php?cod_acao_governo={$cod_acao_governo}&remover_noticia={$id_noticia}&display=inline' ><img src=\"imagens/nvp_bola_xis.gif\" border=0 style='padding-left:10px;'></a></td></tr>";
         }
         $tabela .= "</table></td></tr>";
     }
     $obj_fotos_portal = new clsPmiacoesAcaoGovernoFotoPortal();
     $obj_fotos_portal->_campos_lista = "ref_cod_foto_portal";
     $lista_fotos = $obj_fotos_portal->lista($cod_acao_governo);
     if ($lista_fotos) {
         $existe = true;
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         $tabela .= "<tr bgcolor={$cor}><td colspan='2'><b>Fotos Portal</b></td></tr><tr><td>";
         $tabela .= "<table cellpadding=\"2\" cellspacing=\"2\" border=\"0\" align=\"left\" width='100%'>";
         $tabela .= "<tr bgcolor='#A1B3BD'><th>Foto</th><th>Data</th><th width='60%'>T�tulo</th><th width='70'>Excluir</th></tr>";
         $fotos_in = implode(",", $lista_fotos);
         $db = new clsBanco();
         $db->Consulta("SELECT f.cod_foto_portal,f.titulo, f.descricao, f.data_foto, f.caminho, f.nm_credito, f.altura, f.largura FROM foto_portal f WHERE cod_foto_portal in({$fotos_in})");
         $cor = $cor == "#FFFFFF" ? "#E4E9ED" : "#FFFFFF";
         while ($db->ProximoRegistro()) {
             list($cod_foto_portal, $titulo, $descricao, $data_foto, $caminho, $nm_credito) = $db->Tupla();
             $data = date("d/m/Y", strtotime(substr($data, 0, 19)));
             $rowspan = "";
             if ($descricao) {
                 $rowspan = "rowspan='2'";
                 $descricao = "<tr bgcolor={$cor}><td colspan='2'><div><b>Descri&ccedil;&atilde;o:</b> {$descricao}</div></td></tr>";
             }
             $tabela .= "<tr bgcolor={$cor} align='center'><td {$rowspan}><img src='fotos/small/{$caminho}' border='0'></td><td>{$data}</td><td align='left'>{$titulo}</td><td {$rowspan}><a href='acoes_foto_portal.php?cod_acao_governo={$cod_acao_governo}&remover_foto={$cod_foto_portal}&display=inline' ><img src=\"imagens/nvp_bola_xis.gif\" border=0 style='padding-left:10px;'></a></td></tr>{$descricao}";
         }
         $tabela .= "</table></td></tr>";
     }
     $tabela .= "</table>";
     return $existe == true ? $tabela : false;
 }
 /**
  * Construtor (PHP 4)
  *
  * @return object
  */
 function clsPmiacoesAcaoGovernoSetor($ref_cod_acao_governo = null, $ref_cod_setor = null, $ref_funcionario_cad = null, $data_cadastro = null)
 {
     $db = new clsBanco();
     $this->_schema = "pmiacoes.";
     $this->_tabela = "{$this->_schema}acao_governo_setor";
     $this->_campos_lista = $this->_todos_campos = "ref_cod_acao_governo, ref_cod_setor, ref_funcionario_cad, data_cadastro";
     if (is_numeric($ref_cod_acao_governo)) {
         $tmp_obj = new clsPmiacoesAcaoGoverno($ref_cod_acao_governo);
         if ($tmp_obj->detalhe()) {
             $this->ref_cod_acao_governo = $ref_cod_acao_governo;
         }
     }
     if (is_numeric($ref_cod_setor)) {
         $tmp_obj = new clsSetor($ref_cod_setor);
         if ($tmp_obj->detalhe()) {
             $this->ref_cod_setor = $ref_cod_setor;
         }
     }
     if (is_numeric($ref_funcionario_cad)) {
         $tmp_obj = new clsFuncionario($ref_funcionario_cad);
         if ($tmp_obj->detalhe()) {
             $this->ref_funcionario_cad = $ref_funcionario_cad;
         }
     }
     if (is_string($data_cadastro)) {
         $this->data_cadastro = $data_cadastro;
     }
 }
Beispiel #6
0
 function Gerar()
 {
     $this->titulo = "Detalhe do valor";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet");
     $cod_diaria = @$_GET['cod_diaria'];
     $db = new clsBanco();
     $db2 = new clsBanco();
     $db->Consulta("SELECT ref_funcionario_cadastro, ref_cod_diaria_grupo, ref_funcionario, conta_corrente, agencia, banco,  dotacao_orcamentaria,  objetivo, data_partida, data_chegada, estadual, destino, data_pedido, vl100,  vl75, vl50, vl25, ref_cod_setor, num_diaria FROM pmidrh.diaria WHERE cod_diaria='{$cod_diaria}'");
     if ($db->ProximoRegistro()) {
         list($ref_funcionario_cadastro, $ref_cod_diaria_grupo, $ref_funcionario, $conta_corrente, $agencia, $banco, $dotacao_orcamentaria, $objetivo, $data_partida, $data_chegada, $estadual, $destino, $data_pedido, $vl100, $vl75, $vl50, $vl25, $ref_cod_setor, $num_diaria) = $db->Tupla();
         $this->addDetalhe(array("N&deg;. do roteiro", "<span style=\"font-size: 14px;font-weight:bold;\">{$cod_diaria}</span>"));
         $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));
         $objPessoa = new clsPessoaFisica($ref_funcionario);
         $detalhePessoa = $objPessoa->detalhe();
         $this->addDetalhe(array("Funcion&aacute;rio", $detalhePessoa["nome"]));
         $this->addDetalhe(array("CPF", int2CPF($detalhePessoa["cpf"])));
         $objFuncionario = new clsFuncionario($ref_funcionario);
         $detalheFuncionario = $objFuncionario->detalhe();
         $this->addDetalhe(array("Matricula", $detalheFuncionario["matricula"]));
         $data = dataFromPgToBr($data_pedido);
         $data = explode("/", $data);
         if ($ref_cod_setor) {
             $obj_setor = new clsSetor($ref_cod_setor);
             $det_setor = $obj_setor->detalhe();
             $nm_secretaria = $det_setor['nm_setor'];
             $this->addDetalhe(array("Secretaria", $nm_secretaria));
         }
         $this->addDetalhe(array("Conta Corrente", $conta_corrente));
         if (strlen($agencia) < 5) {
             $agencia = str_repeat("0", 5 - strlen($agencia)) . $agencia;
         }
         if ($agencia) {
             $this->addDetalhe(array("Ag&ecirc;ncia", $agencia));
         }
         if (strlen($banco) < 3) {
             $banco = str_repeat("0", 3 - strlen($banco)) . $banco;
         }
         if ($banco) {
             $this->addDetalhe(array("Banco", $banco));
         }
         if ($dotacao_orcamentaria) {
             $this->addDetalhe(array("Dota&ccedil;&atilde;o or&ccedil;ament&aacute;ria", $dotacao_orcamentaria));
         }
         if ($objetivo) {
             $this->addDetalhe(array("Objetivo", $objetivo));
         }
         if ($data_pedido) {
             $this->addDetalhe(array("Data Pedido", date("d/m/Y", strtotime(substr($data_pedido, 0, 16)))));
         }
         if ($data_partida) {
             $this->addDetalhe(array("Data Partida", date("d/m/Y H:i", strtotime(substr($data_partida, 0, 16)))));
         }
         if ($data_chegada) {
             $this->addDetalhe(array("Data Chegada", date("d/m/Y H:i", strtotime(substr($data_chegada, 0, 16)))));
         }
         $estadual = $estadual ? "Sim" : "N&atilde;o";
         $this->addDetalhe(array("Estadual", $estadual));
         if ($destino) {
             $this->addDetalhe(array("Destino", $destino));
         }
         $this->addDetalhe(array("100%", number_format($vl100, 2, ",", ".")));
         $this->addDetalhe(array("75%", number_format($vl75, 2, ",", ".")));
         $this->addDetalhe(array("50%", number_format($vl50, 2, ",", ".")));
         $this->addDetalhe(array("25%", number_format($vl25, 2, ",", ".")));
         $this->addDetalhe(array("Total", "<span style=\"font-size: 12px;font-weight:bold;border-width:1px;border-color:#000000;border-style:solid;padding:2px;\">" . number_format($vl25 + $vl50 + $vl75 + $vl100, 2, ",", ".") . "</span>"));
         if ($num_diaria) {
             $num_diaria = sprintf("%06d", $num_diaria);
             $this->addDetalhe(array("Nº Di&aacute;ria", "{$num_diaria}/{$data['2']}"));
         }
         $this->url_editar = "diaria_cad.php?cod_diaria={$cod_diaria}";
         $this->array_botao[] = "Arquivo para impressão";
         $this->array_botao_url[] = "diaria_pdf.php?cod_diaria={$cod_diaria}";
     } else {
         $this->addDetalhe(array("Erro", "Codigo de diaria invalido"));
     }
     $this->url_novo = "diaria_cad.php";
     $this->url_cancelar = "diaria_lst.php";
     $this->largura = "100%";
 }
 function Gerar()
 {
     $this->titulo = "Detalhe do Setor";
     $this->cod_setor = @$_GET['cod_setor'];
     $obj_setor = new clsSetor($this->cod_setor);
     $detalhe = $obj_setor->detalhe();
     if (!$detalhe) {
         $this->addDetalhe(array("Erro", "Setor Inexistente"));
     } else {
         $objSetor = new clsSetor($detalhe["cod_setor"]);
         $parentes = $objSetor->getNiveis($detalhe["cod_setor"]);
         $strParentes = "";
         $gruda = "";
         for ($i = 0; $i < count($parentes); $i++) {
             $objSetor = new clsSetor($parentes[$i]);
             $detalheSetor = $objSetor->detalhe();
             $strParentes = " {$detalheSetor["nm_setor"]} - {$detalheSetor["sgl_setor"]}";
             //$gruda = " &gt; ";
             $gruda .= "&nbsp&nbsp&nbsp ";
             if ($i == 0) {
                 $this->addDetalhe(array("Setor", $strParentes));
             } else {
                 $this->addDetalhe(array("Setor", "{$gruda}<img src=\"imagens/nvp_setal.gif\">{$strParentes}"));
             }
         }
         $ref_cod_pessoa_cad = $detalhe["ref_cod_pessoa_cad"];
         $obj_pessoa_fj = new clsPessoaFj($ref_cod_pessoa_cad);
         $det = $obj_pessoa_fj->detalhe();
         $this->addDetalhe(array("Responsável pelo cadastro", $det["nome"]));
         $ativo = $detalhe["ativo"] == 1 ? "Sim" : "Não";
         $this->addDetalhe(array("Ativo", $ativo));
         $no_paco = $detalhe["no_paco"] ? "Sim" : "Não";
         $this->addDetalhe(array("No Paço", $no_paco));
         if ($detalhe["endereco"]) {
             $this->addDetalhe(array("Endereço", $detalhe["endereco"]));
         }
         if ($detalhe["tipo"]) {
             switch ($detalhe["tipo"]) {
                 case "s":
                     $this->addDetalhe(array("Tipo", "Secretaria"));
                     break;
                 case "a":
                     $this->addDetalhe(array("Tipo", "Altarquia"));
                     break;
                 case "f":
                     $this->addDetalhe(array("Tipo", "Fundação"));
                     break;
             }
         }
         if ($detalhe["refIdpesResp"]) {
             $obj_pessoa = new clsPessoa($detalhe["refIdpesResp"]);
             $det_pessoa = $obj_pessoa->detalhe();
             $this->addDetalhe(array("Secretario", $det_pessoa["nome"]));
         }
     }
     if (!is_null($detalhe["ref_cod_setor"])) {
         $this->url_editar = "oprot_setor_cad.php?cod_setor={$this->cod_setor}&setor_atual={$detalhe['ref_cod_setor']}";
     } else {
         $this->url_editar = "oprot_setor_cad.php?cod_setor={$this->cod_setor}";
     }
     $this->url_novo = "oprot_setor_cad.php";
     $this->url_cancelar = "oprot_setor_lst.php";
     $this->largura = "100%";
 }
 /**
  * Função retorna o nome completo (com os niveis acima) de um setor
  *
  * @return string
  */
 function getNomeFamilia($intRefCodSetor, $separador = " &gt; ", $sigla = false)
 {
     $campo = $sigla ? "sgl_setor" : "nm_setor";
     $nome = array();
     $niveis = $this->getNiveis($intRefCodSetor);
     for ($i = 0; $i < count($niveis); $i++) {
         $objSetor = new clsSetor($niveis[$i]);
         $det = $objSetor->detalhe();
         $nome[] = $det[$campo];
     }
     return implode($separador, $nome);
 }
 /**
  * Construtor (PHP 4)
  *
  * @return object
  */
 function clsPmiacoesSecretariaResponsavel($ref_cod_setor = null, $ref_cod_funcionario_cad = null, $data_cadastro = null)
 {
     $db = new clsBanco();
     $this->_schema = "pmiacoes.";
     $this->_tabela = "{$this->_schema}secretaria_responsavel";
     $this->_campos_lista = $this->_todos_campos = "ref_cod_setor, ref_cod_funcionario_cad, data_cadastro";
     if (is_numeric($ref_cod_setor)) {
         $tmp_obj = new clsSetor($ref_cod_setor);
         if ($tmp_obj->detalhe()) {
             $this->ref_cod_setor = $ref_cod_setor;
         }
     }
     if (is_numeric($ref_cod_funcionario_cad)) {
         $tmp_obj = new clsFuncionario($ref_cod_funcionario_cad);
         if ($tmp_obj->detalhe()) {
             $this->ref_cod_funcionario_cad = $ref_cod_funcionario_cad;
         }
     }
     if (is_string($data_cadastro)) {
         $this->data_cadastro = $data_cadastro;
     }
 }
 function Gerar()
 {
     @session_start();
     $obj_setor = new clsSetor();
     $this->nome = "form1";
     $this->funcAcaoNome = $this->nome;
     $total = 0;
     $id_pesssoa = $_SESSION['id_pessoa'];
     $this->titulo = "Setores";
     $this->addBanner("imagens/nvp_top_intranet.jpg", "imagens/nvp_vert_intranet.jpg", "Intranet", false);
     // Paginador
     $limite = 10;
     $iniciolimit = $_GET["pagina_{$this->nome}"] ? $_GET["pagina_{$this->nome}"] * $limite - $limite : 0;
     /*
     	Filtro
     */
     foreach ($_GET as $key => $value) {
         $this->{$key} = $value;
     }
     $this->nm_setor = $_GET["nm_setor"] ? $_GET["nm_setor"] : null;
     $this->sgl_setor = $_GET["sgl_setor"] ? $_GET["sgl_setor"] : null;
     include "include/form_setor.inc.php";
     $this->campoTexto("nm_setor", "Nome do Setor", $this->nm_setor, 30, 255);
     $this->campoTexto("sgl_setor", "Sigla do Setor", $this->sgl_setor, 30, 255);
     /*
     	Fim Filtro
     */
     $this->addCabecalhos(array("Setor"));
     if ($this->nm_setor || $this->sgl_setor) {
         $lista = $obj_setor->lista(null, nul, null, $this->nm_setor, $this->sgl_setor, null, null, null, null, 1, null, null, null, "nm_setor");
         if ($lista) {
             foreach ($lista as $key => $valor) {
                 $niveis = $obj_setor->getNiveis($valor["cod_setor"]);
                 $str = "";
                 for ($i = 0; $i < count($niveis); $i++) {
                     $obj = new clsSetor($niveis[$i]);
                     $det = $obj->detalhe();
                     if ($i == 0) {
                         if ($det["sgl_setor"] == $this->sgl_setor) {
                             $str .= "<b>{$det['sgl_setor']}</b>";
                             $cod_setor = $det["cod_setor"];
                         } else {
                             $str .= "{$det['sgl_setor']}";
                         }
                     } else {
                         if ($det["sgl_setor"] == $this->sgl_setor) {
                             $str .= " > <b>{$det['sgl_setor']}</b>";
                             $cod_setor = $det["cod_setor"];
                         } else {
                             $str .= " > {$det['sgl_setor']}";
                         }
                     }
                 }
                 $this->addLinhas(array("<a href=oprot_setor_det.php?cod_setor={$cod_setor}>{$str}</a>"));
                 $total++;
             }
         }
     } else {
         if ($this->setor_0) {
             $objSetores = new clsSetor($this->setor_0);
             $listaSetores0[] = $objSetores->detalhe();
         } else {
             $objSetores = new clsSetor();
             $listaSetores0 = $objSetores->lista(null, null, null, null, null, null, null, null, null, 1, 0);
         }
         if ($listaSetores0) {
             foreach ($listaSetores0 as $key0 => $valor0) {
                 $this->addLinhas(array("<a href=oprot_setor_det.php?cod_setor={$valor0["cod_setor"]}>{$valor0['sgl_setor']}</a>"));
                 $total++;
                 if ($this->setor_1) {
                     $objSetores = new clsSetor($this->setor_1);
                     $listaSetores1[] = $objSetores->detalhe();
                 } else {
                     $objSetores = new clsSetor();
                     $listaSetores1 = $objSetores->lista($valor0["cod_setor"], null, null, null, null, null, null, null, null, 1, 1);
                 }
                 if ($listaSetores1) {
                     foreach ($listaSetores1 as $key1 => $valor1) {
                         $a = "<font color=#9EA3A9>{$valor0['sgl_setor']} ></font> {$valor1['sgl_setor']}";
                         $this->addLinhas(array("<a href=oprot_setor_det.php?cod_setor={$valor1['cod_setor']}>{$a}</a></font>"));
                         $total++;
                         if ($this->setor_2) {
                             $objSetores = new clsSetor($this->setor_2);
                             $listaSetores2[] = $objSetores->detalhe();
                         } else {
                             $objSetores = new clsSetor();
                             $listaSetores2 = $objSetores->lista($valor1["cod_setor"], null, null, null, null, null, null, null, null, 1, 2);
                         }
                         if ($listaSetores2) {
                             foreach ($listaSetores2 as $key2 => $valor2) {
                                 $a = "<font color=#9EA3A9>{$valor0['sgl_setor']} > {$valor1['sgl_setor']} ></font> {$valor2['sgl_setor']}";
                                 $this->addLinhas(array("<a href=oprot_setor_det.php?cod_setor={$valor2['cod_setor']}>{$a}</a></font>"));
                                 $total++;
                                 if ($this->setor_3) {
                                     $objSetores = new clsSetor($this->setor_3);
                                     $listaSetores3[] = $objSetores->detalhe();
                                 } else {
                                     $objSetores = new clsSetor();
                                     $listaSetores3 = $objSetores->lista($valor2["cod_setor"], null, null, null, null, null, null, null, null, 1, 3);
                                 }
                                 if ($listaSetores3) {
                                     foreach ($listaSetores3 as $key3 => $valor3) {
                                         $a = "<font color=#9EA3A9>{$valor0['sgl_setor']} > {$valor1['sgl_setor']} > {$valor2['sgl_setor']} > </font>{$valor3['sgl_setor']} ";
                                         $this->addLinhas(array("<a href=oprot_setor_det.php?cod_setor={$valor3['cod_setor']}>{$a}</a></font>"));
                                         $total++;
                                         if ($this->setor_4) {
                                             $objSetores = new clsSetor($this->setor_4);
                                             $listaSetores4[] = $objSetores->detalhe();
                                         } else {
                                             $objSetores = new clsSetor();
                                             $listaSetores4 = $objSetores->lista($valor3["cod_setor"], null, null, null, null, null, null, null, null, 1, 4);
                                         }
                                         if ($listaSetores4) {
                                             foreach ($listaSetores4 as $key4 => $valor4) {
                                                 $a = "<font color=#9EA3A9>{$valor0['sgl_setor']} > {$valor1['sgl_setor']} > {$valor2['sgl_setor']} > {$valor3['sgl_setor']} ></font> {$valor4['sgl_setor']}";
                                                 $this->addLinhas(array("<a href=oprot_setor_det.php?cod_setor={$valor4['cod_setor']}>{$a}</a></font>"));
                                                 $total++;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->acao = "go(\"oprot_setor_cad.php\")";
     $this->nome_acao = "Novo";
     $this->largura = "100%";
     @session_write_close();
 }
Beispiel #11
0
 function Gerar()
 {
     $this->campoOculto("cod_acao_governo", $this->cod_acao_governo);
     $i = 0;
     @session_start();
     $this->pessoa_logada = $_SESSION['id_pessoa'];
     if (!isset($_POST["inc"])) {
         if (isset($_GET["excluir_setor"]) && $_GET["passo"] != 2 && $_SESSION['acao_det'] == $this->cod_acao_governo) {
             unset($_SESSION["acoes"]["inserido"][$_GET["excluir_setor"]], $_GET["excluir_setor"]);
             header("Location: acoes_setor.php?cod_acao_governo={$this->cod_acao_governo}&passo=2");
         }
     } else {
         if ($_POST["inc"] == 2) {
             $existe = false;
             if (!empty($_SESSION["acoes"]["inserido"])) {
                 foreach ($_SESSION["acoes"]["inserido"] as $key => $valor) {
                     if ($valor == $this->setor) {
                         $existe = true;
                         break;
                     }
                 }
             }
             if (!$existe) {
                 $_SESSION["acoes"]["inserido"][$this->setor] = $this->setor;
             }
         }
     }
     $array = array(0 => "Selecione um clicando na lupa");
     $setores = array('' => 'Selecione');
     $obj_setor = new clsSetor();
     $obj_setor_lista = $obj_setor->lista(null, null, null, null, null, null, null, null, null, 1, 0, null, null, "nm_setor", null, null, null, null, null, null, $cod_setor);
     if ($obj_setor_lista) {
         foreach ($obj_setor_lista as $secretaria) {
             $setores[$secretaria["cod_setor"]] = $secretaria["sgl_setor"];
         }
     }
     $this->campoLista("setor", "Setor", $setores, '', '', false, '', '', '', true);
     $this->campoOculto("inc", "1");
     $this->campoRotulo("incluir", "Incluir setor", "<a href='#' onclick=\"document.getElementById('inc').value=2;acao();\"><img src='imagens/banco_imagens/entrada2.gif' title='Incluir' border=0></a>");
     $this->campoQuebra2();
     $tabela = "<table border=0 width='300' cellpadding=3 id=\"tb_anexos\"><tr bgcolor='A1B3BD' align='center'><td colspan=2>Setores</td></tr>";
     $cor = "#D1DADF";
     if (!empty($_SESSION["acoes"]["inserido"])) {
         foreach ($_SESSION["acoes"]["inserido"] as $indice => $valor) {
             $obj_acoes_cat = new clsSetor($indice);
             $det_acao = $obj_acoes_cat->detalhe();
             $cor = $cor == "#D1DADF" ? "#E4E9ED" : "#D1DADF";
             $tabela .= "<tr bgcolor={$cor} align='center'><td>{$det_acao["sgl_setor"]}</td><td><a href=acoes_setor.php?cod_acao_governo={$this->cod_acao_governo}&excluir_setor={$valor}><img border=0 title='Excluir' src='imagens/banco_imagens/excluirrr.gif'></a></td></tr>";
         }
         $enviar = "document.getElementById(\"{$this->__nome}\").submit()";
     } else {
         $enviar = "window.parent.isEmpty(\"Atenção nenhum setor foi selecionado, \\n para inserir um novo setor clique no botão\\n \\\"Incluir Setor\\\"!\");";
         $tabela .= "<tr bgcolor={$cor} align='center'><td>Nenhum setor adicionado</td></tr>";
     }
     $tabela .= "</table>";
     $this->campoRotulo("tab", "Setores", $tabela);
     $this->acao_enviar = "{$enviar}";
     $this->script_cancelar = "window.parent.fechaExpansivel(\"div_dinamico_\"+(parent.DOM_divs.length*1-1));";
     $this->nome_url_cancelar = "Cancelar";
     echo "<script>if(window.parent == window)window.location = \"acoes_acao_lst.php\"; else window.close();</script>";
 }
 function Gerar()
 {
     $this->campoOculto("cod_setor", $_GET["cod_setor"]);
     $this->campoOculto("cod_pessoa", $this->cod_pessoa);
     $nivelAtual = 0;
     $objSetor = new clsSetor();
     $strSetorAtual = "";
     if (isset($_GET["setor_atual"]) && $_GET["setor_atual"]) {
         $codPai = null;
         $strSetorAtual = "setor_atual={$_GET["setor_atual"]}&";
         $niveis = $objSetor->getNiveis($_GET["setor_atual"]);
         $nivelAtual = count($niveis);
         for ($i = 0; $i < count($niveis); $i++) {
             $listaSetores = $objSetor->lista($codPai, null, null, null, null, null, null, null, null, null, $i);
             $nomeVar = "setor_{$i}";
             $setores = array("" => "Selecione");
             foreach ($listaSetores as $setor) {
                 $setores[$setor["cod_setor"]] = $setor["nm_setor"];
             }
             $this->campoLista($nomeVar, "Setor nivel " . ($i + 1), $setores, $niveis[$i], "if( this.value ) { document.location.href='oprot_setor_cad.php?cod_setor={$this->cod_setor}&setor_atual=' + this.value } else { document.location.href='oprot_setor_cad.php?cod_setor={$this->cod_setor}&setor_atual={$codPai}' }");
             $codPai = $niveis[$i];
         }
     }
     if (isset($_GET["selecionar"])) {
         $codPai = isset($_GET["setor_atual"]) ? $_GET["setor_atual"] : null;
         $listaSetores = $objSetor->lista($codPai, null, null, null, null, null, null, null, null, null, $nivelAtual);
         if (is_array($listaSetores) && count($listaSetores)) {
             $setores = array("" => "Selecione");
             foreach ($listaSetores as $setor) {
                 $setores[$setor["cod_setor"]] = $setor["nm_setor"];
             }
             $nomeVar = "setor_{$nivelAtual}";
             $this->campoLista($nomeVar, "Setor nivel " . ($i + 1), $setores, false, "if( this.value ) { document.location.href='oprot_setor_cad.php?cod_setor={$this->cod_setor}&setor_atual=' + this.value }");
         } else {
             $this->campoRotulo("aviso", "Alerta", "<a href=\"oprot_setor_cad.php?cod_setor={$this->cod_setor}&{$strSetorAtual}\">Nenhum setor neste nivel</a>");
         }
     } else {
         if ($nivelAtual < 5) {
             if ($nivelAtual < 4) {
                 $this->campoRotulo("adicionar", "Selecionar", "<a href=\"oprot_setor_cad.php?cod_setor={$this->cod_setor}&{$strSetorAtual}selecionar=1\">Selecionar um setor já cadastrado</a>");
             }
             $this->campoTexto("nm_setor", "Nome do Setor", $this->nm_setor, 30, 255, true);
             $this->campoTexto("sgl_setor", "Sigla do Setor", $this->sgl_setor, 15, 15, true);
             $this->campoCheck("no_paco", "No Paço", 0);
             $this->campoMemo("end", "Endereço", "", 55, 5);
             $lista = array();
             $lista = array(0 => "Selecione", "s" => "Secretaria", "a" => "Altarquia", "f" => "Fundação");
             $this->campoLista("tipo", "Tipo", $lista, $this->tipo);
             $lista = array();
             $lista[0] = "Selecione";
             $parametros = new clsParametrosPesquisas();
             $parametros->setSubmit(0);
             $parametros->adicionaCampoSelect("secretario", "idpes", "nome");
             $sec = array("Para procurar, clique na lupa ao lado");
             if ($this->secretario) {
                 $cls_pessoa = new clsPessoa_($this->secretario);
                 $detalhe_pessoa = $cls_pessoa->detalhe();
                 $sec = array("Para procurar, clique na lupa ao lado", $this->secretario => $detalhe_pessoa['nome']);
             }
             $this->campoListaPesq("secretario", "Secretário", $sec, $this->secretario, "pesquisa_funcionario_lst.php", "", false, "", "", null, null, "", false, $parametros->serializaCampos());
             //$this->campoListaPesq("secretario", "Secretario Responsável", $lista, $this->secretario, "pesquisa_pessoa.php");
             if ($this->cod_setor) {
                 $obj = new clsSetor($this->cod_setor);
                 $det = $obj->detalhe();
                 $status = $det["ativo"] == 1 ? 1 : 0;
                 $ativo = $this->ativo ? $this->ativo : $status;
                 $this->campoCheck("ativo", "Ativo", $ativo);
             }
         }
     }
 }