Ejemplo n.º 1
0
     $USERtotTALK_MS = sec_convert($USERtotTALK, 'H');
     $USERavgTALK_MS = sec_convert($USERavgTALK, 'H');
     $USERtotTALK_MS = sprintf("%9s", $USERtotTALK_MS);
     $USERavgTALK_MS = sprintf("%6s", $USERavgTALK_MS);
     echo "| {$user} - {$full_name} | {$USERcalls} |  {$USERtotTALK_MS} | {$USERavgTALK_MS} |\n";
     $i++;
 }
 if ($TOTcalls < 1) {
     $TOTcalls = 0;
     $TOTavg = 0;
 } else {
     $TOTavg = $TOTtime / $TOTcalls;
     $TOTavg_MS = sec_convert($TOTavg, 'H');
     $TOTavg = sprintf("%6s", $TOTavg_MS);
 }
 $TOTtime_MS = sec_convert($TOTtime, 'H');
 $TOTtime = sprintf("%10s", $TOTtime_MS);
 $TOTagents = sprintf("%10s", $i);
 $TOTcalls = sprintf("%10s", $TOTcalls);
 $TOTtime = sprintf("%8s", $TOTtime);
 $TOTavg = sprintf("%6s", $TOTavg);
 echo "+--------------------------+------------+------------+--------+\n";
 echo "| TOTAL Agentes: {$TOTagents} | {$TOTcalls} | {$TOTtime} | {$TOTavg} |\n";
 echo "+--------------------------+------------+------------+--------+\n";
 ##############################
 #########  TIME STATS
 echo "\n";
 echo "---------- ESTADÍSTICAS DEL TIEMPO\n";
 echo "<FONT SIZE=0>\n";
 ##############################
 #########  15-minute increment breakdowns of total calls and drops, then answered table
