Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Advertising

Someone
Monday, May 28th, 2012 at 12:55:21pm MDT 

  1. <?php require_once('Connections/SNEP.php'); ?>
  2. <?php require_once('Connections/BANCO_DE_DADOS.php'); ?>
  3. <?php
  4. include "Connections/config_carrinho.php";
  5. conexao();?>
  6. <?php
  7. if (!function_exists("GetSQLValueString")) {
  8. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  9. {
  10.   $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  11.  
  12.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  13.  
  14.   switch ($theType) {
  15.     case "text":
  16.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  17.       break;   
  18.     case "long":
  19.     case "int":
  20.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  21.       break;
  22.     case "double":
  23.       $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
  24.       break;
  25.     case "date":
  26.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  27.       break;
  28.     case "defined":
  29.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  30.       break;
  31.   }
  32.   return $theValue;
  33. }
  34. }
  35.  
  36. mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
  37. $query_RsFilas = "SELECT DISTINCT queue_log.queuename FROM queue_log where queue_log.queuename!='NONE' ORDER BY queue_log.queuename ASC ";
  38. $RsFilas = mysql_query($query_RsFilas, $BANCO_DE_DADOS) or die(mysql_error());
  39. $row_RsFilas = mysql_fetch_assoc($RsFilas);
  40. $totalRows_RsFilas = mysql_num_rows($RsFilas);
  41.  
  42. $pFILA_RsAgentes = "-1";
  43. if (isset($_GET['fila'])) {
  44.   $pFILA_RsAgentes = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
  45. }
  46. mysql_select_db($database_SNEP, $SNEP);
  47. $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"));
  48. $RsAgentes = mysql_query($query_RsAgentes, $SNEP) or die(mysql_error());
  49. $row_RsAgentes = mysql_fetch_assoc($RsAgentes);
  50. $totalRows_RsAgentes = mysql_num_rows($RsAgentes);
  51.  
  52. $colname_RsAbandono = "-1";
  53. if (isset($_GET['fila'])) {
  54.   $colname_RsAbandono = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
  55. }
  56. mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
  57. $query_RsAbandono = sprintf("SELECT count(queue_log.event)  AS count_event_1, queue_log.event, queue_log.queuename, cast(substring((queue_log.time)
  58. FROM 1 for 19) AS datetime) AS data FROM queue_log WHERE cast(substring((queue_log.time)
  59. 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"));
  60. $RsAbandono = mysql_query($query_RsAbandono, $BANCO_DE_DADOS) or die(mysql_error());
  61. $row_RsAbandono = mysql_fetch_assoc($RsAbandono);
  62. $totalRows_RsAbandono = mysql_num_rows($RsAbandono);
  63.  
  64. $colname_RsAtendidas = "-1";
  65. if (isset($_GET['fila'])) {
  66.   $colname_RsAtendidas = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
  67. }
  68. mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
  69. $query_RsAtendidas = sprintf("SELECT count(queue_log.event)  AS count_event_1, queue_log.event, queue_log.queuename, cast(substring((queue_log.time)
  70. FROM 1 for 19) AS datetime) AS data FROM queue_log WHERE cast(substring((queue_log.time)
  71. 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"));
  72. $RsAtendidas = mysql_query($query_RsAtendidas, $BANCO_DE_DADOS) or die(mysql_error());
  73. $row_RsAtendidas = mysql_fetch_assoc($RsAtendidas);
  74. $totalRows_RsAtendidas = mysql_num_rows($RsAtendidas);
  75.  
  76. $colname_RsRecebidas = "-1";
  77. if (isset($_GET['fila'])) {
  78.   $colname_RsRecebidas = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
  79. }
  80. mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
  81. $query_RsRecebidas = sprintf("SELECT count(queue_log.event)  AS count_event_1, queue_log.event, queue_log.queuename, cast(substring((queue_log.time)
  82. FROM 1 for 19) AS datetime) AS data FROM queue_log WHERE cast(substring((queue_log.time)
  83. 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"));
  84. $RsRecebidas = mysql_query($query_RsRecebidas, $BANCO_DE_DADOS) or die(mysql_error());
  85. $row_RsRecebidas = mysql_fetch_assoc($RsRecebidas);
  86. $totalRows_RsRecebidas = mysql_num_rows($RsRecebidas);
  87.  
  88. $colname_RsTimeout = "-1";
  89. if (isset($_GET['fila'])) {
  90.   $colname_RsTimeout = (get_magic_quotes_gpc()) ? $_GET['fila'] : addslashes($_GET['fila']);
  91. }
  92. mysql_select_db($database_BANCO_DE_DADOS, $BANCO_DE_DADOS);
  93. $query_RsTimeout = sprintf("SELECT count(queue_log.event)  AS count_event_1, queue_log.event, queue_log.queuename, cast(substring((queue_log.time)
  94. FROM 1 for 19) AS datetime) AS data FROM queue_log WHERE cast(substring((queue_log.time)
  95. 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"));
  96. $RsTimeout = mysql_query($query_RsTimeout, $BANCO_DE_DADOS) or die(mysql_error());
  97. $row_RsTimeout = mysql_fetch_assoc($RsTimeout);
  98. $totalRows_RsTimeout = mysql_num_rows($RsTimeout);
  99. ?>
  100. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  101. <html xmlns="http://www.w3.org/1999/xhtml">
  102. <head>
  103. <meta http-equiv="refresh" content="5"; charset=iso-8859-1" />
  104. <title>CONEX&Atilde;O COM ASTERISK</title>
  105. <meta name="description" content="{{META_DESCRIPTION}}" />
  106. <meta name="keywords" content="{{META_KEYWORDS}}" />
  107. <style type="text/css">
  108. <!--
  109. body {
  110.         margin-left: 5px;
  111.         margin-top: 2px;
  112.         margin-right: 0px;
  113.         margin-bottom: 0px;
  114.         font-family:verdana;
  115.         font-size:15px;
  116. }
  117. -->
  118.  
  119. </style>
  120. <script language="javascript">
  121. var win = null;
  122. function NovaJanela(pagina,nome,w,h,scroll){
  123.         LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
  124.         TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
  125.         settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
  126.         win = window.open(pagina,nome,settings);
  127. }
  128. </script>
  129. <link href="estilo.css" rel="stylesheet" type="text/css" />
  130. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></head>
  131. <body><div style="background-color:#CCCCCC; position:absolute; width:100%; height:49px; left: 0px; top: 1px;" align="top left">
  132.   <form action="index.php?fila=<?php echo $_GET['fila']; ?>" method="get" name="form1" id="form1">
  133.       <p>FILAS &nbsp; &nbsp;
  134.         <select name="fila">
  135.           <?php
  136. do { 
  137. ?>
  138.           <option value="<?php echo $row_RsFilas['queuename']?>"<?php if (!(strcmp($row_RsFilas['queuename'], $_GET['fila']))) {echo "selected=\"selected\"";} ?>><?php echo $row_RsFilas['queuename']?></option>
  139.           <?php
  140. } while ($row_RsFilas = mysql_fetch_assoc($RsFilas));
  141.   $rows = mysql_num_rows($RsFilas);
  142.   if($rows > 0) {
  143.       mysql_data_seek($RsFilas, 0);
  144.           $row_RsFilas = mysql_fetch_assoc($RsFilas);
  145.   }
  146. ?>
  147.         </select>&nbsp; &nbsp;
  148.         <input type="submit" name="Submit" value="Filtrar" />
  149.       </p>
  150.   </form>
  151. </div>
  152. </p>
  153. <p><div style="position:absolute; width:100%; height:238px; top: 53px; left: 0px;" align="top left">
  154.   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  155.     <?php
  156. // Show IF Conditional region1
  157. if (@$_GET['fila'] != "") {
  158. ?>
  159.     <tr>
  160.       <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  161.           <tr>
  162.             <td height="30" colspan="4" bgcolor="#666666"><div align="left" class="titulos_eventos" style="text-transform:uppercase">
  163.                 <div align="center"><strong><?php echo $_GET['fila']; ?></strong></div>
  164.             </div></td>
  165.           </tr>
  166.           <tr>
  167.             <td width="25%" height="25" valign="middle" bgcolor="#FF6600"><div align="center" class="titulos_eventos"><strong>RECEBIDAS</strong></div></td>
  168.             <td width="25%" height="25" valign="middle" bgcolor="#0066CC"><div align="center" class="titulos_eventos"><strong>ATENDIDOS</strong></div></td>
  169.             <td width="25%" height="25" valign="middle" bgcolor="#FF0000"><div align="center" class="titulos_eventos"><strong>ABANDONOS</strong></div></td>
  170.             <td width="25%" height="25" valign="middle" bgcolor="#FF99FF"><div align="center" class="titulos_eventos"><strong>TIMEOUT</strong></div></td>
  171.           </tr>
  172.           <tr>
  173.             <td width="25%" height="25" bgcolor="#FF6600"><div align="center">
  174. <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>
  175.                         </div></td>
  176.             <td width="25%" height="25" bgcolor="#0066CC"><div align="center">
  177. <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>
  178.                         </div></td>
  179.             <td width="25%" height="25" bgcolor="#FF0000"><div align="center">
  180. <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>
  181.                         </div></td>
  182.             <td width="25%" height="25" bgcolor="#FF99FF"><div align="center">
  183. <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>
  184.                         </div></td>
  185.           </tr>
  186.       </table></td>
  187.     </tr>
  188.     <?php }
  189. // endif Conditional region1
  190. ?>
  191.     <?php
  192. // Show IF Conditional region2
  193. if (@$_GET['fila'] == "") {
  194. ?>
  195.     <tr>
  196.       <td height="30" bgcolor="#666666" class="titulos_eventos"><div align="center">SELECIONE A FILA DESEJADA PARA EXIBIR AS INFORMA&Ccedil;&Otilde;ES </div></td>
  197.     </tr>
  198.     <?php }
  199. // endif Conditional region2
  200. ?>
  201.     <tr>
  202.       <td height="15" bgcolor="#CCCCCC" class="status_fila"><div align="left">
  203.         </div></td>
  204.     </tr>
  205.     <tr>
  206.       <td height="30" class="status_fila"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  207.        
  208.         <tr>
  209.           <td width="100%" colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  210.             <tr>
  211.               <td width="33%">AGENTE</td>
  212.               <td width="33%">STATUS</td>
  213.               <td width="17%">NUMERO</td>
  214.               <td width="17%">ATENDIDAS</td>
  215.             </tr>
  216.             <tr>
  217.               <td colspan="4"><table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
  218.                   <tr>
  219.                     <?php
  220.   do { // horizontal looper version 3
  221. ?>
  222.                     <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  223.                         <tr bgcolor="<?php echo ($ac_sw1++%2==0)?"#CCCCCC":"#FFFFFF"; ?>" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#FFFFCC'">
  224.                           <td width="33%"><?php echo $row_RsAgentes['agente']; ?></td>
  225.                           <td width="33%"><?php
  226.   // SELECIONA REGISTROS DA TABELA QUEUE_LOG  E LISTA ULTIMO EVENTO DO AGENTE CADASTRADO NO BANCO SNEP25///
  227. $sql_origem = "SELECT k.time, k.id, k.callid, k.fila, k.origem, k.status_ultimo_id as status, k.agente_do_conect,
  228. k.tempo_espera_fila, k.tempo_conversa, k.posicao_fila
  229.  
  230. FROM(
  231.  
  232. SELECT a.time, a.id, a.callid, a.queuename AS fila, a.data2 AS origem,
  233.  
  234. (SELECT b.event
  235. FROM queue_log b
  236. WHERE b.queuename = '".$_GET['fila']."'
  237. AND b.callid = a.callid
  238. AND b.id = (SELECT MAX(d.id)
  239.                         FROM queue_log d
  240.                         WHERE d.queuename = '".$_GET['fila']."'
  241.             AND d.callid = a.callid
  242.                         GROUP BY d.callid)
  243. GROUP BY b.callid) AS status_ultimo_id,
  244.  
  245. (SELECT c.agent
  246. FROM queue_log c
  247. WHERE c.queuename = '".$_GET['fila']."'
  248. AND c.callid = a.callid
  249. AND c.event = 'CONNECT'
  250. GROUP BY c.callid) AS agente_do_conect,
  251.  
  252. (SELECT e.data1
  253. FROM queue_log e
  254. WHERE e.queuename = '".$_GET['fila']."'
  255. AND e.callid = a.callid
  256. AND e.event = 'COMPLETECALLER'
  257. GROUP BY e.callid) AS tempo_espera_fila,
  258.  
  259. (SELECT f.data2
  260. FROM queue_log f
  261. WHERE f.queuename = '".$_GET['fila']."'
  262. AND f.callid = a.callid
  263. AND f.event = 'COMPLETECALLER'
  264. GROUP BY f.callid) AS tempo_conversa,
  265.  
  266. (SELECT g.data3
  267. FROM queue_log g
  268. WHERE g.queuename = '".$_GET['fila']."'
  269. AND g.callid = a.callid
  270. AND g.event = 'COMPLETECALLER'
  271. GROUP BY g.callid) AS posicao_fila
  272.  
  273. FROM queue_log a
  274. WHERE a.event = 'ENTERQUEUE'
  275. and a.queuename = '".$_GET['fila']."'
  276.  
  277. GROUP BY a.callid
  278.  
  279. UNION
  280.  
  281. SELECT a.time, a.id, a.callid, a.queuename AS fila, a.data2 AS origem,
  282. a.event AS status_ultimo_id, a.agent AS agente_do_conect,a.data1, a.data2, a.data3
  283. FROM queue_log a
  284. WHERE a.id = (SELECT MAX(d.id)
  285.                         FROM queue_log d
  286.                         WHERE d.agent = a.agent
  287.             AND d.event IN('PAUSEALL', 'PAUSE', 'UNPAUSEALL', 'UNPAUSE')
  288.                         GROUP BY d.agent)
  289. AND a.event IN('PAUSEALL', 'PAUSE', 'UNPAUSEALL', 'UNPAUSE')
  290. GROUP BY a.agent
  291.  
  292. ) k
  293.  
  294. WHERE cast(substring((k.time)
  295. from 1 for 10) AS datetime) = CURDATE()
  296.  
  297. AND k.agente_do_conect = '".$row_RsAgentes['agente']."' order by k.id DESC";
  298. ///// EXECUTA A CONSULTA
  299. $exe_origem = mysql_query($sql_origem, $base) or die(mysql_error());
  300. $reg_origem=mysql_fetch_array($exe_origem, MYSQL_ASSOC);
  301. ///// VERIFICA STATUS E IMPRIME MENSAGEM
  302. echo $reg_origem['status']; ?>
  303.                               <?php if ($reg_origem['status'] == "CONNECT" ) {
  304.                                                       echo 'OCUPADO';
  305.                                        } ?>
  306.                                                           <?php if ($reg_origem['status'] == "PAUSE" ) {
  307.                                                       echo 'EM PAUSA';
  308.                                        } ?>
  309.                                                           <?php if ($reg_origem['status'] == "COMPLETECALLER" ) {
  310.                                                       echo 'LIVRE';
  311.                                        } ?>
  312.                                         <?php if ($reg_origem['status'] == "COMPLETEAGENT" ) {
  313.                                                       echo 'LIVRE';
  314.                                        } ?>
  315.                                         <?php if ($reg_origem['status'] == "UNPAUSE" ) {
  316.                                                       echo 'LIVRE';
  317.                                        } ?>
  318.                                                                            <?php if ($reg_origem['status'] == "" ) {
  319.                                                       echo 'LIVRE';
  320.                                        } ?></td>
  321.                           <td width="17%"><?php if ($reg_origem['status'] == "CONNECT" ) {
  322.                                                       echo $reg_origem['origem'];
  323.                                        } ?></td>
  324.                           <td width="17%">
  325. <?php
  326.   // SELECIONA REGISTROS DA TABELA QUEUE_LOG  E LISTA ULTIMO EVENTO DO AGENTE CADASTRADO NO BANCO SNEP25///
  327. $sql_atendidas = "SELECT queue_log.agent, count(queue_log.event)  AS atendimentos, queue_log.event
  328. FROM queue_log
  329. WHERE cast(substring((queue_log.time)
  330. from 1 for 10) AS datetime) = CURDATE() and (queue_log.event='COMPLETECALLER' or queue_log.event='COMPLETEAGENT')
  331. and queue_log.agent = '".$row_RsAgentes['agente']."'
  332. and queue_log.queuename = '".$_GET['fila']."'
  333. GROUP BY queue_log.agent ";
  334. ///// EXECUTA A CONSULTA
  335. $exe_atendidas = mysql_query($sql_atendidas, $base) or die(mysql_error());
  336. $reg_atendidas=mysql_fetch_array($exe_atendidas, MYSQL_ASSOC); echo $reg_atendidas['atendimentos'];?></td>
  337.                         </tr>
  338.                     </table></td>
  339.                     <?php
  340.     $row_RsAgentes = mysql_fetch_assoc($RsAgentes);
  341.     if (!isset($nested_RsAgentes)) {
  342.       $nested_RsAgentes= 1;
  343.     }
  344.     if (isset($row_RsAgentes) && is_array($row_RsAgentes) && $nested_RsAgentes++ % 1==0) {
  345.       echo "</tr><tr>";
  346.     }
  347.   } while ($row_RsAgentes); //end horizontal looper version 3
  348. ?>
  349.                   </tr>
  350.               </table></td>
  351.             </tr>
  352.           </table></td>
  353.         </tr>
  354.         <tr>
  355.           <td colspan="4">&nbsp;</td>
  356.         </tr>
  357.         <tr>
  358.           <td colspan="4">&nbsp;</td>
  359.         </tr>
  360.         <tr>
  361.           <td colspan="4">&nbsp;</td>
  362.         </tr>
  363.         <tr>
  364.           <td colspan="4">&nbsp;</td>
  365.         </tr>
  366.         <tr>
  367.           <td colspan="4">&nbsp;</td>
  368.         </tr>
  369.         <tr>
  370.           <td colspan="4">&nbsp;</td>
  371.         </tr>
  372.       </table></td>
  373.     </tr>
  374.   </table>
  375. </div>
  376. </body>
  377. </html>
  378. <?php
  379. mysql_free_result($RsFilas);
  380.  
  381. mysql_free_result($RsAgentes);
  382.  
  383. mysql_free_result($RsAbandono);
  384.  
  385. mysql_free_result($RsAtendidas);
  386.  
  387. mysql_free_result($RsRecebidas);
  388.  
  389. mysql_free_result($RsTimeout);
  390. ?>

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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

worth-right
fantasy-obligation