$conta $apelido $src $data $duration $valor "; //$linhas[$imp] = $linhaTmp; $linha .= $linhaTmp; $imp++; } } if (empty($linha)) { if ($isValid && pg_last_error($dbcon)) $noData = "Erro ao realizar a consulta. Erro: " . pg_last_error($dbcon); else $noData = $inRel ? ($isValid ? "Nenhum registro encontrado!" : $msg) : "Informa as datas inicial,final, ramal e clique em consultar!"; $linha = " $noData"; } else { $_SESSION["SSsiteDesc"] = GetSiteDesc($dbcon, $_SESSION["listaSites"]); } $somaDuration = SecondToStrTime($somaDuration); $linha .= " Total chamadas: $imp Totais $somaDuration $somaValor "; if (!$isValid) $jsStartup[] = "alert('$msg');"; $jsJQuery[] = "\$('#dataIni').keypress(function(){formataDataHora(this);}) "; $jsJQuery[] = "\$('#dataFim').keypress(function(){formataDataHora(this);}) "; $_SESSION["SSlinhas"] = $linha; $smarty->assign('imp', $imp); $smarty->assign('dtIni', $_SESSION["dataIni"]); $smarty->assign('dtFim', $_SESSION["dataFim"]); $smarty->assign('ramal', $_SESSION["ramal"]); $smarty->assign('sites', $sites); $smarty->assign('linhas', $linha); $smarty->assign('conta', $conta); $smarty->assign('usuario', $usuario); $smarty->assign('gpRamal', $gpRamal); $smarty->assign('gpConta', $gpConta); $smarty->assign('gpCentroCusto', $gpCentroCusto); GetTemplate($smarty, 'relChamadasSaintes.tpl'); function GetQuery() { $dataIin = FormatDtMssql($_SESSION["dataIni"]); $dataFim = FormatDtMssql($_SESSION["dataFim"]); $ramal = $_SESSION["ramal"]; $site = $_SESSION["listaSites"]; return "select distinct src, substring(dst,1,4) as conta, split_part(userfield, '-', 2) as dst, calldate, billsec, 0.0 as valor, b.apelido from pbx_bilhetes a, pbx_usuarios b where b.matricula::integer = substring(a.dst,1,4)::integer and data >= '$dataIin' and data <= '$dataFim' and site = '$site' and src = '$ramal' and dcontext = 'saida-conta-senha' and userfield <> '' and lastapp <> 'Transferred Call' union all select distinct src, '-' as conta, dst, calldate, billsec, 0.0 as valor, '-' as apelido from pbx_bilhetes where data >= '$dataIin' and data <= '$dataFim' and data <= '2009-07-29' and site = '$site' and src = '$ramal' and dcontext = 'default' and dst = case when((dst >= '5050') and (dst <= '5099'))then '0' else dst end and length(dst) <> 7 and lastapp <> 'Transferred Call' order by 4, 2"; } function GetTopRel() { return ""; } function GetFootRel() { return "
Agentes em  Operação
Transf. Conta Número Data Duração Valor
"; } ?>