function find_file($ServerID, $AsteriskID, $QMUserID, $QMUserName)
{
    global $FILE_FOUND;
    global $FILE_LISTEN_URL;
    global $FILE_LENGTH;
    global $FILE_ENCODING;
    global $FILE_DURATION;
    # uncomment below to enable basic logging of requests
    #	$fp = fopen ("./qm_rpc_debug.txt", "a");
    #	fwrite ($fp, date("U") . "|$ServerID|$AsteriskID|$QMUserID|$QMUserName|\n");
    #	fclose($fp);
    require "dbconnect_mysqli.php";
    require "functions.php";
    #############################################
    ##### START QUEUEMETRICS LOGGING LOOKUP #####
    $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
    $rslt = mysql_to_mysqli($stmt, $link);
    if ($DB) {
        echo "{$stmt}\n";
    }
    $qm_conf_ct = mysqli_num_rows($rslt);
    if ($qm_conf_ct > 0) {
        $row = mysqli_fetch_row($rslt);
        $enable_queuemetrics_logging = $row[0];
        $queuemetrics_server_ip = $row[1];
        $queuemetrics_dbname = $row[2];
        $queuemetrics_login = $row[3];
        $queuemetrics_pass = $row[4];
        $queuemetrics_log_id = $row[5];
    }
    ##### END QUEUEMETRICS LOGGING LOOKUP #####
    ###########################################
    if ($enable_queuemetrics_logging > 0) {
        #$linkB=mysql_connect("$queuemetrics_server_ip", "$queuemetrics_login", "$queuemetrics_pass");
        #mysql_select_db("$queuemetrics_dbname", $linkB);
        $linkB = mysqli_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}", "{$queuemetrics_dbname}");
        $AsteriskID = preg_replace('/[^\\.0-9a-zA-Z]/', '', $AsteriskID);
        $stmt = "SELECT time_id from queue_log where call_id='{$AsteriskID}' order by time_id limit 1;";
        $rslt = mysql_to_mysqli($stmt, $linkB);
        if ($DB) {
            echo "{$stmt}\n";
        }
        $QM_ql_ct = mysqli_num_rows($rslt);
        if ($QM_ql_ct > 0) {
            $row = mysqli_fetch_row($rslt);
            $time_id = $row[0];
            $time_id_end = $time_id + 14400;
            $lead_id_test = substr($AsteriskID, -10, 1);
            if ($lead_id_test == '0') {
                $lead_id = substr($AsteriskID, -10);
            } else {
                $lead_id = substr($AsteriskID, -9);
            }
            $lead_id = $lead_id + 0;
            $stmt = "SELECT start_epoch,length_in_sec,location from recording_log where start_epoch>={$time_id} and start_epoch<={$time_id_end} and lead_id='{$lead_id}' order by recording_id limit 1;";
            $rslt = mysql_to_mysqli($stmt, $link);
            if ($DB) {
                echo "{$stmt}\n";
            }
            $rl_ct = mysqli_num_rows($rslt);
            if ($rl_ct > 0) {
                $row = mysqli_fetch_row($rslt);
                $start_epoch = $row[0];
                $length_in_sec = $row[1];
                $location = $row[2];
                if (strlen($location) > 2) {
                    $extension = substr($location, strrpos($location, '.') + 1);
                    if (preg_match("/mp3|gsm/", $extension)) {
                        $filesize = 2000 * $length_in_sec;
                    } else {
                        $filesize = 15660 * $length_in_sec;
                    }
                    $URLserver_ip = $location;
                    $URLserver_ip = preg_replace('/http:\\/\\//i', '', $URLserver_ip);
                    $URLserver_ip = preg_replace('/https:\\/\\//i', '', $URLserver_ip);
                    $URLserver_ip = preg_replace('/\\/.*/i', '', $URLserver_ip);
                    $stmt = "select count(*) from servers where server_ip='{$URLserver_ip}';";
                    $rsltx = mysql_to_mysqli($stmt, $link);
                    $rowx = mysqli_fetch_row($rsltx);
                    if ($rowx[0] > 0) {
                        $stmt = "select recording_web_link,alt_server_ip from servers where server_ip='{$URLserver_ip}';";
                        $rsltx = mysql_to_mysqli($stmt, $link);
                        $rowx = mysqli_fetch_row($rsltx);
                        if (preg_match("/ALT_IP/i", $rowx[0])) {
                            $location = preg_replace("/{$URLserver_ip}/i", "{$rowx['1']}", $location);
                        }
                    }
                    $FILE_FOUND = true;
                    $FILE_LISTEN_URL = "{$location}";
                    $FILE_LENGTH = "{$filesize}";
                    $FILE_ENCODING = "{$extension}";
                    $FILE_DURATION = sec_convert($length_in_sec, 'H');
                } else {
                    $FILE_FOUND = false;
                    $FILE_LISTEN_URL = "";
                    $FILE_LENGTH = "0";
                    $FILE_ENCODING = "wav";
                    $FILE_DURATION = "0:00";
                }
            } else {
                $FILE_FOUND = false;
                $FILE_LISTEN_URL = "";
                $FILE_LENGTH = "0";
                $FILE_ENCODING = "wav";
                $FILE_DURATION = "0:00";
            }
        } else {
            $FILE_FOUND = false;
            $FILE_LISTEN_URL = "";
            $FILE_LENGTH = "0";
            $FILE_ENCODING = "wav";
            $FILE_DURATION = "0:00";
        }
        mysqli_close($linkB);
    }
    #	$FILE_FOUND      = true;
    #	$FILE_LISTEN_URL = "http://listennow.server/$ServerID/$AsteriskID/$QMUserID/$QMUserName";
    #	$FILE_LENGTH     = "125000";
    #	$FILE_ENCODING   = "mp3";
    #	$FILE_DURATION   = "1:12";
}
Ejemplo n.º 3
0
                            $wait_sec = $ASwait_sec[$k];
                        }
                        $avg_session_sec = round($avg_session_sec);
                        $avg_pause_sec = round($avg_pause_sec);
                        $avg_pause_session = round($avg_pause_session);
                        $pct_pause = round($pct_pause, 1);
                        $avg_cust_sec = round($avg_cust_sec);
                        $avg_wait_sec = round($avg_wait_sec);
                        $pct_of_queue = round($pct_of_queue, 1);
                        $login_sec = sec_convert($login_sec, $time_format);
                        $avg_session_sec = sec_convert($avg_session_sec, $time_format);
                        $avg_pause_sec = sec_convert($avg_pause_sec, $time_format);
                        $cust_sec = sec_convert($cust_sec, $time_format);
                        $wait_sec = sec_convert($wait_sec, $time_format);
                        $avg_cust_sec = sec_convert($avg_cust_sec, $time_format);
                        $avg_wait_sec = sec_convert($avg_wait_sec, $time_format);
                        $output .= "{$ASuser[$k]}{$DL}{$ASfull_name[$k]}{$DL}{$ASuser_group[$k]}{$DL}{$AScalls[$k]}{$DL}{$login_sec}{$DL}{$cust_sec}{$DL}{$avg_cust_sec}{$DL}{$avg_wait_sec}{$DL}{$pct_of_queue}%{$DL}{$ASpause_sec[$k]}{$DL}{$ASsessions[$k]}{$DL}{$avg_session_sec}{$DL}{$ASpauses[$k]}{$DL}{$avg_pause_sec}{$DL}{$pct_pause}%{$DL}{$avg_pause_session}{$DL}{$wait_sec}\n";
                        $k++;
                    }
                    echo "{$output}";
                    $result = 'SUCCESS';
                    $data = "{$user}|{$agent_user}|{$lead_id}|{$date}|{$stage}";
                    $result_reason = "agent_stats_export AGENTS FOUND: {$k}";
                    api_log($link, $api_logging, $api_script, $user, $agent_user, $function, $value, $result, $result_reason, $source, $data);
                }
            }
        }
    }
    exit;
}
################################################################################
     $TOTALAVGSALETIME_graph .= "  <tr><td class='chart_td{$class}'>" . $total_graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $total_graph_stats[$d][15] / $max_totalavgsaletime) . "' height='16' />" . sec_convert($total_graph_stats[$d][15], 'H') . "</td></tr>";
     $TOTALAVGCONTACTTIME_graph .= "  <tr><td class='chart_td{$class}'>" . $total_graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $total_graph_stats[$d][16] / $max_totalavgcontacttime) . "' height='16' />" . sec_convert($total_graph_stats[$d][16], 'H') . "</td></tr>";
     for ($e = 0; $e < count($call_status); $e++) {
         $Sstatus = $call_status[$e];
         $varname = "TOTAL" . $Sstatus . "_graph";
         $max_varname = "max_total" . $Sstatus;
         # $max.= "<!-- $max_varname => ".$$max_varname." //-->\n";
         ${$varname} .= "  <tr><td class='chart_td{$class}'>" . $total_graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $total_graph_stats[$d][$e + 17] / ${$max_varname}) . "' height='16' />" . $total_graph_stats[$d][$e + 17] . "</td></tr>";
     }
 }
 $TOTALCALLS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_calls) . "</th></tr></table>";
 $TOTALLEADS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_leads) . "</th></tr></table>";
 $TOTALCONTACTS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_contacts) . "</th></tr></table>";
 $TOTALCONTACTRATIO_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_contact_ratio) . "%</th></tr></table>";
 $TOTALSYSTEMTIME_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . sec_convert($total_system_time, 'H') . "</th></tr></table>";
 $TOTALTALKTIME_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . sec_convert($total_talk_time, 'H') . "</th></tr></table>";
 $TOTALSALES_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_sales) . "</th></tr></table>";
 $TOTALSALESLEADSRATIO_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_sales_ratio) . "%</th></tr></table>";
 $TOTALSALESCONTACTSRATIO_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_sale_contact_ratio) . "%</th></tr></table>";
 $TOTALSALESPERHOUR_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_sales_per_hour) . "</th></tr></table>";
 $TOTALINCSALES_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_inc_sales) . "</th></tr></table>";
 $TOTALCANCELLEDSALES_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_cnc_sales) . "</th></tr></table>";
 $TOTALCALLBACKS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_callbacks) . "</th></tr></table>";
 $TOTALFIRSTCALLS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_stcall) . "</th></tr></table>";
 $TOTALAVGSALETIME_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_average_sale_time) . "</th></tr></table>";
 $TOTALAVGCONTACTTIME_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_average_contact_time) . "</th></tr></table>";
 for ($e = 0; $e < count($call_status); $e++) {
     $Sstatus = $call_status[$e];
     $total_var = $Sstatus . "_total";
     $graph_var = "TOTAL" . $Sstatus . "_graph";
     ${$graph_var} .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim(${$total_var}) . "</th></tr></table>";
     $JS_text .= "\tvar TOTALABANDONS_graph=\"{$TOTALABANDONS_graph}\";\n";
     $JS_text .= "\n";
     $JS_text .= "\tfor (var i=1; i<=8; i++) {\n";
     $JS_text .= "\t\tvar cellID=\"multigroup_graph\"+i;\n";
     $JS_text .= "\t\tdocument.getElementById(cellID).style.backgroundColor='#DDDDDD';\n";
     $JS_text .= "\t}\n";
     $JS_text .= "\tvar cellID=\"multigroup_graph\"+th_id;\n";
     $JS_text .= "\tdocument.getElementById(cellID).style.backgroundColor='#999999';\n";
     $JS_text .= "\tvar graph_to_display=eval(graph+\"_graph\");\n";
     $JS_text .= "\tdocument.getElementById('multigroup_stats_graph').innerHTML=graph_to_display;\n";
     $JS_text .= "}\n";
     $TOTtalk_sec = sec_convert($TOTtalk_sec, 'H');
     $TOTtalk_avg = sec_convert($TOTtalk_avg, 'H');
     $TOTqueue_seconds = sec_convert($TOTqueue_seconds, 'H');
     $TOTqueue_avg = sec_convert($TOTqueue_avg, 'H');
     $TOTmax_queue_seconds = sec_convert($TOTmax_queue_seconds, 'H');
     $i = sprintf("%4s", $i);
     $TOTcalls_count = sprintf("%6s", $TOTcalls_count);
     $TOTanswer_count = sprintf("%6s", $TOTanswer_count);
     $TOTtalk_sec = sprintf("%9s", $TOTtalk_sec);
     $TOTtalk_avg = sprintf("%7s", $TOTtalk_avg);
     $TOTqueue_seconds = sprintf("%9s", $TOTqueue_seconds);
     $TOTqueue_avg = sprintf("%7s", $TOTqueue_avg);
     $TOTmax_queue_seconds = sprintf("%7s", $TOTmax_queue_seconds);
     $TOTdrop_count = sprintf("%6s", $TOTdrop_count);
     $ASCII_text .= "+------------------------------------------+--------+--------+-----------+---------+-----------+---------+---------+--------+\n";
     $ASCII_text .= "| TOTALS       In-Groups: {$i}             | {$TOTcalls_count} | {$TOTanswer_count} | {$TOTtalk_sec} | {$TOTtalk_avg} | {$TOTqueue_seconds} | {$TOTqueue_avg} | {$TOTmax_queue_seconds} | {$TOTdrop_count} |\n";
     $ASCII_text .= "+------------------------------------------+--------+--------+-----------+---------+-----------+---------+---------+--------+\n";
     # $MAIN.=$GRAPH;
     $CSV_main .= "\"TOTALS       In-Groups: {$i}\",\"{$TOTcalls_count}\",\"{$TOTanswer_count}\",\"{$TOTtalk_sec}\",\"{$TOTtalk_avg}\",\"{$TOTqueue_seconds}\",\"{$TOTqueue_avg}\",\"{$TOTmax_queue_seconds}\",\"{$TOTdrop_count}\"\n";
 }
     $PAUSE_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][3] / $max_pause) . "' height='16' />" . sec_convert($graph_stats[$d][3], 'H') . "</td></tr>";
     for ($e = 0; $e < count($sub_statusesARY); $e++) {
         $Sstatus = $sub_statusesARY[$e];
         $varname = $Sstatus . "_graph";
         $max_varname = "max_" . $Sstatus;
         ${$varname} .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][$e + 4] / ${$max_varname}) . "' height='16' />" . sec_convert($graph_stats[$d][$e + 4], 'H') . "</td></tr>";
     }
 }
 $TOTAL_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTtotTOTAL_MS) . "</th></tr></table>";
 $NONPAUSE_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTtotNONPAUSE_MS) . "</th></tr></table>";
 $PAUSE_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTtotPAUSE_MS) . "%</th></tr></table>";
 for ($e = 0; $e < count($sub_statusesARY); $e++) {
     $Sstatus = $sub_statusesARY[$e];
     $total_var = $Sstatus . "_total";
     $graph_var = $Sstatus . "_graph";
     ${$graph_var} .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim(sec_convert(${$total_var}, 'H')) . "</th></tr></table>";
 }
 $JS_onload .= "\tDrawPauseGraph('TOTAL', '1');\n";
 $JS_text = "<script language='Javascript'>\n";
 $JS_text .= "function DrawPauseGraph(graph, th_id) {\n";
 $JS_text .= "\tvar graph_TOTAL=\"{$TOTAL_graph}\";\n";
 $JS_text .= "\tvar graph_NONPAUSE=\"{$NONPAUSE_graph}\";\n";
 $JS_text .= "\tvar graph_PAUSE=\"{$PAUSE_graph}\";\n";
 for ($e = 0; $e < count($sub_statusesARY); $e++) {
     $Sstatus = $sub_statusesARY[$e];
     $graph_var = $Sstatus . "_graph";
     $JS_text .= "\tvar graph_" . $Sstatus . "=\"" . ${$graph_var} . "\";\n";
 }
 $JS_text .= "\tfor (var i=1; i<=" . (3 + count($sub_statusesARY)) . "; i++) {\n";
 $JS_text .= "\t\tvar cellID=\"pausegraph\"+i;\n";
 $JS_text .= "\t\tdocument.getElementById(cellID).style.backgroundColor='#DDDDDD';\n";
         $user = sprintf("%-60s", $Afull_name[$i]);
         while (mb_strlen($user, 'utf-8') > 20) {
             $user = mb_substr("{$user}", 0, -1, 'utf8');
         }
     }
 }
 if (!eregi("INCALL|QUEUE|PARK|3-WAY", $Astatus[$i])) {
     $call_time_S = $STARTtime - $Astate_change[$i];
 } else {
     if (eregi("3-WAY", $Astatus[$i])) {
         $call_time_S = $STARTtime - $Acall_mostrecent[$i];
     } else {
         $call_time_S = $STARTtime - $Acall_time[$i];
     }
 }
 $call_time_MS = sec_convert($call_time_S, 'M');
 $call_time_MS = sprintf("%7s", $call_time_MS);
 $G = '';
 $EG = '';
 //Add by fnatic
 $NG = '';
 if ($Lstatus == 'INCALL' or $Lstatus == 'PARK') {
     $NG = 'class="thistle"';
     if ($call_time_S >= 10) {
         $G = '<SPAN class="thistle"><B>';
         $EG = '</B></SPAN>';
         $NG = 'class="thistle"';
     }
     if ($call_time_S >= 60) {
         $G = '<SPAN class="violet"><B>';
         $EG = '</B></SPAN>';
Ejemplo n.º 8
0
     $CSV_fronter_header3 .= "\"FRONTER NAME\",\"PHONE\",\"TALK TIME\"\n";
     $CSV_fronter_header3 .= $closer_CSV_span["{$frow['5']}"];
     $CSV_closer_lines .= "\"{$user[$i]} - {$full_name[$i]}\",\"{$USERcalls[$i]}\",\"{$A1}\",\"{$under90}\",\"{$DROP}\",\"{$AVG_TIME}\",\"{$Cpct}%\"\n";
     $i++;
 }
 $totCpct = MathZDC($TOTsales, $TOTcalls - 0 - $totDROP) * 100;
 $totCpct = round($totCpct, 2);
 $totCpct = sprintf("%01.2f", $totCpct);
 $totCpct = sprintf("%6s", $totCpct);
 $totSpct = MathZDC($TOTsales, $TOTcalls - 0) * 100;
 $totSpct = round($totSpct, 2);
 $totSpct = sprintf("%01.2f", $totSpct);
 $totSpct = sprintf("%6s", $totSpct);
 $TOT_AVG_TIME = MathZDC($TOT_TALK_TIME, $TOTcalls - 0);
 $TOT_AVG_TIME = round($TOT_AVG_TIME);
 $TOT_AVG_TIME = sec_convert($TOT_AVG_TIME, 'H');
 $TOT_AVG_TIME = sprintf("%5s", $TOT_AVG_TIME);
 $ppc = MathZDC($totPOINTS, $TOTcalls - $totOTHER - $totDROP);
 $ppc = round($ppc, 2);
 $ppc = sprintf("%01.2f", $ppc);
 $ppc = sprintf("%4s", $ppc);
 $TOP = MathZDC($totTOP, $TOTsales) * 100;
 $TOP = round($TOP, 0);
 $TOP = sprintf("%01.0f", $TOP);
 $TOP = sprintf("%3s", $TOP);
 $BOT = MathZDC($totBOT, $TOTsales) * 100;
 $BOT = round($BOT, 0);
 $BOT = sprintf("%01.0f", $BOT);
 $BOT = sprintf("%3s", $BOT);
 $TOTagents = sprintf("%6s", $i);
 $TOTcalls = sprintf("%6s", $TOTcalls);
     if ($status_found < 1) {
         $SUMstatusesHTML .= "        0 |";
     } else {
         $TOTtotPAUSE = $TOTtotPAUSE + $Scalls;
         $USERsumstatPAUSE_MS = sec_convert($Scalls, 'H');
         $pfUSERsumstatPAUSE_MS = sprintf("%8s", $USERsumstatPAUSE_MS);
         $SUMstatusTXT = sprintf("%8s", $pfUSERsumstatPAUSE_MS);
         $SUMstatusesHTML .= " {$SUMstatusTXT} |";
     }
     $n++;
 }
 ### END loop through each status ###
 $TOT_AGENTS = sprintf("%-4s", $m);
 $TOTtotPAUSE_MS = sec_convert($TOTtotPAUSE, 'H');
 $TOTtotNONPAUSE_MS = sec_convert($TOTtotNONPAUSE, 'H');
 $TOTtotTOTAL_MS = sec_convert($TOTtotTOTAL, 'H');
 $TOTtotPAUSE_MS = sprintf("%10s", $TOTtotPAUSE_MS);
 $TOTtotNONPAUSE_MS = sprintf("%10s", $TOTtotNONPAUSE_MS);
 $TOTtotTOTAL_MS = sprintf("%10s", $TOTtotTOTAL_MS);
 while (strlen($TOTtotPAUSE_MS) > 10) {
     $TOTtotPAUSE_MS = substr("{$TOTtotPAUSE_MS}", 0, -1);
 }
 while (strlen($TOTtotNONPAUSE_MS) > 10) {
     $TOTtotNONPAUSE_MS = substr("{$TOTtotNONPAUSE_MS}", 0, -1);
 }
 while (strlen($TOTtotTOTAL_MS) > 10) {
     $TOTtotTOTAL_MS = substr("{$TOTtotTOTAL_MS}", 0, -1);
 }
 echo "+-----------------+----------+----------+----------+----------+  +{$sub_statusesHEAD}\n";
 echo "|  TOTALS        AGENTS:{$TOT_AGENTS} |{$TOTtotTOTAL_MS}|{$TOTtotNONPAUSE_MS}|{$TOTtotPAUSE_MS}|  |{$SUMstatusesHTML}\n";
 echo "+----------------------------+----------+----------+----------+  +{$sub_statusesHEAD}\n";
     if ($d == 0) {
         $class = " first";
     } else {
         if ($d + 1 == count($graph_stats)) {
             $class = " last";
         } else {
             $class = "";
         }
     }
     $CALLS_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(MathZDC(400 * $graph_stats[$d][1], $max_calls)) . "' height='16' />" . $graph_stats[$d][1] . "</td></tr>";
     $DURATION_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(MathZDC(400 * $graph_stats[$d][2], $max_duration)) . "' height='16' />" . sec_convert($graph_stats[$d][2], 'H') . "</td></tr>";
     $HANDLETIME_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(MathZDC(400 * $graph_stats[$d][3], $max_handletime)) . "' height='16' />" . sec_convert($graph_stats[$d][3], 'H') . "</td></tr>";
 }
 $CALLS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($total_calls) . "</th></tr></table>";
 $DURATION_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . sec_convert($total_duration, 'H') . "</th></tr></table>";
 $HANDLETIME_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . sec_convert($total_handle_time, 'H') . "</th></tr></table>";
 $JS_onload .= "\tDraw" . $list_id . "Graph('CALLS', '1');\n";
 $JS_text .= "function Draw" . $list_id . "Graph(graph, th_id) {\n";
 $JS_text .= "\tvar CALLS_graph=\"{$CALLS_graph}\";\n";
 $JS_text .= "\tvar DURATION_graph=\"{$DURATION_graph}\";\n";
 $JS_text .= "\tvar HANDLETIME_graph=\"{$HANDLETIME_graph}\";\n";
 $JS_text .= "\n";
 $JS_text .= "\tfor (var i=1; i<=3; i++) {\n";
 $JS_text .= "\t\tvar cellID=\"list_" . $list_id . "_graph\"+i;\n";
 $JS_text .= "\t\tdocument.getElementById(cellID).style.backgroundColor='#DDDDDD';\n";
 $JS_text .= "\t}\n";
 $JS_text .= "\tvar cellID=\"list_" . $list_id . "_graph\"+th_id;\n";
 $JS_text .= "\tdocument.getElementById(cellID).style.backgroundColor='#999999';\n";
 $JS_text .= "\tvar graph_to_display=eval(graph+\"_graph\");\n";
 $JS_text .= "\tdocument.getElementById('stats_" . $list_id . "_graph').innerHTML=graph_to_display;\n";
 $JS_text .= "}\n";
 $GRAPH_text .= $GRAPH . $GRAPH2 . $GRAPH3;
 for ($i = 1; $i < count($TOTALS_array); $i++) {
     $CSV_text .= "\"{$TOTALS_array[$i]}\",";
     switch ($i % 5) {
         case "1":
         case "2":
             $ASCII_text .= " " . sprintf("%5s", $TOTALS_array[$i]) . " |";
             break;
         case "3":
             $ASCII_text .= " " . sprintf("%10s", $TOTALS_array[$i]) . "% |";
             break;
         case "4":
             $ASCII_text .= " " . sprintf("%12s", $TOTALS_array[$i]) . " |";
             break;
         case "0":
             $ASCII_text .= " " . sprintf("%9s", sec_convert($TOTALS_array[$i], 'H')) . " ||";
             break;
     }
 }
 $ASCII_text .= "\n";
 $CSV_text .= "\n";
 $ASCII_text .= $ASCII_header2;
 if ($file_download == 1) {
     $FILE_TIME = date("Ymd-His");
     $CSVfilename = "AGENT_PERFORMACE_DETAIL{$US}{$FILE_TIME}.csv";
     // We'll be outputting a TXT file
     header('Content-type: application/octet-stream');
     // It will be called LIST_101_20090209-121212.txt
     header("Content-Disposition: attachment; filename=\"{$CSVfilename}\"");
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
Ejemplo n.º 12
0
     $CUSTOMER_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][9] / $max_customer) . "' height='16' />" . sec_convert($graph_stats[$d][9], 'HF') . "</td></tr>";
     $TALKPCT_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][10] / $max_talkpct) . "' height='16' />" . $graph_stats[$d][10] . " %</td></tr>";
     $DISPOPCT_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][11] / $max_dispopct) . "' height='16' />" . $graph_stats[$d][11] . " %</td></tr>";
     $PAUSEPCT_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][12] / $max_pausepct) . "' height='16' />" . $graph_stats[$d][12] . " %</td></tr>";
     $DEADPCT_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][13] / $max_deadpct) . "' height='16' />" . $graph_stats[$d][13] . " %</td></tr>";
     $WAITPCT_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][14] / $max_waitpct) . "' height='16' />" . $graph_stats[$d][14] . " %</td></tr>";
     $PARKS_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][15] / $max_user_holds) . "' height='16' />" . $graph_stats[$d][15] . "</td></tr>";
     $PARKTIME_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][16] / $max_total_hold_time) . "' height='16' />" . sec_convert($graph_stats[$d][16], 'HF') . "</td></tr>";
     $AVGPARK_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][17] / $max_avg_hold_time) . "' height='17' />" . sec_convert($graph_stats[$d][17], 'HF') . "</td></tr>";
     $PARKSCALL_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats[$d][18] / $max_user_hpc) . "' height='16' />" . $graph_stats[$d][18] . "</td></tr>";
     for ($e = 0; $e < count($sub_statusesARY); $e++) {
         $Sstatus = $sub_statusesARY[$e];
         $varname = $Sstatus . "_graph";
         $max_varname = "max_" . $Sstatus;
         #$max.= "<!-- $max_varname => ".$$max_varname." //-->\n";
         ${$varname} .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(1000 * $graph_stats_sub[$d][$e] / ${$max_varname}) . "' height='16' />" . sec_convert($graph_stats_sub[$d][$e], 'HF') . "</td></tr>";
     }
 }
 $CALLS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTcalls) . "</th></tr></table>";
 $TIMECLOCK_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTtimeTC) . "</th></tr></table>";
 $AGENTTIME_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTALtime) . "</th></tr></table>";
 $WAIT_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTwait) . "</th></tr></table>";
 $TALK_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTtalk) . "</th></tr></table>";
 $DISPO_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTdispo) . "</th></tr></table>";
 $PAUSE_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTpause) . "</th></tr></table>";
 $DEAD_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTdead) . "</th></tr></table>";
 $CUSTOMER_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($hTOTcustomer) . "</th></tr></table>";
 $WAITPCT_graph .= "<tr><th class='thgraph' scope='col'>AVERAGE:</th><th class='thgraph' scope='col'>" . trim($hTOTwaitpct) . "</th></tr></table>";
 $TALKPCT_graph .= "<tr><th class='thgraph' scope='col'>AVERAGE:</th><th class='thgraph' scope='col'>" . trim($hTOTtalkpct) . "</th></tr></table>";
 $DISPOPCT_graph .= "<tr><th class='thgraph' scope='col'>AVERAGE:</th><th class='thgraph' scope='col'>" . trim($hTOTdispopct) . "</th></tr></table>";
 $PAUSEPCT_graph .= "<tr><th class='thgraph' scope='col'>AVERAGE:</th><th class='thgraph' scope='col'>" . trim($hTOTpausepct) . "</th></tr></table>";
     $PAUSE_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(MathZDC(400 * $graph_stats[$d][3], $max_pause)) . "' height='16' />" . sec_convert($graph_stats[$d][3], $TIME_H_agentperfdetail) . "</td></tr>";
     for ($e = 0; $e < count($sub_statusesARY); $e++) {
         $Sstatus = $sub_statusesARY[$e];
         $varname = $Sstatus . "_graph";
         $max_varname = "max_" . $Sstatus;
         ${$varname} .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(MathZDC(400 * $graph_stats[$d][$e + 4], ${$max_varname})) . "' height='16' />" . sec_convert($graph_stats[$d][$e + 4], $TIME_H_agentperfdetail) . "</td></tr>";
     }
 }
 $TOTAL_graph .= "<tr><th class='thgraph' scope='col'>" . _QXZ("LOGIN TIME") . ":</th><th class='thgraph' scope='col'>" . trim($TOTtotTOTAL_MS) . "</th></tr></table>";
 $NONPAUSE_graph .= "<tr><th class='thgraph' scope='col'>" . _QXZ("LOGIN TIME") . ":</th><th class='thgraph' scope='col'>" . trim($TOTtotNONPAUSE_MS) . "</th></tr></table>";
 $PAUSE_graph .= "<tr><th class='thgraph' scope='col'>" . _QXZ("LOGIN TIME") . ":</th><th class='thgraph' scope='col'>" . trim($TOTtotPAUSE_MS) . "%</th></tr></table>";
 for ($e = 0; $e < count($sub_statusesARY); $e++) {
     $Sstatus = $sub_statusesARY[$e];
     $total_var = $Sstatus . "_total";
     $graph_var = $Sstatus . "_graph";
     ${$graph_var} .= "<tr><th class='thgraph' scope='col'>" . _QXZ("TOTAL") . ":</th><th class='thgraph' scope='col'>" . trim(sec_convert(${$total_var}, $TIME_H_agentperfdetail)) . "</th></tr></table>";
 }
 $JS_onload .= "\tDrawPauseGraph('TOTAL', '1');\n";
 $JS_text = "<script language='Javascript'>\n";
 $JS_text .= "function DrawPauseGraph(graph, th_id) {\n";
 $JS_text .= "\tvar graph_TOTAL=\"{$TOTAL_graph}\";\n";
 $JS_text .= "\tvar graph_NONPAUSE=\"{$NONPAUSE_graph}\";\n";
 $JS_text .= "\tvar graph_PAUSE=\"{$PAUSE_graph}\";\n";
 for ($e = 0; $e < count($sub_statusesARY); $e++) {
     $Sstatus = $sub_statusesARY[$e];
     $graph_var = $Sstatus . "_graph";
     $JS_text .= "\tvar graph_" . $Sstatus . "=\"" . ${$graph_var} . "\";\n";
 }
 $JS_text .= "\tfor (var i=1; i<=" . (3 + count($sub_statusesARY)) . "; i++) {\n";
 $JS_text .= "\t\tvar cellID=\"pausegraph\"+i;\n";
 $JS_text .= "\t\tdocument.getElementById(cellID).style.backgroundColor='#DDDDDD';\n";
     } else {
         if ($d + 1 == count($graph_stats)) {
             $class = " last";
         } else {
             $class = "";
         }
     }
     $CALLS_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][1] / $max_calls) . "' height='16' />" . $graph_stats[$d][1] . "</td></tr>";
     $SYSTEMRELEASE_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][2] / $max_system_release) . "' height='16' />" . $graph_stats[$d][2] . "</td></tr>";
     $AGENTRELEASE_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][3] / $max_agent_release) . "' height='16' />" . $graph_stats[$d][3] . "</td></tr>";
     $SALES_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][4] / $max_sales) . "' height='16' />" . $graph_stats[$d][4] . "</td></tr>";
     $DNCS_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][5] / $max_dncs) . "' height='16' />" . $graph_stats[$d][5] . "</td></tr>";
     $NAS_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][6] / $max_nas) . "' height='16' />" . $graph_stats[$d][6] . "%</td></tr>";
     $DROPS_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][7] / $max_drops) . "' height='16' />" . $graph_stats[$d][7] . "%</td></tr>";
     $LOGINTIME_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][8] / $max_login_time) . "' height='16' />" . sec_convert($graph_stats[$d][8], 'H') . "</td></tr>";
     $PAUSETIME_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(400 * $graph_stats[$d][9] / $max_pause_time) . "' height='16' />" . sec_convert($graph_stats[$d][9], 'H') . "</td></tr>";
 }
 $CALLS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTcalls_count) . "</th></tr></table>";
 $SYSTEMRELEASE_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTsystem_count) . "</th></tr></table>";
 $AGENTRELEASE_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTagent_count) . "</th></tr></table>";
 $SALES_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTptp_count) . "</th></tr></table>";
 $DNCS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTrtp_count) . "</th></tr></table>";
 $NAS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTna_percent) . "%</th></tr></table>";
 $DROPS_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTdrop_percent) . "%</th></tr></table>";
 $LOGINTIME_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTagent_sec) . "</th></tr></table>";
 $PAUSETIME_graph .= "<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>" . trim($TOTpause_sec) . "</th></tr></table>";
 $JS_onload .= "\tDrawMultiCampaignGraph('CALLS', '1');\n";
 $JS_text .= "function DrawMultiCampaignGraph(graph, th_id) {\n";
 $JS_text .= "\tvar CALLS_graph=\"{$CALLS_graph}\";\n";
 $JS_text .= "\tvar SYSTEMRELEASE_graph=\"{$SYSTEMRELEASE_graph}\";\n";
 $JS_text .= "\tvar AGENTRELEASE_graph=\"{$AGENTRELEASE_graph}\";\n";
