From f8907964bab9d64f74a446446b239aad12cbc0f3 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 3 Feb 2010 17:33:01 +0000 Subject: [PATCH] Added agent activity section to User Stats report Added Customer Time columns to agent time and performance detail report Added rare vicidial_closer_log 0 length check to AST_cleanup_agent_log.pl script git-svn-id: svn://192.168.202.10@1329 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/AST_cleanup_agent_log.pl | 18 ++- .../TO_BE_TRANSLATED_2.4.txt | 2 + www/vicidial/AST_agent_performance_detail.php | 43 +++++-- www/vicidial/AST_agent_time_detail.php | 43 ++++--- www/vicidial/user_stats.php | 114 +++++++++++++++++- 5 files changed, 186 insertions(+), 34 deletions(-) diff --git a/bin/AST_cleanup_agent_log.pl b/bin/AST_cleanup_agent_log.pl index b48c2c3d..7c48ba09 100644 --- a/bin/AST_cleanup_agent_log.pl +++ b/bin/AST_cleanup_agent_log.pl @@ -10,7 +10,7 @@ # # This program only needs to be run by one server # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # CHANGES # 60711-0945 - Changed to DBI by Marin Blu @@ -23,6 +23,7 @@ # 91209-0956 - Added PAUSEREASON-LAGGED queue_log correction during live call # 91210-0609 - Added LOGOFF queue_log correction during live call # 91214-0933 - Added queue_position to queue_log COMPLETE... and ABANDON records +# 100203-1110 - Added fix for vicidial_closer_log records with 0 length # # constants @@ -151,12 +152,14 @@ if ($Tsec < 10) {$Tsec = "0$Tsec";} $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; $VDAD_SQL_time = "and event_time > \"$TDSQLdate\" and event_time < \"$FDSQLdate\""; +$VDCL_SQL_time = "and call_date > \"$TDSQLdate\" and call_date < \"$FDSQLdate\""; $QM_SQL_time = "and time_id > $TDtarget and time_id < $FDtarget"; $QM_SQL_time_H = "and time_id > $TDtarget and time_id < $HDtarget"; if ($ALL_TIME > 0) { $VDAD_SQL_time = ""; + $VDCL_SQL_time = ""; $QM_SQL_time = ""; } if ($TWENTYFOUR_HOURS > 0) @@ -173,6 +176,7 @@ if ($TWENTYFOUR_HOURS > 0) $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; $VDAD_SQL_time = "and event_time > \"$TDSQLdate\" and event_time < \"$FDSQLdate\""; + $VDCL_SQL_time = "and call_date > \"$TDSQLdate\" and event_time < \"$FDSQLdate\""; $QM_SQL_time = "and time_id > $TDtarget and time_id < $FDtarget"; $QM_SQL_time_H = "and time_id > $TDtarget and time_id < $HDtarget"; } @@ -190,6 +194,7 @@ if ($TWENTYFOUR_OLDER > 0) $TDSQLdate = "$Tyear-$Tmon-$Tmday $Thour:$Tmin:$Tsec"; $VDAD_SQL_time = "and event_time < \"$TDSQLdate\""; + $VDCL_SQL_time = "and call_date < \"$TDSQLdate\""; $QM_SQL_time = "and time_id < $TDtarget"; $QM_SQL_time_H = "and time_id < $TDtarget"; } @@ -741,6 +746,17 @@ if ($TEST < 1) if ($DB) {print STDERR " Bad Dispo times zeroed out: $affected_rows\n";} +if ($DBX) {print "\n\n";} +if ($DB) {print " - cleaning up closer records\n";} + $stmtA = "UPDATE vicidial_closer_log set length_in_sec=(end_epoch - start_epoch) where length_in_sec < 1 and end_epoch > 1000 $VDCL_SQL_time;"; + if($DBX){print STDERR "|$stmtA|\n";} +if ($TEST < 1) + { + $affected_rows = $dbhA->do($stmtA); + } +if ($DB) {print STDERR " Bad Closer times recalculated: $affected_rows\n\n";} + + diff --git a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index 14f60596..a7fd9db6 100644 --- a/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -21,6 +21,8 @@ Default External Server IP|| If set to 1, this option will make all new phones created have Use External Server IP set to Y. Default is 0|| Webphone URL|| This is the URL of the webphone that will be used with this system if it is enabled in the phones record that an agent is using. Default is empty|| +AGENT ACTIVITY FOR THIS TIME PERIOD|| +these fields are in seconds|| ############################################################ CLIENT diff --git a/www/vicidial/AST_agent_performance_detail.php b/www/vicidial/AST_agent_performance_detail.php index 1e2d524c..a6bfcb1e 100644 --- a/www/vicidial/AST_agent_performance_detail.php +++ b/www/vicidial/AST_agent_performance_detail.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -20,6 +20,7 @@ # 90523-0935 - Rewrite of seconds to minutes and hours conversion # 90717-1500 - Changed to be multi-campaign, multi-user-group select # 90908-1058 - Added DEAD time statistics +# 100203-1131 - Added CUSTOMER time statistics # require("dbconnect.php"); @@ -58,12 +59,10 @@ $stmt = "SELECT use_non_latin FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); -$i=0; -while ($i < $qm_conf_ct) +if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; - $i++; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -78,7 +77,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); Header("HTTP/1.0 401 Unauthorized"); @@ -306,6 +305,9 @@ while ($i < $rows_to_print) $dispo_sec[$i] = $row[6]; $status[$i] = $row[7]; $dead_sec[$i] = $row[8]; + $customer_sec[$i] = ($talk_sec[$i] - $dead_sec[$i]); + if ($customer_sec[$i] < 1) + {$customer_sec[$i]=0;} if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) ) { $statusesTXT = sprintf("%8s", $status[$i]); @@ -327,9 +329,9 @@ while ($i < $rows_to_print) } echo "CALL STATS BREAKDOWN: (Statistics related to handling of calls only)\n"; -echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; -echo "| USER NAME | ID | LEADS | TIME | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG |$statusesHTML\n"; -echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +echo "| USER NAME | ID | LEADS | TIME | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n"; +echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; ### BEGIN loop through each user ### @@ -345,6 +347,7 @@ while ($m < $k) $Swait_sec=0; $Sdispo_sec=0; $Sdead_sec=0; + $Scustomer_sec=0; $SstatusesHTML=''; ### BEGIN loop through each status ### @@ -365,6 +368,7 @@ while ($m < $k) $Swait_sec = ($Swait_sec + $wait_sec[$i]); $Sdispo_sec = ($Sdispo_sec + $dispo_sec[$i]); $Sdead_sec = ($Sdead_sec + $dead_sec[$i]); + $Scustomer_sec = ($Scustomer_sec + $customer_sec[$i]); $SstatusTXT = sprintf("%8s", $calls[$i]); $SstatusesHTML .= " $SstatusTXT |"; $status_found++; @@ -387,6 +391,7 @@ while ($m < $k) $TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec); $TOTtotDISPO=($TOTtotDISPO + $Sdispo_sec); $TOTtotDEAD=($TOTtotDEAD + $Sdead_sec); + $TOTtotCUSTOMER=($TOTtotCUSTOMER + $Scustomer_sec); $Stime = ($Stalk_sec + $Spause_sec + $Swait_sec + $Sdispo_sec); if ( ($Scalls > 0) and ($Stalk_sec > 0) ) {$Stalk_avg = ($Stalk_sec/$Scalls);} else {$Stalk_avg=0;} @@ -398,6 +403,8 @@ while ($m < $k) else {$Sdispo_avg=0;} if ( ($Scalls > 0) and ($Sdead_sec > 0) ) {$Sdead_avg = ($Sdead_sec/$Scalls);} else {$Sdead_avg=0;} + if ( ($Scalls > 0) and ($Scustomer_sec > 0) ) {$Scustomer_avg = ($Scustomer_sec/$Scalls);} + else {$Scustomer_avg=0;} $RAWuser = $Suser; $RAWcalls = $Scalls; @@ -429,6 +436,8 @@ while ($m < $k) $USERavgDISPO_MS = sec_convert($Sdispo_avg,'M'); $USERtotDEAD_MS = sec_convert($Sdead_sec,'H'); $USERavgDEAD_MS = sec_convert($Sdead_avg,'M'); + $USERtotCUSTOMER_MS = sec_convert($Scustomer_sec,'H'); + $USERavgCUSTOMER_MS = sec_convert($Scustomer_avg,'M'); $pfUSERtime_MS = sprintf("%9s", $pfUSERtime_MS); $pfUSERtotTALK_MS = sprintf("%8s", $pfUSERtotTALK_MS); @@ -441,9 +450,11 @@ while ($m < $k) $pfUSERavgDISPO_MS = sprintf("%6s", $USERavgDISPO_MS); $pfUSERtotDEAD_MS = sprintf("%8s", $USERtotDEAD_MS); $pfUSERavgDEAD_MS = sprintf("%6s", $USERavgDEAD_MS); + $pfUSERtotCUSTOMER_MS = sprintf("%8s", $USERtotCUSTOMER_MS); + $pfUSERavgCUSTOMER_MS = sprintf("%6s", $USERavgCUSTOMER_MS); $PAUSEtotal[$m] = $pfUSERtotPAUSE_MS; - $Toutput = "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS | $pfUSERtotDEAD_MS | $pfUSERavgDEAD_MS |$SstatusesHTML\n"; + $Toutput = "| $Sfull_name | $Suser | $Scalls | $pfUSERtime_MS | $pfUSERtotPAUSE_MS | $pfUSERavgPAUSE_MS | $pfUSERtotWAIT_MS | $pfUSERavgWAIT_MS | $pfUSERtotTALK_MS | $pfUSERavgTALK_MS | $pfUSERtotDISPO_MS | $pfUSERavgDISPO_MS | $pfUSERtotDEAD_MS | $pfUSERavgDEAD_MS | $pfUSERtotCUSTOMER_MS | $pfUSERavgCUSTOMER_MS |$SstatusesHTML\n"; $TOPsorted_output[$m] = $Toutput; @@ -531,6 +542,8 @@ if ($TOTtotPAUSE < 1) {$TOTavgPAUSE = '0';} else {$TOTavgPAUSE = ($TOTtotPAUSE / $TOTcalls);} if ($TOTtotWAIT < 1) {$TOTavgWAIT = '0';} else {$TOTavgWAIT = ($TOTtotWAIT / $TOTcalls);} +if ($TOTtotCUSTOMER < 1) {$TOTavgCUSTOMER = '0';} +else {$TOTavgCUSTOMER = ($TOTtotCUSTOMER / $TOTcalls);} $TOTtime_MS = sec_convert($TOTtime,'H'); $TOTtotTALK_MS = sec_convert($TOTtotTALK,'H'); @@ -538,11 +551,13 @@ $TOTtotDISPO_MS = sec_convert($TOTtotDISPO,'H'); $TOTtotDEAD_MS = sec_convert($TOTtotDEAD,'H'); $TOTtotPAUSE_MS = sec_convert($TOTtotPAUSE,'H'); $TOTtotWAIT_MS = sec_convert($TOTtotWAIT,'H'); +$TOTtotCUSTOMER_MS = sec_convert($TOTtotCUSTOMER,'H'); $TOTavgTALK_MS = sec_convert($TOTavgTALK,'M'); $TOTavgDISPO_MS = sec_convert($TOTavgDISPO,'H'); $TOTavgDEAD_MS = sec_convert($TOTavgDEAD,'H'); $TOTavgPAUSE_MS = sec_convert($TOTavgPAUSE,'H'); $TOTavgWAIT_MS = sec_convert($TOTavgWAIT,'H'); +$TOTavgCUSTOMER_MS = sec_convert($TOTavgCUSTOMER,'H'); $TOTtime_MS = sprintf("%10s", $TOTtime_MS); $TOTtotTALK_MS = sprintf("%10s", $TOTtotTALK_MS); @@ -550,11 +565,13 @@ $TOTtotDISPO_MS = sprintf("%10s", $TOTtotDISPO_MS); $TOTtotDEAD_MS = sprintf("%10s", $TOTtotDEAD_MS); $TOTtotPAUSE_MS = sprintf("%10s", $TOTtotPAUSE_MS); $TOTtotWAIT_MS = sprintf("%10s", $TOTtotWAIT_MS); +$TOTtotCUSTOMER_MS = sprintf("%10s", $TOTtotCUSTOMER_MS); $TOTavgTALK_MS = sprintf("%6s", $TOTavgTALK_MS); $TOTavgDISPO_MS = sprintf("%6s", $TOTavgDISPO_MS); $TOTavgDEAD_MS = sprintf("%6s", $TOTavgDEAD_MS); $TOTavgPAUSE_MS = sprintf("%6s", $TOTavgPAUSE_MS); $TOTavgWAIT_MS = sprintf("%6s", $TOTavgWAIT_MS); +$TOTavgCUSTOMER_MS = sprintf("%6s", $TOTavgCUSTOMER_MS); while(strlen($TOTtime_MS)>10) {$TOTtime_MS = substr("$TOTtime_MS", 0, -1);} while(strlen($TOTtotTALK_MS)>10) {$TOTtotTALK_MS = substr("$TOTtotTALK_MS", 0, -1);} @@ -562,16 +579,18 @@ while(strlen($TOTtotDISPO_MS)>10) {$TOTtotDISPO_MS = substr("$TOTtotDISPO_MS", 0 while(strlen($TOTtotDEAD_MS)>10) {$TOTtotDEAD_MS = substr("$TOTtotDEAD_MS", 0, -1);} while(strlen($TOTtotPAUSE_MS)>10) {$TOTtotPAUSE_MS = substr("$TOTtotPAUSE_MS", 0, -1);} while(strlen($TOTtotWAIT_MS)>10) {$TOTtotWAIT_MS = substr("$TOTtotWAIT_MS", 0, -1);} +while(strlen($TOTtotCUSTOMER_MS)>10) {$TOTtotCUSTOMER_MS = substr("$TOTtotCUSTOMER_MS", 0, -1);} while(strlen($TOTavgTALK_MS)>6) {$TOTavgTALK_MS = substr("$TOTavgTALK_MS", 0, -1);} while(strlen($TOTavgDISPO_MS)>6) {$TOTavgDISPO_MS = substr("$TOTavgDISPO_MS", 0, -1);} while(strlen($TOTavgDEAD_MS)>6) {$TOTavgDEAD_MS = substr("$TOTavgDEAD_MS", 0, -1);} while(strlen($TOTavgPAUSE_MS)>6) {$TOTavgPAUSE_MS = substr("$TOTavgPAUSE_MS", 0, -1);} while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1);} +while(strlen($TOTavgCUSTOMER_MS)>6) {$TOTavgCUSTOMER_MS = substr("$TOTavgCUSTOMER_MS", 0, -1);} -echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; -echo "| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$TOTtotDEAD_MS| $TOTavgDEAD_MS |$SUMstatusesHTML\n"; -echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +echo "| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$TOTtotDEAD_MS| $TOTavgDEAD_MS |$TOTtotCUSTOMER_MS| $TOTavgCUSTOMER_MS |$SUMstatusesHTML\n"; +echo "+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; echo "\n\n"; diff --git a/www/vicidial/AST_agent_time_detail.php b/www/vicidial/AST_agent_time_detail.php index f9f6f991..dbb85f42 100644 --- a/www/vicidial/AST_agent_time_detail.php +++ b/www/vicidial/AST_agent_time_detail.php @@ -4,11 +4,12 @@ # Pulls time stats per agent selectable by campaign or user group # should be most accurate agent stats of all of the reports # -# Copyright (C) 2009 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2010 Matt Florell LICENSE: AGPLv2 # # CHANGES # 90522-0723 - First build # 90908-1103 - Added DEAD time stats +# 100203-1147 - Added CUSTOMER time statistics # require("dbconnect.php"); @@ -47,12 +48,10 @@ $stmt = "SELECT use_non_latin FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); -$i=0; -while ($i < $qm_conf_ct) +if ($qm_conf_ct > 0) { $row=mysql_fetch_row($rslt); $non_latin = $row[0]; - $i++; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -67,7 +66,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); Header("HTTP/1.0 401 Unauthorized"); @@ -345,17 +344,20 @@ else $lead = $row[5]; $status = $row[6]; $dead = $row[7]; - if ($wait > 30000) {$wait=0;} if ($talk > 30000) {$talk=0;} if ($dispo > 30000) {$dispo=0;} if ($pause > 30000) {$pause=0;} if ($dead > 30000) {$dead=0;} + $customer = ($talk - $dead); + if ($customer < 1) + {$customer=0;} $TOTwait = ($TOTwait + $wait); $TOTtalk = ($TOTtalk + $talk); $TOTdispo = ($TOTdispo + $dispo); $TOTpause = ($TOTpause + $pause); $TOTdead = ($TOTdead + $dead); + $TOTcustomer = ($TOTcustomer + $customer); $TOTALtime = ($TOTALtime + $pause + $dispo + $talk + $wait); if ( ($lead > 0) and ((!eregi("NULL",$status)) and (strlen($status) > 0)) ) {$TOTcalls++;} @@ -377,6 +379,7 @@ else $Sdispo[$m] = ($Sdispo[$m] + $dispo); $Spause[$m] = ($Spause[$m] + $pause); $Sdead[$m] = ($Sdead[$m] + $dead); + $Scustomer[$m] = ($Scustomer[$m] + $customer); if ( ($lead > 0) and ((!eregi("NULL",$status)) and (strlen($status) > 0)) ) {$Scalls[$m]++;} } $m++; @@ -390,6 +393,7 @@ else $Sdispo[$uc] = $dispo; $Spause[$uc] = $pause; $Sdead[$uc] = $dead; + $Scustomer[$uc] = $customer; if ($lead > 0) {$Scalls[$uc]++;} $uc++; } @@ -410,13 +414,13 @@ else if ($file_download < 1) { echo "AGENT TIME BREAKDOWN:\n"; - echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; - echo "| USER NAME | ID | LEADS | TIME CLOCK | AGENT TIME | WAIT | TALK | DISPO | PAUSE | DEAD | |$sub_statusesHTML\n"; - echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + echo "| USER NAME | ID | LEADS | TIME CLOCK | AGENT TIME | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n"; + echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; } else { - $file_output .= "USER,ID,LEADS,TIME CLOCK,AGENT TIME,WAIT,TALK,DISPO,PAUSE,DEAD$sub_statusesFILE\n"; + $file_output .= "USER,ID,LEADS,TIME CLOCK,AGENT TIME,WAIT,TALK,DISPO,PAUSE,DEAD,CUSTOMER$sub_statusesFILE\n"; } ##### END print the output to screen or put into file output variable @@ -445,6 +449,7 @@ else $Sdispo[$m]= sec_convert($Sdispo[$m],'H'); $Spause[$m]= sec_convert($Spause[$m],'H'); $Sdead[$m]= sec_convert($Sdead[$m],'H'); + $Scustomer[$m]= sec_convert($Scustomer[$m],'H'); $Stime[$m]= sec_convert($Stime[$m],'H'); $RAWtime = $Stime[$m]; @@ -453,6 +458,7 @@ else $RAWdispo = $Sdispo[$m]; $RAWpause = $Spause[$m]; $RAWdead = $Sdead[$m]; + $RAWcustomer = $Scustomer[$m]; $n=0; $user_name_found=0; @@ -547,6 +553,7 @@ else $Sdispo[$m]= sprintf("%10s", $Sdispo[$m]); $Spause[$m]= sprintf("%10s", $Spause[$m]); $Sdead[$m]= sprintf("%10s", $Sdead[$m]); + $Scustomer[$m]= sprintf("%10s", $Scustomer[$m]); $Scalls[$m]= sprintf("%8s", $Scalls[$m]); $Stime[$m]= sprintf("%10s", $Stime[$m]); @@ -568,11 +575,11 @@ else if ($file_download < 1) { - $Toutput = "| $Sname[$m] | $Suser[$m] | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] | $Swait[$m] | $Stalk[$m] | $Sdispo[$m] | $Spause[$m] | $Sdead[$m] | |$SstatusesHTML\n"; + $Toutput = "| $Sname[$m] | $Suser[$m] | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] | $Swait[$m] | $Stalk[$m] | $Sdispo[$m] | $Spause[$m] | $Sdead[$m] | $Scustomer[$m] | |$SstatusesHTML\n"; } else { - $fileToutput = "$RAWname,$RAWuser,$RAWcalls,$RAWtimeTC,$RAWtime,$RAWwait,$RAWtalk,$RAWdispo,$RAWpause,$RAWdead$SstatusesFILE\n"; + $fileToutput = "$RAWname,$RAWuser,$RAWcalls,$RAWtimeTC,$RAWtime,$RAWwait,$RAWtalk,$RAWdispo,$RAWpause,$RAWdead,$RAWcustomer$SstatusesFILE\n"; } $TOPsorted_output[$m] = $Toutput; @@ -620,7 +627,7 @@ else $TOT_AGENTS = sprintf("%4s", $m); $k=$m; - if ($DB) {echo "Done analyzing... $TOTwait|$TOTtalk|$TOTdispo|$TOTpause|$TOTdead|$TOTALtime|$TOTcalls|$uc|
\n";} + if ($DB) {echo "Done analyzing... $TOTwait|$TOTtalk|$TOTdispo|$TOTpause|$TOTdead|$TOTcustomer|$TOTALtime|$TOTcalls|$uc|
\n";} ### BEGIN sort through output to display properly ### @@ -704,6 +711,7 @@ else $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'); @@ -713,6 +721,7 @@ else $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 ########## @@ -721,16 +730,16 @@ else if ($file_download < 1) { - echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; - echo "| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls |$TOTtimeTC |$TOTALtime |$TOTwait |$TOTtalk |$TOTdispo |$TOTpause |$TOTdead | |$SUMstatusesHTML\n"; - echo "+----------------------------+----------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + 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) {echo " * denotes AUTOLOGOUT from timeclock\n";} echo "\n\n"; } else { - $file_output .= "TOTALS,$TOT_AGENTS,$TOTcalls,$TOTtimeTC,$TOTALtime,$TOTwait,$TOTtalk,$TOTdispo,$TOTpause,$TOTdead$SUMstatusesFILE\n"; + $file_output .= "TOTALS,$TOT_AGENTS,$TOTcalls,$TOTtimeTC,$TOTALtime,$TOTwait,$TOTtalk,$TOTdispo,$TOTpause,$TOTdead,$TOTcustomer$SUMstatusesFILE\n"; } } diff --git a/www/vicidial/user_stats.php b/www/vicidial/user_stats.php index dce45ce3..1254ed40 100644 --- a/www/vicidial/user_stats.php +++ b/www/vicidial/user_stats.php @@ -21,6 +21,7 @@ # 90524-2009 - Changed time display to use functions.php # 91130-2037 - Added user closer log manager flag display # 100126-0847 - Added DID log display options +# 100203-1008 - Added agent activity log section # header ("Content-type: text/html; charset=utf-8"); @@ -552,8 +553,8 @@ if ($did < 1) ##### vicidial agent inbound calls for this time period ##### echo "INBOUND/CLOSER CALLS FOR THIS TIME PERIOD: (10000 record limit)\n"; -echo "\n"; -echo "\n"; +echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAIGN WAIT (S) LIST LEAD HANGUP REASON
\n"; +echo "\n"; $stmt="select call_date,length_in_sec,status,phone_number,campaign_id,queue_seconds,list_id,lead_id,term_reason from vicidial_closer_log where user='" . mysql_real_escape_string($user) . "' and call_date >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and call_date <= '" . mysql_real_escape_string($end_date) . " 23:59:59' order by call_date desc limit 10000;"; if ($did > 0) @@ -565,6 +566,7 @@ $logs_to_print = mysql_num_rows($rslt); $u=0; $TOTALinSECONDS=0; +$TOTALagentSECONDS=0; while ($logs_to_print > $u) { $row=mysql_fetch_row($rslt); @@ -584,6 +586,11 @@ while ($logs_to_print > $u) {$row[7]='0';} } $TOTALinSECONDS = ($TOTALinSECONDS + $row[1]); + $AGENTseconds = ($row[1] - $row[5]); + if ($AGENTseconds < 0) + {$AGENTseconds=0;} + + $TOTALagentSECONDS = ($TOTALagentSECONDS + $AGENTseconds); $u++; echo ""; @@ -594,6 +601,7 @@ while ($logs_to_print > $u) echo "\n"; echo "\n"; echo "\n"; + echo "\n"; echo "\n"; echo "\n"; echo "\n"; @@ -602,11 +610,109 @@ while ($logs_to_print > $u) echo ""; echo ""; echo "\n"; -echo "\n"; - +echo "\n"; +echo "\n"; +echo "\n"; echo "
# DATE/TIME LENGTH STATUS PHONE CAMPAIGN WAIT (S) AGENT (S) LIST LEAD HANGUP REASON
$row[3] $row[4] $row[5] $AGENTseconds $row[6] $row[7] $row[8]
TOTALS $TOTALinSECONDS  
  $TOTALagentSECONDS  


