From 0460f8047ad5aec9bed09fd78de5f639d94705b7 Mon Sep 17 00:00:00 2001 From: mattf Date: Thu, 8 Mar 2012 00:29:53 +0000 Subject: [PATCH] Added additional statuses and HTML display option to Team Performance Detail report git-svn-id: svn://192.168.202.10@1794 3d104415-ff17-0410-8863-d5cf3c621b8a --- .../vicidial/AST_team_performance_detail.php | 641 +++++++++++++++--- 1 file changed, 565 insertions(+), 76 deletions(-) diff --git a/agc_2-X/trunk/www/vicidial/AST_team_performance_detail.php b/agc_2-X/trunk/www/vicidial/AST_team_performance_detail.php index 2ef7ab91..c1c8b66a 100644 --- a/agc_2-X/trunk/www/vicidial/AST_team_performance_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_team_performance_detail.php @@ -14,6 +14,7 @@ # 110804-0049 - Added First Call Resolution # 111104-1259 - Added user_group restrictions for selecting in-groups # 120224-1424 - Added new colums and PRECAL to System Time +# 120307-1926 - Added additional statuses option and HTML display option # require("dbconnect.php"); @@ -32,6 +33,8 @@ if (isset($_GET["end_date_T"])) {$end_date_T=$_GET["end_date_T"];} elseif (isset($_POST["end_date_T"])) {$end_date_T=$_POST["end_date_T"];} if (isset($_GET["group"])) {$group=$_GET["group"];} elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["call_status"])) {$call_status=$_GET["call_status"];} + elseif (isset($_POST["call_status"])) {$call_status=$_POST["call_status"];} if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} @@ -40,10 +43,14 @@ if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +if (isset($_GET["report_display_type"])) {$report_display_type=$_GET["report_display_type"];} + elseif (isset($_POST["report_display_type"])) {$report_display_type=$_POST["report_display_type"];} $report_name = 'Team Performance Detail'; $db_source = 'M'; +$JS_text.="\n"; $HTML_head.="\n"; +$HTML_head.="\n"; $HTML_head.="\n"; $HTML_head.="$report_name$group_S\n"; @@ -347,12 +411,36 @@ while ($user_groups_to_print > $o) $o++; } $HTML_text.="\n"; -$HTML_text.="\n"; +$HTML_text.="\n"; + +$HTML_text.=" Show additional statuses:
"; +$HTML_text.="\n"; + + +$HTML_text.="\n"; +$HTML_text.="Display as:
"; +$HTML_text.="\n

"; $HTML_text.="\n"; $HTML_text.="         "; $HTML_text.="          \n"; -$HTML_text.="DOWNLOAD |"; +$HTML_text.="DOWNLOAD |"; $HTML_text.=" REPORTS \n"; $HTML_text.="\n"; $HTML_text.=""; @@ -362,7 +450,7 @@ if ($SUBMIT=="SUBMIT") { # Sale counts per rep $stmt="select max(event_time), vicidial_agent_log.user, vicidial_agent_log.lead_id, vicidial_list.status as current_status from vicidial_agent_log, vicidial_list where event_time>='$query_date' and event_time<='$end_date' $group_SQL and vicidial_agent_log.status in (select status from vicidial_campaign_statuses where sale='Y' $group_SQL UNION select status from vicidial_statuses where sale='Y') and vicidial_agent_log.lead_id=vicidial_list.lead_id group by vicidial_agent_log.user, vicidial_agent_log.lead_id"; - if ($DB) {$HTML_text.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $rslt=mysql_query($stmt, $link); while ($row=mysql_fetch_array($rslt)) { @@ -385,7 +473,7 @@ if ($SUBMIT=="SUBMIT") # counted towards sales talk time, move the below lines OUTSIDE the curly bracket below, so the query runs regardless of what "type" of # sale it is. $sale_time_stmt="select sum(talk_sec)-sum(dead_sec) from vicidial_agent_log where user='$user' and lead_id='$lead_id' $group_SQL"; - if ($DB) {$HTML_text.="$sale_time_stmt\n";} + if ($DB) {$ASCII_text.="$sale_time_stmt\n";} $sale_time_rslt=mysql_query($sale_time_stmt, $link); $sale_time_row=mysql_fetch_row($sale_time_rslt); $sales_talk_time_array[$row["user"]]+=$sale_time_row[0]; @@ -405,6 +493,51 @@ if ($SUBMIT=="SUBMIT") $total_cnc_sales=0; $total_callbacks=0; $total_stcall=0; + for ($q=0; $q".$call_status[$q].""; + } + $total_graph_stats[]=""; + $max_totalcalls=1; + $max_totalleads=1; + $max_totalcontacts=1; + $max_totalcontactratio=1; + $max_totalsystemtime=1; + $max_totaltalktime=1; + $max_totalsales=1; + $max_totalsalesleadsratio=1; + $max_totalsalescontactsratio=1; + $max_totalsalesperhour=1; + $max_totalincsales=1; + $max_totalcancelledsales=1; + $max_totalcallbacks=1; + $max_totalfirstcall=1; + $max_totalavgsaletime=1; + $max_totalavgcontacttime=1; + $TOTALGRAPH="

"; + $TOTALGRAPH2="".$GRAPH2.""; + $TOTALGRAPH3="
CALLSLEADSCONTACTSCONTACT RATIOSYSTEM TIMETALK TIMESALESSALES TO LEADS RATIOSALES TO CONTACTS RATIOSALES PER HOURINCOMPLETE SALESCANCELLED SALESCALLBACKSFIRST CALLSAVG SALE TIMEAVG CONTACT TIME

 