Ejemplo n.º 15
0
    $MAIN .= "<tr bgcolor=white>";
    $MAIN .= "<td colspan=2><font size=2>TOTALS</td>";
    $MAIN .= "<td align=right><font size=2> {$TOTALpauseSECONDS}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALwaitSECONDS}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALtalkSECONDS}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALdispoSECONDS}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALdeadSECONDS}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALcustomerSECONDS}</td>\n";
    $MAIN .= "<td colspan=4><font size=2> &nbsp; </td></tr>\n";
    $CSV_text7 .= "\"\",\"\",\"TOTALS\",\"{$TOTALpauseSECONDS}\",\"{$TOTALwaitSECONDS}\",\"{$TOTALtalkSECONDS}\",\"{$TOTALdispoSECONDS}\",\"{$TOTALdeadSECONDS}\",\"{$TOTALcustomerSECONDS}\"\n";
    $TOTALpauseSECONDShh = sec_convert($TOTALpauseSECONDS, 'H');
    $TOTALwaitSECONDShh = sec_convert($TOTALwaitSECONDS, 'H');
    $TOTALtalkSECONDShh = sec_convert($TOTALtalkSECONDS, 'H');
    $TOTALdispoSECONDShh = sec_convert($TOTALdispoSECONDS, 'H');
    $TOTALdeadSECONDShh = sec_convert($TOTALdeadSECONDS, 'H');
    $TOTALcustomerSECONDShh = sec_convert($TOTALcustomerSECONDS, 'H');
    $MAIN .= "<tr bgcolor=white>";
    $MAIN .= "<td colspan=2><font size=1>(in HH:MM:SS)</td>";
    $MAIN .= "<td align=right><font size=2> {$TOTALpauseSECONDShh}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALwaitSECONDShh}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALtalkSECONDShh}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALdispoSECONDShh}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALdeadSECONDShh}</td>\n";
    $MAIN .= "<td align=right><font size=2> {$TOTALcustomerSECONDShh}</td>\n";
    $MAIN .= "<td colspan=4><font size=2> &nbsp; </td></tr>\n";
    $CSV_text7 .= "\"\",\"\",\"(in HH:MM:SS)\",\"{$TOTALpauseSECONDShh}\",\"{$TOTALwaitSECONDShh}\",\"{$TOTALtalkSECONDShh}\",\"{$TOTALdispoSECONDShh}\",\"{$TOTALdeadSECONDShh}\",\"{$TOTALcustomerSECONDShh}\"\n";
    $MAIN .= "</TABLE></center><BR><BR>\n";
}
##### vicidial recordings for this time period #####
$MAIN .= "<B>RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href='{$download_link}&file_download=8'>[DOWNLOAD]</a></B>\n";
$MAIN .= "<TABLE width=750 cellspacing=0 cellpadding=1>\n";
Ejemplo n.º 16
0
         $SUMstatusTXT = sprintf("%10s", $pfUSERsumstatPAUSE_MS);
         $SUMstatusesHTML .= "{$SUMstatusTXT} |";
         $SUMstatusesFILE .= ",{$pfUSERsumstatPAUSE_MS}";
     }
     $n++;
 }
 ### END loop through each status ###
 ### call function to calculate and print dialable leads
 $TOTwait = sec_convert($TOTwait, 'H');
 $TOTtalk = sec_convert($TOTtalk, 'H');
 $TOTdispo = sec_convert($TOTdispo, 'H');
 $TOTpause = sec_convert($TOTpause, 'H');
 $TOTdead = sec_convert($TOTdead, 'H');
 $TOTcustomer = sec_convert($TOTcustomer, 'H');
 $TOTALtime = sec_convert($TOTALtime, 'H');
 $TOTtimeTC = sec_convert($TOTtimeTC, 'H');
 $TOTcalls = sprintf("%8s", $TOTcalls);
 $TOTwait = sprintf("%11s", $TOTwait);
 $TOTtalk = sprintf("%11s", $TOTtalk);
 $TOTdispo = sprintf("%11s", $TOTdispo);
 $TOTpause = sprintf("%11s", $TOTpause);
 $TOTdead = sprintf("%11s", $TOTdead);
 $TOTcustomer = sprintf("%11s", $TOTcustomer);
 $TOTALtime = sprintf("%11s", $TOTALtime);
 $TOTtimeTC = sprintf("%11s", $TOTtimeTC);
 ###### END LAST LINE TOTALS FORMATTING ##########
 if ($file_download < 1) {
     echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+   +{$sub_statusesHEAD}\n";
     echo "|  TOTALS        AGENTS:{$TOT_AGENTS} | {$TOTcalls} |{$TOTtimeTC} |{$TOTALtime} |{$TOTwait} |{$TOTtalk} |{$TOTdispo} |{$TOTpause} |{$TOTdead} |{$TOTcustomer} |   |{$SUMstatusesHTML}\n";
     echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+   +{$sub_statusesHEAD}\n";
     if ($AUTOLOGOUTflag > 0) {
Ejemplo n.º 17
0
            echo "<td align=right><font size=2> {$event_hours_minutes}";
            if ($DB) {
                echo " - {$total_login_time} - {$login_sec}";
            }
            echo "</td></tr>\n";
        }
        $o++;
    }
    if (strlen($login_sec) < 1) {
        $login_sec = $STARTtime - $row[1];
        $total_login_time = $total_login_time + $login_sec;
        if ($DB) {
            echo "LOGIN ONLY - {$total_login_time} - {$login_sec}";
        }
    }
    $total_login_hours_minutes = sec_convert($total_login_time, 'H');
    if ($DB) {
        echo " - {$total_login_time} - {$login_sec}";
    }
    echo "<tr><td align=right><font size=2> </td>";
    echo "<td align=right><font size=2> </td>\n";
    echo "<td align=right><font size=2> </td>\n";
    echo "<td align=right><font size=2> </td>\n";
    echo "<td align=right colspan=2><font size=2><font size=2>TOTAL </td>\n";
    echo "<td align=right><font size=2> {$total_login_hours_minutes}  </td></tr>\n";
    echo "</TABLE><BR>{$db_source}\n";
}
?>

