getMessage(); } $smarty->assign("linhas", $linha); $smarty->assign("msg", $mensagem); $smarty->display('callcenter/agente/agenteHistorico.tpl'); function ___GetGrid($result, $ramal) { $numrow = 0; $linha = ""; while ($row = pg_fetch_array($result)) { $fone = FormataFone($row["clid"]); $data = date('d/m/Y', strtotime($row["calldate"])); $hora = date('H:i:s', strtotime($row["calldate"])); $horaAtend = date('H:i:s', strtotime($row["data_atend"])); $dura = SecondToStrTime($row["duracao"]); $proto = $row["protocolo"]; $proto = substr($proto, 0, 4) . "-" . substr($proto, 4, (strlen($proto) - 4)); $img1 = ($row["direcao"] == 'E') ? "direcaoE32.png" : "direcaoS32.png"; $title1 = ($row["direcao"] == 'E') ? "Chamada Entrante!" : "Chamada Sainte!"; $direcao = " \"$title1\""; $numFone = soNumero($row["clid"]); $acao = "\"Retornar"; $linkRamal = "$acao"; $linha .= sprintf(" $data $hora $horaAtend %s $dura $proto $direcao $linkRamal ", ocultarTelefone($fone)); $numrow++; } $linha .= " Total $numrow "; return $linha; } function ___GetData($dbcon) { $matricula = GetMatricula(); $dac = $_SESSION[AGT_DAC_CONECT_DESC]; $query = "Select bil.calldate, src as clid, dac.param2 as duracao, protocolo, to_timestamp(uid1::float) as data_atend, 'E' as direcao from ast_eventos_dacs dac, ast_bilhetes bil, pbx_protocolo_reg reg where bil.uniqueid = dac.uid2 and reg.uniqueid = bil.uniqueid and bil.data_bilhete = cast(now() as date) and substring(dac.agente, 7,4) = '$matricula' and dac.fila = '$dac' and dac.evento in('COMPLETEAGENT', 'COMPLETECALLER', 'COMPLETECALLERRAMAL', 'TRANSFER', 'COMPLETECALLERRAMAL') and bil.lastapp <> 'Transferred Call' union all Select bil.calldate, dst as clid, dac.param2 as duracao, protocolo, bil.calldate as data_atend, 'S' as direcao from ast_eventos_dacs dac, ast_bilhetes bil, pbx_protocolo_reg reg where bil.uniqueid = dac.uid2 and reg.uniqueid = bil.uniqueid and bil.data_bilhete = cast(now() as date) and substring(dac.agente, 7,4) = '$matricula' and dac.fila = '$dac' and dac.evento in('COMPLETAAGENT','COMPLETACALLER','TRANSFERORIG','BUSYS','NOANSWERS') and bil.lastapp <> 'Transferred Call' order by 1, 4"; //if(IsAdmin()) echo $query; $result = pg_query($dbcon, $query); if (!$result) { throw new Exception('Não foi possível encontrar nenhum registro!'); } return $result; } function ___GetDiscarDireto($ramal, $numero) { $servidorApi = "127.0.0.1"; $userApi = "sinccontasenha"; $senhaApi = "s3ncC0nt@S2nh@"; $url = "http://$servidorApi/integracao?method=DiscarDireto&numeroDiscar=$numero&ramal=$ramal&login=$userApi&senha=$senhaApi&tipoRetorno=XML"; $xml = simplexml_load_string(GetApi($url)); $ret = trim(strval($xml->result)); if ($ret != "true") { throw new Exception("Não foi possível realizar a chamada!"); } echo "OK"; exit(0); } ?>