<?php
include("../sol/sessao.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>SolBT - <?=$sitenome?></title>
<link rel="StyleSheet" type="text/css" href="../sol/includes/estilos.css" id="estilo" />
<script language='JavaScript' src='../sol/includes/FuncoesTela.js' type="text/javascript"></script>
<script language='JavaScript' type="text/javascript">
<!--
function Salvar()
{
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
document.getElementById('titulo').value = document.getElementById('titulo').value.trim();
document.getElementById('prazo').value = document.getElementById('prazo').value.trim();
document.getElementById('prazoa').value = document.getElementById('prazoa').value.trim();
document.getElementById('data').value = document.getElementById('data').value.trim();
document.getElementById('dataa').value = document.getElementById('dataa').value.trim();
//Valida data
var er = /^(([0-2]\d|[3][0-1])\/([0]\d|[1][0-2])\/[1-2][0-9]\d{2})$/;
b = document.getElementById('data').value;
if (document.getElementById('data').value.length > 0)
{
if(!er.test(b))
{
window.alert('Data de lançamento inicial inválida!');
document.getElementById('data').value = '';
document.getElementById('data').focus();
return;
}
}
b = document.getElementById('dataa').value;
if (document.getElementById('dataa').value.length > 0)
{
if(!er.test(b))
{
window.alert('Data de lançamento final inválida!');
document.getElementById('dataa').value = '';
document.getElementById('dataa').focus();
return;
}
}
b = document.getElementById('prazo').value;
if (document.getElementById('prazo').value.length > 0)
{
if(!er.test(b))
{
window.alert('Data do prazo inicial inválida!');
document.getElementById('prazo').value = '';
document.getElementById('prazo').focus();
return;
}
}
b = document.getElementById('prazoa').value;
if (document.getElementById('prazoa').value.length > 0)
{
if(!er.test(b))
{
window.alert('Data do prazo final inválida!');
document.getElementById('prazoa').value = '';
document.getElementById('prazoa').focus();
return;
}
}
//Verifica prioridades
if (document.getElementById('prioridadea').selectedIndex < document.getElementById('prioridade').selectedIndex)
{
if (document.getElementById('prioridadea').value > -1)
{
window.alert('O nÃvel da priodidade final não pode ser menor que o da inicial!');
document.getElementById('prioridadea').value = '';
document.getElementById('prioridadea').focus();
return;
}
}
//Posta
document.forms.frmChamado.submit();
}
function SelecionaModulo(valor)
{
ajax = InstanciaAJAX();
document.getElementById('modulo').options.length = 1;
document.getElementById('versao').options.length = 1;
OpcaoModulo = document.getElementById('opcaomodulo');
if (valor > 0)
{
ajax.open('POST', 'modulos.xml.php', true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajax.onreadystatechange = function()
{
//Enquanto estiver processando emite a mensagem de aguarde
if(ajax.readyState == 1)
{
OpcaoModulo.innerHTML = 'Carregando módulos...';
}
//Após ser processado chama função processXML que vai varrer os dados
if(ajax.readyState == 4 )
{
if(ajax.responseXML)
{
processXML(ajax.responseXML);
}
else
{
//Caso não consiga ler o arquivo XML emite a mensagem e desabilita a lista de cidades
OpcaoModulo.innerHTML = 'Todos';
}
}
}
}
//Passa o código do estado escolhido como parâmetro pro POST e envia
var params = 'id=' + valor;
ajax.send(params);
}
function processXML(obj)
{
//Pega a TAG modulo
var dataArray = obj.getElementsByTagName('modulo');
//Verifica o total de elementos contidos na TAG
if(dataArray.length > 0)
{
//Percorre o arquivo XML para extrair os dados
for(var i = 0 ; i < dataArray.length ; i++)
{
var item = dataArray[i];
//Conteudo dos campos no arquivo XML
var cod = item.getElementsByTagName('codigo')[0].firstChild.nodeValue;
var smodulo = item.getElementsByTagName('nome')[0].firstChild.nodeValue;
OpcaoModulo.innerHTML = 'Todos';
//Cria um novo option dinamicamente
var novo = document.createElement('option');
//Atribui um ID a esse elemento
novo.setAttribute('id', 'opcaomodulo');
//Atribui valor e texto
novo.value = cod;
novo.text = smodulo;
//Adiciona o novo elemento
document.getElementById('modulo').options.add(novo);
}
SelecionaVersao(document.getElementById('sistema').value);
}
else
{
//Caso o XML volte vazio
OpcaoModulo.innerHTML = 'Todos';
}
}
function SelecionaVersao(valor)
{
ajax = InstanciaAJAX();
document.getElementById('versao').options.length = 1;
OpcaoVersao = document.getElementById('opcaoversao');
if (valor > 0)
{
ajax.open('POST', 'versoes.xml.php', true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajax.onreadystatechange = function()
{
//Enquanto estiver processando emite a mensagem de aguarde
if(ajax.readyState == 1)
{
OpcaoVersao.innerHTML = 'Carregando versões...';
}
//Após ser processado chama função processXML que vai varrer os dados
if(ajax.readyState == 4 )
{
if(ajax.responseXML)
{
processXMLVer(ajax.responseXML);
}
else
{
//Caso não consiga ler o arquivo XML emite a mensagem e desabilita a lista de cidades
OpcaoVersao.innerHTML = 'Todas';
}
}
}
}
//Passa o código do estado escolhido como parâmetro pro POST e envia
var params = 'id=' + valor;
ajax.send(params);
}
function processXMLVer(obj)
{
//Pega a TAG modulo
var dataArray = obj.getElementsByTagName('versao');
//Verifica o total de elementos contidos na TAG
if(dataArray.length > 0)
{
//Percorre o arquivo XML para extrair os dados
for(var i = 0 ; i < dataArray.length ; i++)
{
var item = dataArray[i];
//Conteudo dos campos no arquivo XML
var cod = item.getElementsByTagName('codigo')[0].firstChild.nodeValue;
var sver = item.getElementsByTagName('ver')[0].firstChild.nodeValue;
OpcaoVersao.innerHTML = 'Todas';
//Cria um novo option dinamicamente
var novo = document.createElement('option');
//Atribui um ID a esse elemento
novo.setAttribute('id', 'opcaoversao');
//Atribui valor e texto
novo.value = cod;
novo.text = sver;
//Adiciona o novo elemento
document.getElementById('versao').options.add(novo);
}
}
else
{
//Caso o XML volte vazio
OpcaoVersao.innerHTML = 'Todas';
}
}
//Pesquisa e valida o cliente
function ValidarCliente(pesquisa)
{
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
b = document.getElementById('cliente').value = b = document.getElementById('cliente').value.trim();
var er = /[0-9]{1,}/;
b = document.getElementById('cliente').value;
if (document.getElementById('cliente').value == '')
{
document.getElementById('clinome').value = '';
if (!pesquisa)
{
window.alert('Campo solicitante/cliente deve ser preenchido!');
document.getElementById('cliente').focus();
return false;
}
}
else
{
if(!er.test(b))
{
window.alert('Campo solicitante/cliente inválido!');
document.getElementById('cliente').value = '';
document.getElementById('cliente').focus();
return false;
}
else
{
ajax = InstanciaAJAX();
document.getElementById('clinome').value = '';
ajax.open('POST', 'clientes.xml.php', true);
ajax.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ajax.onreadystatechange = function()
{
//Enquanto estiver processando emite a mensagem de aguarde
if(ajax.readyState == 1)
{
document.getElementById('clinome').style.color = '#666666';
document.getElementById('clinome').value = 'Localizando solicitante/cliente...';
}
//Após ser processado chama função processXML que vai varrer os dados
if(ajax.readyState == 4 )
{
if(ajax.responseXML)
{
return processaCliente(ajax.responseXML);
}
else
{
document.getElementById('clinome').value = '';
document.getElementById('cliente').value = '';
alert('Solicitante/cliente não encontrado ou ainda não efetivado!');
document.getElementById('clinome').style.color = '#000000';
document.getElementById('cliente').focus();
return false;
}
}
}
//Passa o código do estado escolhido como parâmetro pro POST e envia
var params = 'id=' + document.getElementById('cliente').value;
ajax.send(params);
return true;
}
}
}
function processaCliente(obj)
{
//Pega a TAG modulo
var dataArray = obj.getElementsByTagName('cliente');
//Verifica o total de elementos contidos na TAG
if(dataArray.length > 0)
{
//Percorre o arquivo XML para extrair os dados
for(var i = 0 ; i < dataArray.length ; i++)
{
var item = dataArray[i];
//Conteudo dos campos no arquivo XML
var cli = item.getElementsByTagName('nome')[0].firstChild.nodeValue;
var codreal = item.getElementsByTagName('codigo')[0].firstChild.nodeValue;
document.getElementById('cliente').value = codreal;
document.getElementById('clinome').value = cli;
document.getElementById('clinome').style.color = '#000000';
return true
}
}
else
{
//Caso o XML volte vazio
document.getElementById('clinome').value = '';
document.getElementById('cliente').value = '';
alert('Solicitante/cliente informado não encontrado ou ainda não efetivado!');
document.getElementById('clinome').style.color = '#000000';
document.getElementById('cliente').focus();
return false;
}
}
function BuscarCliente()
{
document.getElementById('clinome').value = '';
document.getElementById('cliente').value = '';
document.getElementById('pesqcli').style.display = '';
document.getElementById('actSair').style.display = 'none';
document.getElementById('rpVoltar').style.display = 'none';
document.getElementById('actCFG').style.display = 'none';
document.getElementById('edtPesqCli').value = '';
document.getElementById('carregando').style.display = '';
document.getElementById('edtPesqCli').focus();
window.open('pesqcli.php', 'ipesqcli');
}
-->
</script>
</head>
<body onload="document.getElementById('titulo').focus();">
<?php
include("../sol/framepesqcli.php");
?>
<?php
include("../sol/includes/menus.php");
?>
<table width="100%">
<?php
include("../sol/includes/top.php");
?>
<!-- CONTEUDO DA PAGINA -->
<tr>
<td id="Conteudo">
<br />
<span class="Titulo">Pesquisa de chamados</span><br /> <br />
<!--
<input type="text" id="" name="" value="" maxlength="" size="" /><br />
-->
<form action="chamados.php?filtro=pesquisa" method="post" id="frmChamado">
Título: <input type="text" id="titulo" name="titulo" value="" maxlength="250" size="75" onfocus="if (document.getElementById('pesqcli').style.display == '') document.getElementById('edtPesqCli').focus();;" /><br /> <br />
Data lançamento: <input type="text" id="data" name="data" value="" maxlength="10" size="10" /> a <input type="text" id="dataa" name="dataa" value="" maxlength="10" size="10" /> Prazo: <input type="text" id="prazo" name="prazo" value="" maxlength="10" size="10" /> a <input type="text" id="prazoa" name="prazoa" value="" maxlength="10" size="10" /> <em style="color:#666666;">(DD/MM/AAAA)</em><br /> <br />
Prioridade:
<select id="prioridade" name="prioridade">
<option value="-1" selected></option>
<?php
//Conecta ao banco e abre query
$dados = new dados();
$dados->get_conexao();
$sql = "SELECT * FROM prioridades ORDER BY nivel DESC";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["nivel"].'" style="color:#'.getCorPrioridade($reg["nivel"]).';">'.utf8_encode($reg["prioridade"]).'</option>';
}
?>
</select>
a
<select id="prioridadea" name="prioridadea">
<option value="-1" selected></option>
<?php
//Conecta ao banco e abre query
$dados = new dados();
$dados->get_conexao();
$sql = "SELECT * FROM prioridades ORDER BY nivel DESC";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["nivel"].'" style="color:#'.getCorPrioridade($reg["nivel"]).';">'.utf8_encode($reg["prioridade"]).'</option>';
}
?>
</select>
Tipo:
<select id="tipo" name="tipo">
<option value="0" selected>Tudo</option>
<?php
$sql = "SELECT * FROM tipos_de_chamado ORDER BY tipo ASC";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["id_tipos"].'">'.utf8_encode($reg["tipo"]).'</option>';
}
?>
</select>
<br /> <br />
Solicitante/Cliente:
<input type="text" id="cliente" name="cliente" value="" maxlength="7" size="5" onblur="ValidarCliente(true);" />
<input type="button" name="btnCliente" id="btnCliente" value="..." onclick="BuscarCliente();" title="Localizar cliente..." />
<input type="text" id="clinome" name="clinome" value="" size="50" readonly="true" />
<br /> <br />
Vinculados à unidade:
<select name="unidade" id="unidade">
<option value="0" selected>Qualquer uma</option>
<?php
//Lista todos os andamentos acima mais os de abertura
$sql = "SELECT id_inst, nome FROM instituicao WHERE vinculado_unidade = 0 ORDER BY nome ASC";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["id_inst"].'">'.utf8_encode($reg["nome"]).'</option>';
}
?>
</select>
Status:
<select id="status" name="status">
<option value="T" selected>Todos</option>
<option value="A">Aberto/pendente</option>
<option value="N">Em processamento</option>
<option value="F">Fechado/resolvido</option>
</select>
<br /> <br />
Sistema:
<select id="sistema" name="sistema" onchange="SelecionaModulo(this.value);">
<option value="0" selected>Todos</option>
<?php
$sql = "SELECT * FROM sistemas";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["id_sistema"].'">'.utf8_encode($reg["sistema"]).'</option>';
}
?>
</select>
Módulo: <select id="modulo" name="modulo"><option value="0" id="opcaomodulo" selected>Todos</option></select>
Versão: <select id="versao" name="versao"><option value="0" id="opcaoversao" selected>Todas</option></select>
<br /> <br />Andamento:
<select name="andamento" id="andamento">
<option value="0" selected>Todos</option>
<?php
//Lista todos os andamentos acima mais os de abertura
$sql = "SELECT id_andamento, andamento FROM andamentos ORDER BY andamento ASC";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["id_andamento"].'">'.utf8_encode($reg["andamento"]).'</option>';
}
?>
</select>
Departamento:
<select name="departamento" id="departamento">
<option value="0" selected>Todos</option>
<?php
//Lista todos os andamentos acima mais os de abertura
$sql = "SELECT id, departamento FROM departamentos ORDER BY departamento ASC";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["id"].'">'.utf8_encode($reg["departamento"]).'</option>';
}
?>
</select>
<br /> <br />
Aberto pelo usuário:
<select name="usuario" id="usuario">
<option value="0" selected>Qualquer um</option>
<?php
//Lista todos os andamentos acima mais os de abertura
$sql = "SELECT id_usuario, username FROM usuarios ORDER BY username ASC";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["id_usuario"].'">'.utf8_encode($reg["username"]).'</option>';
}
?>
</select>
Alterado recentemento por:
<select name="ult_usuario" id="ult_usuario">
<option value="0" selected>Qualquer um</option>
<?php
//Lista todos os andamentos acima mais os de abertura
$sql = "SELECT id_usuario, username FROM usuarios ORDER BY username ASC";
$rs = mysql_query($sql);
while ($reg = mysql_fetch_array($rs))
{
echo '<option value="'.$reg["id_usuario"].'">'.utf8_encode($reg["username"]).'</option>';
}
?>
</select>
<br /> <br /> <br />
<input type="button" name="btnSalvar" id="btnSalvar" value="Pesquisar chamados" onclick="Salvar();" onfocus="if (document.getElementById('pesqcli').style.display == '') document.getElementById('edtPesqCli').focus();;" style="
font-weight:bold; font-size:12pt;" />
</form>
<br /> <br />
</td>
</tr>
<!-- FIM DE CONTEUDO DA PAGINA -->
<?php
include("../sol/includes/rp.php");
?>
</table>
</body>
</html>
<?php
@mysql_close();
?>