</BODY></HTML>
 $ASCII_text .= "+--------------------------+------------+------------+--------+\n";
 $ASCII_text .= "| " . _QXZ("TOTAL Agents:", 13) . " {$TOTagents} | {$TOTcalls} | {$TOTtime} | {$TOTavg} |\n";
 $ASCII_text .= "+--------------------------+------------+------------+--------+\n";
 for ($d = 0; $d < count($graph_stats); $d++) {
     if ($d == 0) {
         $class = " first";
     } else {
         if ($d + 1 == count($graph_stats)) {
             $class = " last";
         } else {
             $class = "";
         }
     }
     $CALLS_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(MathZDC(400 * $graph_stats[$d][1], $max_calls)) . "' height='16' />" . $graph_stats[$d][1] . "</td></tr>";
     $TIMEHMS_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(MathZDC(400 * $graph_stats[$d][2], $max_timehms)) . "' height='16' />" . sec_convert($graph_stats[$d][2], 'H') . "</td></tr>";
     $AVERAGE_graph .= "  <tr><td class='chart_td{$class}'>" . $graph_stats[$d][0] . "</td><td nowrap class='chart_td value{$class}'><img src='images/bar.png' alt='' width='" . round(MathZDC(400 * $graph_stats[$d][3], $max_average)) . "' height='16' />" . sec_convert($graph_stats[$d][3], 'H') . "</td></tr>";
 }
 $CALLS_graph .= "<tr><th class='thgraph' scope='col'>" . _QXZ("TOTAL") . ":</th><th class='thgraph' scope='col'>" . trim($TOTALcalls) . "</th></tr></table>";
 $TIMEHMS_graph .= "<tr><th class='thgraph' scope='col'>" . _QXZ("TOTAL") . ":</th><th class='thgraph' scope='col'>" . trim($TOTtime) . "</th></tr></table>";
 $AVERAGE_graph .= "<tr><th class='thgraph' scope='col'>" . _QXZ("TOTAL") . ":</th><th class='thgraph' scope='col'>" . trim($TOTavg) . "</th></tr></table>";
 $JS_text .= "<script language='Javascript'>\n";
 $JS_text .= "function DrawGraph(graph, th_id) {\n";
 $JS_text .= "\tvar CALLS_graph=\"{$CALLS_graph}\";\n";
 $JS_text .= "\tvar TIMEHMS_graph=\"{$TIMEHMS_graph}\";\n";
 $JS_text .= "\tvar AVERAGE_graph=\"{$AVERAGE_graph}\";\n";
 $JS_text .= "\n";
 $JS_text .= "\tfor (var i=1; i<=3; i++) {\n";
 $JS_text .= "\t\tvar cellID=\"agent_stats_graph\"+i;\n";
 $JS_text .= "\t\tdocument.getElementById(cellID).style.backgroundColor='#DDDDDD';\n";
 $JS_text .= "\t}\n";
 $JS_text .= "\tvar cellID=\"agent_stats_graph\"+th_id;\n";
