diff --git a/admin/cadQgrupos.php b/admin/cadQgrupos.php index e8dca810..66f2a388 100644 --- a/admin/cadQgrupos.php +++ b/admin/cadQgrupos.php @@ -231,7 +231,6 @@ $exige_classificacao = $_POST["exige_classificacao"]; $justificativa_pausa = $_POST["justificativa_pausa"]; $retornar_abandonadas = isset($_POST["retornar_abandonadas"]) ? $_POST["retornar_abandonadas"] : 0; - $libera_pausa = isset($_POST['libera_pausa']) ? $_POST['libera_pausa'] : 0; if ($acao == "inseri") { if (strtoupper($nome) != 'TODOS') {// VERIFICA NOME DA FILA <> TODOS @@ -251,13 +250,13 @@ if (!$row[0] && !$row[1]) { $query = "INSERT INTO pbx_queues_grupos(nome, musicclass, strategy, servicelevel, timeout, retry, maxlen, joinempty, eventwhencalled, eventmemberstatus, ringinuse, - periodic_announce_frequency,wrapuptime,autofill,autopause,\"announce-frequency\",\"announce-holdtime\",\"announce-round-seconds\",\"monitor-format\",\"monitor-type\",reportholdtime,timeoutrestart, - numero,timeout2,m_espera,opcao,acao,setinterfacevar,anuncio, id_transbordo, max_agente_pausa, tempo_ring, exige_classificacao, justificativa_pausa, context, retornar_abandonadas,status $dataClass, - modo_atendimento,id_pesquisa_liberacao, disponivelfila, libera_pausa) - VALUES ('$nome', '$musicclass', '$strategy', $servicelevel, $timeout, $retry, $maxlen, '$joinempty', '$eventwhencalled', '$eventmemberstatus', '$ringinuse', $periodic_announce_frequency,'$wrapuptime'," - . "'$autofill','$autopause','$announce_frequency','$announce_holdtime','$announce_round_seconds','$monitor_format','$monitor_type','$reportholdtime','$timeoutrestart','$numero','$timeout2','$m_espera'," - . "'$opcao','$acao_opcao','$setinterfacevar','$som_ura', $idTransbordo, $max_agente_pausa, $tempoRing, $exige_classificacao, $justificativa_pausa, '$context', $retornar_abandonadas,'$ativaFila' $dateClass," - . "'$modoAtendimento',$pesquisaLiberacao, '$disponivelfila', '$libera_pausa')"; + periodic_announce_frequency,wrapuptime,autofill,autopause,\"announce-frequency\",\"announce-holdtime\",\"announce-round-seconds\",\"monitor-format\",\"monitor-type\",reportholdtime,timeoutrestart + ,numero,timeout2,m_espera,opcao,acao,setinterfacevar,anuncio, id_transbordo, max_agente_pausa, tempo_ring, exige_classificacao, justificativa_pausa, context, retornar_abandonadas,status $dataClass,modo_atendimento,id_pesquisa_liberacao, disponivelfila) + VALUES ('$nome', '$musicclass', '$strategy', $servicelevel, $timeout, $retry, + $maxlen, '$joinempty', '$eventwhencalled', '$eventmemberstatus', '$ringinuse', + $periodic_announce_frequency, + '$wrapuptime','$autofill','$autopause','$announce_frequency','$announce_holdtime','$announce_round_seconds','$monitor_format', + '$monitor_type','$reportholdtime','$timeoutrestart','$numero','$timeout2','$m_espera','$opcao','$acao_opcao','$setinterfacevar','$som_ura', $idTransbordo, $max_agente_pausa, $tempoRing, $exige_classificacao, $justificativa_pausa, '$context', $retornar_abandonadas,'$ativaFila' $dateClass,'$modoAtendimento',$pesquisaLiberacao, '$disponivelfila')"; pg_query($dbcon, $query); $query2 = "select id from pbx_queues_grupos order by id desc limit 1"; @@ -298,7 +297,7 @@ maxlen='$maxlen', joinempty='$joinempty', eventwhencalled='$eventwhencalled', eventmemberstatus='$eventmemberstatus', ringinuse='$ringinuse', periodic_announce_frequency='$periodic_announce_frequency',wrapuptime='$wrapuptime',autofill='$autofill',autopause='$autopause',\"announce-frequency\"='$announce_frequency',\"announce-holdtime\"='$announce_holdtime',\"announce-round-seconds\"='$announce_round_seconds',\"monitor-format\"='$monitor_format', \"monitor-type\" ='$monitor_type',reportholdtime='$reportholdtime',timeoutrestart='$timeoutrestart',numero='$numero',timeout2='$timeout2',m_espera='$m_espera',opcao='$opcao',acao='$acao_opcao',setinterfacevar='$setinterfacevar', anuncio='$som_ura', id_transbordo = '$idTransbordo', max_agente_pausa = '$max_agente_pausa', - tempo_ring = '$tempoRing', exige_classificacao = '$exige_classificacao', justificativa_pausa = '$justificativa_pausa', context = '$context', retornar_abandonadas = '$retornar_abandonadas', modo_atendimento = '$modoAtendimento',id_pesquisa_liberacao = $pesquisaLiberacao,disponivelfila = '$disponivelfila',libera_pausa = '$libera_pausa',status = '$ativaFila' $dataClass + tempo_ring = '$tempoRing', exige_classificacao = '$exige_classificacao', justificativa_pausa = '$justificativa_pausa', context = '$context', retornar_abandonadas = '$retornar_abandonadas', modo_atendimento = '$modoAtendimento',id_pesquisa_liberacao = $pesquisaLiberacao,disponivelfila = '$disponivelfila',status = '$ativaFila' $dataClass WHERE id=$id"; pg_query($dbcon, $query); @@ -425,69 +424,44 @@ $justificativa_pausa = $dados["justificativa_pausa"]; $exige_classificacao = $dados["exige_classificacao"]; $retornar_abandonadas = $dados["retornar_abandonadas"]; - $libera_pausa = $dados['libera_pausa']; } if (!isset($monitor_format)) { $monitor_format = "wav49"; - } + } ?>
- + - - + - "; + + +$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 .= " + "; + if (IsSuper()) { + $linha .= " "; } - + $linha .= " + + + "; + } + $colspan = IsSuper() ? 4 : 3; + if (empty($linha)) + $linha = ""; + + 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; +} - $agenteAnota = new AgenteAnota($idProg, $dbcon, 0); - $agenteAnota->ExecutaRelatorio(); ?> diff --git a/agente/agentert.php b/agente/agentert.php index f1bb169f..6e60e174 100644 --- a/agente/agentert.php +++ b/agente/agentert.php @@ -1333,18 +1333,6 @@ function SairPausa($db) { } } - $query = "SELECT a.status, a.motivo_pausa, libera_pausa - FROM pbx_supervisor_agentes a - INNER JOIN pbx_queues_grupos b ON a.dac = b.nome - WHERE matricula = '$matricula'"; - - $result = pg_query($db, $query); - $resp = pg_fetch_assoc($result); - - if($resp['status'] == 'PAUSA' && strtolower($resp['motivo_pausa']) == strtolower($resp['libera_pausa'])){ - GeraExcept("Esta pausa é restrita para ser removida, por favor comunique seu supervisor!"); - } - /* * Remove da pausa do asterisk somente se a opçao disponivel atendimento nao * estiver marcada, diff --git a/asterisk/var_lib_asterisk/scripts/abandonadas/retornoAbandonada.php b/asterisk/var_lib_asterisk/scripts/abandonadas/retornoAbandonada.php index c233fc3a..6d8af0a9 100644 --- a/asterisk/var_lib_asterisk/scripts/abandonadas/retornoAbandonada.php +++ b/asterisk/var_lib_asterisk/scripts/abandonadas/retornoAbandonada.php @@ -310,7 +310,7 @@ function __GetQueryRad($agentesLivres, $diasAbandon) { and strtoint(c.espera) = 0 and d.retornar_abandonadas = 1 and a.abdsr_data >= (now()::date - $diasAbandon) - order by a.abdsr_data desc, a.abdsr_data_hora_inicio asc limit $agentesLivres"; + order by a.abdsr_data_hora_inicio desc limit $agentesLivres"; GravaLog("cmd:", $pathLog); diff --git a/asterisk/var_lib_asterisk/scripts/integracao/abdAgi.php b/asterisk/var_lib_asterisk/scripts/integracao/abdAgi.php index 461126ef..56693b51 100644 --- a/asterisk/var_lib_asterisk/scripts/integracao/abdAgi.php +++ b/asterisk/var_lib_asterisk/scripts/integracao/abdAgi.php @@ -455,6 +455,84 @@ $inTran = false; include_once '/var/lib/asterisk/scripts/integracao/constServerIntegra.php'; include_once '/var/lib/asterisk/scripts/integracao/localDataBase.php'; +$scrpt = $argv[0]; +$UNIQUEID = $arg1; + +$userfield = $agi->get_variable('MONITOR_FILENAME', true); +$userfield = trim($userfield) ? $userfield : 'AUDIO.WAV'; + +$path = '/var/log/asterisk/encerra_chamada_satelitenorte.log'; +$query = sprintf("select a.chdr_id from pbx_chamada_ramal a where a.uniqueid = '%s' and a.chdr_fim is null", $UNIQUEID); +$result = pg_query($conn, $query); + + +if (pg_num_rows($result)) { + GravaLog($query . "\n AUDIO: " . $userfield . "\n", $path); + $dados = pg_fetch_array($result, null, PGSQL_ASSOC); + $chdr_id = $dados['chdr_id']; + $audio = str_ireplace('.WAV', '.MP3', $userfield); + + $token = '026d3a4b331078aa09d096d11e495215'; + $parametros = array('method' => 'terminachamada', 'audio' => $audio, 'id_chamada' => $UNIQUEID, 'token' => $token, 'login' => 'admin', 'senha' => 'SiP1029384756', 'tipoRetorno' => 'JSON'); + //$parametros = array('audio' => $audio, 'id_chamada' => $UNIQUEID, 'token' => $token); + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, "http://satelitenorte.xpro.me/gestaodeleads/terminachamada"); + //curl_setopt($ch, CURLOPT_URL, "http://127.0.0.1/aplicativo/integracao/index.php"); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 10); + curl_setopt($ch, CURLOPT_POSTFIELDS, $parametros); + $content = trim(curl_exec($ch)); + curl_close($ch); + $retorno = json_decode($content, true); + + $log = sprintf("Status: %s Msg: %s", $retorno["status"], $retorno["mensagem"]); + $query = sprintf("update pbx_chamada_ramal set chdr_fim = now(), chdr_log = %s where chdr_id = '%s'", QuotedStr($log), $chdr_id); + GravaLog($query . "\n", $path); + $result = pg_query($conn, $query); + if (!$result) { + GravaLog($query . "\n", $path); + } +} + +$integra = $agi->get_variable('INTEGRA-SAIDA', true); +if ($integra == 'SAIDA') { + + $intMetodo = $agi->get_variable('INTEGRA-METODO', true); + $intUniqueid = $agi->get_variable('UNIQUEID', true); + $intTelefone = $agi->get_variable('INTEGRA-FONE', true); + $intFone = str_replace('@', '|', $intTelefone); + $intRegIni = $agi->get_variable('INTEGRA-REGINI', true); + $intRegFim = $agi->get_variable('INTEGRA-REGFIM', true); + $intRetCliente = $agi->get_variable('INTEGRA-RETCLI', true); + $intRetCli = str_replace('@', '|', $intRetCliente); + $intRamal = $agi->get_variable('INTEGRA-RAMAL', true); + $intUra = $agi->get_variable('INTEGRA-URA', true); + + $sql = "INSERT INTO pbx_integracao_reg(" + . "reg_id_metodo," + . "reg_uniqueid," + . "reg_uniqueid_old," + . "reg_fone," + . "reg_retorno," + . "reg_inicio," + . "reg_fim," + . "reg_msg," + . "reg_status_exec," + . "reg_status," + . "retorno_cliente," + . "reg_ramal," + . "reg_ura) " + . "VALUES($intMetodo,'$intUniqueid','$intUniqueid','$intFone','$intFone','$intRegIni','$intRegFim','INTEGRACAO-ATIVO-SAIDA'," + . "1,0,'$intRetCli','$intRamal','$intUra');"; + @pg_query($conn, $sql); + $pgError = pg_last_error(); + if ($pgError) { + GravaLog($sql, '/var/log/asterisk/integracao_ativa_sainte.log'); + GravaLog($pgError, '/var/log/asterisk/integracao_ativa_sainte.log'); + } +} + $ligueme = $agi->get_variable('LIGUE-ME', true); if ($ligueme) { $ligueUniq = $agi->get_variable('UNIQUEID', true); diff --git a/cadastros/pesquisa/pesquisaFuncoes.php b/cadastros/pesquisa/pesquisaFuncoes.php index 30aded79..44c83903 100644 --- a/cadastros/pesquisa/pesquisaFuncoes.php +++ b/cadastros/pesquisa/pesquisaFuncoes.php @@ -19,7 +19,7 @@ function GetPesquisaRel($db, $plId, $matricula = null) { $result = pg_query($db, $query); if (!$plId) { - $ret = ''; + $ret = ''; } while ($linhaBd = pg_fetch_array($result)) { diff --git a/cadastros/pesquisa/pesquisaRel.php b/cadastros/pesquisa/pesquisaRel.php index abc96040..8ab6ceed 100644 --- a/cadastros/pesquisa/pesquisaRel.php +++ b/cadastros/pesquisa/pesquisaRel.php @@ -10,23 +10,21 @@ private $___plDescricao = ''; private $___ppId = 0; private $___ppNome = ''; - private $___tipoRelatorio; private $___datas = array(); public function __construct($idProg, $dbcon, $incDac) { parent::__construct($idProg, $dbcon, $incDac); - $this->___tipoRelatorio = isset($_REQUEST['tipoRelatorio']) ? $_REQUEST['tipoRelatorio'] : 0; $this->___dac = isset($_POST["listaDacs"]) ? $_POST["listaDacs"] : 0; $this->___lstPesquisa = isset($_POST["lstPesquisa"]) ? $_POST["lstPesquisa"] : '0| | | |0| '; } function ___FiltrosRelatorio() { global $dbcon; - - if ($this->___lstPesquisa) { + + if($this->___lstPesquisa){ $this->___plId = explode('|', $this->___lstPesquisa)[0]; } - + $lstPesquisa = GetPesquisaRel($dbcon, $this->___plId); if ($this->___media != MEDIA_PRINT_GRID) { /* @@ -57,16 +55,14 @@ $lkPrint = ""; if ($this->___dataCount) { $prt = 'Clique aqui para imprimir!'; - if (!$this->___tipoRelatorio) { - $prtHtml = "\"Clique"; - $lkPrint .= sprintf($prtHtml, $this->GetidProg(), MEDIA_PRINT_HTML, $this->___tipoRelatorio, substr(LimpaString(GetDispProgSel($this->GetIdProg())), 0, 20), 'print.gif'); - $lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_PDF, $this->___tipoRelatorio, 'prt-pdf.png'); - $lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_CSV, $this->___tipoRelatorio, 'prt-csv.png'); - } + $prtHtml = "\"Clique"; + $lkPrint .= sprintf($prtHtml, $this->GetidProg(), MEDIA_PRINT_HTML, $this->___tipoRelatorio, substr(LimpaString(GetDispProgSel($this->GetIdProg())), 0, 20), 'print.gif'); $lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_EXCEL, $this->___tipoRelatorio, 'prt-xls.png'); + $lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_PDF, $this->___tipoRelatorio, 'prt-pdf.png'); + $lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_CSV, $this->___tipoRelatorio, 'prt-csv.png'); } - $tipoRel = !$this->___tipoRelatorio ? '' : 'checked="checked"'; + //$tipoRel = !$this->___tipoRelatorio ? '' : 'checked="checked"'; /* * Personalise esta funcao se necessitar de outras opnioes de filtro. */ @@ -80,7 +76,6 @@ $filtro .= ''; $filtro .= ''; $filtro .= ''; - $filtro .= ''; $filtro .= ''; $filtro .= ''; @@ -101,9 +96,9 @@ /* * Guarda os filtros passados para recuperar na emissao dos relatoios para impressao. */ - $_SESSION["SSstorageFiltros"] = array($this->___dac, $this->___dataIni, $this->___dataFim, $this->___tipoRelatorio); + $_SESSION["SSstorageFiltros"] = array($this->___dac, $this->___dataIni, $this->___dataFim); - return sprintf($filtro, $tipoRel, $this->___dataIni, $this->___dataFim, $lkPrint); + return sprintf($filtro, $this->___dataIni, $this->___dataFim, $lkPrint); } protected function ___GetDadosDb($pqId = null) { @@ -120,42 +115,7 @@ GetDadosPesq($dbcon, $this->___lstPesquisa, $plId, $plDescricao, $ppId, $ppNome, $datas); - if ($this->___tipoRelatorio) { - $query = "select a.uniqueid::numeric, a.pl_id, a.pp_id, a.pm_data - ,e.pp_nome as campanha - ,getddd(f.src, '00') as ddd - ,case when(length(f.src) >= 10)then substring(f.src,2) else f.src end as telefone - ,'ATENDIDA' as condicao - ,'1' as digito - ,'NAO' as transferido - ,'1' as tentativa - ,f.calldate as datahora - ,(min(f.duration) * interval '1 second' ) as duracao - ,f.channel as canal - ,'-' as campo_1 - ,case when((select count(*) from pbx_pesquisa_questoes where pp_id = a.pp_id) = count(b.pq_id))then 'RESPONDEU TODAS AS PERGUNDAS' else 'RESPONDEU ATE A PERGUNTA ' || max(b.pq_display) end as finalizacao - ,(select STRING_AGG(remove_acentos(pq_questao), ';') from pbx_pesquisa_questoes where pp_id = a.pp_id) as perguntas - ,STRING_AGG( remove_acentos(c.po_opcao), ';') as respostas - ,split_part(e.pp_nome, '-', 1) as campo15 - ,split_part(e.pp_nome, '-', 2) as campo16 - from pbx_pesquisa_movimento a - inner join pbx_pesquisa_questoes b on b.pp_id = a.pp_id and b.pq_id = a.pq_id - inner join pbx_pesquisa_opcoes c on c.pp_id = b.pp_id and c.pq_id = b.pq_id and c.po_id = a.po_id - inner join (select uniqueid, umv_ura_nome from pbx_ura_movimento where umv_ura_opcao is not null) d on d.uniqueid = a.uniqueid - inner join pbx_pesquisa e on e.pp_id = a.pp_id - inner join pbx_bilhetes f on f.uniqueid = a.uniqueid - where a.pm_data >= '$dataIni' - and a.pm_data <= '$dataFim' - and a.pp_id = $ppId - and a.pl_id = $plId - group by a.uniqueid, a.pl_id, a.pp_id, a.pm_data, e.pp_nome,getddd(f.src, '0'),f.src,case when(length(f.src) >= 10)then substring(f.src,2) else f.src end,f.calldate,f.duration,f.channel - order by a.uniqueid, calldate;"; - - $result = $this->___GetQuery($query); - $row = pg_fetch_all($result); - $this->SetData($row ? $row : array()); - } else { - $query = "SELECT pq_display, pq_questao, + $query = "SELECT pq_display, pq_questao, (select count(*) from pbx_pesquisa_movimento where pl_id = $plId @@ -169,27 +129,45 @@ where b.pp_id = a.pp_id and b.pl_id = '$plId' and pq_status = 1 order by 1"; - $result = $this->___GetQuery($query); - $row = pg_fetch_all($result); - $this->SetData($row ? $row : array()); - - foreach ($row as $dataPsq) { - $sql = "select a.po_id, a.po_tecla, a.po_opcao, count(b.po_id) as num_resp - from pbx_pesquisa_opcoes a - left outer join pbx_pesquisa_movimento b on b.po_id = a.po_id - and pl_id = $plId - and b.pq_id = a.pq_id - and b.id_dac = $dac - and b.pm_data >= '$dataIni' - and b.pm_data <= '$dataFim' - where a.pq_id = {$dataPsq['pq_id']} - group by a.po_id, a.po_tecla, a.po_opcao - order by 2"; - $res = $this->___GetQuery($sql); - $rows = pg_fetch_all($res); - $this->SetData($rows ? $rows : array()); - } + $result = $this->___GetQuery($query); + $row = pg_fetch_all($result); + $this->SetData($row ? $row : array()); + + foreach ($row as $dataPsq) { + $sql = "select a.po_id, a.po_tecla, a.po_opcao, count(b.po_id) as num_resp + from pbx_pesquisa_opcoes a + left outer join pbx_pesquisa_movimento b on b.po_id = a.po_id + and pl_id = $plId + and b.pq_id = a.pq_id + and b.id_dac = $dac + and b.pm_data >= '$dataIni' + and b.pm_data <= '$dataFim' + where a.pq_id = {$dataPsq['pq_id']} + group by a.po_id, a.po_tecla, a.po_opcao + order by 2"; + $res = $this->___GetQuery($sql); + $rows = pg_fetch_all($res); + $this->SetData($rows ? $rows : array()); } + + $query = "SELECT fila, d.matricula, apelido, + SUM(CASE WHEN (c.data_reg IS NOT NULL)THEN 1 ELSE 0 END) AS envio_pesquisa, + SUM(CASE WHEN (c.data_fim IS NOT NULL)THEN 1 ELSE 0 END) AS completou_pesquisa, + COUNT(*) AS chamadas_realizadas + FROM pbx_bilhetes a + INNER JOIN pbx_eventos_dacs b ON a.uniqueid = b.uid2 + LEFT JOIN pbx_pesquisa_regitra c ON a.uniqueid = c.uniqueid + LEFT JOIN pbx_usuarios d ON d.matricula = SUBSTRING(b.agente, 7, 4) + WHERE calldate::DATE >= '$dataIni' + AND calldate::DATE <= '$dataFim' + AND b.evento IN('COMPLETEAGENT','COMPLETECALLER', 'TRANSFER','COMPLETEAGENTRAMAL','COMPLETECALLERRAMAL', 'COMPLETACALLER', 'COMPLETAAGENT') + AND fila = 'SUPORTE_NIVEL1_ARAXA' + GROUP BY fila, d.matricula, apelido"; + + $result = $this->___GetQuery($query); + $row = pg_fetch_all($result); + $this->SetData($row ? $row : array()); + } protected function ___PreparaCsv() { @@ -243,7 +221,7 @@ $dataRel[] = GenerateCsvFromArray($linha); unset($linha); } - $dataRel[] = GenerateCsvFromArray(array('Total', '', 'Resp.: ' . $somaResp, number_format(($somaResp / $somaResp) * 100.0, 2, ',', '.') . '%')); + $dataRel[] = GenerateCsvFromArray(array('Total', '', 'Resp.: '.$somaResp,number_format(($somaResp / $somaResp) * 100.0, 2, ',', '.') . '%')); $x++; } @@ -255,6 +233,10 @@ $dataRel = array(); $filtro = $this->___FiltrosRelatorio(); + /* + * Inicia o relatório. + */ + /* * Cria os filtros */ @@ -273,116 +255,54 @@ $dataRel[] = $linha; + $dadosCabecalio = array('Opcao', 'Resposta', 'Quantidade', 'Porcentagem'); + $dadosField = array('po_tecla', 'po_opcao', 'num_resp', 'por_resp'); + /* - * Inicia o relatório. + * Monta a linha de cabecalio. */ - if ($this->___tipoRelatorio) { - $dadosCabecalio = array('CAMPANHA', 'DDD', 'TELEFONE', 'CONDICAO', 'DIGITO', 'TRANSFERIDO', 'TENTATIVA', 'DATA HORA', 'DURACAO', 'CANAL', 'CAMPO1', 'FINALIZACAO'); - $dadosField = array('campanha', 'ddd', 'telefone', 'condicao', 'digito', 'transferido', 'tentativa', 'datahora', 'duracao', 'canal', 'campo_1', 'finalizacao'); - - $perCnt = 0; - foreach ($this->GetData()[0] as $k => $row) { - if ($k == 'perguntas') { - $resp = explode(';', $row['perguntas']); - foreach ($resp as $v) { - $dadosCabecalio[] = $v; - } - $perCnt = count($resp); - } - if ($perCnt) { - for ($x = 0; $x < $perCnt; $x++) { - $dadosField[] = "resposta_" . $x; - } - } - break; - } + $x = 1; + $somaResp = 0; + /* + * Linhas de dados. + */ + foreach ($this->GetData()[0] as $row) { - $dadosCabecalio[] = 'Campo 15'; - $dadosCabecalio[] = 'campo 16'; - $dadosField[] = 'campo15'; - $dadosField[] = 'campo16'; + $somaResp = $this->__CalculaPorcentagem($row['pq_questao'], $this->GetData()[0]); + $dataRel[] = array('LABEL', '', '', RemoveAcentos($row['pq_questao'])); - /* - * Monta a linha de cabecalio. - */ $linha = array('LABEL'); foreach ($dadosCabecalio as $value) { $linha[] = $value; } - $dataRel[] = $linha; - - $x = 1; - $somaResp = 0; - - /* - * Linhas de dados. - */ - - foreach ($this->GetData()[0] as $row) { - $row['datahora'] = date('d/m/Y H:i:s', strtotime($row['datahora'])); - $rps = explode(";", $row['respostas']); - for ($x = 0; $x < $perCnt; $x++) { - $row["resposta_" . $x] = $rps[$x] ? str_replace("º","o",$rps[$x]) : " - "; - } + $dataRel[] = $linha; + //$row['po_opcao'] = RemoveAcentos($row['po_opcao']); + // Formata linha de dados. + foreach ($this->GetData()[$x] as $dataPsq) { $linha = array('DADOS'); foreach ($dadosField as $key) { - $linha[] = $row["$key"]; - } - $dataRel[] = $linha; - } - - } else { - $dadosCabecalio = array('Opcao', 'Resposta', 'Quantidade', 'Porcentagem'); - $dadosField = array('po_tecla', 'po_opcao', 'num_resp', 'por_resp'); - - /* - * Monta a linha de cabecalio. - */ - - $x = 1; - $somaResp = 0; - /* - * Linhas de dados. - */ - foreach ($this->GetData()[0] as $row) { - $somaResp = $this->__CalculaPorcentagem($row['pq_questao'], $this->GetData()[0]); - $dataRel[] = array('LABEL', '', '', RemoveAcentos($row['pq_questao'])); - - $linha = array('LABEL'); - foreach ($dadosCabecalio as $value) { - $linha[] = $value; - } - - $dataRel[] = $linha; - //$row['po_opcao'] = RemoveAcentos($row['po_opcao']); - // Formata linha de dados. - - foreach ($this->GetData()[$x] as $dataPsq) { - $linha = array('DADOS'); - foreach ($dadosField as $key) { - - if ($key == 'po_opcao') { - $linha[] = RemoveAcentos($dataPsq["$key"]); - } else if ($key == 'por_resp') { - $dataPsq['por_resp'] = number_format(($dataPsq["num_resp"] / $somaResp) * 100.0, 2, ',', '.') . '%'; - $linha[] = $dataPsq['por_resp']; - } else { - $linha[] = $dataPsq["$key"]; - } + if ($key == 'po_opcao') { + $linha[] = RemoveAcentos($dataPsq["$key"]); + } else if ($key == 'por_resp') { + $dataPsq['por_resp'] = number_format(($dataPsq["num_resp"] / $somaResp) * 100.0, 2, ',', '.') . '%'; + $linha[] = $dataPsq['por_resp']; + } else { + $linha[] = $dataPsq["$key"]; } - - $dataRel[] = $linha; - unset($linha); } - $dataRel[] = array('LABEL', 'Total', '', 'Resp.: ' . $somaResp, number_format(($somaResp / $somaResp) * 100.0, 2, ',', '.') . '%'); - - $x++; + + $dataRel[] = $linha; + unset($linha); } + $dataRel[] = array('LABEL', 'Total', '', 'Resp.: '.$somaResp,number_format(($somaResp / $somaResp) * 100.0, 2, ',', '.') . '%'); + + $x++; } + $this->___dataRel[] = $dataRel; } @@ -417,13 +337,6 @@ /* * Verifica se retornou dados */ - - if ($this->___tipoRelatorio) { - $dataRel[] = sprintf("
-
CADASTRO DE FILAS +
CADASTRO DE FILAS -
-
- + +
- - + - - + - + - + -
-
+
Nome: -
-
-
+
Número: -
-
-
- Liberar Pausa (?) - - -
-
-
+
Música de Espera: /> Não -
-
-
+
Classe de Música: -
-
-
-
-
+
-
-
+
Estratégia:
-
-
- + "; - foreach ($dadosField as $key => $value) { - $linha .= sprintf("", $value, $row["$key"]); - } - $linha .= ""; - $dataRel[] = $linha; - } - /* - * Linha de totalizacao. - */ - //$linha = ''; - //$dataRel[] = sprintf($linha, $somaQuantidade, SecondToStrTime($somaTempo)); - - /* - * Fecha relatorio. - */ - $dataRel[] = '
- diff --git a/admin/usuarios.php b/admin/usuarios.php index 1a7e38ce..72210271 100644 --- a/admin/usuarios.php +++ b/admin/usuarios.php @@ -1,12 +1,10 @@ -getMessage(); $jsStartup[] = "alert('$msg');"; } - - } -?> + ?> + +
-
+
Ligações sem Agentes?:
- NOVA FILA + NOVA FILA
- + + + + - - diff --git a/agente/agenteAnota.php b/agente/agenteAnota.php index eafb5829..793b1fc5 100644 --- a/agente/agenteAnota.php +++ b/agente/agenteAnota.php @@ -1,370 +1,126 @@ ___consultar = isset($_POST["btPesquisa"]); - $this->___validar = isset($_POST["btAnota"]) && (trim($_POST["AnotaTexto"]) != ""); - $this->___agenteAnota = isset($_POST["AnotaTexto"]) ? $_POST["AnotaTexto"] : ""; - $this->___agenteFone = isset($_POST["AnotaFone"]) ? soNumero($_POST["AnotaFone"]) : (isset($_SESSION[RAMAL_DESTINO]) ? soNumero($_SESSION[RAMAL_DESTINO]) : ''); - $this->___listaAgente = isset($_POST["listaAgente"]) ? $_POST["listaAgente"] : GetMatricula(); - $this->___dataIni = IsPostBack() ? $_POST['dataIni'] : date('d/m/Y'); - $this->___dataFim = IsPostBack() ? $_POST['dataFim'] : date('d/m/Y'); - $this->___matricula = GetMatricula(); - } - - function ___ValidaForm() { - - if (!is_date($this->___dataIni) && empty($this->___agenteFone)) { - GeraExcept('A "Data Inicial" informada é inválida!'); - } - - if (!is_date($this->___dataFim) && empty($this->___agenteFone)) { - GeraExcept('A "Data Final" informada é inválida!'); - } - - if (!$this->___consultar && $this->___validar && empty($this->___agenteFone)) { - $msg = GetAnotacoesKey() ? "Informe o número do telefone!" : "Informe o número do protocolo!"; - GeraExcept($msg); - } - - if($this->___validar && !$this->___consultar){ - $this->___InserirAnotacao(); - } - } - - function ___FiltrosRelatorio() { - if ($this->___media != MEDIA_PRINT_GRID) { - /* - * Recupera os filtros da sess�o do usu�rio. - */ - list($this->___dataIni, $this->___dataFim, $this->___agenteFone) = $_SESSION["SSstorageFiltros"]; - - if ($this->___media == MEDIA_PRINT_HTML) { - return sprintf("Data Inicial: %s Data Final: %s ", $this->___dataIni, $this->___dataFim); - } - - $fltCsv = array(); - $fltCsv[] = "Data Inicial: " . $this->___dataIni; - $fltCsv[] = "Data Final: " . $this->___dataFim; - $fltCsv[] = "Data Hora Emissao: " . date('d/m/Y H i s)'); - $fltCsv[] = "Emitido Por: " . GetLogin(); - return $fltCsv; - } - - $lkPrint = ""; - if ($this->___dataCount) { - $prt = 'Clique aqui para imprimir!'; - $prtHtml = "\"Clique"; - //$lkPrint .= sprintf($prtHtml, $this->GetidProg(), MEDIA_PRINT_HTML, substr(LimpaString(GetDispProgSel($this->GetIdProg())), 0, 20), 'print.gif'); - $lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_EXCEL, 'prt-xls.png'); - //$lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_PDF, 'prt-pdf.png'); - //$lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_CSV, 'prt-csv.png'); - } - - $filtro .= '
- - - - - - - - - - - - -
Palavra ChaveFiltro Status
- " onkeyup="ConsultaRamal('index.php?idProg=10028&pbxRequest=1', event);" size="20"> - -
- > Todos - > Ativa - > Desativada -
-
- - - NOVA CONTA -
+
Palavra Chave
+ " onkeyup="ConsultaRamal('index.php?idProg=10028&pbxRequest=1', event);" size="20"> + + + NOVA CONTA
- +
@@ -91,7 +72,7 @@ - - + - - - - + + + + - + - +
Id NomeStatus Ações
- +
@@ -136,21 +113,21 @@
Não foram encontrados registros
- - - -
- - Bloco de Anotações - Bloco de Anotações - -
'; - /* - * Personalise esta função se necessitar de outras opções de filtro. - */ - $filtro .= ''; - /* - * Rotulos. - */ - $filtro .= ''; - $filtro .= IsSuper() ? '' : ''; - $filtro .= ''; - $filtro .= ''; - $filtro .= ''; - $filtro .= sprintf('', GetAnotacoesKey() ? 'Fone' : $_SESSION['prm_label_protoco_pesquisa']); - - /* - * Valores. - */ - $filtro .= ''; - $filtro .= IsSuper() ? sprintf("", $this->GetAgentesAnotacoes($this->___listaAgente)) : ''; - $filtro .= sprintf("", $this->GetAgentesAnotacoes($this->___listaAgente)); - $filtro .= ''; - $filtro .= ''; - $filtro .= ''; - $filtro .= ''; - $filtro .= ''; - $filtro .= '
AgentesAgentesData Inicial Data Final %s
'; - $filtro .= sprintf('' - . '' - . '', $this->___agenteFone); - $filtro .= '
%s
'; - - $filtro .= "
"; - - $filtro .= ''; - $filtro .= ""; - $filtro .= ""; - $filtro .= ""; - $filtro .= ""; - $filtro .= "
{$_SESSION['prm_label_protoco_texto']}
"; - - - /* - * Guarda os filtros passados para recuperar na emiss�o dos relat?ios para impress�o. - */ - $_SESSION["SSstorageFiltros"] = array($this->___dataIni, $this->___dataFim, $this->___agenteFone); - - return sprintf($filtro, $this->___dataIni, $this->___dataFim, $lkPrint); - } - - protected function ___GetDadosDb() { - $dataIni = FormatDtMssql($this->___dataIni); - $dataFim = FormatDtMssql($this->___dataFim); - - $query = sprintf("SELECT a.id_text, a.conteudo, a.matricula_agente, a.fone_cliente, a.data, b.apelido - FROM pbx_anotacoes a - INNER JOIN pbx_usuarios b ON b.matricula = a.matricula_agente::text - WHERE data::DATE >= '$dataIni' AND data::DATE <= '$dataFim'"); - - if(empty($this->___agenteFone)){ - $query .= $this->___listaAgente ? " AND a.matricula_agente::text = '$this->___listaAgente' " : ""; - } - - $query .= " AND fone_cliente LIKE '%$this->___agenteFone%'"; - $query .= " ORDER BY b.apelido, a.data DESC"; - - $result = $this->___GetQuery($query); - $row = pg_fetch_all($result); - - $this->SetData($row ? $row : array()); - } - - protected function ___PreparaCsv() { - - } - - protected function ___PreparaExcel() { - $dataRel = array(); - $dataAgrup = array(); - $filtro = $this->___FiltrosRelatorio(); - - /* - * Inicia o relatório. - */ - - /* - * Cria os filtros - */ - $linha = array('LABEL'); - foreach ($filtro as $values) { - list($label, $value) = explode(":", $values); - $linha[] = $label; - } - $dataRel[] = $linha; - - $linha = array('DADOS'); - foreach ($filtro as $values) { - list($label, $value) = explode(":", $values); - $linha[] = $value; - } - - $dataRel[] = $linha; - - $dadosCabecalio = array('ID','Data', RemoveAcentos($_SESSION['prm_label_protoco_pesquisa']), 'Mensagem','Autor'); - $dadosField = array('id_text', 'data', 'fone_cliente', 'conteudo', 'apelido'); - - /* - * Monta a linha de cabecalio. - */ - $linha = array('LABEL'); - foreach ($dadosCabecalio as $value) { - $linha[] = $value; - } - $dataRel[] = $linha; - - $somaTempo = 0; - $somaQuantidade = 0; - /* - * Linhas de dados. - */ - foreach ($this->GetData()[0] as $row) { - $row["data"] = date('d/m/Y', strtotime($row["data"])); - $row["conteudo"] = RemoveAcentos($row['conteudo']); - // Formata linha de dados. - $linha = array('DADOS'); - foreach ($dadosField as $key) { - $linha[] = $row["$key"]; - } - - $dataRel[] = $linha; - } - - $dataRel[] = $linha; - - $this->___dataRel[] = $dataRel; - } - - protected function ___PreparaGrid() { - $dadosCabecalio = array( - 'ID' => 'align="center"', - 'Data' => 'align="center"', - $_SESSION['prm_label_protoco_pesquisa'] => 'align="center"', - 'Mensagem' => 'align="left"', - 'Autor' => 'align="center"', - ); - $dadosField = array( - 'id_text' => 'align="center"', - 'data' => 'align="center"', - 'fone_cliente' => 'align="center"', - 'conteudo' => 'align="left"', - 'apelido' => 'align="center"', - ); - /* - * Inicia o relat�rio. - */ - $dataRel[] = ''; - - /* - * Monta a linha de cabecalio. - */ - $linha = ''; - foreach ($dadosCabecalio as $key => $value) { - $linha .= sprintf("", $value, $key); - } - $linha .= ""; - $dataRel[] = $linha; - - /* - * Verifica se retornou dados - */ - if (!IsPostBack() || !count($this->GetData()[0])) { - $dataRel[] = sprintf("
%s
%s
", count($dadosCabecalio), (!IsPostBack() ? 'Informe os parametros e clique em consultar!' : 'Nenhum registro encontado!')); - $this->___dataRel[] = $dataRel; - return; - } - - $somaQuantidade = 0; - /* - * Linhas de dados. - */ - foreach ($this->GetData()[0] as $row) { - $row["data"] = date('d/m/Y', strtotime($row["data"])); - - // Formata linha de dados. - $linha = "
%s
TotalRegistros: %sDuração: %s
'; - $this->___dataRel[] = $dataRel; - } - - protected function ___PreparaHtml() { - - } - - protected function ___PreparaPdf() { - - } - - private function ___InserirAnotacao(){ - if ($this->___validar && empty($this->___agenteAnota)) { - GeraExcept("Insira uma anotação!"); - } - - $query = "SELECT * FROM pbx_anotacoes WHERE conteudo = '{$this->___agenteAnota}' AND fone_cliente = '{$this->___agenteFone}';"; - $res = $this->___GetQuery($query); - if(pg_fetch_assoc($res)){ - GeraExcept('Essas informações já foram registradas!'); - } - - $query = "INSERT INTO pbx_anotacoes (conteudo,matricula_agente,fone_cliente) VALUES('$this->___agenteAnota', '$this->___matricula', '$this->___agenteFone');"; - $result = $this->___GetQuery($query); - if(!$result){ - GeraExcept('Não foi possível inserir o registro'); - } - } - - private function GetAgentesAnotacoes($matricula) { - $query = "SELECT id, apelido, nome, matricula FROM pbx_usuarios WHERE delete_ = 0 AND apelido NOT IN('sinccontasenha') ORDER BY apelido"; //'admin', - $result = $this->___GetQuery($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; - } - - public function ExecutaRelatorio() { - global $jsStartup, $jsJQuery, $smarty; - try { - /* - * Use esta fun��o para validar dados do formul�rio. - */ - $this->___ValidaForm(); - - /* - * Recupera os dados do banco. - */ - $this->___ConteudoRelatorio(); - - /* - * Imprime relat�rio de acordo com a media passada. - */ - $conteudoRelatorio = $this->___ImprimeRelatorio(); - } catch (Exception $exc) { - $this->SetMsg($exc->getMessage()); - $jsStartup[] = sprintf("alert('%s');", $this->GetMsg()); - $this->___GravaLog(); - } - - /* - * Inclua os scripts necessários aqui. - */ - $jsJQuery[] = "\$('#dataIni').keypress(function(){formataDataHora(this);}) "; - $jsJQuery[] = "\$('#dataFim').keypress(function(){formataDataHora(this);}) "; - - $smarty->assign('filtros', $this->___FiltrosRelatorio()); - $smarty->assign('conteudo', $conteudoRelatorio); - $smarty->assign('msg', $this->GetMsg()); - GetTemplate($smarty, 'relatoriosGrid.tpl'); +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +$tpLayout = 1; +$matricula = GetMatricula(); +$consultar = isset($_POST["btPesquisa"]); +$valida = isset($_POST["btAnota"]) && (trim($_POST["AnotaTexto"]) != ""); +$agtAnota = isset($_POST["AnotaTexto"]) ? $_POST["AnotaTexto"] : ""; +$agtFone = isset($_POST["AnotaFone"]) ? soNumero($_POST["AnotaFone"]) : (isset($_SESSION[RAMAL_DESTINO]) ? soNumero($_SESSION[RAMAL_DESTINO]) : ''); +$btAnota = isset($_POST["btAnota"]) ? $_POST["btAnota"] : ""; +$listaAgente = isset($_POST["listaAgente"]) ? $_POST["listaAgente"] : GetMatricula(); +$dataIni = !isset($_POST["dataIni"]) ? date('d/m/Y') : $_POST["dataIni"]; +$dataFim = !isset($_POST["dataFim"]) ? date('d/m/Y') : $_POST["dataFim"]; + +$msg = ""; +$pesquisa = ""; + +if (isset($_GET["formAction"])) { + $idDel = $_GET["id"]; + $query = "delete from pbx_anotacoes where id_text = '$idDel'"; + @pg_query($dbcon, $query); +} + +if (!is_date($dataIni)) { + $jsStartup[] = "alert('Data inicial inválida!');"; + $msg = "Data inicial inválida!"; + $isValid = 0; +} else if (!is_date($dataFim)) { + $jsStartup[] = "alert('Data final inválida!');"; + $msg = "Data final inválida!"; + $isValid = 0; +} else if (!$consultar && $valida && empty($agtFone)) { + $msg = GetAnotacoesKey() ? "Informe o número do telefone!" : "Informe o número do protocolo!"; +} else if ($valida && empty($agtAnota)) { + $msg = "Insira uma anotação!"; +} else if (!$consultar && $valida) { + $query = "insert into pbx_anotacoes(conteudo, matricula_agente, fone_cliente) + values('$agtAnota', '$matricula', '$agtFone')"; + $result = pg_query($dbcon, $query); + if ($result) { + $agtAnota = ""; + $msg = "Operação realizada com sucesso!"; + } +} + + +$pesquisa = PesquisaFone($dbcon, $agtFone); +if (empty($pesquisa)) + $pesquisa = "
Nenhum registro encontrado!
$data$matAgt$fone$content$imgDel
Nenhum registro encontrado!
FilaData InicialData Final Analitico 
%s
", count($dadosCabecalio), (!IsPostBack() ? 'Informe os parametros e clique em consultar!' : 'O ARQUIVO FOI GERADO EM EXCEL CLICK NO ICONE PARA PODER REALIZAR O DOWNLOAD! Foram encontados ' . count($this->GetData()[0]) . ' registros para essa pesquisa!')); - $this->___dataRel[] = $dataRel; - return; - } - if (!IsPostBack() || !count($this->GetData()[0])) { $dataRel[] = sprintf("%s", count($dadosCabecalio), (!IsPostBack() ? 'Informe os parametros e clique em consultar!' : 'Nenhum registro encontado!')); $this->___dataRel[] = $dataRel; @@ -461,12 +374,12 @@ } $linhas .= ""; } - $linhas .= sprintf("Total$somaResp%s", number_format(($somaResp / $somaResp) * 100.0, 2, ',', '.') . '%'); + $linhas .= sprintf("Total$somaResp%s", number_format(($somaResp / $somaResp) * 100.0, 2, ',', '.').'%'); $x++; $dataRel[] = $linhas; unset($linhas); } - + /* * Fecha relatorio. */ @@ -492,15 +405,15 @@ . "{$est['completou_pesquisa']}" . "{$est['chamadas_realizadas']}" . ""; - + $ttDirect += $est['envio_pesquisa']; $ttCC += $est['completou_pesquisa']; $ttCall += $est['chamadas_realizadas']; } - + $dataRel[] = "Total $ttDirect $ttCC $ttCall"; $dataRel[] = ''; - + $this->___dataRel[] = $dataRel; } @@ -547,7 +460,7 @@ $dataQst[$z]['por_resp'] = number_format(($data["num_resp"] / $somaTotalQtd) * 100.0, 2, ',', '.') . '%'; $z++; } - $totalizador = array('Total: ', $row['pq_questao'], 'Resp.: ' . $somaTotalQtd, number_format(($somaTotalQtd / $somaTotalQtd) * 100.0, 2, ',', '.') . '%'); + $totalizador = array('Total: ', $row['pq_questao'], 'Resp.: '.$somaTotalQtd , number_format(($somaTotalQtd / $somaTotalQtd) * 100.0, 2, ',', '.') . '%'); $tables[] = array($dadosCabecalio, $dadosField, $dataQst, $widthHeader, $totalizador, 0); $x++; unset($dataQst); diff --git a/configGeral.php b/configGeral.php index 17508b3b..64e4dc9e 100644 --- a/configGeral.php +++ b/configGeral.php @@ -6,7 +6,6 @@ define("CONFIG_SUPERVISOR", 3); define("CONFIG_AGENTE", 2); define("CONFIG_MANAGER", 4); define("CONFIG_CHAT", 5); -define("CONFIG_LICENCA", 6); $query = ""; //VerificaPerfilAcesso(SEG_CONFIGURACOES); @@ -522,63 +521,6 @@ if ($idSubProg == CONFIG_BASE_DADOS) { $tpl = "configChatAgente.tpl"; DispRel($smarty, $tpl); - //template configGeral - $tpl = "configSys.tpl"; - $smarty->assign("idSubProg", $idSubProg); - DispRel($smarty, $tpl); -} else if ($idSubProg == CONFIG_LICENCA) { - include "util/funcoesLicenca.php"; - - $fields = filter_input_array(INPUT_POST, FILTER_SANITIZE_SPECIAL_CHARS); - - $query = sprintf("SELECT perm_licenca FROM pbx_usuarios WHERE matricula = '%s';", GetMatricula()); - $result = pg_query($query); - $infoUser = pg_fetch_assoc($result); - $mensagem = null; - - if($fields['document'] && $fields['lcnca_perfil'] && $fields['btGerar']){ - $contacts = []; - foreach ($fields as $k => $p){ - if(strpos($k, 'lcnca_contato') !== false){ - $contacts[] = $p; - } - } - $licenca = __dadosLicenca($fields['document'], $contacts); - GerarArquivo($licenca, $fields['lcnca_perfil']); - } - - if(isset($fields['btValidar'])){ - try{ - $json = validarArquivo($_FILES); - if(!$json){ - throw new Exception('Não foi possível ler o arquivo informado!'); - } - if(!__validLicenca($dbcon, $json)){ - $mensagem = ['type' => 'error', "msg" => "Não foi possível validar a licença!"]; - } - $mensagem = ['type' => 'success', "msg" => "A licença foi registrada com sucesso!"]; - } catch (Exception $ex) { - $mensagem = ['type' => 'error', "msg" => $ex->getMessage()]; - } - } - - $perfils = GetPerfilApl(); - $slcOpt = ""; - foreach($perfils as $k => $v){ - $slcOpt .= ""; - } - $smarty->assign('select_perfil', $slcOpt); - - foreach ($fields as $k => $v){ - $smarty->assign($k, $v); - } - - $smarty->assign('mensagem', $mensagem); - $smarty->assign('perm', $infoUser['perm_licenca']); - $smarty->assign('isAdmin', IsAdmin()); - $tpl = "configLicenca.tpl"; - DispRel($smarty, $tpl); - //template configGeral $tpl = "configSys.tpl"; $smarty->assign("idSubProg", $idSubProg); diff --git a/discador/campanha/processaLista.php b/discador/campanha/processaLista.php index 0a740edf..02742dd5 100644 --- a/discador/campanha/processaLista.php +++ b/discador/campanha/processaLista.php @@ -17,7 +17,6 @@ try { $tipo = $_FILES['list_file']['type']; $nomeArquivo = $_FILES['list_file']['name']; - if (empty($nomeArquivo)) { GeraExcept("Para realizar esta operação é necessario enviar um arquivo!"); } @@ -33,12 +32,13 @@ try { GeraExcept("Não foi possível ler o arquivo!"); } - $fileProc = processaLista($listaClietne, $nomeArquivo); + processaLista($listaClietne, $nomeArquivo); - if ($fileProc) { - DownloadArquivo($fileProc); - $jsStartup[] = "alert('Arquivo gerado com sucesso!');"; - } + $jsStartup[] = "alert('Arquivo gerado com sucesso!');"; + +// if ($fileProc = processaLista($listaClietne, $nomeArquivo)) { +// DownloadArquivo($fileProc); +// } } } catch (Exception $ex) { $msg = $ex->getMessage(); @@ -124,7 +124,7 @@ function processaLista($arquivo, $nomeArquivo) { $idNtp = RegistroInc($dbcon, "select id from pbx_listanegra where UPPER(nome) = 'NAO PERTURBE' and id_pai is null"); $sql = "delete from tb_lista_discador a where exists(select '' from pbx_listanegra where numero = a.numero and (id_pai = '{$idNtp}' or flag = 'NAO PERTUBE'));"; if (!pg_query($dbcon, $sql)) { - throw new Exception("Não foi possível verificar a tabela de lista negra!" . pg_last_error()); + throw new Exception("Não foi possível verificar a tabela de lista negra!"); } $sql = "select numero from tb_lista_discador"; @@ -140,6 +140,7 @@ function processaLista($arquivo, $nomeArquivo) { fclose($handReproc); + if (!file_exists($arqReproc)) { throw new Exception("Não foi possível criar o arquivo no diretório!"); } diff --git a/include/configs/config.php b/include/configs/config.php index 1475ba87..73d419dd 100644 --- a/include/configs/config.php +++ b/include/configs/config.php @@ -14,7 +14,7 @@ define("PRM_DEF_SLOGAN", "Simples IP"); // ################################# define('ENDERECO_SITE', 'Av. Isaac Póvoas, Nº 901, Ed. Mirante do Coxim - Sala 102 - Centro - Cuiabá - MT - Cep: 78032-015'); -define('POWERED_BY', 'Desenvolvido por '.NOME_SITE.' - Copyright © ' . date('Y') . ' simplesip.net.br'); +define('POWERED_BY', 'Desenvolvido por Simples IP - Copyright © ' . date('Y') . ' simplesip.net.br'); define('EMAIL_SITE1', 'meajuda@simplesip.com.br'); define('EMAIL_SITE2', 'comercial@simplesip.com.br'); define('TELEFONE_SITE1', '+55(65)3616-8280'); @@ -47,7 +47,7 @@ define('CONF_PARCEIRO_WORKFLOW','logoParceiro'); // ### CONFIGURAÇÃO DAS JANELAS POPUP ### // ###################################### -$myHeader = ''.TITLE_SITE.''; +$myHeader = 'Simples IP'; define('TITLE_JANELA_SITE', $myHeader); // ####################################################### diff --git a/include/util/util.php b/include/util/util.php index 876bc7db..92f5e3d7 100644 --- a/include/util/util.php +++ b/include/util/util.php @@ -380,7 +380,7 @@ function LimpaString($str, $toUpeer = true, $removeSpace = true) { $array2 = array('A', 'A', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'D', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'U', 'P', 'B', 'a', 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'o', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y'); $string = str_replace($array1, $array2, $string); $newstring = preg_replace(($removeSpace ? "/[^a-zA-Z0-9_.]/" : "/[^a-zA-Z0-9\s_.]/"), "", $string); - return $toUpeer ? $newstring : $newstring; + return $toUpeer ? strtoupper($newstring) : $newstring; } function GetFileExt($nomeArq) { diff --git a/login.php b/login.php index c2c74a0d..81e24aba 100644 --- a/login.php +++ b/login.php @@ -20,8 +20,6 @@ $smarty->assign("recuperaSenha", ValidaRecuperaSenha($dbcon)); * usuario nao autenticado */ -include "util/funcoesLicenca.php"; - if (!isset($_POST["loginUser"])) { $jsStartup[] = $setFocus; DispLogin($smarty); // or $siteError->GetPhpError("Autentica Usuario", "", "Erro ao chamar funcao smarty!"); @@ -31,12 +29,6 @@ if (!isset($_POST["loginUser"])) { $senha = substr($_POST["loginPass"], 0, 14); $validaTentativa = countTentativas($dbcon, $login, $tentativaErro); - if(!validarLicenca($dbcon) && ($_POST["loginUser"] != 'admin')){ - $jsStartup[] = "alert('Sua licença é inválida por favor entre em contato com o suporte da Simples IP para ativar sua central!');"; - DispLogin($smarty); - return; - } - if(!$validaTentativa && ($_POST["loginUser"] != 'admin')){ $jsStartup[] = "alert('Seu acesso foi bloqueado por inúmeras tentativas de acesso inválidos! Para o desbloqueio, realize a alteração de senha ou consulte seu Administrador.');"; $jsStartup[] = $setFocus; diff --git a/master.css b/master.css index e9bdbe70..d8455ea2 100644 --- a/master.css +++ b/master.css @@ -330,8 +330,9 @@ form input[type=submit], input[type=text] border-collapse: collapse; background-color:#F7F7F7; font:Arial, Helvetica, sans-serif; - border-top-left-radius: 10px; - border-top-right-radius: 10px; + -webkit-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; overflow: hidden; } @@ -992,34 +993,11 @@ table.gridClean td { } #agrupamentoTable th !important { + font-weight: bold; padding: 0; margin: 0; padding-left: 6px; padding-right: 6px; background-color: #4F71C0; -} - -.alert { - padding: 15px; - border-radius: 5px; - color: white; - font-size: 12px; - font-weight: bold; -} - -.alert-error { - background-color: #f44336; -} - -.alert-success { - background-color: #04AA6D; -} - -.alert-info { - background-color: #2196F3; -} - -.alert-warning { - background-color: #ff9800; } \ No newline at end of file diff --git a/templates/callcenter/agente/agenteAnota.tpl b/templates/callcenter/agente/agenteAnota.tpl index e37f653d..e74fe766 100644 --- a/templates/callcenter/agente/agenteAnota.tpl +++ b/templates/callcenter/agente/agenteAnota.tpl @@ -1,21 +1,18 @@ {capture name="display"} - + - - - - - - - - - - - - - - - - - - - - - -
- - Bloco de Anotações - Bloco de Anotações - - Bloco de Anotações Bloco de Anotações
- {if $isSuper}{/if} + {if $isSuper} + + {/if} + @@ -30,50 +27,41 @@ + -
AgenteAgenteData Inicial Data Final{if $isFone}Fone{else}{$prm_label_protoco_pesquisa}{/if}
-
- - {$msg} - -
{$prm_label_protoco_texto}
- - -
Registros
-
- - - - {if $isSuper}{/if} - - - - - {$linhas} -
DataAgente{if $isFone}Fone{else}{$prm_label_protoco_grid}{/if}Texto 
-
-
+ + + + + {$msg} + + + {$prm_label_protoco_texto} + + + + + + + + Registros + + + +
+ + + + {if $isSuper}{/if} + + + + + {$linhas} +
DataAgente{if $isFone}Fone{else}{$prm_label_protoco_grid}{/if}Texto 
+
+ + {/capture} diff --git a/templates/callcenter/agente/agentert.tpl b/templates/callcenter/agente/agentert.tpl index a9a3d901..446826ee 100644 --- a/templates/callcenter/agente/agentert.tpl +++ b/templates/callcenter/agente/agentert.tpl @@ -307,7 +307,7 @@ Infromações Detalhadas do Contato {/if} Link para Áudio - Bloco de Anotações + Bloco de Anotações Histórico das Chamadas Agenda Trocar Senha diff --git a/templates/configSys.tpl b/templates/configSys.tpl index 503b1e59..07fee57f 100644 --- a/templates/configSys.tpl +++ b/templates/configSys.tpl @@ -1,21 +1,19 @@ {capture name="display"} - +
- +
- + - -
Configuração Geral do Sistema Configuração Geral do Sistema
  Banco de Dados Sistema Agente Supervisor Socket Server Simples ChatLicença