forked from SimplesIP/pabx-app
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.
63 lines
2.6 KiB
63 lines
2.6 KiB
2 years ago
|
<?php
|
||
|
|
||
|
$tpLayout = 1;
|
||
|
$dac = $_GET["dac"];
|
||
|
|
||
|
|
||
|
$nomeTpl = "supervisao/RelSupOriginadas.tpl";
|
||
|
|
||
|
$query = " select a.calldate::time as hora,
|
||
|
a.dst as destino,
|
||
|
a.billsec as tmo,
|
||
|
c.apelido as agente,
|
||
|
a.ramal_origem 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 a.lastapp <> 'Transferred Call'
|
||
|
and b.evento in('COMPLETAAGENT','COMPLETACALLER','TRANSFERORIG','BUSYS','NOANSWERS')
|
||
|
and b.fila = '$dac'
|
||
|
order by 1";
|
||
|
|
||
|
//echo $query;
|
||
|
$result = pg_query($dbcon, $query);
|
||
|
$numrow = 0;
|
||
|
$linhas = "";
|
||
|
$duracaoTotal = '';
|
||
|
while ($row = pg_fetch_array($result)) {
|
||
|
$hora = $row["hora"];
|
||
|
$destino = ocultarTelefone($row["destino"]);
|
||
|
$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>";
|
||
|
//$linhas .= sprintf($linha, FormataDBDataHora($row["hora"]), $row["destino"], SecondToStrTime($row["tmo"]),$row["agente"],$row["ramal_agente"] );
|
||
|
$duracaoTotal += $row["hora"];
|
||
|
$numrow++;
|
||
|
}
|
||
|
|
||
|
$duracaoTotal = SecondToStrTime($duracaoTotal);
|
||
|
$linhas .= "<tr align=\"center\">
|
||
|
<th nowrap align=\"left\" colspan=\"5\" >Total</th>
|
||
|
<th nowrap class=\"headData\">$numrow</th>
|
||
|
</tr>";
|
||
|
|
||
|
//print $linhas;
|
||
|
$smarty->assign('linhas', $linhas);
|
||
|
GetTemplate($smarty, $nomeTpl);
|
||
|
?>
|