Nenhum registro encontrado! | ";
$cor = !$msg || stripos($msg, 'sucesso') ? '#0000FF' : '#FF0000';
$smarty->assign("AnotaFone", $agtFone);
$smarty->assign("AnotaTexto", $agtAnota);
$smarty->assign("corErro", $cor);
$smarty->assign("msg", $msg);
$smarty->assign("linhas", $pesquisa);
$smarty->assign("isFone", GetAnotacoesKey());
$smarty->assign("isSuper", IsSuper());
$smarty->assign("dataIni", $dataIni);
$smarty->assign("dataFim", $dataFim);
$smarty->assign("prm_label_protoco_pesquisa", $_SESSION['prm_label_protoco_pesquisa']);
$smarty->assign("prm_label_protoco_texto", $_SESSION['prm_label_protoco_texto']);
$smarty->assign("prm_label_protoco_grid", $_SESSION['prm_label_protoco_grid']);
if (IsSuper()) {
$agentes = GetAgentesAnotacoes($listaAgente);
$smarty->assign("listaAgente", $agentes);
}
DispLogin($smarty);
function PesquisaFone($db, $num) {
global $listaAgente, $dataIni, $dataFim;
$mat = IsSuper() ? $listaAgente : GetMatricula();
$query = "select a.id_text, a.conteudo, a.matricula_agente, a.fone_cliente, a.data, b.apelido from pbx_anotacoes a, pbx_usuarios b where b.matricula = a.matricula_agente::text ";
$query .= $mat ? " and a.matricula_agente::text = '$mat' " : "";
$query .= sprintf(" and data::date >= %s and data::date <= %s ", FormatDtMssql($dataIni, true), FormatDtMssql($dataFim, true));
$query .= " and fone_cliente like '%" . $num . "%'";
$query .= " order by b.apelido, a.data desc";
$result = pg_query($db, $query);
//if(IsAdmin()) echo $query;
while (($result) && ($row = pg_fetch_array($result))) {
$fone = GetAnotacoesKey() ? FormataFone($row["fone_cliente"]) : $row["fone_cliente"];
$content = $row["conteudo"];
$matAgt = $row["matricula_agente"] . '-' . $row["apelido"];
$data = date('d/m/Y', strtotime($row["data"]));
$imgDel = GetLinkFormDelete($row["id_text"], 'DeletaAnotacao');
$linha .= "
$data | ";
if (IsSuper()) {
$linha .= " $matAgt | ";
}
$linha .= " $fone |
$content |
$imgDel |
";
}
$colspan = IsSuper() ? 4 : 3;
if (empty($linha))
$linha = "Nenhum registro encontrado! |
";
return $linha;
}
function DispLogin($smarty) {
$smarty->display('callcenter/agente/agenteAnota.tpl');
}
function GetAgentesAnotacoes($matricula) {
$query = "select id, apelido, nome, matricula from pbx_usuarios where delete_ = 0 and apelido not in('sinccontasenha' )"; //'admin',
$result = pg_query($query);
$sel = $matricula == "0" ? ' Selected="selected" ' : '';
$item = "\n";
while ($dados = pg_fetch_array($result, null, PGSQL_ASSOC)) {
$mat = $dados['matricula'];
$apelido = $dados['apelido'];
$sel = $mat == $matricula ? ' Selected="selected" ' : '';
$item .= "\n";
}
return $item;
}
?>