Added System max Stats report and permissions for both max stats reports

git-svn-id: svn://192.168.202.10@1778 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
mattf
2012-01-25 17:38:50 +00:00
parent 326a0ea8e3
commit 94a2d35f74
2 changed files with 128 additions and 47 deletions
+114 -45
View File
@@ -105,9 +105,9 @@ $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW'];
$PHP_SELF=$_SERVER['PHP_SELF'];
$QUERY_STRING = getenv("QUERY_STRING");
$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Single Agent Daily , User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report';
$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Campaign Status List Report, Export Calls Report, Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Single Agent Daily , User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Maximum System Stats, Maximum Stats Detail';
$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Campaign Status List Report, Export Calls Report , Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Single Agent Daily , User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search';
$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound Daily Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Campaign Status List Report, Export Calls Report , Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Single Agent Daily , User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Dialer Inventory Report, Custom Reports Links, CallCard Search, Maximum System Stats, Maximum Stats Detail';
$Vtables = 'NONE,log_noanswer,did_agent_log,contact_information';
@@ -3025,12 +3025,13 @@ else
# 120102-2125 - Added Dialer Inventory Report
# 120104-2024 - Changed copyright dates, other small fixes
# 120118-2113 - Fixed bugs in phone alias and conf template updates
# 120125-1234 - Added Maximum System Stats report and permissions for it and Max Stats Detail report
#
# make sure you have added a user to the vicidial_users MySQL table with at least user_level 8 to access this page the first time
$admin_version = '2.4-355a';
$build = '120118-2113';
$admin_version = '2.4-356a';
$build = '120125-1234';
$STARTtime = date("U");
$SQLdate = date("Y-m-d H:i:s");
@@ -3646,6 +3647,7 @@ if ($ADD==999996) {$hh='reports'; echo "INITIAL INSTALL WELCOME";}
if ($ADD==999995) {$hh='reports'; echo "COPYRIGHT TRADEMARK LICENSE";}
if ($ADD==999994) {$hh='reports'; echo "ADMIN UTILITIES";}
if ($ADD==999993) {$hh='reports'; echo "SUMMARY STATS";}
if ($ADD==999992) {$hh='reports'; echo "SYSTEM SUMMARY STATS";}
if ( ($ADD>9) and ($ADD < 99998) )
@@ -32262,6 +32264,9 @@ if ($ADD==999999)
if ( (preg_match("/Server Performance Report/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{echo "<LI><a href=\"AST_server_performance.php\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Server Performance Report</a></FONT>\n";}
if ( (preg_match("/Maximum System Stats/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{echo "<LI><a href=\"admin.php?ADD=999992&stage=TOTAL\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Maximum System Stats</a></FONT>\n";}
if ( ($LOGuser_level >= 9) and ( (preg_match("/Administration Change Log/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) )
{
echo "<LI><a href=\"$PHP_SELF?ADD=700000000000000\"><FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>Administration Change Log</a></FONT>\n";
@@ -32699,59 +32704,123 @@ if ($ADD==999993)
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
if ($stage == 'in-group')
if ( (preg_match("/Maximum Stats Detail/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
$in_out = 'in-group';
$max_type = 'max_inbound';
$modify_link = "<a href=\"$PHP_SELF?ADD=3111&group_id=$campaign_id\">";
$stmt="SELECT group_name from vicidial_inbound_groups where group_id='$campaign_id' $LOGadmin_viewable_groupsSQL;";
$rslt=mysql_query($stmt, $link);
$rows_to_print = mysql_num_rows($rslt);
if ($rows_to_print > 0)
if ($stage == 'in-group')
{
$rowx=mysql_fetch_row($rslt);
$campaign_name = $rowx[0];
$in_out = 'in-group';
$max_type = 'max_inbound';
$modify_link = "<a href=\"$PHP_SELF?ADD=3111&group_id=$campaign_id\">";
$stmt="SELECT group_name from vicidial_inbound_groups where group_id='$campaign_id' $LOGadmin_viewable_groupsSQL;";
$rslt=mysql_query($stmt, $link);
$rows_to_print = mysql_num_rows($rslt);
if ($rows_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$campaign_name = $rowx[0];
}
else
{echo "Not found"; exit;}
}
else
{echo "Not found"; exit;}
{
$in_out = 'campaign';
$max_type = 'max_outbound';
$modify_link = "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id\">";
$stmt="SELECT campaign_name from vicidial_campaigns where campaign_id='$campaign_id' $LOGallowed_campaignsSQL;";
$rslt=mysql_query($stmt, $link);
$rows_to_print = mysql_num_rows($rslt);
if ($rows_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$campaign_name = $rowx[0];
}
else
{echo "Not found"; exit;}
}
echo "<br><B> Administration: Maximum Stats Detail for $stage $modify_link$campaign_id</a> - $campaign_name</B><BR><BR>\n";
echo "<center><TABLE width=$section_width cellspacing=5 cellpadding=2>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,'total_calls','call count',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,$max_type,'most concurrent calls',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,'max_agents','most concurrent agents',0);
echo "</td></tr>\n";
}
else
{
$in_out = 'campaign';
$max_type = 'max_outbound';
$modify_link = "<a href=\"$PHP_SELF?ADD=31&campaign_id=$campaign_id\">";
$stmt="SELECT campaign_name from vicidial_campaigns where campaign_id='$campaign_id' $LOGallowed_campaignsSQL;";
$rslt=mysql_query($stmt, $link);
$rows_to_print = mysql_num_rows($rslt);
if ($rows_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$campaign_name = $rowx[0];
}
else
{echo "Not found"; exit;}
}
echo "<br><B> Administration: Max Stats Detail for $stage $modify_link$campaign_id</a> - $campaign_name</B><BR><BR>\n";
echo "<center><TABLE width=$section_width cellspacing=5 cellpadding=2>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,'total_calls','call count',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,$max_type,'most concurrent calls',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30',$in_out,$link,'max_agents','most concurrent agents',0);
echo "</td></tr>\n";
{echo "You do not have permission to view this page";}
echo "</TABLE></center>\n";
}
##### END max stats detail report #####
######################
# ADD=999992 - max system stats report
######################
if ($ADD==999992)
{
echo "<TABLE><TR><TD>\n";
echo "<FONT FACE=\"ARIAL,HELVETICA\" COLOR=BLACK SIZE=2>";
echo "<br><B> Administration: Maximum System Stats</B><BR><BR>\n";
echo "<center><TABLE width=$section_width cellspacing=5 cellpadding=2>\n";
if ( (preg_match("/Maximum System Stats/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
{
$stmt="SELECT sum(total_calls) from vicidial_daily_max_stats where campaign_id!='' and stats_flag='OPEN';";
$rslt=mysql_query($stmt, $link);
$rows_to_print = mysql_num_rows($rslt);
if ($rows_to_print > 0)
{
$rowx=mysql_fetch_row($rslt);
$ALLtotal_calls = $rowx[0];
$stmt="UPDATE vicidial_daily_max_stats SET total_calls='$ALLtotal_calls' where campaign_id='' and stats_flag='OPEN' and stats_type='TOTAL';";
$rslt=mysql_query($stmt, $link);
}
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30','system',$link,'total_calls','total call count in and out',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30','system',$link,'total_calls_inbound_all','total inbound call count',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30','system',$link,'total_calls_outbound_all','total outbound call count',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30','system',$link,'(max_inbound + max_outbound)','most concurrent calls in and out',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30','system',$link,'max_inbound','most concurrent calls inbound total',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30','system',$link,'max_outbound','most concurrent calls outbound total',0);
echo "</td></tr>\n";
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
horizontal_bar_chart($campaign_id,'30','system',$link,'max_agents','most concurrent agents',0);
echo "</td></tr>\n";
}
else
{echo "You do not have permission to view this page";}
echo "</TABLE></center>\n";
}
##### END max system stats report #####
+14 -2
View File
@@ -4,13 +4,14 @@
#
# functions for administrative scripts and reports
#
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
#
#
# CHANGES:
# 90524-1503 - First Build
# 110708-1723 - Added HF precision option
# 111222-2124 - Added max stats bar chart function
# 120125-1235 - Small changes to max stats function to allow for total system stats
#
##### reformat seconds into HH:MM:SS or MM:SS #####
@@ -111,8 +112,13 @@ function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$met
$NWB = " &nbsp; <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999";
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
### get stats for last X days
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_flag='OPEN';";
if ($metric=='total_calls_inbound_all')
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_type='INGROUP' and stats_flag='OPEN' group by stats_date;";}
if ($metric=='total_calls_outbound_all')
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_type='CAMPAIGN' and stats_flag='OPEN' group by stats_date;";}
$rslt=mysql_query($stmt, $link);
$Xstats_to_print = mysql_num_rows($rslt);
if ($Xstats_to_print > 0)
@@ -131,6 +137,10 @@ function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$met
$Bstats_date[$i] = date("Y-m-d", $stats_start_time);
$Btotal_calls[$i]=0;
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_date='$Bstats_date[$i]';";
if ($metric=='total_calls_inbound_all')
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_date='$Bstats_date[$i]' and stats_type='INGROUP' group by stats_date;";}
if ($metric=='total_calls_outbound_all')
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_date='$Bstats_date[$i]' and stats_type='CAMPAIGN' group by stats_date;";}
$rslt=mysql_query($stmt, $link);
$Ystats_to_print = mysql_num_rows($rslt);
if ($Ystats_to_print > 0)
@@ -144,9 +154,11 @@ function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$met
{echo "<!-- no max stats cache summary information available -->";}
else
{
if ($title=='campaign') {$out_in_type=' outbound';}
if ($title=='in-group') {$out_in_type=' inbound';}
if ($more_link > 0) {$link_text = "<a href=\"$PHP_SELF?ADD=999993&campaign_id=$campaign_id&stage=$title\"><font size=1>more summary stats...</font></a>";}
echo "<table cellspacing=\"1\" cellpadding=\"0\" bgcolor=\"white\" summary=\"Multiple day $metric_name.\" style=\"background-image:url(images/bg_fade.png); background-repeat:repeat-x; background-position:left top; width: 33em;\">\n";
echo "<caption align=\"top\">$days_graph Day $metric_name for this $title &nbsp; $link_text &nbsp; $NWB#vicidial_campaigns-max_stats$NWE<br /></caption>\n";
echo "<caption align=\"top\">$days_graph Day $out_in_type $metric_name for this $title &nbsp; $link_text &nbsp; $NWB#vicidial_campaigns-max_stats$NWE<br /></caption>\n";
echo "<tr>\n";
echo "<th scope=\"col\" style=\"text-align: left; vertical-align:top;\"><span class=\"auraltext\">date</span> </th>\n";
echo "<th scope=\"col\" style=\"text-align: left; vertical-align:top;\"><span class=\"auraltext\">$metric_name</span> </th>\n";