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->campoOculto("ref_pessoa", $this->ref_pessoa);
     if (is_numeric($this->ref_pessoa)) {
         $this->campoOculto("confere_senha", $this->confere_senha);
     }
     //--------------------------------------------------------------------
     if ($_POST) {
         foreach ($_POST as $campo => $val) {
             $this->{$campo} = $this->{$campo} ? $this->{$campo} : $val;
         }
     }
     //--------------------------------------------------------------------
     $this->ref_cod_setor_new = 0;
     if (!$this->ref_cod_setor_new && is_numeric($this->ref_pessoa)) {
         $objFuncionario = new clsPortalFuncionario($this->ref_pessoa);
         $detFunc = $objFuncionario->detalhe();
         $this->ref_cod_setor_new = $detFunc["ref_cod_setor_new"];
     }
     if ($this->ref_cod_setor_new) {
         $objSetor = new clsSetor();
         $parentes = $objSetor->getNiveis($this->ref_cod_setor_new);
         for ($i = 0; $i < 5; $i++) {
             if (isset($parentes[$i]) && $parentes[$i]) {
                 $nmvar = "setor_{$i}";
                 $this->{$nmvar} = $parentes[$i];
             }
         }
     }
     //--------------------------------------------------------------------
     if ($_GET["ref_pessoa"]) {
         $obj_funcionario = new clsPessoaFj($this->ref_pessoa);
         $det_funcionario = $obj_funcionario->detalhe();
         $this->nome = $det_funcionario["nome"];
         $this->campoRotulo("nome", "Nome", $this->nome);
     } else {
         $parametros = new clsParametrosPesquisas();
         $parametros->setSubmit(1);
         $parametros->setPessoa("F");
         $parametros->setPessoaNovo('S');
         $parametros->setPessoaEditar('N');
         $parametros->setPessoaTela("frame");
         $parametros->setPessoaCPF('N');
         $parametros->adicionaCampoTexto("nome", "nome");
         $parametros->adicionaCampoTexto("nome_busca", "nome");
         $parametros->adicionaCampoTexto("ref_pessoa", "idpes");
         $this->campoTextoPesquisa("nome_busca", "Nome", $this->nome, 30, 255, true, "pesquisa_pessoa_lst.php", false, false, "", "", $parametros->serializaCampos() . "&busca=S", true);
         $this->campoOculto("nome", $this->nome);
         $this->campoOculto("ref_pessoa", $this->ref_pessoa);
     }
     $this->campoTexto("matricula", "Matr&iacute;cula", $this->matricula, 12, 12, true);
     $this->campoSenha("_senha", "Senha", $this->_senha, true);
     $this->campoEmail("email", "E-mail usuário", $this->email, 50, 50, false, false, false, 'Utilizado para redefinir a senha, caso o usúario esqueça<br />Este campo pode ser gravado em branco, neste caso será solicitado um e-mail ao usuário, após entrar no sistema.');
     $obj_setor = new clsSetor();
     $lst_setor = $obj_setor->lista(null, null, null, null, null, null, null, null, null, 1, 0);
     $opcoes = array("" => "Selecione");
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     }
     $this->campoLista("setor_0", "Setor", $opcoes, $this->setor_0, "oproDocumentoNextLvl( this.value, '1' )", NULL, NULL, NULL, NULL, FALSE);
     $lst_setor = $obj_setor->lista($this->setor_0);
     $opcoes = array("" => "Selecione");
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     } else {
         $opcoes[""] = "---------";
     }
     $this->campoLista("setor_1", "Subsetor 1", $opcoes, $this->setor_1, "oproDocumentoNextLvl(this.value, '2')", false, "", "", $this->setor_0 == "" ? true : false, false);
     $opcoes = array("" => "Selecione");
     $lst_setor = $obj_setor->lista($this->setor_1);
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     } else {
         $opcoes[""] = "---------";
     }
     $this->campoLista("setor_2", "Subsetor 2", $opcoes, $this->setor_2, "oproDocumentoNextLvl(this.value, '3')", false, "", "", $this->setor_1 == "" ? true : false, false);
     $opcoes = array("" => "Selecione");
     $lst_setor = $obj_setor->lista($this->setor_2);
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     } else {
         $opcoes[""] = "---------";
     }
     $this->campoLista("setor_3", "Subsetor 3", $opcoes, $this->setor_3, "oproDocumentoNextLvl(this.value, '4')", false, "", "", $this->setor_2 == "" ? true : false, false);
     $opcoes = array("" => "Selecione");
     $lst_setor = $obj_setor->lista($this->setor_3);
     if (is_array($lst_setor) && count($lst_setor)) {
         foreach ($lst_setor as $setor) {
             $opcoes[$setor["cod_setor"]] = $setor["sgl_setor"];
         }
     } else {
         $opcoes[""] = "---------";
     }
     $this->campoLista("setor_4", "Subsetor 4", $opcoes, $this->setor_4, "oproDocumentoNextLvl(this.value, '5')", false, "", "", $this->setor_3 == "" ? true : false, false);
     $opcoes = array(0 => "Inativo", 1 => "Ativo");
     $this->campoLista("ativo", "Status", $opcoes, $this->ativo);
     $opcoes = array("" => "Selecione", 5 => "Comissionado", 4 => "Contratado", 3 => "Efetivo", 6 => "Estagi&aacute;rio");
     $this->campoLista("ref_cod_funcionario_vinculo", "V&iacute;nculo", $opcoes, $this->ref_cod_funcionario_vinculo);
     $opcoes = array("" => "Selecione", 5 => "5", 6 => "6", 7 => "7", 10 => "10", 14 => "14", 20 => "20", 21 => "21", 28 => "28", 30 => "30", 35 => "35", 60 => "60", 90 => "90", 120 => "120", 150 => "150", 180 => "180", 210 => "210", 240 => "240", 270 => "270", 300 => "300", 365 => "365");
     $this->campoLista("tempo_expira_conta", "Dias p/ expirar a conta", $opcoes, $this->tempo_expira_conta);
     $tempoExpiraSenha = $GLOBALS['coreExt']['Config']->app->user_accounts->default_password_expiration_period;
     if (is_numeric($tempoExpiraSenha)) {
         $this->campoOculto("tempo_expira_senha", $tempoExpiraSenha);
     } else {
         $opcoes = array('' => 'Selecione', 5 => '5', 30 => '30', 60 => '60', 90 => '90', 120 => '120', 180 => '180');
         $this->campoLista("tempo_expira_senha", "Dias p/ expirar a senha", $opcoes, $this->tempo_expira_senha);
     }
     $this->campoTexto("ramal", "Ramal", $this->ramal, 11, 30);
     $opcoes = array(null => "Não", 'S' => "Sim");
     $this->campoLista("super", "Super usu&aacute;rio", $opcoes, $this->super, '', false, '', '', false, false);
     $opcoes = array(null => "Não", 1 => "Sim");
     $this->campoLista("proibido", "Banido", $opcoes, $this->proibido, '', false, '', '', false, false);
     $opcoes = array(null => "Não", 1 => "Sim");
     $this->campoLista("matricula_permanente", "Matr&iacute;cula permanente", $opcoes, $this->matricula_permanente, '', false, '', '', false, false);
     //-----------------------------------------------------------------------------------------------
     $this->campoRotulo("rotulo_permissoes", "<b><i>Permiss&otilde;es</i></b>", "");
     $obj_menu = new clsPortalMenuMenu();
     $obj_menu->setOrderby("nm_menu ASC");
     $lst_menu = $obj_menu->lista();
     //busca todos os submenus liberado para o funcionario
     if (is_numeric($this->ref_pessoa)) {
         $obj_menu_funcionario = new clsPortalMenuFuncionario($this->ref_pessoa);
         $lst_menu_funcionario = $obj_menu_funcionario->lista(null, null, $this->ref_pessoa);
         if (is_array($lst_menu_funcionario) && count($lst_menu_funcionario)) {
             foreach ($lst_menu_funcionario as $id_submenu) {
                 $array_submenu[] = $id_submenu["ref_cod_menu_submenu"];
             }
         }
     }
     if (is_array($lst_menu) && count($lst_menu)) {
         foreach ($lst_menu as $key => $menu) {
             $array_valores = array();
             if ($menu["cod_menu_menu"] != 1) {
                 /*					if( $menu['nm_menu'] == "i-Frotas")
                 					{
                 						echo $menu["cod_menu_menu"];
                 					}*/
                 $obj_submenu = new clsPortalMenuSubmenu();
                 $obj_submenu->setOrderby("nm_submenu ASC");
                 $lst_submenu = $obj_submenu->lista($menu["cod_menu_menu"], 2);
                 $opcoes = array("" => "Selecione");
                 if (is_array($lst_submenu) && count($lst_submenu)) {
                     foreach ($lst_submenu as $submenu) {
                         $opcoes[$submenu["cod_menu_submenu"]] = $submenu["nm_submenu"];
                     }
                 }
                 if (is_numeric($this->ref_pessoa)) {
                     if (is_array($array_submenu) && count($array_submenu)) {
                         //faz a interseccao dos submenus do funcionario e os submenus do menu atual (do foreach)
                         $array_menu_submenu = array_intersect(array_flip($opcoes), $array_submenu);
                     }
                     $contador = 0;
                     if (is_array($array_menu_submenu) && count($array_menu_submenu)) {
                         //monta a matriz que conterao os valores da tabela (do BD)
                         foreach ($array_menu_submenu as $id_submenu) {
                             $obj_menu_funcionario = new clsPortalMenuFuncionario($this->ref_pessoa, null, null, $id_submenu);
                             $det_menu_funcionario = $obj_menu_funcionario->detalhe();
                             $array_valores[$contador][] = $det_menu_funcionario["ref_cod_menu_submenu"];
                             $array_valores[$contador][] = $det_menu_funcionario["cadastra"];
                             $array_valores[$contador++][] = $det_menu_funcionario["exclui"];
                         }
                     }
                 }
                 $this->campoTabelaInicio(str_replace(" ", "_", limpa_acentos(strtolower($menu["nm_menu"]))), $menu["nm_menu"], array("Submenu", "Cadastrar", "Excluir"), $array_valores, "500");
                 $this->campoLista(str_replace(" ", "_", limpa_acentos(strtolower($menu["nm_menu"]))) . "_", "", $opcoes, "", "", false, "", "", false, false);
                 $this->campoCheck("cad_" . str_replace(" ", "_", limpa_acentos(strtolower($menu["nm_menu"]))), "", "");
                 $this->campoCheck("exc_" . str_replace(" ", "_", limpa_acentos(strtolower($menu["nm_menu"]))), "", "");
                 $this->campoTabelaFim();
             }
         }
     }
 }
 function Gerar()
 {
     //	include( "include/form_setor.inc.php" );
     $obj_setores = new clsPmiacoesSecretariaResponsavel();
     $obj_setores->_campos_lista = "ref_cod_setor";
     $obj_lista = $obj_setores->lista();
     if ($obj_lista) {
         unset($obj_lista[array_search($this->setor, $obj_lista)]);
         $not_in = implode(",", $obj_lista);
     }
     $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, $not_in, $cod_setor);
     $setores = array('' => 'Selecione um setor');
     if ($obj_setor_lista) {
         foreach ($obj_setor_lista as $secretaria) {
             $setores[$secretaria["cod_setor"]] = $secretaria["sgl_setor"];
         }
     }
     $this->campoLista("setor", "Setor", $setores, $this->setor, '', false, '', '', '', true);
     $this->campoOculto("pessoa_logada", $this->pessoa_logada);
     $this->campoOculto("cod_setor_old", $this->setor);
 }
 function RenderHTML()
 {
     $retorno = "<br>";
     $espaco_padrao = "&nbsp; &nbsp;";
     $objSetor = new clsSetor();
     $lista0 = $objSetor->lista(null, null, null, null, null, null, null, null, null, 1, 0);
     if (is_array($lista0)) {
         foreach ($lista0 as $linha0) {
             $espacamento = array();
             for ($i = 0; $i < 1; $i++) {
                 $espacamento[$i] = $espaco_padrao;
             }
             $tabulacao = implode("|", $espacamento);
             $retorno .= "<br>{$tabulacao}+ <a href='oprot_setor_det.php?cod_setor={$linha0["cod_setor"]}'><b>{$linha0["nm_setor"]} - <i>{$linha0["sgl_setor"]}</i></b></a><br>";
             // prox nivel
             $lista1 = $objSetor->lista($linha0["cod_setor"]);
             if (is_array($lista1)) {
                 foreach ($lista1 as $linha1) {
                     $espacamento = array();
                     for ($i = 0; $i < 2; $i++) {
                         $espacamento[$i] = $espaco_padrao;
                     }
                     $tabulacao = implode("|", $espacamento);
                     $retorno .= "{$tabulacao}+ <a href='oprot_setor_det.php?cod_setor={$linha1["cod_setor"]}'>{$linha1["nm_setor"]} - <i>{$linha1["sgl_setor"]}</i></a><br>";
                     // prox nivel
                     $lista2 = $objSetor->lista($linha1["cod_setor"]);
                     if (is_array($lista2)) {
                         foreach ($lista2 as $linha2) {
                             $espacamento = array();
                             for ($i = 0; $i < 3; $i++) {
                                 $espacamento[$i] = $espaco_padrao;
                             }
                             $tabulacao = implode("|", $espacamento);
                             $retorno .= "{$tabulacao}+ <a href='oprot_setor_det.php?cod_setor={$linha2["cod_setor"]}'>{$linha2["nm_setor"]} - <i>{$linha2["sgl_setor"]}</i></a><br>";
                             // prox nivel
                             $lista3 = $objSetor->lista($linha2["cod_setor"]);
                             if (is_array($lista3)) {
                                 foreach ($lista3 as $linha3) {
                                     $espacamento = array();
                                     for ($i = 0; $i < 4; $i++) {
                                         $espacamento[$i] = $espaco_padrao;
                                     }
                                     $tabulacao = implode("|", $espacamento);
                                     $retorno .= "{$tabulacao}+ <a href='oprot_setor_det.php?cod_setor={$linha3["cod_setor"]}'>{$linha3["nm_setor"]} - <i>{$linha3["sgl_setor"]}</i></a><br>";
                                     // prox nivel
                                     $lista4 = $objSetor->lista($linha3["cod_setor"]);
                                     if (is_array($lista4)) {
                                         foreach ($lista4 as $linha4) {
                                             $espacamento = array();
                                             for ($i = 0; $i < 5; $i++) {
                                                 $espacamento[$i] = $espaco_padrao;
                                             }
                                             $tabulacao = implode("|", $espacamento);
                                             $retorno .= "{$tabulacao}+ <a href='oprot_setor_det.php?cod_setor={$linha4["cod_setor"]}'>{$linha4["nm_setor"]} - <i>{$linha4["sgl_setor"]}</i></a><br>";
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     /*
     $db1 = new clsBanco();
     $db2 = new clsBanco();
     $db3 = new clsBanco();
     
     
     $retorno = "<br>";
     $db1->Consulta( "SELECT cod_administracao_secretaria, nm_secretaria, sigla FROM administracao_secretaria ORDER BY nm_secretaria" );
     while ( $db1->ProximoRegistro() )
     {
     	list( $cod_secretaria, $nm_secretaria, $sigla ) = $db1->Tupla();
     	$retorno .= "&nbsp;&nbsp;<a href='administracao_secretaria_det.php?cod={$cod_secretaria}'><b>{$nm_secretaria} - <i>{$sigla}</i></b></a><br>";
     	
     	$db2->Consulta("SELECT ref_cod_administracao_secretaria, cod_departamento, nm_departamento FROM administracao_departamento WHERE ref_cod_administracao_secretaria={$cod_secretaria} ORDER BY nm_departamento");
     	while ($db2->ProximoRegistro())
     	{
     		list ($ref_cod_secretaria, $cod_departamento, $nm_departamento) = $db2->Tupla();
     			$retorno .= "&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;- <a href='administracao_departamento_det.php?cod_departamento={$cod_departamento}&ref_cod_administracao_secretaria={$ref_cod_secretaria}'>{$nm_departamento}</a><br>";
     		
     		$db3->Consulta("SELECT ref_ref_cod_administracao_secretaria, ref_cod_departamento, cod_setor, nm_setor FROM administracao_setor WHERE ref_ref_cod_administracao_secretaria={$ref_cod_secretaria} AND ref_cod_departamento={$cod_departamento} ORDER BY nm_setor");
     		while ($db3->ProximoRegistro())
     		{
     			list ($ref_ref_cod_secretaria, $ref_cod_departamento, $cod_setor, $nm_setor) = $db3->Tupla();
     			$retorno .= "&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;- <a href='administracao_setor_det.php?cod_setor={$cod_setor}&ref_cod_departamento={$ref_cod_departamento}&ref_ref_cod_administracao_secretaria={$ref_ref_cod_secretaria}'>{$nm_setor}</a><br>";
     		}
     		$db3->Libera();
     	}
     	$db2->Libera();
     }
     $db1->Libera();
     */
     return $retorno . "<br><br>";
 }
 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();
 }
 * ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral
 * do GNU para mais detalhes.
 *
 * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto
 * com este programa; se não, escreva para a Free Software Foundation, Inc., no
 * endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
 *
 * @author    Prefeitura Municipal de Itajaí <*****@*****.**>
 * @category  i-Educar
 * @license   @@license@@
 * @package   iEd
 * @since     Arquivo disponível desde a versão 1.0.0
 * @version   $Id$
 */
header('Content-type: text/xml');
require_once 'include/pmidrh/geral.inc.php';
require_once 'Portabilis/Utils/DeprecatedXmlApi.php';
Portabilis_Utils_DeprecatedXmlApi::returnEmptyQueryUnlessUserIsLoggedIn();
echo '<?xml version="1.0" encoding="ISO-8859-15"?>' . "\n";
echo '<query xmlns="sugestoes">' . "\n";
if (isset($_GET['setor_pai'])) {
    $obj = new clsSetor();
    $lista = $obj->lista($_GET['setor_pai']);
    if ($lista) {
        foreach ($lista as $linha) {
            echo '  <item>' . $linha['sgl_setor'] . '</item>' . "\n";
            echo '  <item>' . $linha['cod_setor'] . '</item>' . "\n";
        }
    }
}
echo '</query>';
Beispiel #8
0
 function Gerar()
 {
     @session_start();
     $this->pessoaFj = $_SESSION['id_pessoa'];
     session_write_close();
     $this->campoOculto("pessoaFj", $this->pessoaFj);
     $this->campoOculto("cod_diaria", $this->cod_diaria);
     if ($this->num_diaria) {
         $this->campoOculto("num_diaria", $this->num_diaria);
     }
     // Campo listaPesq de Funcionario
     $lista = array();
     if ($this->ref_funcionario) {
         $objPessoa = new clsPessoaFJ($this->ref_funcionario);
         $detalhe = $objPessoa->detalhe();
         if ($detalhe) {
             $lista[$detalhe["idpes"]] = $detalhe["nome"];
             $lista[""] = "Pesquise outras pessoas clicando no botao ao lado";
         } else {
             $lista[""] = "Pesquise a pessoa clicando no botao ao lado";
         }
     } else {
         $lista[""] = "Pesquise a pessoa clicando no botao ao lado";
     }
     $parametros = new clsParametrosPesquisas();
     $parametros->setSubmit(0);
     $parametros->adicionaCampoSelect("ref_funcionario", "ref_cod_pessoa_fj", "nome");
     $this->campoListaPesq("ref_funcionario", "Funcion&aacute;rio", $lista, $this->ref_funcionario, "pesquisa_funcionario_lst.php", "", false, "", "", null, null, "", false, $parametros->serializaCampos());
     $grupo = array();
     $grupo[""] = "Selecione o grupo";
     $db = new clsBanco();
     $db->Consulta("SELECT cod_diaria_grupo, desc_grupo FROM pmidrh.diaria_grupo ORDER BY cod_diaria_grupo ASC");
     while ($db->ProximoRegistro()) {
         list($cod_grupo, $nome) = $db->Tupla();
         $grupo[$cod_grupo] = $nome;
     }
     $this->campoLista("ref_cod_diaria_grupo", "Grupo de di&aacute;ria", $grupo, $this->ref_cod_diaria_grupo, "diaria_carrega_valores();");
     $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, "diaria_carrega_valores();");
     $this->campoTexto("conta_corrente", "Conta corrente", $this->conta_corrente, 10, 10);
     if (!$this->banco) {
         $this->banco = "001";
     }
     if (!$this->agencia) {
         $this->agencia = "03050";
     }
     $this->campoTexto("agencia", "Ag&ecirc;ncia", $this->agencia, 10, 10);
     $this->campoTexto("banco", "Banco", $this->banco, 10, 10);
     $this->campoTexto("dotacao_orcamentaria", "Dota&ccedil;&atilde;o Or&ccedil;ament&aacute;ria", $this->dotacao_orcamentaria, 50, 50);
     $this->campoMemo("objetivo", "Objetivo", $this->objetivo, 48, 2);
     if ($this->data_pedido) {
         $this->data_pedido = date("d/m/Y", strtotime(substr($this->data_pedido, 0, 16)));
     }
     $this->campoData("data_pedido", "Data para Empenho", $this->data_pedido, true);
     if ($this->data_partida) {
         $this->hora_partida = date("H:i", strtotime($this->data_partida));
         $this->data_partida = date("d/m/Y", strtotime($this->data_partida));
     }
     $this->campoData("data_partida", "Data de Partida", $this->data_partida, false, false, false, "onBlur=\"diaria_carrega_valores();\"");
     $this->campoHora("hora_partida", "Hora de Partida", $this->hora_partida, false, false, "onBlur=\"diaria_carrega_valores();\"");
     if ($this->data_chegada) {
         $this->hora_chegada = date("H:i", strtotime($this->data_chegada));
         $this->data_chegada = date("d/m/Y", strtotime($this->data_chegada));
     }
     $this->campoData("data_chegada", "Data de Chegada", $this->data_chegada, false, false, false, "onBlur=\"diaria_carrega_valores();\"");
     $this->campoHora("hora_chegada", "Hora de Chegada", $this->hora_chegada, false, false, "onBlur=\"diaria_carrega_valores();\"");
     if (!is_numeric($this->estadual)) {
         $this->estadual = 1;
     }
     $this->campoLista("estadual", "Estadual", array("N&atilde;o", "Sim"), $this->estadual, "diaria_carrega_valores();");
     $this->campoTexto("destino", "Destino", $this->destino, 50, 100);
     $this->campoTexto("vl100", "Valor 100%", number_format($this->vl100, 2, ',', '.'), 20, 20, false, false, true);
     $this->campoTextoInv("sug100", " &nbsp; &nbsp; Valor sugerido", "", 10, 10);
     $this->campoTexto("vl75", "Valor 75%", number_format($this->vl75, 2, ',', '.'), 20, 20, false, false, true);
     $this->campoTextoInv("sug75", " &nbsp; &nbsp; Valor sugerido", "", 10, 10);
     $this->campoTexto("vl50", "Valor 50%", number_format($this->vl50, 2, ',', '.'), 20, 20, false, false, true);
     $this->campoTextoInv("sug50", " &nbsp; &nbsp; Valor sugerido", "", 10, 10);
     $this->campoTexto("vl25", "Valor 25%", number_format($this->vl25, 2, ',', '.'), 20, 20, false, false, true);
     $this->campoTextoInv("sug25", " &nbsp; &nbsp; Valor sugerido", "", 10, 10);
     $this->campoRotulo("copia", "Copiar", "<a href=\"#bottom\" onclick=\"diaria_copia_valores();\">Clique aqui para copiar os valores sugeridos.</a>", false, "<script type=\"text/javascript\">diaria_carrega_valores();</script>");
 }
*																		 *
*	Este programa  é distribuído na expectativa de ser útil, mas SEM	 *
*	QUALQUER GARANTIA. Sem mesmo a garantia implícita de COMERCIALI-	 *
*	ZAÇÃO  ou  de ADEQUAÇÃO A QUALQUER PROPÓSITO EM PARTICULAR. Con-	 *
*	sulte  a  Licença  Pública  Geral  GNU para obter mais detalhes.	 *
*																		 *
*	Você  deve  ter  recebido uma cópia da Licença Pública Geral GNU	 *
*	junto  com  este  programa. Se não, escreva para a Free Software	 *
*	Foundation,  Inc.,  59  Temple  Place,  Suite  330,  Boston,  MA	 *
*	02111-1307, USA.													 *
*																		 *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// opcao para selecionar o proximo setor manualmente
$objSetor = new clsSetor();
$listaSetores = array("Selecione");
$lista = $objSetor->lista(null, null, null, null, null, null, null, null, null, 1, 0, null, null, "sgl_setor ASC");
if (is_array($lista) && count($lista)) {
    foreach ($lista as $linha) {
        $listaSetores[$linha["cod_setor"]] = $linha["sgl_setor"];
    }
}
$this->campoLista("setor_0", "Setor", $listaSetores, $this->setor_0, "oproDocumentoNextLvl( this.value, '1' )", true);
$listaVazia = array("-----------");
if ($this->setor_0) {
    $lista1 = array("Selecione");
    $lista = $objSetor->lista($this->setor_0, null, null, null, null, null, null, null, null, 1, null, null, null, "sgl_setor ASC");
    if (is_array($lista) && count($lista)) {
        foreach ($lista as $linha) {
            $lista1[$linha["cod_setor"]] = $linha["sgl_setor"];
        }
    } else {
Beispiel #10
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);
             }
         }
     }
 }