\n"; +##### vicidial agent activity records for this time period ##### +if ($did < 1) + { + echo "AGENT ACTIVITY FOR THIS TIME PERIOD: (10000 record limit)\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + $stmt="select event_time,lead_id,campaign_id,pause_sec,wait_sec,talk_sec,dispo_sec,dead_sec,status,sub_status,user_group from vicidial_agent_log where user='" . mysql_real_escape_string($user) . "' and event_time >= '" . mysql_real_escape_string($begin_date) . " 0:00:01' and event_time <= '" . mysql_real_escape_string($end_date) . " 23:59:59' and ( (pause_sec > 0) or (wait_sec > 0) or (talk_sec > 0) or (dispo_sec > 0) ) order by event_time desc limit 10000;"; + $rslt=mysql_query($stmt, $link); + $logs_to_print = mysql_num_rows($rslt); + + $u=0; + $TOTALpauseSECONDS=0; + $TOTALwaitSECONDS=0; + $TOTALtalkSECONDS=0; + $TOTALdispoSECONDS=0; + $TOTALdeadSECONDS=0; + $TOTALcustomerSECONDS=0; + while ($logs_to_print > $u) + { + $row=mysql_fetch_row($rslt); + $event_time = $row[0]; + $lead_id = $row[1]; + $campaign_id = $row[2]; + $pause_sec = $row[3]; + $wait_sec = $row[4]; + $talk_sec = $row[5]; + $dispo_sec = $row[6]; + $dead_sec = $row[7]; + $status = $row[8]; + $pause_code = $row[9]; + $user_group = $row[10]; + $customer_sec = ($talk_sec - $dead_sec); + if ($customer_sec < 0) + {$customer_sec=0;} + + if (eregi("1$|3$|5$|7$|9$", $u)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $TOTALpauseSECONDS = ($TOTALpauseSECONDS + $pause_sec); + $TOTALwaitSECONDS = ($TOTALwaitSECONDS + $wait_sec); + $TOTALtalkSECONDS = ($TOTALtalkSECONDS + $talk_sec); + $TOTALdispoSECONDS = ($TOTALdispoSECONDS + $dispo_sec); + $TOTALdeadSECONDS = ($TOTALdeadSECONDS + $dead_sec); + $TOTALcustomerSECONDS = ($TOTALcustomerSECONDS + $customer_sec); + + + $u++; + echo ""; + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + } + + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\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'); + + echo ""; + echo ""; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + + echo "
  these fields are in seconds  
# DATE/TIME PAUSE WAIT TALK DISPO DEAD CUSTOMER STATUS LEAD CAMPAIGN PAUSE CODE
$u$event_time $pause_sec $wait_sec $talk_sec $dispo_sec $dead_sec $customer_sec $status $lead_id $campaign_id $pause_code
TOTALS $TOTALpauseSECONDS $TOTALwaitSECONDS $TOTALtalkSECONDS $TOTALdispoSECONDS $TOTALdeadSECONDS $TOTALcustomerSECONDS  
(in HH:MM:SS) $TOTALpauseSECONDShh $TOTALwaitSECONDShh $TOTALtalkSECONDShh $TOTALdispoSECONDShh $TOTALdeadSECONDShh $TOTALcustomerSECONDShh  


\n"; + } + + ##### vicidial recordings for this time period ##### echo "RECORDINGS FOR THIS TIME PERIOD: (10000 record limit)\n";