From f818a2aaf0af7d741de36e9913b24d0a4f69e7e2 Mon Sep 17 00:00:00 2001 From: mattf Date: Wed, 9 Jul 2008 07:58:15 +0000 Subject: [PATCH] added status time stats to VDAD and CLOSER reports added default-alt-dial option to vicidial.php git-svn-id: svn://192.168.202.10@912 3d104415-ff17-0410-8863-d5cf3c621b8a --- docs/QC_PROCESS.txt | 10 ++- www/agc/vicidial.php | 9 +++ www/vicidial/AST_CLOSERstats.php | 121 +++++++++++++++++++++++------ www/vicidial/AST_VDADstats.php | 126 +++++++++++++++++++++++++------ 4 files changed, 218 insertions(+), 48 deletions(-) diff --git a/docs/QC_PROCESS.txt b/docs/QC_PROCESS.txt index 5598fed6..27caaef5 100644 --- a/docs/QC_PROCESS.txt +++ b/docs/QC_PROCESS.txt @@ -31,7 +31,7 @@ Each qc_user_level will have different permissions for the qc system: 4- can check records of other QC agents 5- can view stats on qc system 6- can view finished and non-committed records and alter them -7- Manager level +7- Manager level (can do anything including delete QC records) The qc_stage is a status within QC that tells what is going on with the record: NONE - record has never been QCd @@ -40,6 +40,7 @@ PASS - QC agent has passed the record LOCK_2 - a QC agent is reviewing the record for possible finishing FINISH - record is ready to be processed COMMIT - QC record is committed to the system and cannot be modified by anyone +DEAD - QC record is old and present for logs only, newer record has taken it's place The Database Changes: @@ -47,10 +48,11 @@ The Database Changes: # This table contains the original lead information before changes CREATE TABLE qc_vicidial_list_original ( qc_id INT(9) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL, +qc_import_date DATETIME, original_id VARCHAR(20) UNIQUE NOT NULL, +campaign_group_id VARCHAR(20), modify_date TIMESTAMP, status VARCHAR(6), -qc_import_date DATETIME, user VARCHAR(20), closer VARCHAR(20), vendor_lead_code VARCHAR(20), @@ -78,7 +80,7 @@ security_phrase VARCHAR(100), comments VARCHAR(255), ); -# This table contains the updated QC record +# This table contains the updated QC records CREATE TABLE qc_vicidial_list ( qc_id INT(9) UNSIGNED NOT NULL, lead_id INT(9) UNSIGNED NOT NULL, @@ -134,7 +136,7 @@ index (qc_stage) qc_session_id INT(9) UNSIGNED PRIMARY KEY NOT NULL, user VARCHAR(20), qc_user_level INT(2) default '0', -status ENUM('READY','QUEUE','INCALL','PAUSED','CLOSER') default 'PAUSED', +status ENUM('READY','INQC','PAUSED') default 'PAUSED', qc_id INT(9) UNSIGNED NOT NULL, lead_id INT(9) UNSIGNED NOT NULL, selected_inbound_groups TEXT, diff --git a/www/agc/vicidial.php b/www/agc/vicidial.php index 19d2ded4..8f806934 100644 --- a/www/agc/vicidial.php +++ b/www/agc/vicidial.php @@ -297,6 +297,7 @@ $LogiNAJAX = '1'; # set to 1 to do lookups on campaigns for login $HidEMonitoRSessionS = '1'; # set to 1 to hide remote monitoring channels from "session calls" $LogouTKicKAlL = '1'; # set to 1 to hangup all calls in session upon agent logout $PhoneSComPIP = '1'; # set to 1 to log computer IP to phone if blank, set to 2 to force log each login +$DefaulTAlTDiaL = '0'; # set to 1 to enable ALT DIAL by default if enabled for the campaign $TEST_all_statuses = '0'; # TEST variable allows all statuses in dispo screen @@ -1931,6 +1932,7 @@ if ($enable_fast_refresh < 1) {echo "\tvar refresh_interval = 1000;\n";} var manual_dial_preview = ''; var starting_alt_phone_dialing = ''; var alt_phone_dialing = ''; + var DefaulTAlTDiaL = ''; var wrapup_seconds = ''; var wrapup_message = ''; var wrapup_counter = 0; @@ -6205,6 +6207,9 @@ else {clearDiv('DiaLDiaLAltPhonE');} if (volumecontrol_active != '1') {hideDiv('VolumeControlSpan');} + if (DefaulTAlTDiaL == '1') + {document.vicidial_form.DiaLAltPhonE.checked=true;} + document.vicidial_form.LeadLookuP.checked=true; if (agent_pause_codes_active=='Y') @@ -6641,6 +6646,8 @@ else var buildDivHTML = " ALT PHONE DIAL
"; document.getElementById("DiaLDiaLAltPhonEHide").innerHTML = buildDivHTML; } + if (DefaulTAlTDiaL == '1') + {document.vicidial_form.DiaLAltPhonE.checked=true;} } } function buildDiv(divvar) @@ -6663,6 +6670,8 @@ else document.getElementById(divvar).innerHTML = buildDivHTML; if (reselect_alt_dial==1) {document.vicidial_form.DiaLAltPhonE.checked=true} + if (DefaulTAlTDiaL == '1') + {document.vicidial_form.DiaLAltPhonE.checked=true;} } } } diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php index b7e31351..549c4311 100644 --- a/www/vicidial/AST_CLOSERstats.php +++ b/www/vicidial/AST_CLOSERstats.php @@ -12,6 +12,7 @@ # 71025-0021 - Added status breakdown # 71218-1155 - Added end_date for multi-day reports # 80430-1920 - Added Customer hangup cause stats +# 80709-0331 - Added time stats to call statuses # require("dbconnect.php"); @@ -173,11 +174,12 @@ if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $TOTALcalls = sprintf("%10s", $row[0]); -if ( ($row[0] < 1) or ($row[1] < 1) ) +$TOTALsec = $row[1]; +if ( ($row[0] < 1) or ($TOTALsec < 1) ) {$average_call_seconds = ' 0';} else { - $average_call_seconds = ($row[1] / $row[0]); + $average_call_seconds = ($TOTALsec / $row[0]); $average_call_seconds = round($average_call_seconds, 0); $average_call_seconds = sprintf("%10s", $average_call_seconds); } @@ -372,10 +374,11 @@ $TOTALcalls = 0; echo "\n"; echo "---------- CALL STATUS STATS\n"; -echo "+--------+----------------------+------------+\n"; -echo "| STATUS | DESCRIPTION | CALLS |\n"; -echo "+--------+----------------------+------------+\n"; +echo "+--------+----------------------+------------+------------+----------+----------+\n"; +echo "| STATUS | DESCRIPTION | CALLS | TOTAL TIME | AVG TIME |CALLS/HOUR|\n"; +echo "+--------+----------------------+------------+------------+----------+----------+\n"; +## first get all statuses and names $stmt="SELECT * from vicidial_statuses order by status"; $rslt=mysql_query($stmt, $link); $statuses_to_print = mysql_num_rows($rslt); @@ -401,7 +404,8 @@ while ($Cstatuses_to_print > $o) $o++; } -$stmt="select count(*),status from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;"; +## get counts and time totals for all statuses in this campaign +$stmt="select count(*),status,sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $statuses_to_print = mysql_num_rows($rslt); @@ -410,11 +414,45 @@ while ($i < $statuses_to_print) { $row=mysql_fetch_row($rslt); - $TOTALcalls = ($TOTALcalls + $row[0]); + $STATUScount = $row[0]; + $RAWstatus = $row[1]; + $TOTALcalls = ($TOTALcalls + $row[0]); + $STATUSrate = ($STATUScount / ($TOTALsec / 3600) ); + $STATUSrate = sprintf("%.2f", $STATUSrate); + + $STATUShours_H = ($row[2] / 3600); + $STATUShours_H_int = round($STATUShours_H, 2); + $STATUShours_H_int = intval("$STATUShours_H_int"); + $STATUShours_M = ($STATUShours_H - $STATUShours_H_int); + $STATUShours_M = ($STATUShours_M * 60); + $STATUShours_M_int = round($STATUShours_M, 2); + $STATUShours_M_int = intval("$STATUShours_M_int"); + $STATUShours_S = ($STATUShours_M - $STATUShours_M_int); + $STATUShours_S = ($STATUShours_S * 60); + $STATUShours_S = round($STATUShours_S, 0); + if ($STATUShours_S < 10) {$STATUShours_S = "0$STATUShours_S";} + if ($STATUShours_M_int < 10) {$STATUShours_M_int = "0$STATUShours_M_int";} + $STATUShours = "$STATUShours_H_int:$STATUShours_M_int:$STATUShours_S"; + + $STATUSavg_H = (($row[2] / 3600) / $STATUScount); + $STATUSavg_H_int = round($STATUSavg_H, 2); + $STATUSavg_H_int = intval("$STATUSavg_H_int"); + $STATUSavg_M = ($STATUSavg_H - $STATUSavg_H_int); + $STATUSavg_M = ($STATUSavg_M * 60); + $STATUSavg_M_int = round($STATUSavg_M, 2); + $STATUSavg_M_int = intval("$STATUSavg_M_int"); + $STATUSavg_S = ($STATUSavg_M - $STATUSavg_M_int); + $STATUSavg_S = ($STATUSavg_S * 60); + $STATUSavg_S = round($STATUSavg_S, 0); + if ($STATUSavg_S < 10) {$STATUSavg_S = "0$STATUSavg_S";} + if ($STATUSavg_M_int < 10) {$STATUSavg_M_int = "0$STATUSavg_M_int";} + $STATUSavg = "$STATUSavg_H_int:$STATUSavg_M_int:$STATUSavg_S"; $STATUScount = sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);} - $RAWstatus = $row[1]; $status = sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);} + $STATUShours = sprintf("%10s", $STATUShours);while(strlen($STATUShours)>10) {$STATUShours = substr("$STATUShours", 0, -1);} + $STATUSavg = sprintf("%8s", $STATUSavg);while(strlen($STATUSavg)>8) {$STATUSavg = substr("$STATUSavg", 0, -1);} + $STATUSrate = sprintf("%8s", $STATUSrate);while(strlen($STATUSrate)>8) {$STATUSrate = substr("$STATUSrate", 0, -1);} if ($non_latin < 1) { @@ -428,17 +466,58 @@ while ($i < $statuses_to_print) } - echo "| $status | $status_name | $STATUScount |\n"; + echo "| $status | $status_name | $STATUScount | $STATUShours | $STATUSavg | $STATUSrate |\n"; $i++; } -$TOTALcalls = sprintf("%10s", $TOTALcalls); +if ($TOTALcalls < 1) + { + $TOTALhours = '0:00:00'; + $TOTALavg = '0:00:00'; + $TOTALrate = '0.00'; + } +else + { + $TOTALrate = ($TOTALcalls / ($TOTALsec / 3600) ); + $TOTALrate = sprintf("%.2f", $TOTALrate); -echo "+--------+----------------------+------------+\n"; -echo "| TOTAL: | $TOTALcalls |\n"; -echo "+-------------------------------+------------+\n"; + $TOTALhours_H = ($TOTALsec / 3600); + $TOTALhours_H_int = round($TOTALhours_H, 2); + $TOTALhours_H_int = intval("$TOTALhours_H_int"); + $TOTALhours_M = ($TOTALhours_H - $TOTALhours_H_int); + $TOTALhours_M = ($TOTALhours_M * 60); + $TOTALhours_M_int = round($TOTALhours_M, 2); + $TOTALhours_M_int = intval("$TOTALhours_M_int"); + $TOTALhours_S = ($TOTALhours_M - $TOTALhours_M_int); + $TOTALhours_S = ($TOTALhours_S * 60); + $TOTALhours_S = round($TOTALhours_S, 0); + if ($TOTALhours_S < 10) {$TOTALhours_S = "0$TOTALhours_S";} + if ($TOTALhours_M_int < 10) {$TOTALhours_M_int = "0$TOTALhours_M_int";} + $TOTALhours = "$TOTALhours_H_int:$TOTALhours_M_int:$TOTALhours_S"; + $TOTALavg_H = (($TOTALsec / 3600) / $TOTALcalls); + $TOTALavg_H_int = round($TOTALavg_H, 2); + $TOTALavg_H_int = intval("$TOTALavg_H_int"); + $TOTALavg_M = ($TOTALavg_H - $TOTALavg_H_int); + $TOTALavg_M = ($TOTALavg_M * 60); + $TOTALavg_M_int = round($TOTALavg_M, 2); + $TOTALavg_M_int = intval("$TOTALavg_M_int"); + $TOTALavg_S = ($TOTALavg_M - $TOTALavg_M_int); + $TOTALavg_S = ($TOTALavg_S * 60); + $TOTALavg_S = round($TOTALavg_S, 0); + if ($TOTALavg_S < 10) {$TOTALavg_S = "0$TOTALavg_S";} + if ($TOTALavg_M_int < 10) {$TOTALavg_M_int = "0$TOTALavg_M_int";} + $TOTALavg = "$TOTALavg_H_int:$TOTALavg_M_int:$TOTALavg_S"; + } +$TOTALcalls = sprintf("%10s", $TOTALcalls); +$TOTALhours = sprintf("%10s", $TOTALhours);while(strlen($TOTALhours)>10) {$TOTALhours = substr("$TOTALhours", 0, -1);} +$TOTALavg = sprintf("%8s", $TOTALavg);while(strlen($TOTALavg)>8) {$TOTALavg = substr("$TOTALavg", 0, -1);} +$TOTALrate = sprintf("%8s", $TOTALrate);while(strlen($TOTALrate)>8) {$TOTALrate = substr("$TOTALrate", 0, -1);} + +echo "+--------+----------------------+------------+------------+----------+----------+\n"; +echo "| TOTAL: | $TOTALcalls | $TOTALhours | $TOTALavg | $TOTALrate |\n"; +echo "+--------+----------------------+------------+------------+----------+----------+\n"; ############################## @@ -474,8 +553,8 @@ while ($i < $users_to_print) $USERavgTALK = $row[4]; $USERtotTALK_M = ($USERtotTALK / 60); - $USERtotTALK_M = round($USERtotTALK_M, 2); - $USERtotTALK_M_int = intval("$USERtotTALK_M"); + $USERtotTALK_M_int = round($USERtotTALK_M, 2); + $USERtotTALK_M_int = intval("$USERtotTALK_M_int"); $USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int); $USERtotTALK_S = ($USERtotTALK_S * 60); $USERtotTALK_S = round($USERtotTALK_S, 0); @@ -484,8 +563,8 @@ while ($i < $users_to_print) $USERtotTALK_MS = sprintf("%8s", $USERtotTALK_MS); $USERavgTALK_M = ($USERavgTALK / 60); - $USERavgTALK_M = round($USERavgTALK_M, 2); - $USERavgTALK_M_int = intval("$USERavgTALK_M"); + $USERavgTALK_M_int = round($USERavgTALK_M, 2); + $USERavgTALK_M_int = intval("$USERavgTALK_M_int"); $USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int); $USERavgTALK_S = ($USERavgTALK_S * 60); $USERavgTALK_S = round($USERavgTALK_S, 0); @@ -502,8 +581,8 @@ if (!$TOTcalls) {$TOTcalls = 1;} $TOTavg = ($TOTtime / $TOTcalls); $TOTavg = round($TOTavg, 0); $TOTavg_M = ($TOTavg / 60); -$TOTavg_M = round($TOTavg_M, 2); -$TOTavg_M_int = intval("$TOTavg_M"); +$TOTavg_M_int = round($TOTavg_M, 2); +$TOTavg_M_int = intval("$TOTavg_M_int"); $TOTavg_S = ($TOTavg_M - $TOTavg_M_int); $TOTavg_S = ($TOTavg_S * 60); $TOTavg_S = round($TOTavg_S, 0); @@ -512,8 +591,8 @@ $TOTavg_MS = "$TOTavg_M_int:$TOTavg_S"; $TOTavg = sprintf("%6s", $TOTavg_MS); $TOTtime_M = ($TOTtime / 60); -$TOTtime_M = round($TOTtime_M, 2); -$TOTtime_M_int = intval("$TOTtime_M"); +$TOTtime_M_int = round($TOTtime_M, 2); +$TOTtime_M_int = intval("$TOTtime_M_int"); $TOTtime_S = ($TOTtime_M - $TOTtime_M_int); $TOTtime_S = ($TOTtime_S * 60); $TOTtime_S = round($TOTtime_S, 0); diff --git a/www/vicidial/AST_VDADstats.php b/www/vicidial/AST_VDADstats.php index 8b5ac43a..2a3932cc 100644 --- a/www/vicidial/AST_VDADstats.php +++ b/www/vicidial/AST_VDADstats.php @@ -11,6 +11,7 @@ # 71218-1155 - Added end_date for multi-day reports # 80430-1920 - Added Customer hangup cause stats # 80620-0031 - Fixed human answered calculation for drop perfentage +# 80709-0230 - Added time stats to call statuses # header ("Content-type: text/html; charset=utf-8"); @@ -176,11 +177,12 @@ if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); $TOTALcalls = sprintf("%10s", $row[0]); -if ( ($row[0] < 1) or ($row[1] < 1) ) +$TOTALsec = $row[1]; +if ( ($row[0] < 1) or ($TOTALsec < 1) ) {$average_hold_seconds = ' 0';} else { - $average_hold_seconds = ($row[1] / $row[0]); + $average_hold_seconds = ($TOTALsec / $row[0]); $average_hold_seconds = round($average_hold_seconds, 2); $average_hold_seconds = sprintf("%10s", $average_hold_seconds); } @@ -340,10 +342,11 @@ $TOTALcalls = 0; echo "\n"; echo "---------- CALL STATUS STATS\n"; -echo "+--------+----------------------+------------+\n"; -echo "| STATUS | DESCRIPTION | CALLS |\n"; -echo "+--------+----------------------+------------+\n"; +echo "+--------+----------------------+------------+------------+----------+----------+\n"; +echo "| STATUS | DESCRIPTION | CALLS | TOTAL TIME | AVG TIME |CALLS/HOUR|\n"; +echo "+--------+----------------------+------------+------------+----------+----------+\n"; +## first get all statuses and names $stmt="SELECT * from vicidial_statuses order by status"; $rslt=mysql_query($stmt, $link); $statuses_to_print = mysql_num_rows($rslt); @@ -369,7 +372,8 @@ while ($Cstatuses_to_print > $o) $o++; } -$stmt="select count(*),status from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;"; +## get counts and time totals for all statuses in this campaign +$stmt="select count(*),status,sum(length_in_sec) from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' group by status;"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} @@ -379,11 +383,45 @@ while ($i < $statuses_to_print) { $row=mysql_fetch_row($rslt); - $TOTALcalls = ($TOTALcalls + $row[0]); + $STATUScount = $row[0]; + $RAWstatus = $row[1]; + $TOTALcalls = ($TOTALcalls + $row[0]); + $STATUSrate = ($STATUScount / ($TOTALsec / 3600) ); + $STATUSrate = sprintf("%.2f", $STATUSrate); + + $STATUShours_H = ($row[2] / 3600); + $STATUShours_H_int = round($STATUShours_H, 2); + $STATUShours_H_int = intval("$STATUShours_H_int"); + $STATUShours_M = ($STATUShours_H - $STATUShours_H_int); + $STATUShours_M = ($STATUShours_M * 60); + $STATUShours_M_int = round($STATUShours_M, 2); + $STATUShours_M_int = intval("$STATUShours_M_int"); + $STATUShours_S = ($STATUShours_M - $STATUShours_M_int); + $STATUShours_S = ($STATUShours_S * 60); + $STATUShours_S = round($STATUShours_S, 0); + if ($STATUShours_S < 10) {$STATUShours_S = "0$STATUShours_S";} + if ($STATUShours_M_int < 10) {$STATUShours_M_int = "0$STATUShours_M_int";} + $STATUShours = "$STATUShours_H_int:$STATUShours_M_int:$STATUShours_S"; + + $STATUSavg_H = (($row[2] / 3600) / $STATUScount); + $STATUSavg_H_int = round($STATUSavg_H, 2); + $STATUSavg_H_int = intval("$STATUSavg_H_int"); + $STATUSavg_M = ($STATUSavg_H - $STATUSavg_H_int); + $STATUSavg_M = ($STATUSavg_M * 60); + $STATUSavg_M_int = round($STATUSavg_M, 2); + $STATUSavg_M_int = intval("$STATUSavg_M_int"); + $STATUSavg_S = ($STATUSavg_M - $STATUSavg_M_int); + $STATUSavg_S = ($STATUSavg_S * 60); + $STATUSavg_S = round($STATUSavg_S, 0); + if ($STATUSavg_S < 10) {$STATUSavg_S = "0$STATUSavg_S";} + if ($STATUSavg_M_int < 10) {$STATUSavg_M_int = "0$STATUSavg_M_int";} + $STATUSavg = "$STATUSavg_H_int:$STATUSavg_M_int:$STATUSavg_S"; $STATUScount = sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -1);} - $RAWstatus = $row[1]; $status = sprintf("%-6s", $row[1]);while(strlen($status)>6) {$status = substr("$status", 0, -1);} + $STATUShours = sprintf("%10s", $STATUShours);while(strlen($STATUShours)>10) {$STATUShours = substr("$STATUShours", 0, -1);} + $STATUSavg = sprintf("%8s", $STATUSavg);while(strlen($STATUSavg)>8) {$STATUSavg = substr("$STATUSavg", 0, -1);} + $STATUSrate = sprintf("%8s", $STATUSrate);while(strlen($STATUSrate)>8) {$STATUSrate = substr("$STATUSrate", 0, -1);} if ($non_latin < 1) { @@ -397,16 +435,58 @@ while ($i < $statuses_to_print) } - echo "| $status | $status_name | $STATUScount |\n"; + echo "| $status | $status_name | $STATUScount | $STATUShours | $STATUSavg | $STATUSrate |\n"; $i++; } -$TOTALcalls = sprintf("%10s", $TOTALcalls); +if ($TOTALcalls < 1) + { + $TOTALhours = '0:00:00'; + $TOTALavg = '0:00:00'; + $TOTALrate = '0.00'; + } +else + { + $TOTALrate = ($TOTALcalls / ($TOTALsec / 3600) ); + $TOTALrate = sprintf("%.2f", $TOTALrate); -echo "+--------+----------------------+------------+\n"; -echo "| TOTAL: | $TOTALcalls |\n"; -echo "+-------------------------------+------------+\n"; + $TOTALhours_H = ($TOTALsec / 3600); + $TOTALhours_H_int = round($TOTALhours_H, 2); + $TOTALhours_H_int = intval("$TOTALhours_H_int"); + $TOTALhours_M = ($TOTALhours_H - $TOTALhours_H_int); + $TOTALhours_M = ($TOTALhours_M * 60); + $TOTALhours_M_int = round($TOTALhours_M, 2); + $TOTALhours_M_int = intval("$TOTALhours_M_int"); + $TOTALhours_S = ($TOTALhours_M - $TOTALhours_M_int); + $TOTALhours_S = ($TOTALhours_S * 60); + $TOTALhours_S = round($TOTALhours_S, 0); + if ($TOTALhours_S < 10) {$TOTALhours_S = "0$TOTALhours_S";} + if ($TOTALhours_M_int < 10) {$TOTALhours_M_int = "0$TOTALhours_M_int";} + $TOTALhours = "$TOTALhours_H_int:$TOTALhours_M_int:$TOTALhours_S"; + + $TOTALavg_H = (($TOTALsec / 3600) / $TOTALcalls); + $TOTALavg_H_int = round($TOTALavg_H, 2); + $TOTALavg_H_int = intval("$TOTALavg_H_int"); + $TOTALavg_M = ($TOTALavg_H - $TOTALavg_H_int); + $TOTALavg_M = ($TOTALavg_M * 60); + $TOTALavg_M_int = round($TOTALavg_M, 2); + $TOTALavg_M_int = intval("$TOTALavg_M_int"); + $TOTALavg_S = ($TOTALavg_M - $TOTALavg_M_int); + $TOTALavg_S = ($TOTALavg_S * 60); + $TOTALavg_S = round($TOTALavg_S, 0); + if ($TOTALavg_S < 10) {$TOTALavg_S = "0$TOTALavg_S";} + if ($TOTALavg_M_int < 10) {$TOTALavg_M_int = "0$TOTALavg_M_int";} + $TOTALavg = "$TOTALavg_H_int:$TOTALavg_M_int:$TOTALavg_S"; + } +$TOTALcalls = sprintf("%10s", $TOTALcalls); +$TOTALhours = sprintf("%10s", $TOTALhours);while(strlen($TOTALhours)>10) {$TOTALhours = substr("$TOTALhours", 0, -1);} +$TOTALavg = sprintf("%8s", $TOTALavg);while(strlen($TOTALavg)>8) {$TOTALavg = substr("$TOTALavg", 0, -1);} +$TOTALrate = sprintf("%8s", $TOTALrate);while(strlen($TOTALrate)>8) {$TOTALrate = substr("$TOTALrate", 0, -1);} + +echo "+--------+----------------------+------------+------------+----------+----------+\n"; +echo "| TOTAL: | $TOTALcalls | $TOTALhours | $TOTALavg | $TOTALrate |\n"; +echo "+--------+----------------------+------------+------------+----------+----------+\n"; ############################## @@ -450,8 +530,8 @@ while ($i < $users_to_print) $USERavgTALK = $row[4]; $USERtotTALK_M = ($USERtotTALK / 60); - $USERtotTALK_M = round($USERtotTALK_M, 2); - $USERtotTALK_M_int = intval("$USERtotTALK_M"); + $USERtotTALK_M_int = round($USERtotTALK_M, 2); + $USERtotTALK_M_int = intval("$USERtotTALK_M_int"); $USERtotTALK_S = ($USERtotTALK_M - $USERtotTALK_M_int); $USERtotTALK_S = ($USERtotTALK_S * 60); $USERtotTALK_S = round($USERtotTALK_S, 0); @@ -460,8 +540,8 @@ while ($i < $users_to_print) $USERtotTALK_MS = sprintf("%6s", $USERtotTALK_MS); $USERavgTALK_M = ($USERavgTALK / 60); - $USERavgTALK_M = round($USERavgTALK_M, 2); - $USERavgTALK_M_int = intval("$USERavgTALK_M"); + $USERavgTALK_M_int = round($USERavgTALK_M, 2); + $USERavgTALK_M_int = intval("$USERavgTALK_M_int"); $USERavgTALK_S = ($USERavgTALK_M - $USERavgTALK_M_int); $USERavgTALK_S = ($USERavgTALK_S * 60); $USERavgTALK_S = round($USERavgTALK_S, 0); @@ -478,8 +558,8 @@ if (!$TOTcalls) {$TOTcalls = 1;} $TOTavg = ($TOTtime / $TOTcalls); $TOTavg = round($TOTavg, 0); $TOTavg_M = ($TOTavg / 60); -$TOTavg_M = round($TOTavg_M, 2); -$TOTavg_M_int = intval("$TOTavg_M"); +$TOTavg_M_int = round($TOTavg_M, 2); +$TOTavg_M_int = intval("$TOTavg_M_int"); $TOTavg_S = ($TOTavg_M - $TOTavg_M_int); $TOTavg_S = ($TOTavg_S * 60); $TOTavg_S = round($TOTavg_S, 0); @@ -488,8 +568,8 @@ $TOTavg_MS = "$TOTavg_M_int:$TOTavg_S"; $TOTavg = sprintf("%6s", $TOTavg_MS); $TOTtime_M = ($TOTtime / 60); -$TOTtime_M = round($TOTtime_M, 2); -$TOTtime_M_int = intval("$TOTtime_M"); +$TOTtime_M_int = round($TOTtime_M, 2); +$TOTtime_M_int = intval("$TOTtime_M_int"); $TOTtime_S = ($TOTtime_M - $TOTtime_M_int); $TOTtime_S = ($TOTtime_S * 60); $TOTtime_S = round($TOTtime_S, 0); @@ -509,8 +589,8 @@ $row=mysql_fetch_row($rslt); $AVGwait = $row[0]; $AVGwait_M = ($AVGwait / 60); -$AVGwait_M = round($AVGwait_M, 2); -$AVGwait_M_int = intval("$AVGwait_M"); +$AVGwait_M_int = round($AVGwait_M, 2); +$AVGwait_M_int = intval("$AVGwait_M_int"); $AVGwait_S = ($AVGwait_M - $AVGwait_M_int); $AVGwait_S = ($AVGwait_S * 60); $AVGwait_S = round($AVGwait_S, 0);