PABX da Simples IP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
2.3 KiB

<?php
$tpLayout = 1;
$dac = $_GET["dac"];
$nomeTpl = "supervisao/RelSupRecebidas.tpl";
$query = " select a.calldate::time as hora, a.src as origem, a.billsec as tmo, coalesce(c.apelido, '-') as agente,
(select max(strtoint(destino)) from pbx_bilhetes_complemento where uniqueid2 = a.uniqueid and direcao = 'fila-ramal') as ramal_agente,
case when(a.disposition = 'ANSWERED')then 1 else 0 end as status,
b.fila,
(select max(protocolo) from pbx_protocolo_reg where uniqueid = a.uniqueid) as protocolo
from ast_bilhetes a
inner join ast_eventos_dacs b on b.uid2 = a.uniqueid
left join pbx_usuarios c on c.matricula = substring(b.agente,7 ,4)
where a.data_bilhete = now()::date
and b.evento in('COMPLETEAGENT','COMPLETECALLER', 'TRANSFER','COMPLETEAGENTRAMAL','COMPLETECALLERRAMAL')
and a.lastapp <> 'Transferred Call'
and b.fila = '$dac'
order by 1";
$result = pg_query($dbcon, $query);
$numrow = 0;
$linhas = "";
while ($row = pg_fetch_array($result)) {
$hora = $row["hora"];
$destino = ocultarTelefone($row["origem"]);
$tempo = SecondToStrTime($row["tmo"]);
$agente = $row["agente"];
$ramalAgente = $row["ramal_agente"];
//$proto = $row["protocolo"];
$proto = substr($row["protocolo"], 0, 4) . "-" . substr($row["protocolo"], 4);
$linhas .= " <tr align=\"center\">
<td nowrap align=\"center\" class=\"headData\">$hora</td>
<td nowrap align=\"left\" class=\"headData\">$destino</td>
<td nowrap align=\"center\" class=\"headData\">$tempo</td>
<td nowrap align=\"left\" class=\"headData\">$agente</td>
<td nowrap align=\"left\" class=\"headData\">$ramalAgente</td>
<td nowrap align=\"center\" class=\"headData\">$proto</td>
</tr>";
$numrow++;
}
$linhas .= "<tr align=\"center\">
<th nowrap align=\"left\" colspan=\"5\" >Total</th>
<th nowrap class=\"headData\">$numrow</th>
</tr>";
$smarty->assign('linhas', $linhas);
GetTemplate($smarty, $nomeTpl);
?>