function find_file($ServerID, $AsteriskID, $QMUserID, $QMUserName)
{
    global $FILE_FOUND;
    global $FILE_LISTEN_URL;
    global $FILE_LENGTH;
    global $FILE_ENCODING;
    global $FILE_DURATION;
    require "dbconnect.php";
    require "functions.php";
    #############################################
    ##### START QUEUEMETRICS LOGGING LOOKUP #####
    $stmt = "SELECT enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_log_id FROM system_settings;";
    $rslt = mysql_query($stmt, $link);
    if ($DB) {
        echo "{$stmt}\n";
    }
    $qm_conf_ct = mysql_num_rows($rslt);
    if ($qm_conf_ct > 0) {
        $row = mysql_fetch_row($rslt);
        $enable_queuemetrics_logging = $row[0];
        $queuemetrics_server_ip = $row[1];
        $queuemetrics_dbname = $row[2];
        $queuemetrics_login = $row[3];
        $queuemetrics_pass = $row[4];
        $queuemetrics_log_id = $row[5];
    }
    ##### END QUEUEMETRICS LOGGING LOOKUP #####
    ###########################################
    if ($enable_queuemetrics_logging > 0) {
        $linkB = mysql_connect("{$queuemetrics_server_ip}", "{$queuemetrics_login}", "{$queuemetrics_pass}");
        mysql_select_db("{$queuemetrics_dbname}", $linkB);
        $stmt = "SELECT time_id from queue_log where call_id='{$AsteriskID}' order by time_id limit 1;";
        $rslt = mysql_query($stmt, $linkB);
        if ($DB) {
            echo "{$stmt}\n";
        }
        $QM_ql_ct = mysql_num_rows($rslt);
        if ($QM_ql_ct > 0) {
            $row = mysql_fetch_row($rslt);
            $time_id = $row[0];
            $time_id_end = $time_id + 14400;
            $lead_id_test = substr($AsteriskID, -10, 1);
            if ($lead_id_test == '0') {
                $lead_id = substr($AsteriskID, -10);
            } else {
                $lead_id = substr($AsteriskID, -9);
            }
            $lead_id = $lead_id + 0;
            $stmt = "SELECT start_epoch,length_in_sec,location from recording_log where start_epoch>={$time_id} and start_epoch<={$time_id_end} and lead_id='{$lead_id}' order by recording_id limit 1;";
            $rslt = mysql_query($stmt, $link);
            if ($DB) {
                echo "{$stmt}\n";
            }
            $rl_ct = mysql_num_rows($rslt);
            if ($rl_ct > 0) {
                $row = mysql_fetch_row($rslt);
                $start_epoch = $row[0];
                $length_in_sec = $row[1];
                $location = $row[2];
                if (strlen($location) > 2) {
                    $extension = substr($location, strrpos($location, '.') + 1);
                    if (ereg("mp3|gsm", $extension)) {
                        $filesize = 2000 * $length_in_sec;
                    } else {
                        $filesize = 15660 * $length_in_sec;
                    }
                    $URLserver_ip = $location;
                    $URLserver_ip = eregi_replace('http://', '', $URLserver_ip);
                    $URLserver_ip = eregi_replace('https://', '', $URLserver_ip);
                    $URLserver_ip = eregi_replace("\\/.*", '', $URLserver_ip);
                    $stmt = "select count(*) from servers where server_ip='{$URLserver_ip}';";
                    $rsltx = mysql_query($stmt, $link);
                    $rowx = mysql_fetch_row($rsltx);
                    if ($rowx[0] > 0) {
                        $stmt = "select recording_web_link,alt_server_ip from servers where server_ip='{$URLserver_ip}';";
                        $rsltx = mysql_query($stmt, $link);
                        $rowx = mysql_fetch_row($rsltx);
                        if (eregi("ALT_IP", $rowx[0])) {
                            $location = eregi_replace($URLserver_ip, $rowx[1], $location);
                        }
                    }
                    $FILE_FOUND = true;
                    $FILE_LISTEN_URL = "{$location}";
                    $FILE_LENGTH = "{$filesize}";
                    $FILE_ENCODING = "{$extension}";
                    $FILE_DURATION = sec_convert($length_in_sec, 'H');
                } else {
                    $FILE_FOUND = false;
                    $FILE_LISTEN_URL = "";
                    $FILE_LENGTH = "0";
                    $FILE_ENCODING = "wav";
                    $FILE_DURATION = "0:00";
                }
            } else {
                $FILE_FOUND = false;
                $FILE_LISTEN_URL = "";
                $FILE_LENGTH = "0";
                $FILE_ENCODING = "wav";
                $FILE_DURATION = "0:00";
            }
        } else {
            $FILE_FOUND = false;
            $FILE_LISTEN_URL = "";
            $FILE_LENGTH = "0";
            $FILE_ENCODING = "wav";
            $FILE_DURATION = "0:00";
        }
        mysql_close($linkB);
    }
    #	$FILE_FOUND      = true;
    #	$FILE_LISTEN_URL = "http://listennow.server/$ServerID/$AsteriskID/$QMUserID/$QMUserName";
    #	$FILE_LENGTH     = "125000";
    #	$FILE_ENCODING   = "mp3";
    #	$FILE_DURATION   = "1:12";
}
             $total_sec = $total_sec + $row[0];
             $found_sec++;
         }
         $k++;
     }
     $Ccall_time_MS = sec_convert($group_sec, 'M');
     $Ccall_time_MS = sprintf("%10s", $Ccall_time_MS);
     echo "| {$group_alias_name[$i]} | {$Ccall_time_MS} | {$count[$i]} |";
     if ($DB) {
         echo "{$found_sec}";
     }
     echo "\n";
     $i++;
 }
 $TOTcount = sprintf("%-8s", $TOTcount);
 $Tcall_time_MS = sec_convert($total_sec, 'M');
 $Tcall_time_MS = sprintf("%10s", $Tcall_time_MS);
 echo "+------------------------------------------------------------------------+------------+----------+\n";
 echo "                                                                         | {$Tcall_time_MS} | {$TOTcount} |\n";
 echo "                                                                         +------------+----------+\n";
 echo "\n</PRE>\n";
 $ENDtime = date("U");
 $RUNtime = $ENDtime - $STARTtime;
 echo "<BR><BR>\n" . _QXZ("Run Time") . ": {$RUNtime} " . _QXZ("seconds") . "\n";
 if ($db_source == 'S') {
     mysqli_close($link);
     $use_slave_server = 0;
     $db_source = 'M';
     require "dbconnect_mysqli.php";
 }
 $endMS = microtime();
