From fd849df6b6d4f060c6bc1485ef817fb9d947dc08 Mon Sep 17 00:00:00 2001 From: Claudio Zimmermann Junior Date: Thu, 4 Jul 2024 09:55:07 -0400 Subject: [PATCH] Implementei relatorio de metodos de integracao --- include/util/funcoesApl.php | 1011 +++++++++++------ include/util/funcoesInternas.php | 3 +- projeto/base/sql/grupo_licenca_developers.sql | 2 +- .../chamadasEntrantes/entrantesIntegracao.php | 359 ++++++ 4 files changed, 1021 insertions(+), 354 deletions(-) create mode 100644 relatorios/pbx/chamadasEntrantes/entrantesIntegracao.php diff --git a/include/util/funcoesApl.php b/include/util/funcoesApl.php index ae8bda4a..0d7faf10 100755 --- a/include/util/funcoesApl.php +++ b/include/util/funcoesApl.php @@ -1,6 +1,9 @@ 0)); } -function GetIdUser() { +function GetIdUser() +{ if (IsAdmin()) { return 0; } return isset($_SESSION["SSidUser"]) ? $_SESSION["SSidUser"] : 0; } -function VerificaCadastroMenu($conn) { +function VerificaCadastroMenu($conn) +{ global $alturaTabelaAgente; /* * Esta funcao verifica se o menus estao cadastrdos corretamente @@ -99,7 +104,7 @@ function VerificaCadastroMenu($conn) { $menuUsuario[] = array('22', 'mnRelDesligamento', '1', 'Chamadas Desligadas A/B', 'index.php?idProg=108', '', '18', '1', '0', '', '108'); $menuUsuario[] = array('23', 'mnRelRecebidasDDD', '1', 'Chamadas Totalizadas por DDD', 'index.php?idProg=95', '', '18', '1', '0', '', '95'); $menuUsuario[] = array('24', 'mnRelClassifica', '1', 'Classificação de Atendimento', 'index.php?idProg=51', '', '18', '1', '0', '', '51'); - // $menuUsuario[] = array('25', 'mnRelContribuinte', '1', 'Relatório de ' . $nomeModCli, 'index.php?idProg=52', '', '18', '1', '0', '', '52'); + // $menuUsuario[] = array('25', 'mnRelContribuinte', '1', 'Relatório de ' . $nomeModCli, 'index.php?idProg=52', '', '18', '1', '0', '', '52'); $menuUsuario[] = array('27', 'mnRelDesempenhoOperacao', '1', 'Desempenho/Operação', 'index.php?idProg=97', '', '18', '1', '0', '', '97'); $menuUsuario[] = array('28', 'mnRelMetas', '1', 'Metas', 'index.php?idProg=58&idMenu=28&menuNome=Metas', '', '18', '1', '0', '', '58'); $menuUsuario[] = array('29', 'mnMetaMensal', '1', 'Meta Mensal', 'index.php?idProg=32', '', '28', '1', '0', '', '32'); @@ -316,15 +321,15 @@ function VerificaCadastroMenu($conn) { $menuUsuario[] = array('177', 'mnCustomizados', '1', 'Customizados', 'index.php?idProg=58&idMenu=177&menuNome=Customizados', '', '17', '1', '0', '', '58'); $menuUsuario[] = array('178', 'mnRelChamadasGeral', '1', 'Chamadas Geral', 'index.php?idProg=366', '', '177', '1', '0', '', '366'); -// $menuUsuario[] = array('177', 'mnAnalysis', '1', 'Gráficos', 'index.php?idProg=58&idMenu=177&menuNome=Analysis', '', '17', '1', '0', '', '58'); -// $menuUsuario[] = array('178', 'mnResumoOperacao', '1', 'Resumo Chamadas/DAC', 'index.php?idProg=289', '', '177', '1', '0', '', '289'); -// $menuUsuario[] = array('179', 'mnResumoOperacaoServico', '1', 'Resumo Chamadas/Serviços', 'index.php?idProg=290', '', '177', '1', '0', '', '290'); -// $menuUsuario[] = array('180', 'mnIndicesDac', '1', 'Índices/DAC', 'index.php?idProg=291', '', '177', '1', '0', '', '291'); -// $menuUsuario[] = array('181', 'mnIndicesServ', '1', 'Índices/Serviços', 'index.php?idProg=292', '', '177', '1', '0', '', '292'); -// $menuUsuario[] = array('182', 'mnMetaMensalServ', '1', 'Meta Mensal/Serviço', 'index.php?idProg=293', '', '28', '1', '0', '', '293'); -// $menuUsuario[] = array('183', 'mnMetaDiariaServ', '1', 'Meta Diária/Serviço', 'index.php?idProg=294', '', '28', '1', '0', '', '294'); -// $menuUsuario[] = array('184', 'mnDesempenhoDac', '1', 'Desempenho por DAC', 'index.php?idProg=300', '', '177', '1', '0', '', '300'); -// $menuUsuario[] = array('185', 'mnDesempenhoServ', '1', 'Desempenho por Serviço', 'index.php?idProg=301', '', '177', '1', '0', '', '301'); + // $menuUsuario[] = array('177', 'mnAnalysis', '1', 'Gráficos', 'index.php?idProg=58&idMenu=177&menuNome=Analysis', '', '17', '1', '0', '', '58'); + // $menuUsuario[] = array('178', 'mnResumoOperacao', '1', 'Resumo Chamadas/DAC', 'index.php?idProg=289', '', '177', '1', '0', '', '289'); + // $menuUsuario[] = array('179', 'mnResumoOperacaoServico', '1', 'Resumo Chamadas/Serviços', 'index.php?idProg=290', '', '177', '1', '0', '', '290'); + // $menuUsuario[] = array('180', 'mnIndicesDac', '1', 'Índices/DAC', 'index.php?idProg=291', '', '177', '1', '0', '', '291'); + // $menuUsuario[] = array('181', 'mnIndicesServ', '1', 'Índices/Serviços', 'index.php?idProg=292', '', '177', '1', '0', '', '292'); + // $menuUsuario[] = array('182', 'mnMetaMensalServ', '1', 'Meta Mensal/Serviço', 'index.php?idProg=293', '', '28', '1', '0', '', '293'); + // $menuUsuario[] = array('183', 'mnMetaDiariaServ', '1', 'Meta Diária/Serviço', 'index.php?idProg=294', '', '28', '1', '0', '', '294'); + // $menuUsuario[] = array('184', 'mnDesempenhoDac', '1', 'Desempenho por DAC', 'index.php?idProg=300', '', '177', '1', '0', '', '300'); + // $menuUsuario[] = array('185', 'mnDesempenhoServ', '1', 'Desempenho por Serviço', 'index.php?idProg=301', '', '177', '1', '0', '', '301'); $menuUsuario[] = array('186', 'mnUra', '1', 'URA', 'index.php?idProg=58&idMenu=186&menuNome=URA', '', '17', '1', '0', '', '58'); @@ -396,13 +401,15 @@ function VerificaCadastroMenu($conn) { if (UseModVendas()) { $menuUsuario[] = array('215', 'mnDashboard', '1', 'Dashboard ' . MenuVendas(), 'index.php?idProg=358', '', '173', '1', '0', '', '358'); } - + $menuUsuario[] = array('214', 'mnSimplesChat', '1', 'ChannelChat', 'index.php?idProg=355', '', '1', '1', '0', '', '355'); $menuUsuario[] = array('217', 'mnSimplesChatAdm', '0', 'Administrador SimplesChat', 'index.php?idProg=359', '', '1', '1', '0', '', '359'); $menuUsuario[] = array('218', 'mnSimplesChatSup', '0', 'Supervisor SimplesChat', 'index.php?idProg=360', '', '1', '1', '0', '', '360'); $menuUsuario[] = array('219', 'mnSimplesChatAgt', '0', 'Agente SimplesChat', 'index.php?idProg=361', '', '1', '1', '0', '', '361'); $menuUsuario[] = array('220', 'mnLgpdAdm', '0', 'Administra LGPD', 'index.php?idProg=364', '', '1', '1', '0', '', '364'); $menuUsuario[] = array('221', 'mnpermEditaClassificado', '0', 'Permite Editar Classificação', 'index.php?idProg=368', '', '1', '1', '0', '', '368'); + $menuUsuario[] = array('222', 'mnRelatorioIntegracao', '1', 'Métodos da Integração', 'index.php?idProg=369', '', '49', '1', '0', '', '369'); + $menuUsuario[] = array('112', 'mnSair', '1', 'Sair', 'index.php?idProg=-1&DEBUG=0', '', '', '1', '1', '10', '-1'); @@ -423,7 +430,7 @@ function VerificaCadastroMenu($conn) { } //registro apgados com sucesso if ($result) { - $permissions = existLicense($conn); + $permissions = existLicense($conn); foreach ($menuUsuario as $key => $value) { if (!in_array($value[0], $permissions) && ($value[0] != '112')) { unset($menuUsuario[$key]); @@ -439,11 +446,24 @@ function VerificaCadastroMenu($conn) { $vMenu = $menuUsuario[$key]; //Verifica se é um link para nova janela //$novaJan = (stripos($vMenu[4], 'NovaJanela') !== false); - $query = sprintf($query, QuotedStr($vMenu[0]), empty($vMenu[1]) ? 'null' : QuotedStr($vMenu[1]), empty($vMenu[2]) ? '0' : QuotedStr($vMenu[2]), empty($vMenu[3]) ? 'null' : QuotedStr(($vMenu[3])), //utf8_encode - empty($vMenu[4]) ? 'null' : QuotedStr($vMenu[4]), empty($vMenu[5]) ? 'null' : QuotedStr($vMenu[5]), empty($vMenu[6]) ? 'null' : QuotedStr($vMenu[6]), empty($vMenu[7]) ? '0' : QuotedStr($vMenu[7]), empty($vMenu[8]) ? '0' : QuotedStr($vMenu[8]), empty($vMenu[9]) ? 'null' : QuotedStr($vMenu[9]), QuotedStr($vMenu[10])); + $query = sprintf( + $query, + QuotedStr($vMenu[0]), + empty($vMenu[1]) ? 'null' : QuotedStr($vMenu[1]), + empty($vMenu[2]) ? '0' : QuotedStr($vMenu[2]), + empty($vMenu[3]) ? 'null' : QuotedStr(($vMenu[3])), //utf8_encode + empty($vMenu[4]) ? 'null' : QuotedStr($vMenu[4]), + empty($vMenu[5]) ? 'null' : QuotedStr($vMenu[5]), + empty($vMenu[6]) ? 'null' : QuotedStr($vMenu[6]), + empty($vMenu[7]) ? '0' : QuotedStr($vMenu[7]), + empty($vMenu[8]) ? '0' : QuotedStr($vMenu[8]), + empty($vMenu[9]) ? 'null' : QuotedStr($vMenu[9]), + QuotedStr($vMenu[10]) + ); $result = pg_query($conn, $query); if (!$result) { + file_put_contents(LOG_PATH, "query falhou: $query\n", FILE_APPEND); break; } } @@ -483,7 +503,8 @@ function VerificaCadastroMenu($conn) { } -function CriaPerfilSincronizacao($conn) { +function CriaPerfilSincronizacao($conn) +{ $result = true; $query = "delete from pbx_grupo_funcoes where gp_id = (select gp_id from pbx_grupo where gp_nome = 'SincContaSenha' )"; $result = $result && pg_query($conn, $query); @@ -545,7 +566,8 @@ function CriaPerfilSincronizacao($conn) { // return true; //} -function GetLinkNovaJanela($width, $height, $link, $nomeJan, $atrib = '') { +function GetLinkNovaJanela($width, $height, $link, $nomeJan, $atrib = '') +{ SetDimensoes($width, $height); $janW = round($GLOBALS["janW"]); $janH = round($GLOBALS["janH"]); @@ -556,22 +578,26 @@ function GetLinkNovaJanela($width, $height, $link, $nomeJan, $atrib = '') { return $link; } -function IsSuper() { +function IsSuper() +{ return ($_SESSION["SSsuper"] == 1); } -function IsUserAdmin() { +function IsUserAdmin() +{ $query = sprintf("select count(*) from pbx_grupo_usuario where gp_id = (select gp_id from pbx_grupo where gp_nome = 'ADMINISTRADOR') and user_id = '%s'", GetIdUser()); $result = pg_query($query); $row = @pg_fetch_row($result); return $row[0] ? true : false; } -function IsAdmin() { +function IsAdmin() +{ return strtoupper(GetLogin()) == 'ADMIN'; } -function AgenteON($idUser = null) { +function AgenteON($idUser = null) +{ if ($idUser != null) { $query = sprintf("SELECT '' FROM pbx_supervisor_agentes a INNER JOIN pbx_usuarios b ON a.matricula = b.matricula @@ -587,7 +613,8 @@ function AgenteON($idUser = null) { //return isset($_SESSION[SS_AGENTE_CONECTADO]) && $_SESSION[SS_AGENTE_CONECTADO]; } -function GetMaxAgentePausa($dac = 0) { +function GetMaxAgentePausa($dac = 0) +{ if ($dac) { $query = "select max_agente_pausa from pbx_queues_grupos where id = '$dac'"; $result = pg_query($query); @@ -597,14 +624,16 @@ function GetMaxAgentePausa($dac = 0) { return isset($_SESSION['prm_max_agente_pausa']) ? $_SESSION['prm_max_agente_pausa'] : 0; } -function VerificaRamalConectado($nome) { +function VerificaRamalConectado($nome) +{ $query = "select count(*) from pbx_supervisor_agentes where ramal = '$nome' "; $result = pg_query($query); $row = @pg_fetch_row($result); return $row[0]; } -function VerificaMaxAgentePausa($dac) { +function VerificaMaxAgentePausa($dac) +{ /* * Busca a configuração da fila */ @@ -623,7 +652,8 @@ function VerificaMaxAgentePausa($dac) { return GetPercAgentePausa($dac) >= $percPausa; } -function GetPercAgentePausa($dac) { +function GetPercAgentePausa($dac) +{ $query = "select count(*) as total, coalesce(sum(case when(status = 'PAUSA')then 1 else 0 end), 0) as pausa from pbx_supervisor_agentes where dac = (select nome from pbx_dacs where id = '$dac')"; //if(IsAdmin()) echo $query; $result = pg_query($query); @@ -634,14 +664,16 @@ function GetPercAgentePausa($dac) { return !$total ? 0 : round(($pausa * 100.0) / $total); } -function IsSysAdmin($user = '') { +function IsSysAdmin($user = '') +{ if (!empty($user)) return strtoupper($user) == 'ADMINISTRADOR'; else return strtoupper(GetLogin()) == 'ADMINISTRADOR'; } -function GetIdSysAdmin($dbcon) { +function GetIdSysAdmin($dbcon) +{ $query = "select id from pbx_usuarios where upper(apelido) = 'ADMINISTRADOR'"; $result = pg_query($dbcon, $query); $row = @pg_fetch_row($result); @@ -649,7 +681,8 @@ function GetIdSysAdmin($dbcon) { return $row[0]; } -function __GetLoginFromId($id) { +function __GetLoginFromId($id) +{ if ($id && $id < 0) { $gpId = abs($id); $query = "select gp_nome from pbx_grupo where gp_id = '$gpId'"; @@ -662,7 +695,8 @@ function __GetLoginFromId($id) { return $row[0]; } -function GetIdFromLogin($dbcon, $login) { +function GetIdFromLogin($dbcon, $login) +{ $query = "select id from pbx_usuarios where upper(apelido) = upper('$login') and delete_ = 0"; $result = pg_query($dbcon, $query); $row = @pg_fetch_row($result); @@ -670,7 +704,8 @@ function GetIdFromLogin($dbcon, $login) { return $row[0]; } -function CriaUserApi($dbcon) { +function CriaUserApi($dbcon) +{ $query = "select id from pbx_usuarios where upper(apelido) = upper('user.api')"; $result = pg_query($dbcon, $query); @@ -681,7 +716,8 @@ function CriaUserApi($dbcon) { } } -function _Menu($dbcon) { +function _Menu($dbcon) +{ // fun_id, fun_nome, fun_menu, fun_menu_text, fun_menu_url, fun_menu_img, fun_id_pai, fun_status, fun_public // 2;"mnAgente";1;"Agente";"index.php?idProg=14";"";1;1;0 @@ -697,7 +733,7 @@ function _Menu($dbcon) { /* * Nivel 1 */ - $makeMenu .= (!$startMenu ? "" : ", " ) . sprintf("[%s, %s, %s,", IsNull($row["fun_menu_text"], 'null', 1), IsNull($row["fun_menu_url"], 'null', 1), 'null', 'null'); + $makeMenu .= (!$startMenu ? "" : ", ") . sprintf("[%s, %s, %s,", IsNull($row["fun_menu_text"], 'null', 1), IsNull($row["fun_menu_url"], 'null', 1), 'null', 'null'); $startMenu++; /* * Nivel 2 @@ -710,7 +746,7 @@ function _Menu($dbcon) { $makeMenu .= "\n"; $startMenu2 = 0; while ($rowNivel2 = pg_fetch_array($resultNivel2)) { - $makeMenu .= (!$startMenu2 ? "" : ", " ); + $makeMenu .= (!$startMenu2 ? "" : ", "); $startMenu2++; $makeMenu .= sprintf(" [%s, %s, %s,", IsNull($rowNivel2["fun_menu_text"], 'null', 1), IsNull($rowNivel2["fun_menu_url"], 'null', 1), 'null'); //print nivel 2 $idPai = $rowNivel2["fun_id"]; @@ -721,7 +757,7 @@ function _Menu($dbcon) { $makeMenu .= "\n"; $startMenu3 = 0; while ($rowNivel3 = pg_fetch_array($resultNivel3)) { - $makeMenu .= (!$startMenu3 ? "" : ", " ); + $makeMenu .= (!$startMenu3 ? "" : ", "); $startMenu3++; $makeMenu .= sprintf(" [%s, %s, %s, ", IsNull($rowNivel3["fun_menu_text"], 'null', 1), IsNull($rowNivel3["fun_menu_url"], 'null', 1), 'null'); $idPai = $rowNivel3["fun_id"]; @@ -732,7 +768,7 @@ function _Menu($dbcon) { $makeMenu .= "\n"; $startMenu4 = 0; while ($rowNivel4 = pg_fetch_array($resultNivel4)) { - $makeMenu .= (!$startMenu4 ? "" : ", " ); + $makeMenu .= (!$startMenu4 ? "" : ", "); $startMenu4++; $makeMenu .= sprintf(" [%s, %s, %s,", IsNull($rowNivel4["fun_menu_text"], 'null', 1), IsNull($rowNivel4["fun_menu_url"], 'null', 1), 'null'); $idPai = $rowNivel4["fun_id"]; @@ -743,7 +779,7 @@ function _Menu($dbcon) { $makeMenu .= "\n"; $startMenu5 = 0; while ($rowNivel5 = pg_fetch_array($resultNivel4)) { - $makeMenu .= (!$startMenu5 ? "" : ", " ); + $makeMenu .= (!$startMenu5 ? "" : ", "); $startMenu5++; $makeMenu .= sprintf(" [%s, %s, %s, null]\n", IsNull($rowNivel5["fun_menu_text"], 'null', 1), IsNull($rowNivel5["fun_menu_url"], 'null', 1), 'null'); } @@ -763,9 +799,10 @@ function _Menu($dbcon) { return $makeMenu; } -function GetQueryMenu($idUsuario, $idPai, $menuBase = 0) { +function GetQueryMenu($idUsuario, $idPai, $menuBase = 0) +{ $query = IsAdmin() ? " select * from pbx_funcoes where coalesce(fun_id_pai, 0) = $idPai and fun_staus = 1 order by ord" : - " select distinct a.fun_id, a.fun_nome, a.fun_menu, a.fun_menu_text, a.fun_menu_url, a.fun_menu_img, a.fun_id_pai, a.fun_status, a.fun_public, a.ord + " select distinct a.fun_id, a.fun_nome, a.fun_menu, a.fun_menu_text, a.fun_menu_url, a.fun_menu_img, a.fun_id_pai, a.fun_status, a.fun_public, a.ord from( select a.fun_id, a.fun_nome, a.fun_menu, a.fun_menu_text, a.fun_menu_url, a.fun_menu_img, a.fun_id_pai, a.fun_status, a.fun_public, a.ord from pbx_funcoes a @@ -779,7 +816,7 @@ function GetQueryMenu($idUsuario, $idPai, $menuBase = 0) { and a.fun_id = c.fun_id and d.id = '$idUsuario' and a.fun_id_pai = '$idPai' and b.fun_status = 1 and c.fun_stasus = 1 " . - ( + ( !$menuBase ? "" : " union all select a.fun_id, a.fun_nome, a.fun_menu, a.fun_menu_text, a.fun_menu_url, a.fun_menu_img, a.fun_id_pai, a.fun_status, a.fun_public, a.ord @@ -792,7 +829,8 @@ function GetQueryMenu($idUsuario, $idPai, $menuBase = 0) { return $query; } -function GetItensMenu($tpLayout = 0) { +function GetItensMenu($tpLayout = 0) +{ /* "mnAudio" ;"mnSupervisor" ;"mnConfiguracao" ;"mnCadastro" ;"mnSistema" ;"mnAgente" ;"mnUsuario" ; "mnClassificacao" ;"mnRelatorio" ;"mnRelProdAgente" ;"mnRelTransAgente" ;"mnMetaMensal" ;"mnMetaMensaAneel" ; @@ -807,7 +845,8 @@ function GetItensMenu($tpLayout = 0) { } } -function GetJqToolTip($obj, $text) { +function GetJqToolTip($obj, $text) +{ return "\$('#$obj') .hover( function(){ @@ -819,12 +858,14 @@ function GetJqToolTip($obj, $text) { );"; } -function GetJqTips($obj) { +function GetJqTips($obj) +{ //return "$('$obj').tooltip();"; return "$('$obj').easyTooltip();"; } -function GetJQuery($j) { +function GetJQuery($j) +{ $result = "", $url); } -function PbxAlert($msg) { +function PbxAlert($msg) +{ echo ""; } -function GravaFull($__idProg = 0, $uniqueid = '', $msg = '', $param = '') { +function GravaFull($__idProg = 0, $uniqueid = '', $msg = '', $param = '') +{ if (IsUserConnect() || $param) { global $idProg; $dir = '/var/log/asterisk/audita'; @@ -3487,7 +3716,7 @@ function GravaFull($__idProg = 0, $uniqueid = '', $msg = '', $param = '') { $data = date('Y-m-d H:i:s'); $arAudita = array('uid' => $uid, 'ip' => $ip, 'data' => $data, 'login' => $login, 'prog' => $programa, 'msg' => $msg, 'request' => $_REQUEST, 'session' => $_SESSION); $log = json_encode($arAudita, JSON_INVALID_UTF8_SUBSTITUTE); - + if (!file_exists($path)) { $file = @fopen($path, 'w+'); } else { @@ -3507,7 +3736,8 @@ function GravaFull($__idProg = 0, $uniqueid = '', $msg = '', $param = '') { } } -function CommandoAmi($params) { +function CommandoAmi($params) +{ list($sckHost, $sckPort, $sckUser, $sckPass) = GetSckConnect(); $socket = ConectaAmi($sckHost, $sckPort, $sckUser, $sckPass); @@ -3518,7 +3748,8 @@ function CommandoAmi($params) { return false; } -function SetCookieApl($name, $value, $expire = -1) { +function SetCookieApl($name, $value, $expire = -1) +{ if ($expire === -1) { $expire = time() + 60 * 60 * 24 * 300; } @@ -3526,7 +3757,8 @@ function SetCookieApl($name, $value, $expire = -1) { return setcookie($name, $value, $expire); } -function GetCookieApl($name) { +function GetCookieApl($name) +{ if (!isset($_COOKIE[$name])) { return false; } @@ -3535,11 +3767,13 @@ function GetCookieApl($name) { return $_COOKIE[$name]; } -function GetRamalMonitorar($name) { +function GetRamalMonitorar($name) +{ return isset($_SESSION[$name]) ? $_SESSION[$name] : null; } -function ValidaRamalApl($ramal) { +function ValidaRamalApl($ramal) +{ /* * Esta função verifica se o ramal existe, e retorna o canal se o ramal é valido. */ @@ -3555,7 +3789,8 @@ function ValidaRamalApl($ramal) { return $row[0]; } -function SetAcessoAudio($dac) { +function SetAcessoAudio($dac) +{ /* * Desativado o uso de sessoes. */ @@ -3571,7 +3806,8 @@ function SetAcessoAudio($dac) { $_SESSION['SSAcessoAudio'] = $acessAudio; } -function GetAcessoAudio($dac) { +function GetAcessoAudio($dac) +{ $idUser = GetIdUser(); //$query = "select '' from pbx_fila_audios x, pbx_grupo_usuario y where y.gp_id = x.gp_id and y.user_id = $idUser and x.id = '$dac'"; $query = "select '' from pbx_fila_audios x, pbx_grupo_usuario y, pbx_dacs z where y.gp_id = x.gp_id and z.id = x.id and y.user_id = '$idUser' and z.nome = '$dac'"; @@ -3593,7 +3829,8 @@ function GetAcessoAudio($dac) { */ } -function ConfigRamalMonitorar() { +function ConfigRamalMonitorar() +{ try { $nomeRamalMonitorar = ($_REQUEST['nomeRamalMonitorar']); $nomecanalMonitorar = ($_REQUEST['nomeCanalMonitorar']); @@ -3626,7 +3863,8 @@ function ConfigRamalMonitorar() { } } -function GetIdentRota($dbcon, $codServ = 0, $wdt = 160) { +function GetIdentRota($dbcon, $codServ = 0, $wdt = 160) +{ $codSel = $codServ; $width = $wdt ? "style=\"max-width: {$wdt}px\"" : ""; $serv = "'; @@ -4162,13 +4437,15 @@ function GetAno($ano, $head = 0, $sql = '') { return $combo; } -function GetPausaAusente($dbcon, $matricula) { +function GetPausaAusente($dbcon, $matricula) +{ $query = "select '' from pbx_supervisor_agentes a where matricula = '$matricula' and status = 'PAUSA' and upper(motivo_pausa) in('AUSENTE','RECUSADA')"; $result = pg_query($dbcon, $query); return pg_num_rows($result); } -function Menu($dbcon, $queryHead = "", $queryItens = "", $idUser = 0, $hiddeLink = 0, $param = null) { +function Menu($dbcon, $queryHead = "", $queryItens = "", $idUser = 0, $hiddeLink = 0, $param = null) +{ //$menu = $_SESSION["SSmenuSistema"]; //$indexMenu = $_SESSION["SSidxMenuSistema"]; //$dadosMenu = $_SESSION["SSdadosMenuSistema"]; @@ -4187,7 +4464,8 @@ function Menu($dbcon, $queryHead = "", $queryItens = "", $idUser = 0, $hiddeLink return $makeMenu; } -function ExtratItens($itensMenu, $numMod) { +function ExtratItens($itensMenu, $numMod) +{ $makeMenu = ''; $makeMenu .= $numMod ? "\n,[" : "\n["; $i = 0; @@ -4205,7 +4483,8 @@ function ExtratItens($itensMenu, $numMod) { return $makeMenu; } -function QueryMenuHead($idUser, $public = 0) { +function QueryMenuHead($idUser, $public = 0) +{ if ($idUser < 0) { $idGrupo = abs($idUser); $permUser = GetGrupoUserPermissoes($idGrupo); @@ -4240,7 +4519,8 @@ function QueryMenuHead($idUser, $public = 0) { order by ord "; } -function QueryMenuItens($idUser, $idMenu = 0, $notMenu = 0, $param = null) { +function QueryMenuItens($idUser, $idMenu = 0, $notMenu = 0, $param = null) +{ if ($idUser < 0) { $idGrupo = abs($idUser); $permUser = GetGrupoUserPermissoes($idGrupo, $idMenu, 1); @@ -4297,15 +4577,20 @@ function QueryMenuItens($idUser, $idMenu = 0, $notMenu = 0, $param = null) { return $query; } -function GetLinkMenu($linkMenu, $funId = 0, $url = '', $acao = 'upd') { +function GetLinkMenu($linkMenu, $funId = 0, $url = '', $acao = 'upd') +{ switch ($linkMenu) { - case 0: return "#"; - case 1: return $url; - default: return sprintf("index.php?idProg=%s&funId=%s&acao=%s", GetGerPerfil(), $funId, $acao); + case 0: + return "#"; + case 1: + return $url; + default: + return sprintf("index.php?idProg=%s&funId=%s&acao=%s", GetGerPerfil(), $funId, $acao); }; } -function MontaMenu($idMenu, $userId, $linkMenu = 1, $notMenu = 0, $acao = "upd") { +function MontaMenu($idMenu, $userId, $linkMenu = 1, $notMenu = 0, $acao = "upd") +{ global $dbcon; /* * Funcao retorna menu para aplicacao. @@ -4340,7 +4625,7 @@ function MontaMenu($idMenu, $userId, $linkMenu = 1, $notMenu = 0, $acao = "upd") $menu .= MontaMenu($dados['fun_id'], $userId, $linkMenu, $notMenu, $acao); $menu .= "\n]"; } - $menu = $menuHead . $menu . ( ($linkMenu < 2) ? "];\n" : "]];\n"); + $menu = $menuHead . $menu . (($linkMenu < 2) ? "];\n" : "]];\n"); return $menu; } else { $query = QueryMenuItens($userId, $idMenu, $notMenu); @@ -4357,7 +4642,8 @@ function MontaMenu($idMenu, $userId, $linkMenu = 1, $notMenu = 0, $acao = "upd") } } -function GetGerPerfil() { +function GetGerPerfil() +{ /* * Esta funcao retorna o id do script perfilfuncoesGrupo.php que eh * responsavel por adicionar e remover permissoes aos usuarios. @@ -4365,7 +4651,8 @@ function GetGerPerfil() { return "121"; } -function GetGrupoUserPermissoes($idGrupo, $idMenu = 0, $itens = 0) { +function GetGrupoUserPermissoes($idGrupo, $idMenu = 0, $itens = 0) +{ $query = "select user_id from pbx_grupo a where gp_id = '$idGrupo' "; $result = pg_query($query); $row = pg_fetch_row($result); @@ -4398,14 +4685,16 @@ function GetGrupoUserPermissoes($idGrupo, $idMenu = 0, $itens = 0) { and d.fun_status = 1 ", QuotedStr($idMenu), QuotedStr($userId)); } -function printPre($data, $exit = false) { +function printPre($data, $exit = false) +{ echo "
" . print_r($data, true) . "
"; if ($exit) { exit; } } -function truncate($string, $length = 80) { +function truncate($string, $length = 80) +{ if (!isset($string) || empty($string)) { return ""; } @@ -4417,13 +4706,16 @@ function truncate($string, $length = 80) { return substr($string, 0, $length) . "..."; } -function IsLogado() { +function IsLogado() +{ return (isset($_SESSION['SSidUser']) && !empty($_SESSION['SSidUser'])); } -function ArrayDotNotation($arr) { +function ArrayDotNotation($arr) +{ $iterator = new RecursiveIteratorIterator( - new RecursiveArrayIterator($arr), RecursiveIteratorIterator::SELF_FIRST + new RecursiveArrayIterator($arr), + RecursiveIteratorIterator::SELF_FIRST ); $path = []; $flatArray = []; @@ -4432,15 +4724,14 @@ function ArrayDotNotation($arr) { $path[$iterator->getDepth()] = $key; if (!is_array($value)) { - $flatArray[ - implode('.', array_slice($path, 0, $iterator->getDepth() + 1)) - ] = $value; + $flatArray[implode('.', array_slice($path, 0, $iterator->getDepth() + 1))] = $value; } } return $flatArray; } -function PodePublicarMural($idProg, $info) { +function PodePublicarMural($idProg, $info) +{ global $dbcon; $isPopup = (getRequest('window', INPUT_GET)); $naoPublicarPelasPaginas = [14, 6]; @@ -4451,7 +4742,8 @@ function PodePublicarMural($idProg, $info) { return $podePublicar; } -function GetRetornoAbandonadas($hora, $nro, $dac) { +function GetRetornoAbandonadas($hora, $nro, $dac) +{ $query = "select ret_agente, ret_calldate as data @@ -4468,7 +4760,8 @@ function GetRetornoAbandonadas($hora, $nro, $dac) { return $dados; } -function GetTotalDependencias($recurso, $key) { +function GetTotalDependencias($recurso, $key) +{ if ($recurso == 'voice') { $key = sprintf("%s/%%", $key); } @@ -4559,11 +4852,13 @@ function GetTotalDependencias($recurso, $key) { * @param int $totaldep O número de dependências identificadas para o recurso corrente. * @return String */ -function GetLinkDependenciaRecurso($opcao, $acao, $recursoTipo, $nomeRecurso, $totaldep) { +function GetLinkDependenciaRecurso($opcao, $acao, $recursoTipo, $nomeRecurso, $totaldep) +{ return !$totaldep ? "" : sprintf("", $opcao, $acao, $recursoTipo, $nomeRecurso, $totaldep); } -function GetManagerParams() { +function GetManagerParams() +{ $query = "select prm_sk_host, prm_sk_port, prm_sk_login, prm_sk_password from pbx_parametros"; $result = pg_query($query); @@ -4574,7 +4869,8 @@ function GetManagerParams() { return false; } -function SetIntegracaoContato($retorno_cliente) { +function SetIntegracaoContato($retorno_cliente) +{ $matricula = GetMatricula(); $ramal = GetRamalMonitorar(RAMAL_MONITOR_AGENTE); @@ -4585,7 +4881,8 @@ function SetIntegracaoContato($retorno_cliente) { // pg_query($query); } -function GetMetodoIntegra($idMetodo) { +function GetMetodoIntegra($idMetodo) +{ $query = "select a.itgm_tipo, a.itgm_comando, itgm_retorno, a.opcao as opcao_metodo, a.stored_params, c.itgp_prefix, b.itgc_host, b.itgc_port, b.itgc_database, b.itgc_user, b.itgc_password, @@ -4604,14 +4901,16 @@ function GetMetodoIntegra($idMetodo) { return false; } -function GetCodecs($useVideo = false) { +function GetCodecs($useVideo = false) +{ $video = array('h261', 'h263', 'h263p', 'h264', 'vp8', 'vp9'); $som = array('adpcm', 'alaw', 'ulaw', 'g719', 'g722', 'g723', 'g726', 'g726aal2', 'g729', 'gsm', 'ilbc', 'lpc10', 'silk', 'speex', 'slin'); return !$useVideo ? $som : array_merge($som, $video); } -function GetStatusModulo($status, $param = "A") { +function GetStatusModulo($status, $param = "A") +{ $resp = ""; if ($status == $param) { $resp = ""; @@ -4622,7 +4921,8 @@ function GetStatusModulo($status, $param = "A") { return $resp; } -function GetSelectValProto($param = null) { +function GetSelectValProto($param = null) +{ $query = "SELECT prm_validacao_protocolo FROM pbx_parametros"; $result = pg_query($query); $validacao = pg_fetch_assoc($result); @@ -4639,7 +4939,8 @@ function GetSelectValProto($param = null) { return $opt; } -function GetMaxDaysRel() { +function GetMaxDaysRel() +{ $query = "SELECT prm_max_dias_relatorio FROM pbx_parametros"; $result = pg_query($query); $maxdays = pg_fetch_assoc($result); @@ -4647,7 +4948,8 @@ function GetMaxDaysRel() { return $maxdays['prm_max_dias_relatorio']; } -function GetRestringeAudio() { +function GetRestringeAudio() +{ $query = "SELECT prm_restringe_audio FROM pbx_parametros"; $result = pg_query($query); $resp = pg_fetch_assoc($result); @@ -4655,7 +4957,8 @@ function GetRestringeAudio() { return $resp['prm_restringe_audio']; } -function MaxDaysRel($dataIni, $dataFim) { +function MaxDaysRel($dataIni, $dataFim) +{ if (GetMaxDaysRel() != 0) { if (strtotime(FormatDateHour($dataFim)) > strtotime(FormatDateHour($dataIni) . "+" . GetMaxDaysRel() . "days")) { return "O período não pode ultrapassar " . GetMaxDaysRel() . " dias!"; @@ -4665,7 +4968,8 @@ function MaxDaysRel($dataIni, $dataFim) { } } -function DownloadImg($file) { +function DownloadImg($file) +{ $fsize = filesize($file); header('Content-Description: File Transfer'); header('Content-Transfer-Encoding: binary'); @@ -4694,7 +4998,8 @@ function DownloadImg($file) { exit; } -function MostraSenhaRamal($idProg, $ramal) { +function MostraSenhaRamal($idProg, $ramal) +{ $query = "select * from (select dispositivo, secret, nome from pbx_sip_ramais union all @@ -4735,11 +5040,13 @@ values(%s, %s, %s, 'GET', %s, (select substring(arquivo, } } -function ComplementoCampanhaAtivo() { +function ComplementoCampanhaAtivo() +{ return $_SESSION['prm_ativa_complemento_campanha']; } -function VerificaUsoServicos() { +function VerificaUsoServicos() +{ if (!isset($_SESSION["SSUsoServico"])) { $query = "select case when( exists( select '' from pbx_servicos a, pbx_servicos_registra b where b.serv_id = a.serv_id))then 1 else 0 end as existe_servico"; @@ -4750,10 +5057,12 @@ function VerificaUsoServicos() { return $_SESSION["SSUsoServico"]; } -function GetUsoServico() { +function GetUsoServico() +{ return $_SESSION["prm_relatorio_servico"]; } -function GetAvisoLgpdMonitoria() { +function GetAvisoLgpdMonitoria() +{ return $_SESSION["prm_aviso_lgpd_monitoria"]; } diff --git a/include/util/funcoesInternas.php b/include/util/funcoesInternas.php index def5559f..1a88f6c0 100755 --- a/include/util/funcoesInternas.php +++ b/include/util/funcoesInternas.php @@ -338,7 +338,7 @@ $funcosInternas[] = "insert into pbx_funcoes_internas(id_prog, arquivo, id_prog_ $funcosInternas[] = "insert into pbx_funcoes_internas(id_prog, arquivo, id_prog_pai, status, exit)values(366,'relatorios/custom/relChamadaGeral.php',366,0,0)"; $funcosInternas[] = "insert into pbx_funcoes_internas(id_prog, arquivo, id_prog_pai, status, exit)values(367,'supervisao/editaClassificado.php',150,0,0)"; $funcosInternas[] = "insert into pbx_funcoes_internas(id_prog, arquivo, id_prog_pai, status, exit)values(368,'permEditaClassificado.php',368,0,0)"; - +$funcosInternas[] = "insert into pbx_funcoes_internas(id_prog, arquivo, id_prog_pai, status, exit)values(369,'relatorios/pbx/chamadasEntrantes/entrantesIntegracao.php',72,0,0)"; @@ -477,4 +477,3 @@ foreach ($funcosInternas as $query) { break; } } -?> diff --git a/projeto/base/sql/grupo_licenca_developers.sql b/projeto/base/sql/grupo_licenca_developers.sql index abd73a5f..b2d4e428 100644 --- a/projeto/base/sql/grupo_licenca_developers.sql +++ b/projeto/base/sql/grupo_licenca_developers.sql @@ -30,7 +30,7 @@ SELECT inserir_dados_licenca_grupos('DEVELOPERS', ARRAY[1,2,3,4,5,7,8,9,10,11,12 119,120,122,125,126,127,128,129,130,131,132,135,137,138,140,141,142,143,144, 145,146,147,148,149,150,151,152,154,155,156,157,158,159,160,161,162,163,166, 167,168,169,170,172,175,186,187,188,189,190,191,192,193,194,196,197,198,199, - 200,202,203,204,205,208,209,210,211,212,213,214,217,218,219,220,112] + 200,202,203,204,205,208,209,210,211,212,213,214,217,218,219,220,112,222] ); -- Exclui a funcao do banco. diff --git a/relatorios/pbx/chamadasEntrantes/entrantesIntegracao.php b/relatorios/pbx/chamadasEntrantes/entrantesIntegracao.php new file mode 100644 index 00000000..e37eaa05 --- /dev/null +++ b/relatorios/pbx/chamadasEntrantes/entrantesIntegracao.php @@ -0,0 +1,359 @@ +___telefone = isset($_REQUEST['telefone']) ? $_REQUEST['telefone'] : ''; + $this->___dataIni = IsPostBack() ? $_POST['dataIni'] : date('d/m/Y') . " 00:00"; + $this->___dataFim = IsPostBack() ? $_POST['dataFim'] : date('d/m/Y') . " 23:59"; + $this->___metodo = IsPostBack() ? $_POST['metodo'] : ''; + } + + // nao precisa validar. Tudo eh aceito aqui. + function ___ValidaForm() + { + return; + } + + function ___FiltrosRelatorio() + { + $lkPrint = ''; + $prt = 'Clique aqui para imprimir!'; + $lkPrint .= sprintf($prt, $this->GetidProg(), MEDIA_PRINT_EXCEL, 'prt-xls.png'); + + if ($this->___media != MEDIA_PRINT_GRID) { + list($this->___dataIni, $this->___dataFim, $this->___metodo, $this->___telefone) = $_SESSION["SSstorageFiltros"]; + $fltCsv = array(); + $fltCsv[] = "Data Inicial: " . $this->___dataIni; + $fltCsv[] = "Data Final: " . $this->___dataFim; + $fltCsv[] = $this->___metodo ? "Metodo: " . $this->___metodo : ''; + $fltCsv[] = "Data Emissao: " . date('d/m/Y H:i:s'); + $fltCsv[] = "Emitido Por: " . GetLogin(); + return $fltCsv; + } + + /* + * Personalise esta função se necessitar de outras opções de filtro. + */ + $filtro = ''; + /* + * Rotulos. + */ + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + + /* + * Valores. + */ + $filtro .= '' + . ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= ''; + $filtro .= '
 Data Inicial Data Final MetodoTelefone/Ramal'; + $filtro .= ' 
 %s
'; + + /* + * Guarda os filtros passados para recuperar na emissao dos relatoios para impressao. + */ + $_SESSION["SSstorageFiltros"] = array($this->___dataIni, $this->___dataFim, $this->___metodo, $this->___telefone); + + return sprintf($filtro, $this->___dataIni, $this->___dataFim, $this->___metodo, $this->___telefone, $lkPrint); + } + + 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; + /* + * Esta variavel contém o nome das colunas do relatório + */ + $dadosCabecalio = array('Data', 'Metodo', 'Resultado', 'Telefone', 'Cliente'); + + /* + * Valores correspondem a $key do array de dados retornado por GetData(); + */ + $dadosField = array('reg_inicio', 'itgm_nome', 'reg_msg', 'reg_fone', 'reg_retorno'); + + /* + * Monta a linha de cabecalio. Dados que o primeiro elemento é "LABEL" + * na impressão será destacado com negrito. + */ + $linha = array('LABEL'); + foreach ($dadosCabecalio as $value) { + $linha[] = $value; + } + $dataRel[] = $linha; + + /* + * Inicializa variáveis para sumarização. + */ + $sum = 0; + + /* + * Linhas de dados. + */ + foreach ($this->GetData()[0] as $row) { + /* + * Realiza soma ou outras funções como formatação de dados. + */ + $sum++; + $linha = array('DADOS'); + $row['reg_inicio'] = date('d/m/Y H:i:s', strtotime($row['reg_inicio'])); + foreach ($dadosField as $key) { + $linha[] = $row["$key"]; + } + $dataRel[] = $linha; + } + /* + * Contem dados da impressão. + */ + $this->___dataRel[] = $dataRel; + + // totalização + if (!$this->___metodo) + return; + + $dataRel = array(array('DADOS')); + $total = array(); + foreach ($this->GetData()[0] as $value) { + $total[$value['reg_msg']]++; + } + + //cabecalho + $header = array('LABEL'); + $data = array('DADOS'); + foreach ($total as $key => $value) { + $header[] = $key; + $data[] = $value; + } + $dataRel[] = $header; + $dataRel[] = $data; + $this->___dataRel[] = $dataRel; + } + + function ___PreparaCsv() + {; + } + + function ___PreparaGrid() + { + $dataRel = array(); + $dataAgrup = array(); + + /* + * Cria o cabeçalio da tabela de dados. + */ + $dadosCabecalio = array('Data' => 'align="center"', 'Método' => 'align="left"', 'Resultado' => 'align="left"', 'Telefone' => 'align="left"', 'Cliente' => 'align="left"'); + + /* + * Corresponde aos campos de dados retornados por GetData(). + */ + $dadosField = array('reg_inicio' => 'align="center"', 'itgm_nome' => 'align="left"', 'reg_msg' => 'align="left"', 'reg_fone' => 'align="left"', 'reg_retorno' => 'align="left"'); + + /* + * 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) - 1, (!IsPostBack() ? 'Informe os parametros e clique em consultar!' : 'Nenhum registro encontado!')); + $this->___dataRel[] = $dataRel; + return; + } + + $sum = 0; + + /* + * Linhas de dados. + */ + foreach ($this->GetData()[0] as $row) { + + $row['reg_inicio'] = date('d/m/Y H:i:s', strtotime($row['reg_inicio'])); + + $sum++; + + $row["coluna_1"] = SecondToStrTime(round($row["coluna_1"], 0)); + + // Formata linha de dados. + $linha = ""; + foreach ($dadosField as $key => $value) { + $linha .= sprintf("%s", $value, $row["$key"]); + } + $linha .= ""; + $dataRel[] = $linha; + } + + /* + * Fecha relatorio. + */ + $dataRel[] = ''; + $this->___dataRel[] = $dataRel; + + if (!$this->___metodo) + return; + /* + * Tabela de totalizacao. + */ + $total = array(); + foreach ($this->GetData()[0] as $value) { + $total[$value['reg_msg']]++; + } + + $dataRel = array(); + $dataRel[] = ''; + $linha = ''; + foreach ($total as $key => $value) { + $linha .= ""; + } + $linha .= ""; + + + $dataRel[] = sprintf($linha, $sum); + $dataRel[] = '
Totalização
$key$value
TOTAL$sum
'; + $this->___dataRel[] = $dataRel; + } + + function ___PreparaHtml() + { + } + + function ___PreparaPdf() + { + } + + function ___GetDadosDb() + { + $dataIni = strlen($this->___dataIni) == 10 ? FormatDtMssql($this->___dataIni) . " 00:00" : FormatDtMssql(substr($this->___dataIni, 0, 10)) . substr($this->___dataIni, 10, 16); + $dataFim = strlen($this->___dataFim) == 10 ? FormatDtMssql($this->___dataFim) . " 23:59" : FormatDtMssql(substr($this->___dataFim, 0, 10)) . substr($this->___dataFim, 10, 16); + $metodo = $this->___metodo ? $this->___metodo : false; + $telefone = $this->___telefone ? $this->___telefone : false; + + //Query para buscar dados no relatorio + $query = "SELECT a.reg_id, a.reg_inicio, a.reg_id_metodo, a.reg_msg, a.reg_fone, a.reg_retorno, b.itgm_nome FROM pbx_integracao_reg a + INNER JOIN pbx_integracao_metodo b ON a.reg_id_metodo = b.itgm_id + WHERE reg_inicio >= '$dataIni' + AND reg_inicio <= '$dataFim'"; + if ($metodo) { + $query .= "AND reg_id_metodo = $metodo"; + } + if ($telefone) { + $query .= "AND reg_fone LIKE '%$telefone%'"; + } + $query .= "ORDER BY reg_inicio DESC;"; + + $result = $this->___GetQuery($query); + while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) { + $dataRel[] = $row; + } + $this->SetData($dataRel); + + // query para listar os metodos de integracao ativa + $query = "SELECT itgm_id, itgm_nome FROM pbx_integracao_metodo WHERE opcao = 'anuncios';"; + $result = $this->___GetQuery($query); + $methods = array(); + while ($row = pg_fetch_array($result, null, PGSQL_ASSOC)) { + $methods[] = $row; + } + $this->SetData($methods); + } + + public function ExecutaRelatorio() + { + global $jsStartup, $jsJQuery, $smarty; + try { + /* + * Use esta função para validar dados do formulário. + * nesse caso, nao precisa validar. + */ + //$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'); + } +} + +$relInt = new EntrantesIntegracao($idProg, $dbcon, 1); +$relInt->ExecutaRelatorio();