From 57d56d0fdd3327254111a1973a1cc2966ca24e49 Mon Sep 17 00:00:00 2001 From: mattf Date: Fri, 8 Jul 2011 21:37:56 +0000 Subject: [PATCH] Added agent time detail options.php time precision option git-svn-id: svn://192.168.202.10@1691 3d104415-ff17-0410-8863-d5cf3c621b8a --- www/vicidial/AST_agent_time_detail.php | 56 ++++++++++++++++---------- www/vicidial/functions.php | 17 ++++++-- www/vicidial/options-example.php | 5 +++ 3 files changed, 53 insertions(+), 25 deletions(-) diff --git a/www/vicidial/AST_agent_time_detail.php b/www/vicidial/AST_agent_time_detail.php index 4f4683c5..3adba291 100644 --- a/www/vicidial/AST_agent_time_detail.php +++ b/www/vicidial/AST_agent_time_detail.php @@ -20,6 +20,7 @@ # 101208-0320 - Fixed issue 404 # 110307-1057 - Added user_case setting in options.php # 110623-0728 - Fixed user group selection bug +# 110708-1727 - Added options.php setting for time precision # require("dbconnect.php"); @@ -56,6 +57,7 @@ $report_name = 'Agent Time Detail'; $db_source = 'M'; $user_case = ''; +$TIME_agenttimedetail = ''; if (file_exists('options.php')) { require('options.php'); @@ -66,6 +68,8 @@ if ($user_case == '2') {$userSQL = 'lcase(user)';} if (strlen($userSQL)<2) {$userSQL = 'user';} +if (strlen($TIME_agenttimedetail)<1) + {$TIME_agenttimedetail = 'H';} ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### @@ -540,13 +544,13 @@ else $RAWcalls = $Scalls[$m]; $RAWtimeSEC = $Stime[$m]; - $Swait[$m]= sec_convert($Swait[$m],'H'); - $Stalk[$m]= sec_convert($Stalk[$m],'H'); - $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'); + $Swait[$m]= sec_convert($Swait[$m],$TIME_agenttimedetail); + $Stalk[$m]= sec_convert($Stalk[$m],$TIME_agenttimedetail); + $Sdispo[$m]= sec_convert($Sdispo[$m],$TIME_agenttimedetail); + $Spause[$m]= sec_convert($Spause[$m],$TIME_agenttimedetail); + $Sdead[$m]= sec_convert($Sdead[$m],$TIME_agenttimedetail); + $Scustomer[$m]= sec_convert($Scustomer[$m],$TIME_agenttimedetail); + $Stime[$m]= sec_convert($Stime[$m],$TIME_agenttimedetail); $RAWtime = $Stime[$m]; $RAWwait = $Swait[$m]; @@ -583,7 +587,7 @@ else $punches_found++; $RAWtimeTCsec = $TCtime[$n]; $TOTtimeTC = ($TOTtimeTC + $TCtime[$n]); - $StimeTC[$m]= sec_convert($TCtime[$n],'H'); + $StimeTC[$m]= sec_convert($TCtime[$n],$TIME_agenttimedetail); $RAWtimeTC = $StimeTC[$m]; $StimeTC[$m] = sprintf("%10s", $StimeTC[$m]); } @@ -592,7 +596,9 @@ else if ($punches_found < 1) { $RAWtimeTCsec = "0"; - $StimeTC[$m]= "0:00"; + $StimeTC[$m] = "0:00"; + if ($TIME_agenttimedetail == 'HF') + {$StimeTC[$m] = "0:00:00";} $RAWtimeTC = $StimeTC[$m]; $StimeTC[$m] = sprintf("%10s", $StimeTC[$m]); } @@ -625,7 +631,7 @@ else { if ( ($Suser[$m]=="$PCuser[$i]") and ($Sstatus=="$sub_status[$i]") ) { - $USERcodePAUSE_MS = sec_convert($PCpause_sec[$i],'H'); + $USERcodePAUSE_MS = sec_convert($PCpause_sec[$i],$TIME_agenttimedetail); if (strlen($USERcodePAUSE_MS)<1) {$USERcodePAUSE_MS='0';} $pfUSERcodePAUSE_MS = sprintf("%10s", $USERcodePAUSE_MS); @@ -638,8 +644,16 @@ else } if ($status_found < 1) { - $SstatusesHTML .= " 0:00 |"; - $SstatusesFILE .= ",0:00"; + if ($TIME_agenttimedetail == 'HF') + { + $SstatusesHTML .= " 0:00:00 |"; + $SstatusesFILE .= ",0:00:00"; + } + else + { + $SstatusesHTML .= " 0:00 |"; + $SstatusesFILE .= ",0:00"; + } } ### END loop through each stat line ### $n++; @@ -800,7 +814,7 @@ else { $TOTtotPAUSE = ($TOTtotPAUSE + $Scalls); - $USERsumstatPAUSE_MS = sec_convert($Scalls,'H'); + $USERsumstatPAUSE_MS = sec_convert($Scalls,$TIME_agenttimedetail); $pfUSERsumstatPAUSE_MS = sprintf("%11s", $USERsumstatPAUSE_MS); $SUMstatusTXT = sprintf("%10s", $pfUSERsumstatPAUSE_MS); @@ -812,14 +826,14 @@ else ### 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'); + $TOTwait = sec_convert($TOTwait,$TIME_agenttimedetail); + $TOTtalk = sec_convert($TOTtalk,$TIME_agenttimedetail); + $TOTdispo = sec_convert($TOTdispo,$TIME_agenttimedetail); + $TOTpause = sec_convert($TOTpause,$TIME_agenttimedetail); + $TOTdead = sec_convert($TOTdead,$TIME_agenttimedetail); + $TOTcustomer = sec_convert($TOTcustomer,$TIME_agenttimedetail); + $TOTALtime = sec_convert($TOTALtime,$TIME_agenttimedetail); + $TOTtimeTC = sec_convert($TOTtimeTC,$TIME_agenttimedetail); $hTOTcalls = sprintf("%8s", $TOTcalls); $hTOTwait = sprintf("%11s", $TOTwait); diff --git a/www/vicidial/functions.php b/www/vicidial/functions.php index f3a6e7b7..ae58f562 100644 --- a/www/vicidial/functions.php +++ b/www/vicidial/functions.php @@ -1,14 +1,15 @@ LICENSE: AGPLv2 +# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 # # # CHANGES: # 90524-1503 - First Build +# 110708-1723 - Added HF precision option # ##### reformat seconds into HH:MM:SS or MM:SS ##### @@ -18,11 +19,19 @@ function sec_convert($sec,$precision) if ($sec < 1) { - return "0:00"; + if ($precision == 'HF') + {return "0:00:00";} + else + {return "0:00";} } else { - if ($sec < 3600) {$precision='M';} + if ($precision == 'HF') + {$precision='H';} + else + { + if ( ($sec < 3600) and ($precision != 'S') ) {$precision='M';} + } if ($precision == 'H') { diff --git a/www/vicidial/options-example.php b/www/vicidial/options-example.php index 0f9ae711..465679ff 100644 --- a/www/vicidial/options-example.php +++ b/www/vicidial/options-example.php @@ -8,6 +8,7 @@ # CHANGELOG # 101216-1043 - First Build # 110307-1039 - Added upper-case/lower-case user setting +# 110708-1730 - Added precision time setting # # used by the realtime_report.php script @@ -51,4 +52,8 @@ $RS_AGENTtimeSTATS = 0; # 0=no, 1=yes # used by agent reports $user_case = 0; # 1=upper-case, 2-lower-case, 0-no-case-change +# force time precision for reports +$TIME_agenttimedetail = 'H'; # H=hour, M=minute, S=second, HF=force hour + + ?>