Advertising
- Someone
- Monday, May 28th, 2012 at 12:55:21pm MDT
- <?php require_once('Connections/SNEP.php'); ?>
- <?php require_once('Connections/BANCO_DE_DADOS.php'); ?>
- <?php
- include "Connections/config_carrinho.php";
- conexao();?>
- <?php
- if (!function_exists("GetSQLValueString")) {
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
- {
- $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
- $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
- switch ($theType) {
- case "text":
- $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
- break;
- case "long":
- case "int":
- $theValue = ($theValue != "") ? intval($theValue) : "NULL";
- break;
- case "double":
- $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
- break;
- case "date":
- $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
- break;
- case "defined":
- $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
- break;
- }
- return $theValue;
- }
- }
- mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
- $query_RsFilas = "SELECT DISTINCT queue_log.queuename FROM queue_log where queue_log.queuename!='NONE' ORDER BY queue_log.queuename ASC ";
- $RsFilas = mysql_query($query_RsFilas, $BANCO_DE_DADOS) or die(mysql_error());
- $row_RsFilas = mysql_fetch_assoc($RsFilas);
- $totalRows_RsFilas = mysql_num_rows($RsFilas);
- $pFILA_RsAgentes = "-1";
- if (isset($_GET['fila'])) {
- $pFILA_RsAgentes = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
- }
- mysql_select_db($database_SNEP, $SNEP);
- $query_RsAgentes = sprintf("SELECT queue_members.membername AS agente FROM queue_members where queue_members.queue_name = %s ORDER BY queue_members.membername ASC ", GetSQLValueString($pFILA_RsAgentes, "text"));
- $RsAgentes = mysql_query($query_RsAgentes, $SNEP) or die(mysql_error());
- $row_RsAgentes = mysql_fetch_assoc($RsAgentes);
- $totalRows_RsAgentes = mysql_num_rows($RsAgentes);
- $colname_RsAbandono = "-1";
- if (isset($_GET['fila'])) {
- $colname_RsAbandono = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
- }
- mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
- $query_RsAbandono = sprintf("SELECT count(queue_log.event) AS count_event_1, queue_log.event, queue_log.queuename, cast(substring((queue_log.time)
- FROM 1 for 19) AS datetime) AS data FROM queue_log WHERE cast(substring((queue_log.time)
- from 1 for 10) AS datetime) = CURDATE() and queue_log.queuename = %s and queue_log.event= 'ABANDON' GROUP BY queue_log.event, queue_log.queuename ", GetSQLValueString($colname_RsAbandono, "text"));
- $RsAbandono = mysql_query($query_RsAbandono, $BANCO_DE_DADOS) or die(mysql_error());
- $row_RsAbandono = mysql_fetch_assoc($RsAbandono);
- $totalRows_RsAbandono = mysql_num_rows($RsAbandono);
- $colname_RsAtendidas = "-1";
- if (isset($_GET['fila'])) {
- $colname_RsAtendidas = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
- }
- mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
- $query_RsAtendidas = sprintf("SELECT count(queue_log.event) AS count_event_1, queue_log.event, queue_log.queuename, cast(substring((queue_log.time)
- FROM 1 for 19) AS datetime) AS data FROM queue_log WHERE cast(substring((queue_log.time)
- from 1 for 10) AS datetime) = CURDATE() and queue_log.queuename = %s and queue_log.event= 'CONNECT' GROUP BY queue_log.event, queue_log.queuename ", GetSQLValueString($colname_RsAtendidas, "text"));
- $RsAtendidas = mysql_query($query_RsAtendidas, $BANCO_DE_DADOS) or die(mysql_error());
- $row_RsAtendidas = mysql_fetch_assoc($RsAtendidas);
- $totalRows_RsAtendidas = mysql_num_rows($RsAtendidas);
- $colname_RsRecebidas = "-1";
- if (isset($_GET['fila'])) {
- $colname_RsRecebidas = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
- }
- mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
- $query_RsRecebidas = sprintf("SELECT count(queue_log.event) AS count_event_1, queue_log.event, queue_log.queuename, cast(substring((queue_log.time)
- FROM 1 for 19) AS datetime) AS data FROM queue_log WHERE cast(substring((queue_log.time)
- from 1 for 10) AS datetime) = CURDATE() and queue_log.queuename = %s and queue_log.event= 'ENTERQUEUE' GROUP BY queue_log.event, queue_log.queuename ", GetSQLValueString($colname_RsRecebidas, "text"));
- $RsRecebidas = mysql_query($query_RsRecebidas, $BANCO_DE_DADOS) or die(mysql_error());
- $row_RsRecebidas = mysql_fetch_assoc($RsRecebidas);
- $totalRows_RsRecebidas = mysql_num_rows($RsRecebidas);
- $colname_RsTimeout = "-1";
- if (isset($_GET['fila'])) {
- $colname_RsTimeout = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
- }
- mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
- $query_RsTimeout = sprintf("SELECT count(queue_log.event) AS count_event_1, queue_log.event, queue_log.queuename, cast(substring((queue_log.time)
- FROM 1 for 19) AS datetime) AS data FROM queue_log WHERE cast(substring((queue_log.time)
- from 1 for 10) AS datetime) = CURDATE() and queue_log.queuename = %s and queue_log.event= 'EXITWITHTIMEOUT' GROUP BY queue_log.event, queue_log.queuename ", GetSQLValueString($colname_RsTimeout, "text"));
- $RsTimeout = mysql_query($query_RsTimeout, $BANCO_DE_DADOS) or die(mysql_error());
- $row_RsTimeout = mysql_fetch_assoc($RsTimeout);
- $totalRows_RsTimeout = mysql_num_rows($RsTimeout);
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="refresh" content="5"; charset=iso-8859-1" />
- <title>CONEXÃO COM ASTERISK</title>
- <meta name="description" content="{{META_DESCRIPTION}}" />
- <meta name="keywords" content="{{META_KEYWORDS}}" />
- <style type="text/css">
- <!--
- body {
- margin-left: 5px;
- margin-top: 2px;
- margin-right: 0px;
- margin-bottom: 0px;
- font-family:verdana;
- font-size:15px;
- }
- -->
- </style>
- <script language="javascript">
- var win = null;
- function NovaJanela(pagina,nome,w,h,scroll){
- LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
- TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
- settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
- win = window.open(pagina,nome,settings);
- }
- </script>
- <link href="estilo.css" rel="stylesheet" type="text/css" />
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head>
- <body><div style="background-color:#CCCCCC; position:absolute; width:100%; height:49px; left: 0px; top: 1px;" align="top left">
- <form action="index.php?fila=<?php echo $_GET['fila']; ?>" method="get" name="form1" id="form1">
- <p>FILAS
- <select name="fila">
- <?php
- do {
- ?>
- <option value="<?php echo $row_RsFilas['queuename']?>"<?php if (!(strcmp($row_RsFilas['queuename'], $_GET['fila']))) {echo "selected=\"selected\"";} ?>><?php echo $row_RsFilas['queuename']?></option>
- <?php
- } while ($row_RsFilas = mysql_fetch_assoc($RsFilas));
- $rows = mysql_num_rows($RsFilas);
- if($rows > 0) {
- mysql_data_seek($RsFilas, 0);
- $row_RsFilas = mysql_fetch_assoc($RsFilas);
- }
- ?>
- </select>
- <input type="submit" name="Submit" value="Filtrar" />
- </p>
- </form>
- </div>
- </p>
- <p><div style="position:absolute; width:100%; height:238px; top: 53px; left: 0px;" align="top left">
- <table width="100%" border="0" cellspacing="0" cellpadding="0">
- <?php
- // Show IF Conditional region1
- if (@$_GET['fila'] != "") {
- ?>
- <tr>
- <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td height="30" colspan="4" bgcolor="#666666"><div align="left" class="titulos_eventos" style="text-transform:uppercase">
- <div align="center"><strong><?php echo $_GET['fila']; ?></strong></div>
- </div></td>
- </tr>
- <tr>
- <td width="25%" height="25" valign="middle" bgcolor="#FF6600"><div align="center" class="titulos_eventos"><strong>RECEBIDAS</strong></div></td>
- <td width="25%" height="25" valign="middle" bgcolor="#0066CC"><div align="center" class="titulos_eventos"><strong>ATENDIDOS</strong></div></td>
- <td width="25%" height="25" valign="middle" bgcolor="#FF0000"><div align="center" class="titulos_eventos"><strong>ABANDONOS</strong></div></td>
- <td width="25%" height="25" valign="middle" bgcolor="#FF99FF"><div align="center" class="titulos_eventos"><strong>TIMEOUT</strong></div></td>
- </tr>
- <tr>
- <td width="25%" height="25" bgcolor="#FF6600"><div align="center">
- <a class="linkmenu_eventos" href="lista.php?evento=<?php echo $row_RsRecebidas['event']; ?>&fila=<?php echo $_GET['fila']; ?>" onclick="NovaJanela(this.href,'nomeJanela','450','450','yes');return false"><?php echo $row_RsRecebidas['count_event_1']; ?></a>
- </div></td>
- <td width="25%" height="25" bgcolor="#0066CC"><div align="center">
- <a class="linkmenu_eventos" href="lista.php?evento=<?php echo $row_RsAtendidas['event']; ?>&fila=<?php echo $_GET['fila']; ?>" onclick="NovaJanela(this.href,'nomeJanela','600','450','yes');return false"><?php echo $row_RsAtendidas['count_event_1']; ?></a>
- </div></td>
- <td width="25%" height="25" bgcolor="#FF0000"><div align="center">
- <a class="linkmenu_eventos" href="lista.php?evento=<?php echo $row_RsAbandono['event']; ?>&fila=<?php echo $_GET['fila']; ?>" onclick="NovaJanela(this.href,'nomeJanela','600','450','yes');return false"><?php echo $row_RsAbandono['count_event_1']; ?></a>
- </div></td>
- <td width="25%" height="25" bgcolor="#FF99FF"><div align="center">
- <a class="linkmenu_eventos" href="lista.php?evento=<?php echo $row_RsTimeout['event']; ?>&fila=<?php echo $_GET['fila']; ?>" onclick="NovaJanela(this.href,'nomeJanela','450','450','yes');return false"><?php echo $row_RsTimeout['count_event_1']; ?></a>
- </div></td>
- </tr>
- </table></td>
- </tr>
- <?php }
- // endif Conditional region1
- ?>
- <?php
- // Show IF Conditional region2
- if (@$_GET['fila'] == "") {
- ?>
- <tr>
- <td height="30" bgcolor="#666666" class="titulos_eventos"><div align="center">SELECIONE A FILA DESEJADA PARA EXIBIR AS INFORMAÇÕES </div></td>
- </tr>
- <?php }
- // endif Conditional region2
- ?>
- <tr>
- <td height="15" bgcolor="#CCCCCC" class="status_fila"><div align="left">
- </div></td>
- </tr>
- <tr>
- <td height="30" class="status_fila"><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="100%" colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td width="33%">AGENTE</td>
- <td width="33%">STATUS</td>
- <td width="17%">NUMERO</td>
- <td width="17%">ATENDIDAS</td>
- </tr>
- <tr>
- <td colspan="4"><table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
- <tr>
- <?php
- do { // horizontal looper version 3
- ?>
- <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
- <tr bgcolor="<?php echo ($ac_sw1++%2==0)?"#CCCCCC":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#FFFFCC'">
- <td width="33%"><?php echo $row_RsAgentes['agente']; ?></td>
- <td width="33%"><?php
- // SELECIONA REGISTROS DA TABELA QUEUE_LOG E LISTA ULTIMO EVENTO DO AGENTE CADASTRADO NO BANCO SNEP25///
- $sql_origem = "SELECT k.time, k.id, k.callid, k.fila, k.origem, k.status_ultimo_id as status, k.agente_do_conect,
- k.tempo_espera_fila, k.tempo_conversa, k.posicao_fila
- FROM(
- SELECT a.time, a.id, a.callid, a.queuename AS fila, a.data2 AS origem,
- (SELECT b.event
- FROM queue_log b
- WHERE b.queuename = '".$_GET['fila']."'
- AND b.callid = a.callid
- AND b.id = (SELECT MAX(d.id)
- FROM queue_log d
- WHERE d.queuename = '".$_GET['fila']."'
- AND d.callid = a.callid
- GROUP BY d.callid)
- GROUP BY b.callid) AS status_ultimo_id,
- (SELECT c.agent
- FROM queue_log c
- WHERE c.queuename = '".$_GET['fila']."'
- AND c.callid = a.callid
- AND c.event = 'CONNECT'
- GROUP BY c.callid) AS agente_do_conect,
- (SELECT e.data1
- FROM queue_log e
- WHERE e.queuename = '".$_GET['fila']."'
- AND e.callid = a.callid
- AND e.event = 'COMPLETECALLER'
- GROUP BY e.callid) AS tempo_espera_fila,
- (SELECT f.data2
- FROM queue_log f
- WHERE f.queuename = '".$_GET['fila']."'
- AND f.callid = a.callid
- AND f.event = 'COMPLETECALLER'
- GROUP BY f.callid) AS tempo_conversa,
- (SELECT g.data3
- FROM queue_log g
- WHERE g.queuename = '".$_GET['fila']."'
- AND g.callid = a.callid
- AND g.event = 'COMPLETECALLER'
- GROUP BY g.callid) AS posicao_fila
- FROM queue_log a
- WHERE a.event = 'ENTERQUEUE'
- and a.queuename = '".$_GET['fila']."'
- GROUP BY a.callid
- UNION
- SELECT a.time, a.id, a.callid, a.queuename AS fila, a.data2 AS origem,
- a.event AS status_ultimo_id, a.agent AS agente_do_conect,a.data1, a.data2, a.data3
- FROM queue_log a
- WHERE a.id = (SELECT MAX(d.id)
- FROM queue_log d
- WHERE d.agent = a.agent
- AND d.event IN('PAUSEALL', 'PAUSE', 'UNPAUSEALL', 'UNPAUSE')
- GROUP BY d.agent)
- AND a.event IN('PAUSEALL', 'PAUSE', 'UNPAUSEALL', 'UNPAUSE')
- GROUP BY a.agent
- ) k
- WHERE cast(substring((k.time)
- from 1 for 10) AS datetime) = CURDATE()
- AND k.agente_do_conect = '".$row_RsAgentes['agente']."' order by k.id DESC";
- ///// EXECUTA A CONSULTA
- $exe_origem = mysql_query($sql_origem, $base) or die(mysql_error());
- $reg_origem=mysql_fetch_array($exe_origem, MYSQL_ASSOC);
- ///// VERIFICA STATUS E IMPRIME MENSAGEM
- echo $reg_origem['status']; ?>
- <?php if ($reg_origem['status'] == "CONNECT" ) {
- echo 'OCUPADO';
- } ?>
- <?php if ($reg_origem['status'] == "PAUSE" ) {
- echo 'EM PAUSA';
- } ?>
- <?php if ($reg_origem['status'] == "COMPLETECALLER" ) {
- echo 'LIVRE';
- } ?>
- <?php if ($reg_origem['status'] == "COMPLETEAGENT" ) {
- echo 'LIVRE';
- } ?>
- <?php if ($reg_origem['status'] == "UNPAUSE" ) {
- echo 'LIVRE';
- } ?>
- <?php if ($reg_origem['status'] == "" ) {
- echo 'LIVRE';
- } ?></td>
- <td width="17%"><?php if ($reg_origem['status'] == "CONNECT" ) {
- echo $reg_origem['origem'];
- } ?></td>
- <td width="17%">
- <?php
- // SELECIONA REGISTROS DA TABELA QUEUE_LOG E LISTA ULTIMO EVENTO DO AGENTE CADASTRADO NO BANCO SNEP25///
- $sql_atendidas = "SELECT queue_log.agent, count(queue_log.event) AS atendimentos, queue_log.event
- FROM queue_log
- WHERE cast(substring((queue_log.time)
- from 1 for 10) AS datetime) = CURDATE() and (queue_log.event='COMPLETECALLER' or queue_log.event='COMPLETEAGENT')
- and queue_log.agent = '".$row_RsAgentes['agente']."'
- and queue_log.queuename = '".$_GET['fila']."'
- GROUP BY queue_log.agent ";
- ///// EXECUTA A CONSULTA
- $exe_atendidas = mysql_query($sql_atendidas, $base) or die(mysql_error());
- $reg_atendidas=mysql_fetch_array($exe_atendidas, MYSQL_ASSOC); echo $reg_atendidas['atendimentos'];?></td>
- </tr>
- </table></td>
- <?php
- $row_RsAgentes = mysql_fetch_assoc($RsAgentes);
- if (!isset($nested_RsAgentes)) {
- $nested_RsAgentes= 1;
- }
- if (isset($row_RsAgentes) && is_array($row_RsAgentes) && $nested_RsAgentes++ % 1==0) {
- echo "</tr><tr>";
- }
- } while ($row_RsAgentes); //end horizontal looper version 3
- ?>
- </tr>
- </table></td>
- </tr>
- </table></td>
- </tr>
- <tr>
- <td colspan="4"> </td>
- </tr>
- <tr>
- <td colspan="4"> </td>
- </tr>
- <tr>
- <td colspan="4"> </td>
- </tr>
- <tr>
- <td colspan="4"> </td>
- </tr>
- <tr>
- <td colspan="4"> </td>
- </tr>
- <tr>
- <td colspan="4"> </td>
- </tr>
- </table></td>
- </tr>
- </table>
- </div>
- </body>
- </html>
- <?php
- mysql_free_result($RsFilas);
- mysql_free_result($RsAgentes);
- mysql_free_result($RsAbandono);
- mysql_free_result($RsAtendidas);
- mysql_free_result($RsRecebidas);
- mysql_free_result($RsTimeout);
- ?>
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.