<?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>
<style type="text/css">
BODY {
margin-top:0px;
margin-left:0px;
margin-right:0px;
margin-bottom:0px;
font-family:sans-serif;
font-size:10pt;
color:black;
background-color:white;
}
A {
text-decoration:none;
color:blue;
}
A:HOVER {
color:#198eff;
text-decoration:underline;
}
A:VISITED {
color:blue;
}
</style>
<script language="JavaScript" src="../sol/includes/FuncoesTela.js" type="text/javascript"></script>
<script language='JavaScript' type="text/javascript">
function AjustarTamanhoGrid()
{
<? if (empty($_GET['sol'])) { ?>
parent.document.getElementById('atendidos').height = document.getElementById('mytbl').clientHeight + 10;
<? } else { ?>
parent.document.getElementById('atendidos').height = document.getElementById('mytbl').clientHeight + 50;
<? } ?>
parent.document.getElementById('carregando').style.display = 'none';
}
function SubFiltrar()
{
parent.document.getElementById('atendidos').height = 0;
parent.document.getElementById('carregando').style.display = '';
}
</script>
</head>
<body onload="AjustarTamanhoGrid()">
<?php
if (!empty($_GET['sol']))
{
echo '<b>Exibindo atendimentos para:</b> '.$_GET['sol_nome'];
echo ' [ <a href="agendamentos_ok.php?sit='.$_GET['sit'].'&dir='.$_GET['dir'].'&usu='.$_GET['usu'].'">Exibir atendimentos para todos</a> ]<br /> <br />';
}
?>
<table cellspacing="1" cellpadding="3" style="background-color:#666666;" width="100%" id="mytbl">
<tr style="color:#FFFFFF; font-weight:bold;">
<td width="100"></td>
<td align="center">Data e hora</td>
<td align="center">Direcionamento</td>
<td align="center">Tipo de contato</td>
<td>Solicitante</td>
<td>Pessoa de contato</td>
<td>Situação</td>
<td align="center">Usuário</td>
</tr>
<?php
//Conecta ao banco e abre query
$dados = new dados();
$dados->get_conexao();
$sql = "SELECT
v.data_atendido, v.hora_atendido, v.situacao_contato, u.username, i.nome,
v.pessoa_atendida, v.tipo_atendido, v.id, v.eh_comercial, v.eh_suporte, v.solicitante
FROM
visitas AS v
INNER JOIN
usuarios AS u ON (u.id_usuario = v.usuario_agendou)
INNER JOIN
instituicao AS i ON (i.id_inst = v.solicitante)
WHERE
v.status = 'V'";
if (!empty($_GET['sit'])) $sql .= " AND situacao_contato = '".TrataStr($_GET['sit'])."'";
if ($_GET['dir'] == 'S') $sql .= " AND eh_suporte = 1";
if ($_GET['dir'] == 'C') $sql .= " AND eh_comercial = 1";
if ($_GET['usu'] != '0') $sql .= " AND usuario_agendou = ".$_GET['usu'];
if (!empty($_GET['sol'])) $sql .= " AND solicitante = ".$_GET['sol'];
$sql .= " ORDER BY v.data_atendido DESC, v.hora_atendido DESC";
$rs = mysql_query($sql);
$i = 1;
while ($reg = mysql_fetch_array($rs))
{
?>
<tr style="background-color:#<? if ($i % 2 == 0) echo "E8E8E8"; else echo "FFFFFF";?>;">
<td align="center">[ <a href="pre_agendamento.php?tipo=ver&id=<?=$reg['id']?>" target="_parent">+ detalhes</a> ]</td>
<td align="center">
<?php
echo substr($reg["data_atendido"], 8, 2)."/".substr($reg["data_atendido"], 5, 2)."/".substr($reg["data_atendido"], 0, 4);
echo ' '.substr($reg['hora_atendido'], 0, 5);
?>
</td>
<td align="center"><? if ($reg['eh_comercial'] == 1) echo 'Comercial'; else echo 'Suporte'; ?></td>
<td align="center"><?=utf8_encode($reg['tipo_atendido'])?></td>
<td><a href="agendamentos_ok.php?<?=$_SERVER['QUERY_STRING']?>&sol=<?=$reg['solicitante']?>&sol_nome=<?=utf8_encode($reg['nome'])?>" title="Exibir apenas atendimentos feitos para <?=utf8_encode($reg['nome'])?>..." onclick="SubFiltrar();"><?=utf8_encode($reg['nome'])?></a></td>
<td><?=utf8_encode($reg['pessoa_atendida'])?></td>
<td><?=utf8_encode($reg['situacao_contato'])?></td>
<td align="center"><?=utf8_encode($reg['username'])?></td>
</tr>
<?php
$i++;
}
?>
</table>
</body>
</html>
<?php
@mysql_close();
?>