From ef8a9fe445656a3883677e57ba8bdab94877e117 Mon Sep 17 00:00:00 2001 From: mattf Date: Mon, 10 Nov 2008 05:00:27 +0000 Subject: [PATCH] more changes to vicidial reports git-svn-id: svn://192.168.202.10@1001 3d104415-ff17-0410-8863-d5cf3c621b8a --- bin/AST_CRON_audio_3_ftp.pl | 3 ++ bin/AST_VDadapt.pl | 4 +-- docs/BASE_INSTALL.txt | 2 +- docs/SCRATCH_INSTALL.txt | 2 +- www/vicidial/AST_CLOSERstats.php | 49 ++++++++++++++++++++++++++++-- www/vicidial/AST_VDADstats.php | 42 +++++++++++++++++++++++++ www/vicidial/AST_timeonVDADall.php | 6 ++-- 7 files changed, 98 insertions(+), 10 deletions(-) diff --git a/bin/AST_CRON_audio_3_ftp.pl b/bin/AST_CRON_audio_3_ftp.pl index 0318fff2..89cc33ee 100644 --- a/bin/AST_CRON_audio_3_ftp.pl +++ b/bin/AST_CRON_audio_3_ftp.pl @@ -24,6 +24,8 @@ # FLAG FOR NO DATE DIRECTORY ON FTP # --NODATEDIR # +# if pinging is not working, try the 'icmp' Ping command in the code instead +# # make sure that the following directories exist: # /var/spool/asterisk/monitorDONE # where the mixed -all files are put # @@ -251,6 +253,7 @@ foreach(@FILES) ### BEGIN Remote file transfer $p = Net::Ping->new(); + # $p = Net::Ping->new("icmp"); $ping_good = $p->ping("$VARFTP_host"); if ($ping_good) diff --git a/bin/AST_VDadapt.pl b/bin/AST_VDadapt.pl index dd6b44de..7bae8771 100644 --- a/bin/AST_VDadapt.pl +++ b/bin/AST_VDadapt.pl @@ -1233,7 +1233,7 @@ $sthA->finish(); if ($VCScalls_today[$p] > 0) { # TODAY ANSWERS - $stmtA = "SELECT count(*) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE');"; + $stmtA = "SELECT count(*) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE');"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -1289,7 +1289,7 @@ if ($VCScalls_today[$p] > 0) } # TODAY TOTAL HOLD TIME FOR ANSWERED CALLS - $stmtA = "SELECT sum(queue_seconds) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE');"; + $stmtA = "SELECT sum(queue_seconds) from $vicidial_closer_log where campaign_id='$group_id[$p]' and call_date > '$VDL_date' and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE');"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; diff --git a/docs/BASE_INSTALL.txt b/docs/BASE_INSTALL.txt index 0d2eff3d..4d92d39b 100644 --- a/docs/BASE_INSTALL.txt +++ b/docs/BASE_INSTALL.txt @@ -481,7 +481,7 @@ PHASE 6: ADDING CRONTAB ENTRIES FOR ASTGUICLIENT/VICIDIAL SCRIPTS 2 0 * * 0 /usr/share/astguiclient/AST_agent_week.pl ### remove old recordings more than 7 days old -#24 0 * * * /usr/bin/find /var/spool/asterisk/monitor -maxdepth 2 -type f -mtime +7 -print | xargs rm -f +#24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE -maxdepth 2 -type f -mtime +7 -print | xargs rm -f ### remove old vicidial logs and asterisk logs more than 2 days old 28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f diff --git a/docs/SCRATCH_INSTALL.txt b/docs/SCRATCH_INSTALL.txt index 5f5f6e50..ab1fddff 100644 --- a/docs/SCRATCH_INSTALL.txt +++ b/docs/SCRATCH_INSTALL.txt @@ -2962,7 +2962,7 @@ SUBPHASE 6.5: setting up astguiclient scripts for continuous running #42 0 * * * /usr/share/astguiclient/AST_sourceID_summary_export.pl ### remove old recordings more than 7 days old -#24 0 * * * /usr/bin/find /var/spool/asterisk/monitor -maxdepth 2 -type f -mtime +7 -print | xargs rm -f +#24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE -maxdepth 2 -type f -mtime +7 -print | xargs rm -f ### remove old vicidial logs and asterisk logs more than 2 days old 28 0 * * * /usr/bin/find /var/log/astguiclient -maxdepth 1 -type f -mtime +2 -print | xargs rm -f diff --git a/www/vicidial/AST_CLOSERstats.php b/www/vicidial/AST_CLOSERstats.php index 356b3a6f..637e131c 100644 --- a/www/vicidial/AST_CLOSERstats.php +++ b/www/vicidial/AST_CLOSERstats.php @@ -17,6 +17,7 @@ # 81015-0705 - Added IVR calls count # 81024-0037 - Added multi-select inbound-groups # 81105-2118 - Added Answered calls 15-minute breakdown +# 81109-2340 - Added custom indicators section # require("dbconnect.php"); @@ -307,7 +308,7 @@ $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $row=mysql_fetch_row($rslt); -$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE');"; +$stmt="select count(*),sum(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE');"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $rowy=mysql_fetch_row($rslt); @@ -352,6 +353,7 @@ echo "Answered Calls: $ANSWEREDcalls $ANSWEREDper echo "Average queue time for Answered Calls: $average_answer_seconds seconds\n"; echo "Calls taken into the IVR for this In-Group: $IVRcalls\n"; + echo "\n"; echo "---------- DROPS\n"; @@ -391,6 +393,47 @@ echo "Total DROP Calls: $DROPcalls $DROPpercent% echo "Average hold time for DROP Calls: $average_hold_seconds seconds\n"; + + +if (strlen($group_SQL)>3) + { + $stmt = "SELECT answer_sec_pct_rt_stat_one,answer_sec_pct_rt_stat_two from vicidial_inbound_groups where group_id IN($group_SQL) order by answer_sec_pct_rt_stat_one desc limit 1;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $Sanswer_sec_pct_rt_stat_one = $row[0]; + $Sanswer_sec_pct_rt_stat_two = $row[1]; + + $stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_one;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $answer_sec_pct_rt_stat_one = $row[0]; + + $stmt = "SELECT count(*) from vicidial_closer_log where campaign_id IN($group_SQL) and call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and queue_seconds <= $Sanswer_sec_pct_rt_stat_two;"; + $rslt=mysql_query($stmt, $link); + if ($DB) {echo "$stmt\n";} + $row=mysql_fetch_row($rslt); + $answer_sec_pct_rt_stat_two = $row[0]; + + if ( ($ANSWEREDcalls > 0) and ($answer_sec_pct_rt_stat_one > 0) and ($answer_sec_pct_rt_stat_two > 0) ) + { + $PCTanswer_sec_pct_rt_stat_one = (($answer_sec_pct_rt_stat_one / $ANSWEREDcalls) * 100); + $PCTanswer_sec_pct_rt_stat_one = round($PCTanswer_sec_pct_rt_stat_one, 0); + #$PCTanswer_sec_pct_rt_stat_one = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_one); + $PCTanswer_sec_pct_rt_stat_two = (($answer_sec_pct_rt_stat_two / $ANSWEREDcalls) * 100); + $PCTanswer_sec_pct_rt_stat_two = round($PCTanswer_sec_pct_rt_stat_two, 0); + #$PCTanswer_sec_pct_rt_stat_two = sprintf("%10s", $PCTanswer_sec_pct_rt_stat_two); + } + } +echo "\n"; +echo "---------- CUSTOM INDICATORS\n"; +echo "GDE (Answered/Total calls taken in to this In-Group): $ANSWEREDpercent%\n"; +echo "ACR (Dropped/Answered): $DROP_ANSWEREDpercent%\n"; +echo "TMR1 (Answered within $Sanswer_sec_pct_rt_stat_one seconds/Answered): $PCTanswer_sec_pct_rt_stat_one%\n"; +echo "TMR2 (Answered within $Sanswer_sec_pct_rt_stat_two seconds/Answered): $PCTanswer_sec_pct_rt_stat_two%\n"; + + # GET LIST OF ALL STATUSES and create SQL from human_answered statuses $q=0; $stmt = "SELECT status,status_name,human_answered,category from vicidial_statuses;"; @@ -609,7 +652,7 @@ echo " +--------------------------------------------------------------- echo " | 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; echo "----------+-------------------------------------------------------------------------------------------+------------+\n"; -$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE') group by queue_seconds;"; +$stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE') group by queue_seconds;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); @@ -1375,7 +1418,7 @@ while ($i <= 96) $ad_0=0; $ad_5=0; $ad10=0; $ad15=0; $ad20=0; $ad25=0; $ad30=0; $ad35=0; $ad40=0; $ad45=0; $ad50=0; $ad55=0; $ad60=0; $ad90=0; $ad99=0; $BDansweredCALLS=0; - $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date $SQLtime' and call_date < '$query_date $SQLtimeEND' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE') group by queue_seconds;"; + $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date $SQLtime' and call_date < '$query_date $SQLtimeEND' and campaign_id IN($group_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE') group by queue_seconds;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); diff --git a/www/vicidial/AST_VDADstats.php b/www/vicidial/AST_VDADstats.php index 194c83d7..9f0f89cc 100644 --- a/www/vicidial/AST_VDADstats.php +++ b/www/vicidial/AST_VDADstats.php @@ -14,6 +14,7 @@ # 80709-0230 - Added time stats to call statuses # 80717-2118 - Added calls/hour out of agent login time in status summary # 80722-2049 - Added Status Category stats +# 81109-2341 - Added Productivity Rating # header ("Content-type: text/html; charset=utf-8"); @@ -208,6 +209,7 @@ else echo "Total Calls placed from this Campaign: $TOTALcalls\n"; echo "Average Call Length for all Calls in seconds: $average_hold_seconds\n"; + echo "\n"; echo "---------- DROPS\n"; @@ -298,6 +300,46 @@ echo "Total DROP Calls: $DROPcalls $DROPpercent%\n" echo "Percent of DROP Calls taken out of Answers: $DROPcalls / $ANSWERcalls $DROPANSWERpercent%\n"; echo "Average Length for DROP Calls in seconds: $average_hold_seconds\n"; + + + + +$stmt = "select closer_campaigns from vicidial_campaigns where campaign_id='" . mysql_real_escape_string($group) . "';"; +$rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $closer_campaigns = $row[0]; + $closer_campaigns = preg_replace("/^ | -$/","",$closer_campaigns); + $closer_campaigns = preg_replace("/ /","','",$closer_campaigns); + $closer_campaignsSQL = "'$closer_campaigns'"; +if ($DB > 0) {echo "\n|$closer_campaigns|$closer_campaignsSQL|$stmt|\n";} + +$stmt="select count(*) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($closer_campaignsSQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE');"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$row=mysql_fetch_row($rslt); +$TOTALanswers = ($row[0] + $ANSWERcalls); + + +$stmt = "SELECT sum(wait_sec + talk_sec + dispo_sec) from vicidial_agent_log where campaign_id='" . mysql_real_escape_string($group) . "' and event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END';"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$row=mysql_fetch_row($rslt); +$agent_non_pause_sec = $row[0]; + +if ($agent_non_pause_sec > 0) + { + $AVG_ANSWERagent_non_pause_sec = (($TOTALanswers / $agent_non_pause_sec) * 60); + $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); + } +else + {$AVG_ANSWERagent_non_pause_sec=0;} +$AVG_ANSWERagent_non_pause_sec = sprintf("%10s", $AVG_ANSWERagent_non_pause_sec); + +echo "Productivity Rating: $AVG_ANSWERagent_non_pause_sec\n"; + + + + echo "\n"; echo "---------- AUTO-DIAL NO ANSWERS\n"; diff --git a/www/vicidial/AST_timeonVDADall.php b/www/vicidial/AST_timeonVDADall.php index 31bae44d..ea89c6ca 100644 --- a/www/vicidial/AST_timeonVDADall.php +++ b/www/vicidial/AST_timeonVDADall.php @@ -116,7 +116,7 @@ if (!isset($SERVdisplay)) {$SERVdisplay=1;} # 0=no, 1=yes if (!isset($CALLSdisplay)) {$CALLSdisplay=1;} # 0=no, 1=yes if (!isset($PHONEdisplay)) {$PHONEdisplay=0;} # 0=no, 1=yes if (!isset($CUSTPHONEdisplay)) {$CUSTPHONEdisplay=0;} # 0=no, 1=yes -if (!isset($with_inbound)) {$with_inbound='N';} # 0=no, 1=yes +if (!isset($with_inbound)) {$with_inbound='N';} # N=no, Y=yes, O=only if (!isset($PAUSEcodes)) {$PAUSEcodes='N';} # 0=no, 1=yes $ingroup_detail=''; @@ -428,7 +428,7 @@ if (ereg('O',$with_inbound)) $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); if ($agent_non_pause_sec > 0) { - $AVG_ANSWERagent_non_pause_sec = ($agent_non_pause_sec / $answersTODAY); + $AVG_ANSWERagent_non_pause_sec = (($answersTODAY / $agent_non_pause_sec) * 60); $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); } @@ -545,7 +545,7 @@ if (ereg('O',$with_inbound)) $AVGhold_sec_answer_calls = round($AVGhold_sec_answer_calls, 0); if ($agent_non_pause_sec > 0) { - $AVG_ANSWERagent_non_pause_sec = ($agent_non_pause_sec / $answersTODAY); + $AVG_ANSWERagent_non_pause_sec = (($answersTODAY / $agent_non_pause_sec) * 60); $AVG_ANSWERagent_non_pause_sec = round($AVG_ANSWERagent_non_pause_sec, 2); $AVG_ANSWERagent_non_pause_sec = sprintf("%01.2f", $AVG_ANSWERagent_non_pause_sec); }