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.
 
 
 
 
 
 

67 lines
2.4 KiB

<?php
$tpLayout = 1;
$templateName = 'discador/agtBloqueadoCampanha.htm';
$erro = "";
$cmpId = IsPostBack() ? $_POST["cmp_id"] : $_GET["cmp_id"];
/* $query = " select a.conf_id, a.conf_fone, now() - a.conf_data as tempo, a.cmp_id, a.conf_status, coalesce(a.agente, 0) as agente, b.cmp_descricao, coalesce(c.apelido, '-') as apelido
from pbx_campanha_contato_fone a
inner join pbx_campanha b on b.cmp_id = a.cmp_id
left outer join pbx_usuarios c on cast(c.matricula as int) = a.agente
where a.conf_status in('DISCANDO', 'HUMAN', 'ATENDIDA','HUMAN-ATENDIDA')
and a.conf_status_lista = 1
and a.cmp_id = '$cmpId' ";
*/
$query = " select agd_matricula as agente, agd_fone, agd_status, agd_data as tempo, b.apelido, c.cmp_descricao
from pbx_campanha_agendamento a, pbx_usuarios b, pbx_campanha c
where b.matricula = a.agd_matricula
and c.cmp_id = a.cmp_id
and a.cmp_id = '$cmpId'
and a.agd_data::date = now()::date
order by agd_data desc";
$linha = '';
$result = pg_query($dbcon, $query);
$erro = ($result ? '' : "Não foi possível realizar a operaçao! Erro: " . pg_last_error($dbcon));
while ($dados = pg_fetch_array($result)) {
$agente = $dados["agente"] . '-' . $dados["apelido"];
$fone = $dados["agd_fone"];
$tempo = $dados["tempo"];
$status = $dados["agd_status"];
$desc = $dados["cmp_descricao"];
$img = 'ok16.gif';
$title = 'Ligação Atendida';
if (strtoupper($status) == '0') {
$status = 'AGUARDANDO';
$img = 'tempo.png';
$title = 'Aguardando';
} else if (strtoupper($status) != 'ATENDIDA') {
$status = 'NÃO ATENDIDA';
$img = 'no.gif';
$title = 'Ligação não Atendida';
}
$img = sprintf('<img src="imgSite/%s" border="0" align="absmiddle" alt="%s" title="%s">', $img, $title, $title);
$linha .= " <tr><td>$img</td>
<td>$agente</td>
<td>$fone</td>
<td>$status</td>
<td>$tempo</td>
</tr>";
}
$smarty->assign('linha', $linha);
$smarty->assign('cmp_id', $cmpId);
$smarty->assign('cmp_descricao', $desc);
$smarty->assign('erro', $erroAtu . $erro);
GetTemplate($smarty, $templateName);
?>