Ejemplo n.º 21
0
 $TOTavg_MS = sec_convert($TOTavg, 'H');
 $TOTtime_MS = sec_convert($TOTtime, 'H');
 $TOTavg = sprintf("%6s", $TOTavg_MS);
 $TOTtime = sprintf("%10s", $TOTtime_MS);
 $TOTagents = sprintf("%10s", $i);
 $TOTcalls = sprintf("%10s", $TOTcalls);
 $TOTtime = sprintf("%8s", $TOTtime);
 $TOTavg = sprintf("%6s", $TOTavg);
 $stmt = "select avg(wait_sec) from vicidial_agent_log where event_time >= '{$query_date_BEGIN}' and event_time <= '{$query_date_END}' {$group_SQLand};";
 $rslt = mysql_query($stmt, $link);
 if ($DB) {
     $OUToutput .= "{$stmt}\n";
 }
 $row = mysql_fetch_row($rslt);
 $AVGwait = $row[0];
 $AVGwait_MS = sec_convert($AVGwait, 'H');
 $AVGwait = sprintf("%6s", $AVGwait_MS);
 $OUToutput .= "+--------------------------+------------+------------+--------+\n";
 $OUToutput .= "| TOTAL Agents: {$TOTagents} | {$TOTcalls} | {$TOTtime} | {$TOTavg} |\n";
 $OUToutput .= "+--------------------------+------------+------------+--------+\n";
 $OUToutput .= "| Average Wait time between calls                      {$AVGwait} |\n";
 $OUToutput .= "+-------------------------------------------------------------+\n";
 if ($costformat > 0) {
     $stmt = "select campaign_id,phone_number,length_in_sec from vicidial_log,vicidial_users where call_date >= '{$query_date_BEGIN}' and call_date <= '{$query_date_END}' {$group_SQLand} and vicidial_log.user=vicidial_users.user;";
     $rslt = mysql_query($stmt, $link);
     if ($DB) {
         echo "{$stmt}\n";
     }
     $allcalls_to_print = mysql_num_rows($rslt);
     $w = 0;
     while ($w < $allcalls_to_print) {
     #	$MAIN.="<td align=right><font size=2> $TOTALpauseSECONDS</td>\n";
     #	$MAIN.="<td align=right><font size=2> $TOTALwaitSECONDS</td>\n";
     #	$MAIN.="<td align=right><font size=2> $TOTALtalkSECONDS</td>\n";
     #	$MAIN.="<td align=right><font size=2> $TOTALdispoSECONDS</td>\n";
     #	$MAIN.="<td align=right><font size=2> $TOTALdeadSECONDS</td>\n";
     #	$MAIN.="<td align=right><font size=2> $TOTALcustomerSECONDS</td>\n";
     #	$MAIN.="<td colspan=4><font size=2> &nbsp; </td></tr>\n";
     #	$CSV_text7.="\"\",\"\",\""._QXZ("TOTALS")."\",\"$TOTALpauseSECONDS\",\"$TOTALwaitSECONDS\",\"$TOTALtalkSECONDS\",\"$TOTALdispoSECONDS\",\"$TOTALdeadSECONDS\",\"$TOTALcustomerSECONDS\"\n";
     $TOTALpauseSECONDShh = sec_convert($TOTALpauseSECONDS, 'H');
     $TOTALwaitSECONDShh = sec_convert($TOTALwaitSECONDS, 'H');
     $TOTALtalkSECONDShh = sec_convert($TOTALtalkSECONDS, 'H');
     $TOTALdispoSECONDShh = sec_convert($TOTALdispoSECONDS, 'H');
     $TOTALdeadSECONDShh = sec_convert($TOTALdeadSECONDS, 'H');
     $TOTALcustomerSECONDShh = sec_convert($TOTALcustomerSECONDS, 'H');
     $TOTALtotalSECONDS = $TOTALpauseSECONDS + $TOTALwaitSECONDS + $TOTALtalkSECONDS + $TOTALdispoSECONDS;
     $TOTALtotalSECONDShh = sec_convert($TOTALtotalSECONDS, 'H');
     $MAIN .= "<tr bgcolor=white>";
     $MAIN .= "<td align=center><font size=2><a href=\"./user_stats.php?user={$user}&begin_date={$date[$i]}&end_date={$date[$i]}\">{$date[$i]}</a></td>";
     $MAIN .= "<td align=right><font size=2> {$TOTALpauseSECONDShh}</td>\n";
     $MAIN .= "<td align=right><font size=2> {$TOTALwaitSECONDShh}</td>\n";
     $MAIN .= "<td align=right><font size=2> {$TOTALtalkSECONDShh}</td>\n";
     $MAIN .= "<td align=right><font size=2> {$TOTALdispoSECONDShh}</td>\n";
     $MAIN .= "<td align=right><font size=2> {$TOTALdeadSECONDShh}</td>\n";
     $MAIN .= "<td align=right><font size=2> {$TOTALcustomerSECONDShh}</td>\n";
     $MAIN .= "<td align=right><font size=2> {$TOTALtotalSECONDShh}</td>\n";
     $MAIN .= "</tr>\n";
     $MAINprintALL .= $MAIN;
     $MAIN = '';
     #	$CSV_text7.="\"\",\"\",\""._QXZ("(in HH:MM:SS)")."\",\"$TOTALpauseSECONDShh\",\"$TOTALwaitSECONDShh\",\"$TOTALtalkSECONDShh\",\"$TOTALdispoSECONDShh\",\"$TOTALdeadSECONDShh\",\"$TOTALcustomerSECONDShh\"\n";
     $i++;
 }