"; + $TOTALGRAPH_header=""; + $TOTALCALLS_graph=$TOTALGRAPH_header.""; + $TOTALLEADS_graph=$TOTALGRAPH_header.""; + $TOTALCONTACTS_graph=$TOTALGRAPH_header.""; + $TOTALCONTACTRATIO_graph=$TOTALGRAPH_header.""; + $TOTALSYSTEMTIME_graph=$TOTALGRAPH_header.""; + $TOTALTALKTIME_graph=$TOTALGRAPH_header.""; + $TOTALSALES_graph=$TOTALGRAPH_header.""; + $TOTALSALESLEADSRATIO_graph=$TOTALGRAPH_header.""; + $TOTALSALESCONTACTSRATIO_graph=$TOTALGRAPH_header.""; + $TOTALSALESPERHOUR_graph=$TOTALGRAPH_header.""; + $TOTALINCSALES_graph=$TOTALGRAPH_header.""; + $TOTALCANCELLEDSALES_graph=$TOTALGRAPH_header.""; + $TOTALCALLBACKS_graph=$TOTALGRAPH_header.""; + $TOTALFIRSTCALLS_graph=$TOTALGRAPH_header.""; + $TOTALAVGSALETIME_graph=$TOTALGRAPH_header.""; + $TOTALAVGCONTACTTIME_graph=$TOTALGRAPH_header.""; + for ($q=0; $q".$call_status[$q].""; + } for($i=0; $i<$user_group_ct; $i++) { @@ -425,21 +558,74 @@ if ($SUBMIT=="SUBMIT") $name_rslt=mysql_query($name_stmt, $link); $name_row=mysql_fetch_row($name_rslt); $group_name=$name_row[0]; + for ($q=0; $q0) { + $graph_stats=array(); + $max_calls=1; + $max_leads=1; + $max_contacts=1; + $max_contactratio=1; + $max_systemtime=1; + $max_talktime=1; + $max_sales=1; + $max_salesleadsratio=1; + $max_salescontactsratio=1; + $max_salesperhour=1; + $max_incsales=1; + $max_cancelledsales=1; + $max_callbacks=1; + $max_firstcall=1; + $max_avgsaletime=1; + $max_avgcontacttime=1; + $GRAPH="

CALL CENTER TOTAL
USERCALLS
LEADS
CONTACTS
CONTACT RATIO
SYSTEM TIME
TALK TIME
SALES
SALES TO LEADS RATIO
SALES TO CONTACTS RATIO
SALES PER HOUR
INCOMPLETE SALES
CANCELLED SALES
CALLBACKS
FIRST CALLS
AVG SALE TIME
AVG CONTACT TIME
"; + $STATGRAPH=""; + for ($q=0; $q".$call_status[$q].""; + $max_varname="max_".$call_status[$q]; + $$max_varname=1; + } + + $GRAPH2="".$STATGRAPH.""; + $GRAPH3="
CALLSLEADSCONTACTSCONTACT RATIOSYSTEM TIMETALK TIMESALESSALES TO LEADS RATIOSALES TO CONTACTS RATIOSALES PER HOURINCOMPLETE SALESCANCELLED SALESCALLBACKSFIRST CALLSAVG SALE TIMEAVG CONTACT TIME

 


"; + $graph_header=""; + $CALLS_graph=$graph_header.""; + $LEADS_graph=$graph_header.""; + $CONTACTS_graph=$graph_header.""; + $CONTACTRATIO_graph=$graph_header.""; + $SYSTEMTIME_graph=$graph_header.""; + $TALKTIME_graph=$graph_header.""; + $SALES_graph=$graph_header.""; + $SALESLEADSRATIO_graph=$graph_header.""; + $SALESCONTACTSRATIO_graph=$graph_header.""; + $SALESPERHOUR_graph=$graph_header.""; + $INCSALES_graph=$graph_header.""; + $CANCELLEDSALES_graph=$graph_header.""; + $CALLBACKS_graph=$graph_header.""; + $FIRSTCALLS_graph=$graph_header.""; + $AVGSALETIME_graph=$graph_header.""; + $AVGCONTACTTIME_graph=$graph_header.""; + for ($q=0; $q".$call_status[$q].""; + } + $j=0; - $HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n"; - $HTML_text.="| Agent Name | Agent ID | Calls | Leads | Contacts | Contact Ratio | Nonpause Time | System Time | Talk Time | Sales | Sales per Working Hour | Sales to Leads Ratio | Sales to Contacts Ratio | Sales Per Hour | Incomplete Sales | Cancelled Sales | Callbacks | First Call Resolution | Average Sale Time | Average Contact Time |\n"; - $HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n"; - $CSV_text.="\"\",\"Agent Name\",\"Agent ID\",\"Calls\",\"Leads\",\"Contacts\",\"Contact Ratio\",\"Nonpause Time\",\"System Time\",\"Talk Time\",\"Sales\",\"Sales per Working Hour\",\"Sales to Leads Ratio\",\"Sales to Contacts Ratio\",\"Sales Per Hour\",\"Incomplete Sales\",\"Cancelled Sales\",\"Callbacks\",\"First Call Resolution\",\"Average Sale Time\",\"Average Contact Time\"\n"; + $ASCII_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+$HTMLborderheader\n"; + $ASCII_text.="| Agent Name | Agent ID | Calls | Leads | Contacts | Contact Ratio | Nonpause Time | System Time | Talk Time | Sales | Sales per Working Hour | Sales to Leads Ratio | Sales to Contacts Ratio | Sales Per Hour | Incomplete Sales | Cancelled Sales | Callbacks | First Call Resolution | Average Sale Time | Average Contact Time |$HTMLstatusheader\n"; + $ASCII_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+$HTMLborderheader\n"; + $CSV_text.="\"\",\"Agent Name\",\"Agent ID\",\"Calls\",\"Leads\",\"Contacts\",\"Contact Ratio\",\"Nonpause Time\",\"System Time\",\"Talk Time\",\"Sales\",\"Sales per Working Hour\",\"Sales to Leads Ratio\",\"Sales to Contacts Ratio\",\"Sales Per Hour\",\"Incomplete Sales\",\"Cancelled Sales\",\"Callbacks\",\"First Call Resolution\",\"Average Sale Time\",\"Average Contact Time\"$CSVstatusheader\n"; while ($user_row=mysql_fetch_array($user_rslt)) { $j++; @@ -459,20 +645,20 @@ if ($SUBMIT=="SUBMIT") # Leads $lead_stmt="select count(distinct lead_id) from vicidial_agent_log where lead_id is not null and event_time>='$query_date' and event_time<='$end_date' $group_SQL and user='$user' and user_group='$user_group[$i]'"; - if ($DB) {$HTML_text.="$lead_stmt\n";} + if ($DB) {$ASCII_text.="$lead_stmt\n";} $lead_rslt=mysql_query($lead_stmt, $link); $lead_row=mysql_fetch_row($lead_rslt); $leads=$lead_row[0]; # Callbacks $callback_stmt="select count(*) from vicidial_callbacks where status in ('ACTIVE', 'LIVE') $group_SQL and user='$user' and user_group='$user_group[$i]'"; - if ($DB) {$HTML_text.="$callback_stmt\n";} + if ($DB) {$ASCII_text.="$callback_stmt\n";} $callback_rslt=mysql_query($callback_stmt, $link); $callback_row=mysql_fetch_row($callback_rslt); $callbacks=$callback_row[0]; $stat_stmt="select val.status, val.sub_status, vs.customer_contact, sum(val.talk_sec), sum(val.pause_sec), sum(val.wait_sec), sum(val.dispo_sec), sum(val.dead_sec), count(*) from vicidial_agent_log val, vicidial_statuses vs where val.user='$user' and val.user_group='$user_group[$i]' and val.event_time>='$query_date' and val.event_time<='$end_date' and val.status=vs.status and vs.status in (select status from vicidial_statuses) and val.campaign_id in ($group_SQL_str) group by status, customer_contact UNION select val.status, val.sub_status, vs.customer_contact, sum(val.talk_sec), sum(val.pause_sec), sum(val.wait_sec), sum(val.dispo_sec), sum(val.dead_sec), count(*) from vicidial_agent_log val, vicidial_campaign_statuses vs where val.campaign_id in ($group_SQL_str) and val.user='$user' and val.user_group='$user_group[$i]' and val.event_time>='$query_date' and val.event_time<='$end_date' and val.status=vs.status and val.campaign_id=vs.campaign_id and vs.status in (select distinct status from vicidial_campaign_statuses where ".substr($group_SQL, 4).") group by status, customer_contact"; - if ($DB) {$HTML_text.="$stat_stmt\n";} + if ($DB) {$ASCII_text.="$stat_stmt\n";} $stat_rslt=mysql_query($stat_stmt, $link); while ($stat_row=mysql_fetch_row($stat_rslt)) { @@ -505,11 +691,11 @@ if ($SUBMIT=="SUBMIT") $group_sales_talk_time+=$sales_talk_time_array[$user]; if ($contacts>0) {$average_contact_time=sec_convert(round($contact_talk_time/$contacts), 'H');} else {$average_contact_time="00:00";} - $HTML_text.="| ".sprintf("%-40s", $user_row["full_name"]); - $HTML_text.=" | ".sprintf("%10s", "$user").""; - $HTML_text.=" | ".sprintf("%5s", $calls); $group_calls+=$calls; - $HTML_text.=" | ".sprintf("%5s", $leads); $group_leads+=$leads; - $HTML_text.=" | ".sprintf("%8s", $contacts); $group_contacts+=$contacts; + $ASCII_text.="| ".sprintf("%-40s", $user_row["full_name"]); + $ASCII_text.=" | ".sprintf("%10s", "$user").""; + $ASCII_text.=" | ".sprintf("%5s", $calls); $group_calls+=$calls; + $ASCII_text.=" | ".sprintf("%5s", $leads); $group_leads+=$leads; + $ASCII_text.=" | ".sprintf("%8s", $contacts); $group_contacts+=$contacts; if ($leads>0) { $contact_ratio=sprintf("%.2f", (100*$contacts/$leads)); @@ -518,11 +704,11 @@ if ($SUBMIT=="SUBMIT") { $contact_ratio="0.00"; } - $HTML_text.=" | ".sprintf("%12s", $contact_ratio)."%"; - $HTML_text.=" | ".sprintf("%13s", $user_nonpause_time); - $HTML_text.=" | ".sprintf("%11s", $user_system_time); - $HTML_text.=" | ".sprintf("%9s", $user_talk_time); - $HTML_text.=" | ".sprintf("%5s", $sale_array[$user]); $group_sales+=$sale_array[$user]; + $ASCII_text.=" | ".sprintf("%12s", $contact_ratio)."%"; + $ASCII_text.=" | ".sprintf("%13s", $user_nonpause_time); + $ASCII_text.=" | ".sprintf("%11s", $user_system_time); + $ASCII_text.=" | ".sprintf("%9s", $user_talk_time); + $ASCII_text.=" | ".sprintf("%5s", $sale_array[$user]); $group_sales+=$sale_array[$user]; if ($nonpause_time>0) { $sales_per_working_hours=sprintf("%.2f", ($sale_array[$user]/($nonpause_time/3600))); @@ -531,7 +717,7 @@ if ($SUBMIT=="SUBMIT") { $sales_per_working_hours="0.00"; } - $HTML_text.=" | ".sprintf("%22s", $sales_per_working_hours); + $ASCII_text.=" | ".sprintf("%22s", $sales_per_working_hours); if ($leads>0) { $sales_ratio=sprintf("%.2f", (100*$sale_array[$user]/$leads)); @@ -540,7 +726,7 @@ if ($SUBMIT=="SUBMIT") { $sales_ratio="0.00"; } - $HTML_text.=" | ".sprintf("%19s", $sales_ratio)."%"; + $ASCII_text.=" | ".sprintf("%19s", $sales_ratio)."%"; if ($contacts>0) { $sale_contact_ratio=sprintf("%.2f", (100*$sale_array[$user]/$contacts)); @@ -549,7 +735,7 @@ if ($SUBMIT=="SUBMIT") { $sale_contact_ratio=0; } - $HTML_text.=" | ".sprintf("%22s", $sale_contact_ratio)."%"; + $ASCII_text.=" | ".sprintf("%22s", $sale_contact_ratio)."%"; if ($talk_hours>0) { $sales_per_hour=sprintf("%.2f", ($sale_array[$user]/$talk_hours)); @@ -566,14 +752,71 @@ if ($SUBMIT=="SUBMIT") { $stcall="0.00"; } - $HTML_text.=" | ".sprintf("%14s", $sales_per_hour); - $HTML_text.=" | ".sprintf("%16s", $incomplete_array[$user]); $group_inc_sales+=$incomplete_array[$user]; - $HTML_text.=" | ".sprintf("%15s", $cancel_array[$user]); $group_cnc_sales+=$cancel_array[$user]; - $HTML_text.=" | ".sprintf("%9s", $callbacks); $group_callbacks+=$callbacks; - $HTML_text.=" | ".sprintf("%21s", $stcall); # first call resolution - $HTML_text.=" | ".sprintf("%17s", $average_sale_time); - $HTML_text.=" | ".sprintf("%20s", $average_contact_time)." |\n"; - $CSV_text.="\"$j\",\"$user_row[full_name]\",\"$user\",\"$calls\",\"$leads\",\"$contacts\",\"$contact_ratio %\",\"$user_nonpause_time\",\"$user_system_time\",\"$user_talk_time\",\"$sale_array[$user]\",\"$sales_per_working_hours\",\"$sales_ratio\",\"$sale_contact_ratio\",\"$sales_per_hour\",\"$incomplete_array[$user]\",\"$cancel_array[$user]\",\"$callbacks\",\"$stcall\",\"$average_sale_time\",\"$average_contact_time\"\n"; + + if ($sale_array[$user]>0) {$avg_sale_time=round($sales_talk_time_array[$user]/$sale_array[$user]);} else {$avg_sale_time=0;} + if ($contacts>0) {$avg_contact_time=round($contact_talk_time/$contacts);} else {$avg_contact_time=0;} + $graph_stats[$j][0]=$user_row["full_name"]." - $user"; + $graph_stats[$j][1]=trim($calls); + $graph_stats[$j][2]=trim($leads); + $graph_stats[$j][3]=trim($contacts); + $graph_stats[$j][4]=trim($contact_ratio); + $graph_stats[$j][5]=trim($system_time); + $graph_stats[$j][6]=trim($talk_time); + $graph_stats[$j][7]=trim($sale_array[$user]); + $graph_stats[$j][8]=trim($sales_ratio); + $graph_stats[$j][9]=trim($sale_contact_ratio); + $graph_stats[$j][10]=trim($sales_per_hour); + $graph_stats[$j][11]=trim($incomplete_array[$user]); + $graph_stats[$j][12]=trim($cancel_array[$user]); + $graph_stats[$j][13]=trim($callbacks); + $graph_stats[$j][14]=trim($stcall); + $graph_stats[$j][15]=trim($avg_sale_time); + $graph_stats[$j][16]=trim($avg_contact_time); + + if (trim($calls)>$max_calls) {$max_calls=trim($calls);} + if (trim($leads)>$max_leads) {$max_leads=trim($leads);} + if (trim($contacts)>$max_contacts) {$max_contacts=trim($contacts);} + if (trim($contact_ratio)>$max_contactratio) {$max_contactratio=trim($contact_ratio);} + if (trim($system_time)>$max_systemtime) {$max_systemtime=trim($system_time);} + if (trim($talk_time)>$max_talktime) {$max_talktime=trim($talk_time);} + if (trim($sale_array[$user])>$max_sales) {$max_sales=trim($sale_array[$user]);} + if (trim($sales_ratio)>$max_salesleadsratio) {$max_salesleadsratio=trim($sales_ratio);} + if (trim($sale_contact_ratio)>$max_salescontactsratio) {$max_salescontactsratio=trim($sale_contact_ratio);} + if (trim($sales_per_hour)>$max_salesperhour) {$max_salesperhour=trim($sales_per_hour);} + if (trim($incomplete_array[$user])>$max_incsales) {$max_incsales=trim($incomplete_array[$user]);} + if (trim($cancel_array[$user])>$max_cancelledsales) {$max_cancelledsales=trim($cancel_array[$user]);} + if (trim($callbacks)>$max_callbacks) {$max_callbacks=trim($callbacks);} + if (trim($stcall)>$max_firstcall) {$max_firstcall=trim($stcall);} + if (trim($avg_sale_time)>$max_avgsaletime) {$max_avgsaletime=trim($avg_sale_time);} + if (trim($avg_contact_time)>$max_avgcontacttime) {$max_avgcontacttime=trim($avg_contact_time);} + + $ASCII_text.=" | ".sprintf("%14s", $sales_per_hour); + $ASCII_text.=" | ".sprintf("%16s", $incomplete_array[$user]); $group_inc_sales+=$incomplete_array[$user]; + $ASCII_text.=" | ".sprintf("%15s", $cancel_array[$user]); $group_cnc_sales+=$cancel_array[$user]; + $ASCII_text.=" | ".sprintf("%9s", $callbacks); $group_callbacks+=$callbacks; + $ASCII_text.=" | ".sprintf("%21s", $stcall); # first call resolution + $ASCII_text.=" | ".sprintf("%17s", $average_sale_time); + $ASCII_text.=" | ".sprintf("%20s", $average_contact_time)." |"; + + $CSV_status_text=""; + for ($q=0; $q$Sstatus"; + + $max_varname="max_".$call_status[$q]; + if ($stat_row[0]>$$max_varname) {$$max_varname=$stat_row[0];} + } + $ASCII_text.="\n"; + + $CSV_text.="\"$j\",\"$user_row[full_name]\",\"$user\",\"$calls\",\"$leads\",\"$contacts\",\"$contact_ratio %\",\"$user_nonpause_time\",\"$user_system_time\",\"$user_talk_time\",\"$sale_array[$user]\",\"$sales_per_working_hours\",\"$sales_ratio\",\"$sale_contact_ratio\",\"$sales_per_hour\",\"$incomplete_array[$user]\",\"$cancel_array[$user]\",\"$callbacks\",\"$stcall\",\"$average_sale_time\",\"$average_contact_time\"$CSV_status_text\n"; } ##### GROUP TOTALS ############# @@ -597,10 +840,11 @@ if ($SUBMIT=="SUBMIT") $GROUP_text.="| ".sprintf("%40s", "$group_name"); $GROUP_text.=" | ".sprintf("%10s", "$user_group[$i]"); + $total_graph_stats[$i][0]="$user_group[$i] - $group_name"; - $HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n"; - $HTML_text.="| ".sprintf("%40s", ""); - $HTML_text.=" | ".sprintf("%10s", "TOTALS:"); + $ASCII_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+$HTMLborderheader\n"; + $ASCII_text.="| ".sprintf("%40s", ""); + $ASCII_text.=" | ".sprintf("%10s", "TOTALS:"); $TOTAL_text=" | ".sprintf("%5s", $group_calls); $TOTAL_text.=" | ".sprintf("%5s", $group_leads); @@ -667,16 +911,62 @@ if ($SUBMIT=="SUBMIT") $TOTAL_text.=" | ".sprintf("%9s", $group_callbacks); $TOTAL_text.=" | ".sprintf("%21s", $group_stcall); # first call resolution $TOTAL_text.=" | ".sprintf("%17s", $group_average_sale_time); - $TOTAL_text.=" | ".sprintf("%20s", $group_average_contact_time)." |\n"; + $TOTAL_text.=" | ".sprintf("%20s", $group_average_contact_time)." |"; - $HTML_text.=$TOTAL_text; + $CSV_status_text=""; + for ($q=0; $q$$max_varname) {$$max_varname=$call_status_group_totals[$q];} + } + $TOTAL_text.="\n"; + + if (trim($group_calls)>$max_totalcalls) {$max_totalcalls=trim($group_calls);} + if (trim($group_leads)>$max_totalleads) {$max_totalleads=trim($group_leads);} + if (trim($group_contacts)>$max_totalcontacts) {$max_totalcontacts=trim($group_contacts);} + if (trim($group_contact_ratio)>$max_totalcontactratio) {$max_totalcontactratio=trim($group_contact_ratio);} + if (trim($group_system_time)>$max_totalsystemtime) {$max_totalsystemtime=trim($group_system_time);} + if (trim($group_talk_time)>$max_totaltalktime) {$max_totaltalktime=trim($group_talk_time);} + if (trim($group_sales)>$max_totalsales) {$max_totalsales=trim($group_sales);} + if (trim($group_sales_ratio)>$max_totalsalesleadsratio) {$max_totalsalesleadsratio=trim($group_sales_ratio);} + if (trim($group_sale_contact_ratio)>$max_totalsalescontactsratio) {$max_totalsalescontactsratio=trim($group_sale_contact_ratio);} + if (trim($group_sales_per_hour)>$max_totalsalesperhour) {$max_totalsalesperhour=trim($group_sales_per_hour);} + if (trim($group_inc_sales)>$max_totalincsales) {$max_totalincsales=trim($group_inc_sales);} + if (trim($group_cnc_sales)>$max_totalcancelledsales) {$max_totalcancelledsales=trim($group_cnc_sales);} + if (trim($group_callbacks)>$max_totalcallbacks) {$max_totalcallbacks=trim($group_callbacks);} + if (trim($group_stcall)>$max_totalfirstcall) {$max_totalfirstcall=trim($group_stcall);} + if (trim($group_avg_sale_time)>$max_totalavgsaletime) {$max_totalavgsaletime=trim($group_avg_sale_time);} + if (trim($group_avg_contact_time)>$max_totalavgcontacttime) {$max_totalavgcontacttime=trim($group_avg_contact_time);} + $total_graph_stats[$i][1]=$group_calls; + $total_graph_stats[$i][2]=$group_leads; + $total_graph_stats[$i][3]=$group_contacts; + $total_graph_stats[$i][4]=$group_contact_ratio; + $total_graph_stats[$i][5]=$group_system_time; + $total_graph_stats[$i][6]=$group_talk_time; + $total_graph_stats[$i][7]=$group_sales; + $total_graph_stats[$i][8]=$group_sales_ratio; + $total_graph_stats[$i][9]=$group_sale_contact_ratio; + $total_graph_stats[$i][10]=$group_sales_per_hour; + $total_graph_stats[$i][11]=$group_inc_sales; + $total_graph_stats[$i][12]=$group_cnc_sales; + $total_graph_stats[$i][13]=$group_callbacks; + $total_graph_stats[$i][14]=$group_stcall; + $total_graph_stats[$i][15]=$group_avg_sale_time; + $total_graph_stats[$i][16]=$group_avg_contact_time; + + $ASCII_text.=$TOTAL_text; $GROUP_text.=$TOTAL_text; - $HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n"; - $HTML_text.="\n\n"; + $ASCII_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+$HTMLborderheader\n"; + $ASCII_text.="\n\n"; - $CSV_text.="\"\",\"\",\"TOTALS:\",\"$group_calls\",\"$group_leads\",\"$group_contacts\",\"$group_contact_ratio %\",\"".sec_convert($group_nonpause_time,'H')."\",\"".sec_convert($group_system_time,'H')."\",\"".sec_convert($group_talk_time,'H')."\",\"$group_sales\",\"$sales_per_working_hours\",\"$group_sales_ratio\",\"$group_sale_contact_ratio\",\"$group_sales_per_hour\",\"$group_inc_sales\",\"$group_cnc_sales\",\"$group_callbacks\",\"$group_stcall\",\"$group_average_sale_time\",\"$group_average_contact_time\"\n"; - $GROUP_CSV_text.="\"$i\",\"$group_name\",\"$user_group[$i]\",\"$group_calls\",\"$group_leads\",\"$group_contacts\",\"$group_contact_ratio %\",\"".sec_convert($group_nonpause_time,'H')."\",\"".sec_convert($group_system_time,'H')."\",\"".sec_convert($group_talk_time,'H')."\",\"$group_sales\",\"$sales_per_working_hours\",\"$group_sales_ratio\",\"$group_sale_contact_ratio\",\"$group_sales_per_hour\",\"$group_inc_sales\",\"$group_cnc_sales\",\"$group_callbacks\",\"$group_stcall\",\"$group_average_sale_time\",\"$group_average_contact_time\"\n"; + $CSV_text.="\"\",\"\",\"TOTALS:\",\"$group_calls\",\"$group_leads\",\"$group_contacts\",\"$group_contact_ratio %\",\"".sec_convert($group_nonpause_time,'H')."\",\"".sec_convert($group_system_time,'H')."\",\"".sec_convert($group_talk_time,'H')."\",\"$group_sales\",\"$sales_per_working_hours\",\"$group_sales_ratio\",\"$group_sale_contact_ratio\",\"$group_sales_per_hour\",\"$group_inc_sales\",\"$group_cnc_sales\",\"$group_callbacks\",\"$group_stcall\",\"$group_average_sale_time\",\"$group_average_contact_time\"$CSV_status_text\n"; + $GROUP_CSV_text.="\"$i\",\"$group_name\",\"$user_group[$i]\",\"$group_calls\",\"$group_leads\",\"$group_contacts\",\"$group_contact_ratio %\",\"".sec_convert($group_nonpause_time,'H')."\",\"".sec_convert($group_system_time,'H')."\",\"".sec_convert($group_talk_time,'H')."\",\"$group_sales\",\"$sales_per_working_hours\",\"$group_sales_ratio\",\"$group_sale_contact_ratio\",\"$group_sales_per_hour\",\"$group_inc_sales\",\"$group_cnc_sales\",\"$group_callbacks\",\"$group_stcall\",\"$group_average_sale_time\",\"$group_average_contact_time\"$CSV_status_text\n"; $CSV_text.="\n\n"; $total_calls+=$group_calls; @@ -693,21 +983,107 @@ if ($SUBMIT=="SUBMIT") $total_sales_talk_time+=$group_sales_talk_time; $total_contact_talk_time+=$group_contact_talk_time; + for ($d=1; $d<=count($graph_stats); $d++) { + if ($d==1) {$class=" first";} else if ($d==count($graph_stats)) {$class=" last";} else {$class="";} + $CALLS_graph.=" "; + $LEADS_graph.=" "; + $CONTACTS_graph.=" "; + $CONTACTRATIO_graph.=" "; + $SYSTEMTIME_graph.=" "; + $TALKTIME_graph.=" "; + $SALES_graph.=" "; + $SALESLEADSRATIO_graph.=" "; + $SALESCONTACTSRATIO_graph.=" "; + $SALESPERHOUR_graph.=" "; + $INCSALES_graph.=" "; + $CANCELLEDSALES_graph.=" "; + $CALLBACKS_graph.=" "; + $FIRSTCALLS_graph.=" "; + $AVGSALETIME_graph.=" "; + $AVGCONTACTTIME_graph.=" "; + for ($e=0; $e\n"; + + $$varname.=" "; + } + } + + $CALLS_graph.="
TEAM: $user_group[$i] - $group_name
USERCALLS
LEADS
CONTACTS
CONTACT RATIO
SYSTEM TIME
TALK TIME
SALES
SALES TO LEADS RATIO
SALES TO CONTACTS RATIO
SALES PER HOUR
INCOMPLETE SALES
CANCELLED SALES
CALLBACKS
FIRST CALLS
AVG SALE TIME
AVG CONTACT TIME
".$graph_stats[$d][0]."".$graph_stats[$d][1]."
".$graph_stats[$d][0]."".$graph_stats[$d][2]."
".$graph_stats[$d][0]."".$graph_stats[$d][3]."
".$graph_stats[$d][0]."".$graph_stats[$d][4]."%
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][5], 'H')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][6], 'H')."
".$graph_stats[$d][0]."".$graph_stats[$d][7]."
".$graph_stats[$d][0]."".$graph_stats[$d][8]."%
".$graph_stats[$d][0]."".$graph_stats[$d][9]."%
".$graph_stats[$d][0]."".$graph_stats[$d][10]."
".$graph_stats[$d][0]."".$graph_stats[$d][11]."
".$graph_stats[$d][0]."".$graph_stats[$d][12]."
".$graph_stats[$d][0]."".$graph_stats[$d][13]."
".$graph_stats[$d][0]."".$graph_stats[$d][14]."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][15], 'H')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][16], 'H')."
".$graph_stats[$d][0]."".$graph_stats[$d][($e+17)]."
TOTAL:".trim($group_calls)."
"; + $LEADS_graph.="TOTAL:".trim($group_leads).""; + $CONTACTS_graph.="TOTAL:".trim($group_contacts).""; + $CONTACTRATIO_graph.="TOTAL:".trim($group_contact_ratio)."%"; + $SYSTEMTIME_graph.="TOTAL:".sec_convert($group_system_time,'H').""; + $TALKTIME_graph.="TOTAL:".sec_convert($group_talk_time,'H').""; + $SALES_graph.="TOTAL:".trim($group_sales).""; + $SALESLEADSRATIO_graph.="TOTAL:".trim($group_sales_ratio)."%"; + $SALESCONTACTSRATIO_graph.="TOTAL:".trim($group_sale_contact_ratio)."%"; + $SALESPERHOUR_graph.="TOTAL:".trim($group_sales_per_hour).""; + $INCSALES_graph.="TOTAL:".trim($group_inc_sales).""; + $CANCELLEDSALES_graph.="TOTAL:".trim($group_cnc_sales).""; + $CALLBACKS_graph.="TOTAL:".trim($group_callbacks).""; + $FIRSTCALLS_graph.="TOTAL:".trim($group_stcall).""; + $AVGSALETIME_graph.="TOTAL:".trim($group_average_sale_time).""; + $AVGCONTACTTIME_graph.="TOTAL:".trim($group_average_contact_time).""; + for ($e=0; $e"; + } + $JS_onload.="\tDraw".$user_group[$i]."Graph('CALLS', '1');\n"; + $JS_text.="function Draw".$user_group[$i]."Graph(graph, th_id) {\n"; + $JS_text.=" var CALLS_graph=\"$CALLS_graph\";\n"; + $JS_text.=" var LEADS_graph=\"$LEADS_graph\";\n"; + $JS_text.=" var CONTACTS_graph=\"$CONTACTS_graph\";\n"; + $JS_text.=" var CONTACTRATIO_graph=\"$CONTACTRATIO_graph\";\n"; + $JS_text.=" var SYSTEMTIME_graph=\"$SYSTEMTIME_graph\";\n"; + $JS_text.=" var TALKTIME_graph=\"$TALKTIME_graph\";\n"; + $JS_text.=" var SALES_graph=\"$SALES_graph\";\n"; + $JS_text.=" var SALESLEADSRATIO_graph=\"$SALESLEADSRATIO_graph\";\n"; + $JS_text.=" var SALESCONTACTSRATIO_graph=\"$SALESCONTACTSRATIO_graph\";\n"; + $JS_text.=" var SALESPERHOUR_graph=\"$SALESPERHOUR_graph\";\n"; + $JS_text.=" var INCSALES_graph=\"$INCSALES_graph\";\n"; + $JS_text.=" var CANCELLEDSALES_graph=\"$CANCELLEDSALES_graph\";\n"; + $JS_text.=" var CALLBACKS_graph=\"$CALLBACKS_graph\";\n"; + $JS_text.=" var FIRSTCALLS_graph=\"$FIRSTCALLS_graph\";\n"; + $JS_text.=" var AVGSALETIME_graph=\"$AVGSALETIME_graph\";\n"; + $JS_text.=" var AVGCONTACTTIME_graph=\"$AVGCONTACTTIME_graph\";\n"; + $JS_text.="\n"; + for ($e=0; $e0) { @@ -727,11 +1103,11 @@ if ($SUBMIT=="SUBMIT") } $total_talk_hours=$total_talk_time/3600; - $HTML_text.="| ".sprintf("%40s", ""); - $HTML_text.=" | ".sprintf("%10s", "TOTALS:"); - $HTML_text.=" | ".sprintf("%5s", $total_calls); - $HTML_text.=" | ".sprintf("%5s", $total_leads); - $HTML_text.=" | ".sprintf("%8s", $total_contacts); + $ASCII_text.="| ".sprintf("%40s", ""); + $ASCII_text.=" | ".sprintf("%10s", "TOTALS:"); + $ASCII_text.=" | ".sprintf("%5s", $total_calls); + $ASCII_text.=" | ".sprintf("%5s", $total_leads); + $ASCII_text.=" | ".sprintf("%8s", $total_contacts); if ($total_leads>0) { $total_contact_ratio=sprintf("%.2f", (100*$total_contacts/$total_leads)); @@ -740,11 +1116,11 @@ if ($SUBMIT=="SUBMIT") { $total_contact_ratio="0.00"; } - $HTML_text.=" | ".sprintf("%12s", $total_contact_ratio)."%"; - $HTML_text.=" | ".sprintf("%13s", sec_convert($total_nonpause_time,'H')); - $HTML_text.=" | ".sprintf("%11s", sec_convert($total_system_time,'H')); - $HTML_text.=" | ".sprintf("%9s", sec_convert($total_talk_time,'H')); - $HTML_text.=" | ".sprintf("%5s", $total_sales); + $ASCII_text.=" | ".sprintf("%12s", $total_contact_ratio)."%"; + $ASCII_text.=" | ".sprintf("%13s", sec_convert($total_nonpause_time,'H')); + $ASCII_text.=" | ".sprintf("%11s", sec_convert($total_system_time,'H')); + $ASCII_text.=" | ".sprintf("%9s", sec_convert($total_talk_time,'H')); + $ASCII_text.=" | ".sprintf("%5s", $total_sales); if ($total_nonpause_time>0) { $sales_per_working_hours=sprintf("%.2f", ($total_sales/($total_nonpause_time/3600))); @@ -753,7 +1129,7 @@ if ($SUBMIT=="SUBMIT") { $sales_per_working_hours="0.00"; } - $HTML_text.=" | ".sprintf("%22s", $sales_per_working_hours); + $ASCII_text.=" | ".sprintf("%22s", $sales_per_working_hours); if ($total_leads>0) { $total_sales_ratio=sprintf("%.2f", (100*$total_sales/$total_leads)); @@ -762,7 +1138,7 @@ if ($SUBMIT=="SUBMIT") { $total_sales_ratio="0.00"; } - $HTML_text.=" | ".sprintf("%19s", $total_sales_ratio)."%"; + $ASCII_text.=" | ".sprintf("%19s", $total_sales_ratio)."%"; if ($total_contacts>0) { $total_sale_contact_ratio=sprintf("%.2f", (100*$total_sales/$total_contacts)); @@ -771,7 +1147,7 @@ if ($SUBMIT=="SUBMIT") { $total_sale_contact_ratio=0; } - $HTML_text.=" | ".sprintf("%22s", $total_sale_contact_ratio)."%"; + $ASCII_text.=" | ".sprintf("%22s", $total_sale_contact_ratio)."%"; if ($total_talk_hours>0) { $total_sales_per_hour=sprintf("%.2f", ($total_sales/$total_talk_hours)); @@ -788,22 +1164,122 @@ if ($SUBMIT=="SUBMIT") { $total_stcall="0.00"; } - $HTML_text.=" | ".sprintf("%14s", $total_sales_per_hour); - $HTML_text.=" | ".sprintf("%16s", $total_inc_sales); - $HTML_text.=" | ".sprintf("%15s", $total_cnc_sales); - $HTML_text.=" | ".sprintf("%9s", $total_callbacks); - $HTML_text.=" | ".sprintf("%21s", $total_stcall); # first call resolution - $HTML_text.=" | ".sprintf("%17s", $total_average_sale_time); - $HTML_text.=" | ".sprintf("%20s", $total_average_contact_time)." |\n"; - $HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+---------------+-------------+-----------+-------+------------------------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n"; - $HTML_text.=""; - $HTML_text.="\n"; - $HTML_text.="\n"; + $ASCII_text.=" | ".sprintf("%14s", $total_sales_per_hour); + $ASCII_text.=" | ".sprintf("%16s", $total_inc_sales); + $ASCII_text.=" | ".sprintf("%15s", $total_cnc_sales); + $ASCII_text.=" | ".sprintf("%9s", $total_callbacks); + $ASCII_text.=" | ".sprintf("%21s", $total_stcall); # first call resolution + $ASCII_text.=" | ".sprintf("%17s", $total_average_sale_time); + $ASCII_text.=" | ".sprintf("%20s", $total_average_contact_time)." |"; + + $CSV_status_text=""; + for ($q=0; $q".$total_graph_stats[$d][1].""; + $TOTALLEADS_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][2].""; + $TOTALCONTACTS_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][3].""; + $TOTALCONTACTRATIO_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][4]."%"; + $TOTALSYSTEMTIME_graph.=" ".$total_graph_stats[$d][0]."".sec_convert($total_graph_stats[$d][5], 'H').""; + $TOTALTALKTIME_graph.=" ".$total_graph_stats[$d][0]."".sec_convert($total_graph_stats[$d][6], 'H').""; + $TOTALSALES_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][7].""; + $TOTALSALESLEADSRATIO_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][8]."%"; + $TOTALSALESCONTACTSRATIO_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][9]."%"; + $TOTALSALESPERHOUR_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][10].""; + $TOTALINCSALES_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][11].""; + $TOTALCANCELLEDSALES_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][12].""; + $TOTALCALLBACKS_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][13].""; + $TOTALFIRSTCALLS_graph.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][14].""; + $TOTALAVGSALETIME_graph.=" ".$total_graph_stats[$d][0]."".sec_convert($total_graph_stats[$d][15], 'H').""; + $TOTALAVGCONTACTTIME_graph.=" ".$total_graph_stats[$d][0]."".sec_convert($total_graph_stats[$d][16], 'H').""; + + for ($e=0; $e\n"; + + $$varname.=" ".$total_graph_stats[$d][0]."".$total_graph_stats[$d][($e+17)].""; + } + + } + + $TOTALCALLS_graph.="TOTAL:".trim($total_calls).""; + $TOTALLEADS_graph.="TOTAL:".trim($total_leads).""; + $TOTALCONTACTS_graph.="TOTAL:".trim($total_contacts).""; + $TOTALCONTACTRATIO_graph.="TOTAL:".trim($total_contact_ratio)."%"; + $TOTALSYSTEMTIME_graph.="TOTAL:".sec_convert($total_system_time,'H').""; + $TOTALTALKTIME_graph.="TOTAL:".sec_convert($total_talk_time,'H').""; + $TOTALSALES_graph.="TOTAL:".trim($total_sales).""; + $TOTALSALESLEADSRATIO_graph.="TOTAL:".trim($total_sales_ratio)."%"; + $TOTALSALESCONTACTSRATIO_graph.="TOTAL:".trim($total_sale_contact_ratio)."%"; + $TOTALSALESPERHOUR_graph.="TOTAL:".trim($total_sales_per_hour).""; + $TOTALINCSALES_graph.="TOTAL:".trim($total_inc_sales).""; + $TOTALCANCELLEDSALES_graph.="TOTAL:".trim($total_cnc_sales).""; + $TOTALCALLBACKS_graph.="TOTAL:".trim($total_callbacks).""; + $TOTALFIRSTCALLS_graph.="TOTAL:".trim($total_stcall).""; + $TOTALAVGSALETIME_graph.="TOTAL:".trim($total_average_sale_time).""; + $TOTALAVGCONTACTTIME_graph.="TOTAL:".trim($total_average_contact_time).""; + for ($e=0; $e"; + } + $JS_onload.="\tDrawTotalGraph('CALLS', '1');\n"; + $JS_text.="function DrawTotalGraph(graph, th_id) {\n"; + $JS_text.=" var CALLS_graph=\"$TOTALCALLS_graph\";\n"; + $JS_text.=" var LEADS_graph=\"$TOTALLEADS_graph\";\n"; + $JS_text.=" var CONTACTS_graph=\"$TOTALCONTACTS_graph\";\n"; + $JS_text.=" var CONTACTRATIO_graph=\"$TOTALCONTACTRATIO_graph\";\n"; + $JS_text.=" var SYSTEMTIME_graph=\"$TOTALSYSTEMTIME_graph\";\n"; + $JS_text.=" var TALKTIME_graph=\"$TOTALTALKTIME_graph\";\n"; + $JS_text.=" var SALES_graph=\"$TOTALSALES_graph\";\n"; + $JS_text.=" var SALESLEADSRATIO_graph=\"$TOTALSALESLEADSRATIO_graph\";\n"; + $JS_text.=" var SALESCONTACTSRATIO_graph=\"$TOTALSALESCONTACTSRATIO_graph\";\n"; + $JS_text.=" var SALESPERHOUR_graph=\"$TOTALSALESPERHOUR_graph\";\n"; + $JS_text.=" var INCSALES_graph=\"$TOTALINCSALES_graph\";\n"; + $JS_text.=" var CANCELLEDSALES_graph=\"$TOTALCANCELLEDSALES_graph\";\n"; + $JS_text.=" var CALLBACKS_graph=\"$TOTALCALLBACKS_graph\";\n"; + $JS_text.=" var FIRSTCALLS_graph=\"$TOTALFIRSTCALLS_graph\";\n"; + $JS_text.=" var AVGSALETIME_graph=\"$TOTALAVGSALETIME_graph\";\n"; + $JS_text.=" var AVGCONTACTTIME_graph=\"$TOTALAVGCONTACTTIME_graph\";\n"; + for ($e=0; $e0) @@ -831,8 +1307,21 @@ if ($file_download>0) else { header("Content-type: text/html; charset=utf-8"); + $JS_onload.="}\n"; + $JS_text.=$JS_onload; + $JS_text.="\n"; + + if ($report_display_type=="HTML") + { + $HTML_text.=$GRAPH_text; + } + else + { + $HTML_text.=$ASCII_text; + } echo $HTML_head; + echo $JS_text; $short_header=1; require("admin_header.php"); echo $HTML_text;