diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index a8a484e7..3b05d912 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -815,6 +815,13 @@ OTHER CHANGES: index the vendor_lead_code field in the vicidial_list table: CREATE INDEX vendor_lead_code on vicidial_list (vendor_lead_code); +185. Added Dialer Inventory Report options for excluding lists and ranking + shifts display order. + +186. Added User Group multi-selection option to the real-time report. + +187. Added HTML bar chart display options to most of the reports. + diff --git a/agc_2-X/trunk/bin/AST_dialer_inventory_snapshot.pl b/agc_2-X/trunk/bin/AST_dialer_inventory_snapshot.pl index aa33bbdd..f6acd8c1 100644 --- a/agc_2-X/trunk/bin/AST_dialer_inventory_snapshot.pl +++ b/agc_2-X/trunk/bin/AST_dialer_inventory_snapshot.pl @@ -2,7 +2,7 @@ # # AST_dialer_inventory_snapshot.pl # -# Copyright (C) 2011 Joe Johnson LICENSE: AGPLv2 +# Copyright (C) 2012 Joe Johnson LICENSE: AGPLv2 # Matt Florell # # NOTES: @@ -17,6 +17,7 @@ # 111106-1317 - Added help screen and debug output, reformatting # 111110-0652 - Added single campaign/list options and call time override option # 111230-1140 - Debugging additions and more minor changes +# 120221-2238 - Added list option for inventory_report, use list_description # use DBI; @@ -200,7 +201,7 @@ while(@shift_row=$shift_rslt->fetchrow_array) if ($DB > 0) {print "SHIFT COUNT: $i\n";} -$campaign_stmt="SELECT campaign_id from vicidial_campaigns where campaign_id in (SELECT distinct campaign_id from vicidial_lists) $campaign_SQL order by campaign_id;"; +$campaign_stmt="SELECT campaign_id from vicidial_campaigns where campaign_id in (SELECT distinct campaign_id from vicidial_lists where inventory_report='Y') $campaign_SQL order by campaign_id;"; $campaign_rslt=$dbhA->prepare($campaign_stmt); $campaign_rslt->execute(); while (@group=$campaign_rslt->fetchrow_array) @@ -248,7 +249,7 @@ while (@group=$campaign_rslt->fetchrow_array) if ($DB > 0) {print "CAMPAIGN: $group[0] LIMIT: $call_count_limit TARGET: $call_count_target STATUSES: $i\n";} - $lists_stmt="SELECT list_id, list_name, list_description, if(list_lastcalldate is null, '*** Not called *** ', list_lastcalldate) as list_lastcalldate from vicidial_lists where (campaign_id='$group[0]') $list_SQL order by list_id asc"; + $lists_stmt="SELECT list_id, list_name, list_description, if(list_lastcalldate is null, '*** Not called *** ', list_lastcalldate) as list_lastcalldate from vicidial_lists where (campaign_id='$group[0]') and inventory_report='Y' $list_SQL order by list_id asc"; if ($DBX > 0) {print " |$lists_stmt|\n";} $lists_rslt=$dbhB->prepare($lists_stmt); $lists_rslt->execute(); @@ -352,7 +353,7 @@ while (@group=$campaign_rslt->fetchrow_array) $shift_data.="$val,$shift_count|"; } $shift_data=substr($shift_data,0,-1); - $ins_stmt="insert into dialable_inventory_snapshots(snapshot_time, list_id, list_name, campaign_id, list_lastcalldate, list_start_inv, dialable_count, dialable_count_nofilter, dialable_count_oneoff, dialable_count_inactive, average_call_count, penetration, shift_data, time_setting) values('$snapshot_time', '$list_id', '$list_name', '$group[0]', '$last_calldate', '$list_start_inv', '$Xdialable_count', '$Xdialable_count_nofilter', '$oneoff_count', '$Xdialable_inactive_count', '$average_calls', '$penetration', '$shift_data', '$time_setting')"; + $ins_stmt="insert into dialable_inventory_snapshots(snapshot_time, list_id, list_name, list_description, campaign_id, list_lastcalldate, list_start_inv, dialable_count, dialable_count_nofilter, dialable_count_oneoff, dialable_count_inactive, average_call_count, penetration, shift_data, time_setting) values('$snapshot_time', '$list_id', '$list_name', '$list_description', '$group[0]', '$last_calldate', '$list_start_inv', '$Xdialable_count', '$Xdialable_count_nofilter', '$oneoff_count', '$Xdialable_inactive_count', '$average_calls', '$penetration', '$shift_data', '$time_setting')"; if ($DBX > 0) {print " |$ins_stmt|\n";} $ins_rslt=$dbh->prepare($ins_stmt); $ins_rslt->execute(); diff --git a/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt b/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt index 1e81dc54..e724997b 100644 --- a/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt +++ b/agc_2-X/trunk/docs/SCRATCH_INSTALL.txt @@ -2458,6 +2458,9 @@ SUBPHASE 6.5: setting up astguiclient scripts for continuous running #32 0 * * * /usr/share/astguiclient/AST_VDsales_export.pl #42 0 * * * /usr/share/astguiclient/AST_sourceID_summary_export.pl +### inventory report optional +#1 7 * * * /usr/share/astguiclient/AST_dialer_inventory_snapshot.pl -q --override-24hours + ### remove old recordings more than 7 days old #24 0 * * * /usr/bin/find /var/spool/asterisk/monitorDONE -maxdepth 2 -type f -mtime +7 -print | xargs rm -f diff --git a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql index b2993fcf..054b3b43 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -872,7 +872,8 @@ xferconf_d_number VARCHAR(50) default '', xferconf_e_number VARCHAR(50) default '', web_form_address TEXT, web_form_address_two TEXT, -time_zone_setting ENUM('COUNTRY_AND_AREA_CODE','POSTAL_CODE','NANPA_PREFIX','OWNER_TIME_ZONE_CODE') default 'COUNTRY_AND_AREA_CODE' +time_zone_setting ENUM('COUNTRY_AND_AREA_CODE','POSTAL_CODE','NANPA_PREFIX','OWNER_TIME_ZONE_CODE') default 'COUNTRY_AND_AREA_CODE', +inventory_report ENUM('Y','N') default 'Y' ); CREATE TABLE vicidial_statuses ( @@ -1641,6 +1642,7 @@ shift_length VARCHAR(5) default '16:00', shift_weekdays VARCHAR(7) default '0123456', report_option ENUM('Y','N') default 'N', user_group VARCHAR(20) default '---ALL---', +report_rank SMALLINT(5) default '1', index (shift_id) ); @@ -2794,7 +2796,7 @@ CREATE TABLE vicidial_log_noanswer_archive LIKE vicidial_log_noanswer; CREATE TABLE vicidial_did_agent_log_archive LIKE vicidial_did_agent_log; CREATE UNIQUE INDEX vdala on vicidial_did_agent_log_archive (uniqueid,call_date,did_route); -UPDATE system_settings SET db_schema_version='1313',db_schema_update_date=NOW(); +UPDATE system_settings SET db_schema_version='1314',db_schema_update_date=NOW(); GRANT RELOAD ON *.* TO cron@'%'; GRANT RELOAD ON *.* TO cron@localhost; diff --git a/agc_2-X/trunk/extras/upgrade_2.4.sql b/agc_2-X/trunk/extras/upgrade_2.4.sql index e58dda8d..9dce78bb 100644 --- a/agc_2-X/trunk/extras/upgrade_2.4.sql +++ b/agc_2-X/trunk/extras/upgrade_2.4.sql @@ -1261,3 +1261,9 @@ index (user) ); UPDATE system_settings SET db_schema_version='1313',db_schema_update_date=NOW() where db_schema_version < 1313; + +ALTER TABLE vicidial_lists ADD inventory_report ENUM('Y','N') default 'Y'; + +ALTER TABLE vicidial_shifts ADD report_rank SMALLINT(5) default '1'; + +UPDATE system_settings SET db_schema_version='1314',db_schema_update_date=NOW() where db_schema_version < 1314; diff --git a/agc_2-X/trunk/install.pl b/agc_2-X/trunk/install.pl index 3926a7f9..5e659c72 100644 --- a/agc_2-X/trunk/install.pl +++ b/agc_2-X/trunk/install.pl @@ -2,7 +2,7 @@ # install.pl version 2.4 # -# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES @@ -25,6 +25,7 @@ # 101217-0520 - Added PREPROCESS directory # 110619-2153 - Added languages install and conf file specify options # 110812-1510 - Added tts sound directories creation +# 120224-1614 - Added function to clear out web auth log files # ############################################ @@ -2522,6 +2523,12 @@ if ($NOWEB < 1) `chmod 0777 $PATHweb/vicidial/ploticus/`; `chmod 0777 $PATHweb/vicidial/agent_reports/`; `chmod 0777 $PATHweb/vicidial/server_reports/`; + `cp -f /dev/null $PATHweb/vicidial/project_auth_entries.txt`; + `chmod 0777 $PATHweb/vicidial/project_auth_entries.txt`; + `cp -f /dev/null $PATHweb/agc/vicidial_auth_entries.txt`; + `chmod 0777 $PATHweb/agc/vicidial_auth_entries.txt`; + `cp -f /dev/null $PATHweb/agc/astguiclient_auth_entries.txt`; + `chmod 0777 $PATHweb/agc/astguiclient_auth_entries.txt`; } if ( ($PROMPTcopy_web_lang =~ /y/i) || ($CLIcopy_web_lang =~ /y/i) ) diff --git a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt index baa6d94b..b35bd129 100644 --- a/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt +++ b/agc_2-X/trunk/translations/raw_translation_files/TO_BE_TRANSLATED_2.4.txt @@ -832,6 +832,10 @@ Maximum System Stats Reports|| These statistics are cached totals that are stored throughout each day in real-time through back-end processes. For inbound calls, the total calls per in-group are calculated for each call that enters the process that calculates. For the whole system counts, the totals are generated from log entries as well as other in-group and campaign totals. These totals may not add up due to the settings that you have in your system as well as when the call is hung up|| Hopper VLC Dup Check|| Setting this to Y will result in every lead being inserted into the hopper being checked by vendor_lead_code to make sure there are no duplicate leads inserted with the same vendor_lead_code. This is most useful when Auto-Alt-Dialing with MULTI_LEAD. Default is N|| +Inventory Report|| +If the Inventory Report is enabled on your system, this option will determine whether this list is included in the report or not. Default is Y for yes|| +Report Rank|| +This option allows you to rank shifts in selected reports that support this option|| lead_report_export.php diff --git a/agc_2-X/trunk/www/agc/SCRIPT_virido_crm_call.php b/agc_2-X/trunk/www/agc/SCRIPT_virido_crm_call.php new file mode 100644 index 00000000..17a8a903 --- /dev/null +++ b/agc_2-X/trunk/www/agc/SCRIPT_virido_crm_call.php @@ -0,0 +1,112 @@ + +# +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 +# +# +# CHANGES: +# 120223-1156 - First Build +# + +if (isset($_GET["button_id"])) {$button_id=$_GET["button_id"];} + elseif (isset($_POST["button_id"])) {$button_id=$_POST["button_id"];} +if (isset($_GET["lead_id"])) {$lead_id=$_GET["lead_id"];} + elseif (isset($_POST["lead_id"])) {$lead_id=$_POST["lead_id"];} +if (isset($_GET["vendor_id"])) {$vendor_id=$_GET["vendor_id"];} + elseif (isset($_POST["vendor_id"])) {$vendor_id=$_POST["vendor_id"];} +if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} + elseif (isset($_POST["list_id"])) {$list_id=$_POST["list_id"];} +if (isset($_GET["phone_number"])) {$phone_number=$_GET["phone_number"];} + elseif (isset($_POST["phone_number"])) {$phone_number=$_POST["phone_number"];} +if (isset($_GET["user"])) {$user=$_GET["user"];} + elseif (isset($_POST["user"])) {$user=$_POST["user"];} +if (isset($_GET["user_custom_five"])) {$user_custom_five=$_GET["user_custom_five"];} + elseif (isset($_POST["user_custom_five"])) {$user_custom_five=$_POST["user_custom_five"];} +if (isset($_GET["campaign"])) {$campaign=$_GET["campaign"];} + elseif (isset($_POST["campaign"])) {$campaign=$_POST["campaign"];} +if (isset($_GET["stage"])) {$stage=$_GET["stage"];} + elseif (isset($_POST["stage"])) {$stage=$_POST["stage"];} +if (isset($_GET["epoch"])) {$epoch=$_GET["epoch"];} + elseif (isset($_POST["epoch"])) {$epoch=$_POST["epoch"];} + +### security strip all non-alphanumeric characters out of the variables ### +$button_id=ereg_replace("[^0-9]","",$button_id); +$lead_id=ereg_replace("[^0-9]","",$lead_id); +$list_id=ereg_replace("[^0-9]","",$list_id); +$phone_number=ereg_replace("[^0-9]","",$phone_number); +$vendor_id = ereg_replace("[^- \:\/\_0-9a-zA-Z]","",$vendor_id); +$user=ereg_replace("[^0-9a-zA-Z]","",$user); +$campaign = ereg_replace("[^-\_0-9a-zA-Z]","",$campaign); +$stage = ereg_replace("[^-\_0-9a-zA-Z]","",$stage); +$epoch = ereg_replace("[^0-9]","",$epoch); + +require("dbconnect.php"); + +if (eregi("CLICK",$stage)) + { + $epochNOW = date("U"); + $click_seconds = ($epochNOW - $epoch); + if ( ($click_seconds < 0) or ($click_seconds > 3600) ) + {$click_seconds=0;} + + $stmt="UPDATE qr_busy_button_log SET stage='$stage',click_seconds='$click_seconds' where button_id='$button_id';"; + if ($DB) {echo "|$stmt|\n";} + $rslt=mysql_query($stmt, $link); + + echo "Thank you for clicking the button\n"; + + exit; + } + +else + { + $CL=':'; + $script_name = getenv("SCRIPT_NAME"); + $server_name = getenv("SERVER_NAME"); + $server_port = getenv("SERVER_PORT"); + if (eregi("443",$server_port)) {$HTTPprotocol = 'https://';} + else {$HTTPprotocol = 'http://';} + if (($server_port == '80') or ($server_port == '443') ) {$server_port='';} + else {$server_port = "$CL$server_port";} + $agcPAGE = "$HTTPprotocol$server_name$server_port$script_name"; + + $epoch = date("U"); + $SQLdate = date("Y-m-d H:i:s"); + +# $stmt="INSERT INTO qr_busy_button_log SET lead_id='$lead_id',list_id='$list_id',phone_number='$phone_number',vendor_lead_code='$vendor_id',user='$user',campaign_id='$campaign',stage='DISPLAY',event_time='$SQLdate';"; +# if ($DB) {echo "|$stmt|\n";} +# $rslt=mysql_query($stmt, $link); +# $button_id = mysql_insert_id($link); + + +# Client_Code: XYZ (Default) +# Vendor_Code: ABC (Default) +# Campaign_Code: XX12 (Default) +# BTN: Outbound Dialed Phone number as specified in the lead file (This number will be used to identify the record from the lead file) +# User_Name: This is the Agent Id of the CSR which are used in the daily files sent to us for import. These Ids will also be used by the agent to log into the scripting application + + $virido_url = 'http://iconnect1.intellicomsoftware.com/script/dialercall.aspx'; + + echo "Client_Code: XYZ
\n"; + echo "Vendor_Code: ABC
\n"; + echo "Campaign_Code: XX12
\n"; + echo "User_Name: $user_custom_five
\n"; + echo "BTN: $phone_number
\n"; + echo "
\n"; + + echo "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
\n\n"; + } + +?> + diff --git a/agc_2-X/trunk/www/agc/astguiclient.php b/agc_2-X/trunk/www/agc/astguiclient.php index 7424e159..432c7c0d 100644 --- a/agc_2-X/trunk/www/agc/astguiclient.php +++ b/agc_2-X/trunk/www/agc/astguiclient.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # make sure you have added a user to the vicidial_users MySQL table with at least # user_level 1 or greater to access this page. Also you need to have the login @@ -58,6 +58,7 @@ # 60829-1528 - Made compatible with WeBRooTWritablE setting in dbconnect.php # 90508-0727 - Changed to PHP long tags # 91129-2211 - Replaced SELECT STAR in SQL query +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -89,8 +90,8 @@ $user_abb = "$user$user$user$user"; while ( (strlen($user_abb) > 4) and ($forever_stop < 200) ) {$user_abb = eregi_replace("^.","",$user_abb); $forever_stop++;} -$version = '2.2.0'; -$build = '91129-2211'; +$version = '2.2.4-1'; +$build = '120223-2124'; ### security strip all non-alphanumeric characters out of the variables ### $DB=ereg_replace("[^0-9a-z]","",$DB); @@ -187,7 +188,7 @@ else $LOGfullname=$row[0]; if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -195,7 +196,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/agc/deactivate_lead.php b/agc_2-X/trunk/www/agc/deactivate_lead.php index 1320f249..3116a25c 100644 --- a/agc_2-X/trunk/www/agc/deactivate_lead.php +++ b/agc_2-X/trunk/www/agc/deactivate_lead.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to be used in the "Dispo URL" field of a campaign # or in-group. It should take in the campaign_id to check for the same source_id @@ -23,6 +23,7 @@ # # CHANGES # 100304-0354 - First Build +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # $api_script = 'deactivate'; @@ -196,6 +197,6 @@ else if ($log_to_file > 0) { $fp = fopen ("./deactivate_lead.txt", "a"); - fwrite ($fp, "$NOW_TIME|$lead_id|$search_field|$search_value|$campaign_check|$sale_status|$dispo|$new_status|$user|$pass|$DB|$log_to_file|$MESSAGE|\n"); + fwrite ($fp, "$NOW_TIME|$lead_id|$search_field|$search_value|$campaign_check|$sale_status|$dispo|$new_status|$user|XXXX|$DB|$log_to_file|$MESSAGE|\n"); fclose($fp); } diff --git a/agc_2-X/trunk/www/agc/dispo_move_list.php b/agc_2-X/trunk/www/agc/dispo_move_list.php index 23f235e9..7f465b11 100644 --- a/agc_2-X/trunk/www/agc/dispo_move_list.php +++ b/agc_2-X/trunk/www/agc/dispo_move_list.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This script is designed to be used in the "Dispo URL" field of a campaign # or in-group. It should take in the lead_id to check for the same lead_id @@ -30,6 +30,7 @@ # 100915-1600 - First Build # 110702-2020 - Added multiple sets of options # 111005-1102 - Added check and update for scheduled callback entry +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # $api_script = 'deactivate'; @@ -226,6 +227,6 @@ else if ($log_to_file > 0) { $fp = fopen ("./dispo_move_list.txt", "a"); - fwrite ($fp, "$NOW_TIME|$k|$lead_id|$new_list_id|$sale_status|$dispo|$user|$pass|$DB|$log_to_file|$MESSAGE|\n"); + fwrite ($fp, "$NOW_TIME|$k|$lead_id|$new_list_id|$sale_status|$dispo|$user|XXXX|$DB|$log_to_file|$MESSAGE|\n"); fclose($fp); } diff --git a/agc_2-X/trunk/www/agc/phone_only.php b/agc_2-X/trunk/www/agc/phone_only.php index dbc3cefc..7cc7a757 100644 --- a/agc_2-X/trunk/www/agc/phone_only.php +++ b/agc_2-X/trunk/www/agc/phone_only.php @@ -1,15 +1,16 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGELOG # 110511-1336 - First Build # 110526-1757 - Added webphone_auto_answer option +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # -$version = '2.4-2p'; -$build = '110526-1757'; +$version = '2.4-3p'; +$build = '120223-2124'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=72; $one_mysql_log=0; @@ -287,7 +288,7 @@ else if ($WeBRooTWritablE > 0) { - fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } $user_abb = "$VD_login$VD_login$VD_login$VD_login"; @@ -299,7 +300,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); fclose($fp); } $VDloginDISPLAY=1; diff --git a/agc_2-X/trunk/www/agc/vdc_db_query.php b/agc_2-X/trunk/www/agc/vdc_db_query.php index 9ab690a9..150f7e07 100644 --- a/agc_2-X/trunk/www/agc/vdc_db_query.php +++ b/agc_2-X/trunk/www/agc/vdc_db_query.php @@ -303,10 +303,11 @@ # 111201-1443 - Added group_grade option # 120104-2031 - Fixed missing fullname variable before dispo and start URLs # 120213-1700 - Added vendor_lead_code to all vicidial_hopper inserts +# 120221-2125 - Manual dials update lastcalldate, and other small changes # -$version = '2.4-203'; -$build = '120213-1700'; +$version = '2.4-204'; +$build = '120221-2125'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=438; $one_mysql_log=0; @@ -2336,7 +2337,12 @@ if ($ACTION == 'manDiaLnextCaLL') if ($format=='debug') {echo "\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00032',$user,$server_ip,$session_name,$one_mysql_log);} - + + $stmt="UPDATE vicidial_lists set list_lastcalldate=NOW() where list_id='$list_id';"; + if ($format=='debug') {echo "\n";} + $rslt=mysql_query($stmt, $link); + if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00XXX',$user,$server_ip,$session_name,$one_mysql_log);} + $campaign_cid_override=''; $LISTweb_form_address=''; $LISTweb_form_address_two=''; @@ -2627,7 +2633,7 @@ if ($ACTION == 'manDiaLnextCaLL') $VDCL_xferconf_c_number=''; $VDCL_xferconf_d_number=''; $VDCL_xferconf_e_number=''; - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00277',$user,$server_ip,$session_name,$one_mysql_log);} @@ -2644,7 +2650,7 @@ if ($ACTION == 'manDiaLnextCaLL') if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00278',$user,$server_ip,$session_name,$one_mysql_log);} @@ -3322,7 +3328,7 @@ if ($ACTION == 'manDiaLlookCaLL') { $wait_sec=0; $dead_epochSQL = ''; - $stmt = "select wait_epoch,wait_sec,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00053',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4508,7 +4514,7 @@ if ($stage == "end") $dead_secSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT talk_epoch,talk_sec,wait_sec,wait_epoch,lead_id,comments,dead_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00101',$user,$server_ip,$session_name,$one_mysql_log);} @@ -4951,7 +4957,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### Check for List ID override settings if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00281',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5024,7 +5030,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - $stmt = "select count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; + $stmt = "SELECT count(*) from vicidial_log where lead_id='$lead_id' and uniqueid='$uniqueid';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00118',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5048,7 +5054,7 @@ if ($ACTION == 'VDADcheckINCOMING') $script_recording_delay = $row[0]; } - $stmt = "select group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination from vicidial_inbound_groups where group_id='$VDADchannel_group';"; + $stmt = "SELECT group_name,group_color,web_form_address,fronter_display,ingroup_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_xfer_group,ingroup_recording_override,ingroup_rec_filename,default_group_alias,web_form_address_two,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,uniqueid_status_display,uniqueid_status_prefix,timer_action_destination from vicidial_inbound_groups where group_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00119',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5083,7 +5089,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_uniqueid_status_prefix = $row[24]; $VDCL_timer_action_destination = $row[25]; - $stmt = "select campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT campaign_script,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination from vicidial_campaigns where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00181',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5138,7 +5144,7 @@ if ($ACTION == 'VDADcheckINCOMING') } } - $stmt = "select group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_inbound_group_agents where group_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00188',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5151,7 +5157,7 @@ if ($ACTION == 'VDADcheckINCOMING') if (strlen($VDCL_group_web_vars) < 1) { - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$campaign' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00189',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5173,7 +5179,7 @@ if ($ACTION == 'VDADcheckINCOMING') } else { - $stmt = "select campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination from vicidial_campaigns where campaign_id='$VDADchannel_group';"; + $stmt = "SELECT campaign_script,get_call_launch,xferconf_a_dtmf,xferconf_a_number,xferconf_b_dtmf,xferconf_b_number,default_group_alias,timer_action,timer_action_message,timer_action_seconds,start_call_url,dispo_call_url,xferconf_c_number,xferconf_d_number,xferconf_e_number,timer_action_destination from vicidial_campaigns where campaign_id='$VDADchannel_group';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00121',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5212,7 +5218,7 @@ if ($ACTION == 'VDADcheckINCOMING') $script_recording_delay = $row[0]; } - $stmt = "select group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; + $stmt = "SELECT group_web_vars from vicidial_campaign_agents where campaign_id='$VDADchannel_group' and user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00190',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5227,7 +5233,7 @@ if ($ACTION == 'VDADcheckINCOMING') $VDCL_caller_id_number=''; if (strlen($VDCL_default_group_alias)>1) { - $stmt = "select caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; + $stmt = "SELECT caller_id_number from groups_alias where group_alias_id='$VDCL_default_group_alias';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00187',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5242,7 +5248,7 @@ if ($ACTION == 'VDADcheckINCOMING') ### Check for List ID override settings if (strlen($list_id)>0) { - $stmt = "select xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; + $stmt = "SELECT xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two from vicidial_lists where list_id='$list_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00282',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5442,7 +5448,7 @@ if ($ACTION == 'VDADcheckINCOMING') $wait_sec=0; $StarTtime = date("U"); - $stmt = "select wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT wait_epoch,wait_sec from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00123',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5517,7 +5523,7 @@ if ($ACTION == 'VDADcheckINCOMING') { if (eregi('--A--user_custom_',$VDCL_start_call_url)) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; + $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five from vicidial_users where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00283',$user,$server_ip,$session_name,$one_mysql_log);} @@ -5867,7 +5873,7 @@ if ($ACTION == 'userLOGout') $vlia_delete = mysql_affected_rows($link); $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,talk_epoch,dispo_epoch,agent_log_id from vicidial_agent_log where agent_log_id >= '$agent_log_id' and user='$user' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00136',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6301,7 +6307,7 @@ if ($ACTION == 'updateDISPO') $insert_into_dnc=0; if ( ($use_internal_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00146',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6314,7 +6320,7 @@ if ($ACTION == 'updateDISPO') } if ( ($use_campaign_dnc=='Y') and (eregi("\|$log_dispo_choice\|", $DNC_string_check) ) ) { - $stmt = "select phone_number from vicidial_list where lead_id='$lead_id';"; + $stmt = "SELECT phone_number from vicidial_list where lead_id='$lead_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00148',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6331,7 +6337,7 @@ if ($ACTION == 'updateDISPO') $dispo_epochSQL=''; $lead_id_commentsSQL=''; $StarTtime = date("U"); - $stmt = "select dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; + $stmt = "SELECT dispo_epoch,dispo_sec,talk_epoch,wait_epoch,lead_id,comments,agent_log_id from vicidial_agent_log where agent_log_id <='$agent_log_id' and lead_id='$lead_id' order by agent_log_id desc limit 1;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00150',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6458,7 +6464,7 @@ if ($ACTION == 'updateDISPO') if ( ($auto_dial_level > 0) and (ereg(" $dispo_choice ",$VC_auto_alt_dial_statuses)) ) { - $stmt = "select count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; + $stmt = "SELECT count(*) from vicidial_hopper where lead_id='$lead_id' and status='HOLD';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00156',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6591,7 +6597,7 @@ if ($ACTION == 'updateDISPO') if ( (ereg('ACCTID',$vtiger_search_category)) or (ereg('ACCOUNT',$vtiger_search_category)) ) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00211',$user,$server_ip,$session_name,$one_mysql_log);} @@ -6603,7 +6609,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00212',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7070,7 +7076,7 @@ if ($ACTION == 'updateDISPO') $talk_time_min=0; if ( (eregi('--A--user_custom_',$dispo_call_url)) or (eregi('--A--fullname',$dispo_call_url)) ) { - $stmt = "select custom_one,custom_two,custom_three,custom_four,custom_five,full_name from vicidial_users where user='$user';"; + $stmt = "SELECT custom_one,custom_two,custom_three,custom_four,custom_five,full_name from vicidial_users where user='$user';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00288',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7089,7 +7095,7 @@ if ($ACTION == 'updateDISPO') if (eregi('--A--talk_time',$dispo_call_url)) { - $stmt = "select talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; + $stmt = "SELECT talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00289',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7116,7 +7122,7 @@ if ($ACTION == 'updateDISPO') if (eregi('--A--dispo_name--B--',$dispo_call_url)) { ### find the full status name for this status - $stmt = "select status_name from vicidial_statuses where status='$dispo_choice';"; + $stmt = "SELECT status_name from vicidial_statuses where status='$dispo_choice';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00297',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7128,7 +7134,7 @@ if ($ACTION == 'updateDISPO') } else { - $stmt = "select status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; + $stmt = "SELECT status_name from vicidial_campaign_statuses where status='$dispo_choice' and campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00298',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7478,7 +7484,7 @@ if ($ACTION == 'updateDISPO') if ( ($WeBRooTWritablE > 0) and ($enable_agc_dispo_log > 0) ) { $talk_time = 0; - $stmt = "select talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; + $stmt = "SELECT talk_sec,dead_sec from vicidial_agent_log where lead_id='$lead_id' and agent_log_id='$CALL_agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00312',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7735,7 +7741,7 @@ if ( ($ACTION == 'VDADpause') || ($ACTION == 'VDADready') ) } $pause_sec=0; - $stmt = "select pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT pause_epoch,pause_sec,wait_epoch,wait_sec,dispo_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00169',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7851,7 +7857,7 @@ if ($ACTION == 'UpdatEFavoritEs') } else { - $stmt = "select count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; + $stmt = "SELECT count(*) from phone_favorites where extension='$exten' and server_ip='$server_ip';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00172',$user,$server_ip,$session_name,$one_mysql_log);} @@ -7902,7 +7908,7 @@ if ($ACTION == 'PauseCodeSubmit') else { $pause_sec=0; - $stmt = "select pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; + $stmt = "SELECT pause_epoch from vicidial_agent_log where agent_log_id='$agent_log_id';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00306',$user,$server_ip,$session_name,$one_mysql_log);} @@ -8435,7 +8441,7 @@ if ($ACTION == 'CALLLOGview') echo ""; - $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments from vicidial_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments from vicidial_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $out_logs_to_print = mysql_num_rows($rslt); if ($format=='debug') {echo "|$out_logs_to_print|$stmt|";} @@ -8469,7 +8475,7 @@ if ($ACTION == 'CALLLOGview') $u++; } - $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds from vicidial_closer_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds from vicidial_closer_log where user='$user' and call_date >= '$date 0:00:00' and call_date <= '$date 23:59:59' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $in_logs_to_print = mysql_num_rows($rslt); if ($format=='debug') {echo "|$in_logs_to_print|$stmt|";} @@ -8553,7 +8559,7 @@ if ($ACTION == 'SEARCHRESULTSview') if (strlen($stage) < 3) {$stage = '670';} - $stmt="select agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00374',$user,$server_ip,$session_name,$one_mysql_log);} $rslt=mysql_query($stmt, $link); $camps_to_print = mysql_num_rows($rslt); @@ -8753,7 +8759,7 @@ if ($ACTION == 'SEARCHRESULTSview') ##### BEGIN search queries and output ##### - $stmt="select count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; + $stmt="SELECT count(*) from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL;"; ### LOG INSERTION Search Log Table ### $SQL_log = "$stmt|"; @@ -8803,7 +8809,7 @@ if ($ACTION == 'SEARCHRESULTSview') if ($search_result_count) { - $stmt="select first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; + $stmt="SELECT first_name,last_name,phone_code,phone_number,status,last_local_call_time,lead_id,city,state,postal_code from vicidial_list where $searchSQL $searchownerSQL $searchmethodSQL order by last_local_call_time desc limit 1000;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00380',$user,$server_ip,$session_name,$one_mysql_log);} $out_logs_to_print = mysql_num_rows($rslt); @@ -8904,7 +8910,7 @@ if ($ACTION == 'SEARCHCONTACTSRESULTSview') if (strlen($stage) < 3) {$stage = '670';} - $stmt="select agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT agent_lead_search_method,manual_dial_list_id from vicidial_campaigns where campaign_id='$campaign';"; if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00431',$user,$server_ip,$session_name,$one_mysql_log);} $rslt=mysql_query($stmt, $link); $camps_to_print = mysql_num_rows($rslt); @@ -9073,7 +9079,7 @@ if ($ACTION == 'SEARCHCONTACTSRESULTSview') } ##### BEGIN search queries and output ##### - $stmt="select count(*) from contact_information where $searchSQL;"; + $stmt="SELECT count(*) from contact_information where $searchSQL;"; ### LOG INSERTION Search Log Table ### $SQL_log = "$stmt|"; @@ -9243,7 +9249,7 @@ if ($ACTION == 'LEADINFOview') $callback_id = preg_replace('/\D/','',$callback_id); if (strlen($callback_id) > 0) { - $stmt="select status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; + $stmt="SELECT status,entry_time,callback_time,modify_date,user,recipient,comments,lead_status from vicidial_callbacks where lead_id='$lead_id' and callback_id='$callback_id' limit 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00397',$user,$server_ip,$session_name,$one_mysql_log);} $cb_to_print = mysql_num_rows($rslt); @@ -9265,7 +9271,7 @@ if ($ACTION == 'LEADINFOview') ### END Display callback information ### ### find the screen_label for this campaign - $stmt="select screen_labels from vicidial_campaigns where campaign_id='$campaign';"; + $stmt="SELECT screen_labels from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00416',$user,$server_ip,$session_name,$one_mysql_log);} $csl_to_print = mysql_num_rows($rslt); @@ -9363,7 +9369,7 @@ if ($ACTION == 'LEADINFOview') $INFOout .= ""; - $stmt="select status,vendor_lead_code,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id='$lead_id' limit 1;"; + $stmt="SELECT status,vendor_lead_code,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id from vicidial_list where lead_id='$lead_id' limit 1;"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00398',$user,$server_ip,$session_name,$one_mysql_log);} $info_to_print = mysql_num_rows($rslt); @@ -9585,7 +9591,7 @@ if ($ACTION == 'LEADINFOview') $NOTESout .= ""; - $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,alt_dial,comments,uniqueid,user from vicidial_log where lead_id='$lead_id' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $out_logs_to_print = mysql_num_rows($rslt); if ($format=='debug') {$NOTESout .= "|$out_logs_to_print|$stmt|";} @@ -9636,7 +9642,7 @@ if ($ACTION == 'LEADINFOview') $u++; } - $stmt="select start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; + $stmt="SELECT start_epoch,call_date,campaign_id,length_in_sec,status,phone_code,phone_number,lead_id,term_reason,queue_seconds,uniqueid,closecallid,user from vicidial_closer_log where lead_id='$lead_id' order by call_date desc limit 10000;"; $rslt=mysql_query($stmt, $link); $in_logs_to_print = mysql_num_rows($rslt); if ($format=='debug') {$NOTESout .= "|$in_logs_to_print|$stmt|";} @@ -9822,7 +9828,7 @@ if ($ACTION == 'CALLSINQUEUEgrab') if ($ACTION == 'CalLBacKLisT') { $campaignCBhoursSQL = ''; - $stmt = "select callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT callback_hours_block,callback_list_calltime,local_call_time from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00437',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$camp_count = mysql_num_rows($rslt);} @@ -9842,7 +9848,7 @@ if ($ACTION == 'CalLBacKLisT') if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - $stmt = "select callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; + $stmt = "SELECT callback_id,lead_id,campaign_id,status,entry_time,callback_time,comments from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD') order by callback_time;"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00178',$user,$server_ip,$session_name,$one_mysql_log);} @@ -9864,7 +9870,7 @@ if ($ACTION == 'CalLBacKLisT') $loop_count=0; while ($callbacks_count>$loop_count) { - $stmt = "select first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; + $stmt = "SELECT first_name,last_name,phone_number,gmt_offset_now,state from vicidial_list where lead_id='$lead_id[$loop_count]';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00179',$user,$server_ip,$session_name,$one_mysql_log);} @@ -9888,7 +9894,7 @@ if ($ACTION == 'CalLBacKLisT') if ($ACTION == 'CalLBacKCounT') { $campaignCBhoursSQL = ''; - $stmt = "select callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; + $stmt = "SELECT callback_hours_block from vicidial_campaigns where campaign_id='$campaign';"; $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00438',$user,$server_ip,$session_name,$one_mysql_log);} if ($rslt) {$camp_count = mysql_num_rows($rslt);} @@ -9906,14 +9912,14 @@ if ($ACTION == 'CalLBacKCounT') if ($agentonly_callback_campaign_lock > 0) {$campaignCBsql = "and campaign_id='$campaign'";} - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status NOT IN('INACTIVE','DEAD');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00180',$user,$server_ip,$session_name,$one_mysql_log);} $row=mysql_fetch_row($rslt); $cbcount=$row[0]; - $stmt = "select count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status IN('LIVE');"; + $stmt = "SELECT count(*) from vicidial_callbacks where recipient='USERONLY' and user='$user' $campaignCBsql $campaignCBhoursSQL and status IN('LIVE');"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00332',$user,$server_ip,$session_name,$one_mysql_log);} @@ -9947,7 +9953,7 @@ if ($ACTION == 'customer_3way_hangup_process') ################################################################################ if ($ACTION == 'DiaLableLeaDsCounT') { - $stmt = "select dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; + $stmt = "SELECT dialable_leads from vicidial_campaign_stats where campaign_id='$campaign';"; if ($DB) {echo "$stmt\n";} $rslt=mysql_query($stmt, $link); if ($mel > 0) {mysql_error_logging($NOW_TIME,$link,$mel,$stmt,'00252',$user,$server_ip,$session_name,$one_mysql_log);} diff --git a/agc_2-X/trunk/www/agc/vicidial.php b/agc_2-X/trunk/www/agc/vicidial.php index e596853d..25e65ac1 100644 --- a/agc_2-X/trunk/www/agc/vicidial.php +++ b/agc_2-X/trunk/www/agc/vicidial.php @@ -374,10 +374,11 @@ # 111202-1444 - Added grade-random next-agent-call options # 111227-1940 - Added Timer Action for Dx_DIAL_QUIET options # 120213-2029 - Changed consultative transfer with custom fields behavior for better data updating +# 120223-2119 - Removed logging of good login passwords if webroot writable is enabled # -$version = '2.4-341c'; -$build = '120213-2029'; +$version = '2.4-342c'; +$build = '120223-2119'; $mel=1; # Mysql Error Log enabled = 1 $mysql_log_count=75; $one_mysql_log=0; @@ -1224,7 +1225,7 @@ else if ($WeBRooTWritablE > 0) { - fwrite ($fp, "vdweb|GOOD|$date|$VD_login|$VD_pass|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "vdweb|GOOD|$date|$VD_login|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } $user_abb = "$VD_login$VD_login$VD_login$VD_login"; @@ -1857,7 +1858,7 @@ else { if ($WeBRooTWritablE > 0) { - fwrite ($fp, "vdweb|FAIL|$date|$VD_login|$VD_pass|$ip|$browser|\n"); + fwrite ($fp, "vdweb|FAIL|$date|$VD_login|XXXX|$ip|$browser|\n"); fclose($fp); } $VDloginDISPLAY=1; diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSER_service_level.php b/agc_2-X/trunk/www/vicidial/AST_CLOSER_service_level.php index 20f5bce2..c1b8173a 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSER_service_level.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSER_service_level.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -19,6 +19,7 @@ # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 110703-1756 - Added download option # 111103-2300 - Added user_group restrictions for selecting in-groups +# 120224-0910 - Added HTML display option with bar graphs # require("dbconnect.php"); @@ -40,6 +41,8 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -179,6 +182,7 @@ if (!preg_match("/\|$group\|/i",$groups_string)) $HEADER.="\n"; $HEADER.="\n"; +$HEADER.="\n"; $HEADER.="\n"; $HEADER.="$report_name\n"; @@ -225,6 +229,11 @@ while ($groups_to_print > $o) $o++; } $MAIN.="\n"; +$MAIN.=" "; +$MAIN.="\n"; +$MAIN.="   "; $MAIN.="\n"; $MAIN.="\n"; -$MAIN.="           DOWNLOAD | MODIFY | REPORTS \n"; +$MAIN.="           DOWNLOAD | MODIFY | REPORTS"; +$MAIN.="\n"; $MAIN.="\n\n"; $MAIN.="
\n\n";
@@ -566,13 +576,40 @@ while ($j < $TOTintervals)
 
 ###################################################
 ### TOTALS SUMMARY SECTION ###
-$MAIN.="+-------------------------------------------+--------+--------+--------+--------+--------+--------+--------+--------+----------+--------+\n";
-$MAIN.="|                                           |        |        |        |        |        |  AVG   |  AVG   |        |  TOTAL   |  AVG   |\n";
-$MAIN.="| SHIFT                                     |        |        |  AVG   |        |        | HOLD(s)| HOLD(s)|        | CALLTIME |CALLTIME|\n";
-$MAIN.="| DATE-TIME RANGE                           | DROPS  | DROP % | DROP(s)| HOLD   | HOLD % |  HOLD  | TOTAL  | CALLS  | MIN:SEC  |SECONDS |\n";
-$MAIN.="+-------------------------------------------+--------+--------+--------+--------+--------+--------+--------+--------+----------+--------+\n";
+$ASCII_text.="+-------------------------------------------+--------+--------+--------+--------+--------+--------+--------+--------+----------+--------+\n";
+$ASCII_text.="|                                           |        |        |        |        |        |  AVG   |  AVG   |        |  TOTAL   |  AVG   |\n";
+$ASCII_text.="| SHIFT                                     |        |        |  AVG   |        |        | HOLD(s)| HOLD(s)|        | CALLTIME |CALLTIME|\n";
+$ASCII_text.="| DATE-TIME RANGE                           | DROPS  | DROP % | DROP(s)| HOLD   | HOLD % |  HOLD  | TOTAL  | CALLS  | MIN:SEC  |SECONDS |\n";
+$ASCII_text.="+-------------------------------------------+--------+--------+--------+--------+--------+--------+--------+--------+----------+--------+\n";
 $CSV_text.="\"SHIFT DATE-TIME RANGE\",\"DROPS\",\" DROP %\",\" AVG DROP(s)\",\" HOLD\",\" HOLD %\",\" AVG HOLD(S) HOLD\",\" AVG HOLD(S) TOTAL\",\" CALLS\",\" TOTAL CALLTIME MIN:SEC\",\" AVG CALLTIME SECONDS\"\n";
 
+
+$graph_stats=array();
+$max_drops=1;
+$max_droppct=1;
+$max_avgdrops=1;
+$max_hold=1;
+$max_holdpct=1;
+$max_avgholds=1;
+$max_avgholdstotal=1;
+$max_calls=1;
+$max_totalcalltime=1;
+$max_avgcalltime=1;
+
+$GRAPH="

"; +$GRAPH.=""; +$GRAPH.="
DROPSDROP %AVG DROP(s)HOLDHOLD %AVG HOLD(s) HOLDAVG HOLD(s) TOTALCALLSTOTAL CALLTIME MIN:SECAVG CALLTIME SECONDS

 


"; +$graph_header=""; +$DROPS_graph=$graph_header.""; +$DROPPCT_graph=$graph_header.""; +$AVGDROPS_graph=$graph_header.""; +$HOLD_graph=$graph_header.""; +$HOLDPCT_graph=$graph_header.""; +$AVGHOLDS_graph=$graph_header.""; +$AVGHOLDSTOTAL_graph=$graph_header.""; +$CALLS_graph=$graph_header.""; +$TOTALCALLTIME_graph=$graph_header.""; +$AVGCALLTIME_graph=$graph_header.""; $d=0; while ($d < $DURATIONday) { @@ -616,9 +653,32 @@ while ($d < $DURATIONday) else { $totCALLSavgDATE[$d] = 0; - $totTIME_MS=' '; + $totTIME_MS=' 0:00'; } + if (trim($totDROPSdate[$d])>$max_drops) {$max_drops=trim($totDROPSdate[$d]);} + if (trim($totDROPSpctDATE[$d])>$max_droppct) {$max_droppct=trim($totDROPSpctDATE[$d]);} + if (trim($totDROPSavgDATE[$d])>$max_avgdrops) {$max_avgdrops=trim($totDROPSavgDATE[$d]);} + if (trim($totQUEUEdate[$d])>$max_hold) {$max_hold=trim($totQUEUEdate[$d]);} + if (trim($totQUEUEpctDATE[$d])>$max_holdpct) {$max_holdpct=trim($totQUEUEpctDATE[$d]);} + if (trim($totQUEUEavgDATE[$d])>$max_avgholds) {$max_avgholds=trim($totQUEUEavgDATE[$d]);} + if (trim($totQUEUEtotDATE[$d])>$max_avgholdstotal) {$max_avgholdstotal=trim($totQUEUEtotDATE[$d]);} + if (trim($totCALLSdate[$d])>$max_calls) {$max_calls=trim($totCALLSdate[$d]);} + if (trim($totCALLSsecDATE[$d])>$max_totalcalltime) {$max_totalcalltime=trim($totCALLSsecDATE[$d]);} + if (trim($totCALLSavgDATE[$d])>$max_avgcalltime) {$max_avgcalltime=trim($totCALLSavgDATE[$d]);} + $graph_stats[$d][0]=trim("$daySTART[$d] - $dayEND[$d]"); + $graph_stats[$d][1]=trim($totDROPSdate[$d]); + $graph_stats[$d][2]=trim(sprintf("%6.2f", $totDROPSpctDATE[$d])); + $graph_stats[$d][3]=trim(sprintf("%7.2f", $totDROPSavgDATE[$d])); + $graph_stats[$d][4]=trim($totQUEUEdate[$d]); + $graph_stats[$d][5]=trim(sprintf("%6.2f", $totQUEUEpctDATE[$d])); + $graph_stats[$d][6]=trim(sprintf("%7.2f", $totQUEUEavgDATE[$d])); + $graph_stats[$d][7]=trim(sprintf("%7.2f", $totQUEUEtotDATE[$d])); + $graph_stats[$d][8]=trim($totCALLSdate[$d]); + $graph_stats[$d][9]=trim($totCALLSsecDATE[$d]); + $graph_stats[$d][10]=trim($totTIME_MS); + $graph_stats[$d][11]=trim(sprintf("%6.0f", $totCALLSavgDATE[$d])); + $totCALLSavgDATE[$d] = sprintf("%6.0f", $totCALLSavgDATE[$d]); $totDROPSavgDATE[$d] = sprintf("%7.2f", $totDROPSavgDATE[$d]); $totQUEUEavgDATE[$d] = sprintf("%7.2f", $totQUEUEavgDATE[$d]); @@ -629,7 +689,7 @@ while ($d < $DURATIONday) $totQUEUEdate[$d] = sprintf("%6s", $totQUEUEdate[$d]); $totCALLSdate[$d] = sprintf("%6s", $totCALLSdate[$d]); - $MAIN.="| $daySTART[$d] - $dayEND[$d] | $totDROPSdate[$d] | $totDROPSpctDATE[$d]%|$totDROPSavgDATE[$d] | $totQUEUEdate[$d] | $totQUEUEpctDATE[$d]%|$totQUEUEavgDATE[$d] |$totQUEUEtotDATE[$d] | $totCALLSdate[$d] | $totTIME_MS | $totCALLSavgDATE[$d] |\n"; + $ASCII_text.="| $daySTART[$d] - $dayEND[$d] | $totDROPSdate[$d] | $totDROPSpctDATE[$d]%|$totDROPSavgDATE[$d] | $totQUEUEdate[$d] | $totQUEUEpctDATE[$d]%|$totQUEUEavgDATE[$d] |$totQUEUEtotDATE[$d] | $totCALLSdate[$d] | $totTIME_MS | $totCALLSavgDATE[$d] |\n"; $CSV_text.="\"$daySTART[$d] - $dayEND[$d]\",\"$totDROPSdate[$d]\",\"$totDROPSpctDATE[$d]%\",\"$totDROPSavgDATE[$d]\",\"$totQUEUEdate[$d]\",\"$totQUEUEpctDATE[$d]%\",\"$totQUEUEavgDATE[$d]\",\"$totQUEUEtotDATE[$d]\",\"$totCALLSdate[$d]\",\"$totTIME_MS\",\"$totCALLSavgDATE[$d]\"\n"; $d++; } @@ -684,11 +744,62 @@ else $FtotQUEUE = sprintf("%6s", $totQUEUE); $FtotCALLS = sprintf("%6s", $totCALLS); -$MAIN.="+-------------------------------------------+--------+--------+--------+--------+--------+--------+--------+--------+----------+--------+\n"; -$MAIN.="| TOTALS | $FtotDROPS | $FtotDROPSpct%|$FtotDROPSavg | $FtotQUEUE | $FtotQUEUEpct%|$FtotQUEUEavg |$FtotQUEUEtot | $FtotCALLS |$totTIME_MS | $FtotCALLSavg |\n"; -$MAIN.="+-------------------------------------------+--------+--------+--------+--------+--------+--------+--------+--------+----------+--------+\n"; +$ASCII_text.="+-------------------------------------------+--------+--------+--------+--------+--------+--------+--------+--------+----------+--------+\n"; +$ASCII_text.="| TOTALS | $FtotDROPS | $FtotDROPSpct%|$FtotDROPSavg | $FtotQUEUE | $FtotQUEUEpct%|$FtotQUEUEavg |$FtotQUEUEtot | $FtotCALLS |$totTIME_MS | $FtotCALLSavg |\n"; +$ASCII_text.="+-------------------------------------------+--------+--------+--------+--------+--------+--------+--------+--------+----------+--------+\n"; $CSV_text.="\"TOTALS\",\"$FtotDROPS\",\"$FtotDROPSpct%\",\"$FtotDROPSavg\",\"$FtotQUEUE\",\"$FtotQUEUEpct%\",\"$FtotQUEUEavg\",\"$FtotQUEUEtot\",\"$FtotCALLS\",\"$totTIME_MS\",\"$FtotCALLSavg\"\n"; + + for ($d=0; $d"; + $DROPPCT_graph.=" "; + $AVGDROPS_graph.=" "; + $HOLD_graph.=" "; + $HOLDPCT_graph.=" "; + $AVGHOLDS_graph.=" "; + $AVGHOLDSTOTAL_graph.=" "; + $CALLS_graph.=" "; + $TOTALCALLTIME_graph.=" "; + $AVGCALLTIME_graph.=" "; + } + $DROPS_graph.="
INBOUND SERVICE LEVEL REPORT
STATUSDROPS
DROP %
AVG DROP(s)
HOLD
HOLD %
AVG HOLD(s) HOLD
AVG HOLD(s) TOTAL
CALLS
TOTAL CALLTIME MIN:SEC
AVG CALLTIME SECONDS
".$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]."".$graph_stats[$d][5]."%
".$graph_stats[$d][0]."".$graph_stats[$d][6]."
".$graph_stats[$d][0]."".$graph_stats[$d][7]."
".$graph_stats[$d][0]."".$graph_stats[$d][8]."
".$graph_stats[$d][0]."".$graph_stats[$d][10]."
".$graph_stats[$d][0]."".$graph_stats[$d][11]."
TOTAL:".trim($FtotDROPS)."
"; + $DROPPCT_graph.="TOTAL:".trim($FtotDROPSpct)."%"; + $AVGDROPS_graph.="TOTAL:".trim($FtotDROPSavg).""; + $HOLD_graph.="TOTAL:".trim($FtotQUEUE).""; + $HOLDPCT_graph.="TOTAL:".trim($FtotQUEUEpct)."%"; + $AVGHOLDS_graph.="TOTAL:".trim($FtotQUEUEavg).""; + $AVGHOLDSTOTAL_graph.="TOTAL:".trim($FtotQUEUEtot).""; + $CALLS_graph.="TOTAL:".trim($FtotCALLS).""; + $TOTALCALLTIME_graph.="TOTAL:".trim($totTIME_MS).""; + $AVGCALLTIME_graph.="TOTAL:".trim($FtotCALLSavg).""; + $JS_text="\n"; + +if ($report_display_type=="HTML") + { + $MAIN.=$GRAPH; + } +else + { + $MAIN.=$ASCII_text; + } @@ -1098,6 +1287,7 @@ if ($file_download > 0) { echo "$HEADER"; + echo $JS_text; require("admin_header.php"); echo "$MAIN"; } diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php index 626508f2..8229dfb0 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSERstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -34,6 +34,7 @@ # 110703-1759 - Added download option # 111103-0632 - Added MAXCAL as a drop status # 111103-2003 - Added user_group restrictions for selecting in-groups +# 120224-0910 - Added HTML display option with bar graphs # require("dbconnect.php"); @@ -60,6 +61,8 @@ if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -70,6 +73,8 @@ if (strlen($shift)<2) {$shift='ALL';} $report_name = 'Inbound Report'; $db_source = 'M'; +# $test_table_name="vicidial_closer_log"; + ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### $stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; @@ -255,7 +260,10 @@ $HEADER.=" \n"; $HEADER.="\n"; $HEADER.="\n"; - +$HEADER.="\n"; +$HEADER.="\n"; +$HEADER.="\n"; +$HEADER.="\n"; $HEADER.="\n"; $HEADER.="$report_name\n"; @@ -351,10 +359,13 @@ $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; $MAIN.="\n"; +$MAIN.="
Display as:  "; +$MAIN.="\n
"; $MAIN.="   \n"; $MAIN.="\n"; $MAIN.="\n\n"; - $MAIN.="
\n\n";
 
 
@@ -436,23 +447,23 @@ if ($DID=='Y')
 
 if ($group_ct > 1)
 	{
-	$MAIN.="\n";
-	$MAIN.="---------- MULTI-GROUP BREAKDOWN:\n";
+	$ASCII_text.="\n";
+	$ASCII_text.="---------- MULTI-GROUP BREAKDOWN:\n";
 
 	$CSV_text1.="\n\"MULTI-GROUP BREAKDOWN:\"\n";
 
 	if ($DID=='Y')
 		{
-		$MAIN.="+----------------------+---------+---------+---------+---------+\n";
-		$MAIN.="| DID                  | CALLS   | DROPS   | DROP %  | IVR     |\n";
-		$MAIN.="+----------------------+---------+---------+---------+---------+\n";
+		$ASCII_text.="+----------------------+---------+---------+---------+---------+\n";
+		$ASCII_text.="| DID                  | CALLS   | DROPS   | DROP %  | IVR     |\n";
+		$ASCII_text.="+----------------------+---------+---------+---------+---------+\n";
 		$CSV_text1.="\"DID\",\"CALLS\",\"DROPS\",\"DROP %\",\"IVR\"\n";
 		}
 	else
 		{
-		$MAIN.="+----------------------+---------+---------+---------+---------+\n";
-		$MAIN.="| IN-GROUP             | CALLS   | DROPS   | DROP %  | IVR     |\n";
-		$MAIN.="+----------------------+---------+---------+---------+---------+\n";
+		$ASCII_text.="+----------------------+---------+---------+---------+---------+\n";
+		$ASCII_text.="| IN-GROUP             | CALLS   | DROPS   | DROP %  | IVR     |\n";
+		$ASCII_text.="+----------------------+---------+---------+---------+---------+\n";
 		$CSV_text1.="\"IN-GROUP\",\"CALLS\",\"DROPS\",\"DROP %\",\"IVR\"\n";
 		}
 
@@ -463,7 +474,7 @@ if ($group_ct > 1)
 		$DIDunid_SQL='';
 		$stmt="select did_id from vicidial_inbound_dids where did_pattern='$group[$i]';";
 		$rslt=mysql_query($stmt, $link);
-		if ($DB) {$MAIN.="$stmt\n";}
+		if ($DB) {$ASCII_text.="$stmt\n";}
 		$Sdids_to_print = mysql_num_rows($rslt);
 		if ($Sdids_to_print > 0)
 			{
@@ -473,7 +484,7 @@ if ($group_ct > 1)
 
 		$stmt="select uniqueid from vicidial_did_log where did_id='$did_id[$i]';";
 		$rslt=mysql_query($stmt, $link);
-		if ($DB) {$MAIN.="$stmt\n";}
+		if ($DB) {$ASCII_text.="$stmt\n";}
 		$DIDunids_to_print = mysql_num_rows($rslt);
 		$k=0;
 		while ($k < $DIDunids_to_print)
@@ -491,7 +502,7 @@ if ($group_ct > 1)
 			$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($DIDunid_SQL);";
 			}
 		$rslt=mysql_query($stmt, $link);
-		if ($DB) {$MAIN.="$stmt\n";}
+		if ($DB) {$ASCII_text.="$stmt\n";}
 		$row=mysql_fetch_row($rslt);
 
 		$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and comment_a='$group[$i]' and comment_b='START';";
@@ -500,7 +511,7 @@ if ($group_ct > 1)
 			$stmt="select count(*) from live_inbound_log where start_time >= '$query_date_BEGIN' and start_time <= '$query_date_END' and uniqueid IN($DIDunid_SQL);";
 			}
 		$rslt=mysql_query($stmt, $link);
-		if ($DB) {$MAIN.="$stmt\n";}
+		if ($DB) {$ASCII_text.="$stmt\n";}
 		$rowx=mysql_fetch_row($rslt);
 
 		$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null);";
@@ -509,8 +520,9 @@ if ($group_ct > 1)
 			$stmt="select count(*),sum(length_in_sec) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and status IN('DROP','XDROP') and (length_in_sec <= 49999 or length_in_sec is null) and uniqueid IN($DIDunid_SQL);";
 			}
 		$rslt=mysql_query($stmt, $link);
-		if ($DB) {$MAIN.="$stmt\n";}
+		if ($DB) {$ASCII_text.="$stmt\n";}
 		$rowy=mysql_fetch_row($rslt);
+		if ($row[0]>$max_value) {$max_value=$row[0];}
 
 		$groupDISPLAY =	sprintf("%20s", $group[$i]);
 		$gTOTALcalls =	sprintf("%7s", $row[0]);
@@ -525,15 +537,62 @@ if ($group_ct > 1)
 			}
 		$gDROPpercent =	sprintf("%6s", $gDROPpercent);
 
-		$MAIN.="| $groupDISPLAY | $gTOTALcalls | $gDROPcalls | $gDROPpercent% | $gIVRcalls |\n";
+		$ASCII_text.="| $groupDISPLAY | $gTOTALcalls | $gDROPcalls | $gDROPpercent% | $gIVRcalls |\n";
 		$CSV_text1.="\"$groupDISPLAY\",\"$gTOTALcalls\",\"$gDROPcalls\",\"$gDROPpercent%\",\"$gIVRcalls\"\n";
+		$graph_data_ary[$i][0]=$groupDISPLAY;
+		$graph_data_ary[$i][1]=$gTOTALcalls;
+		$graph_data_ary[$i][2]=$gDROPcalls;
+		$graph_data_ary[$i][3]=$gDROPpercent;
+		$graph_data_ary[$i][4]=$gIVRcalls;
+
 		$i++;
 		}
 
-	$MAIN.="+----------------------+---------+---------+---------+---------+\n";
+	$ASCII_text.="+----------------------+---------+---------+---------+---------+\n";
 
 	}
 
+	if ($report_display_type=="HTML") {
+		$max_value=1;
+		$graph_height=240;
+		$scale = 1;
+		$w=0;
+		for ($i=0; $i$max_value) {$max_value=$graph_data_ary[$i][1];}
+			if ($graph_data_ary[$i][1]>0) {$w++;}
+		}
+		$scale = $graph_height / $max_value;
+
+
+		$GRAPH_text.="";
+		for ($d=0; $d0) {
+				$graph_data_ary[$d][0]=preg_replace('/\s/', "", $graph_data_ary[$d][0]); 
+				$GRAPH_text.="  \n";
+			}
+		}
+		$GRAPH_text.="
MULTI-GROUP BREAKDOWN
GROUPIVRS / DROPS / CALLS
".$graph_data_ary[$d][0]."
".$graph_data_ary[$d][3]."% drops
 
\n"; + if ($graph_data_ary[$d][1]>0) { + $GRAPH_text.="
  • ".$graph_data_ary[$d][1]."
  • "; + if ($graph_data_ary[$d][2]>0) { + $GRAPH_text.="
  • ".$graph_data_ary[$d][2]."
  • "; + } + if ($graph_data_ary[$d][4]>0) { + $GRAPH_text.="
  • ".$graph_data_ary[$d][4]."
  • "; + } + $GRAPH_text.="
\n"; + } else { + $GRAPH_text.="0"; + } + $GRAPH_text.="


"; + + + $MAIN.=$GRAPH_text; + } + else + { + $MAIN.=$ASCII_text; + } $MAIN.="\n"; $MAIN.="Time range: $query_date_BEGIN to $query_date_END\n\n"; @@ -804,11 +863,11 @@ $CSV_text1.="\"Average QUEUE Length across all calls:\",\"$average_total_queue_s $TOTALcalls = 0; -$MAIN.="\n"; -$MAIN.="---------- CALL HOLD TIME BREAKDOWN IN SECONDS
DOWNLOAD\n"; -$MAIN.="+-------------------------------------------------------------------------------------------+------------+\n"; -$MAIN.="| 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; -$MAIN.="+-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text="\n"; +$ASCII_text.="---------- CALL HOLD TIME BREAKDOWN IN SECONDS DOWNLOAD\n"; +$ASCII_text.="+-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text.="| 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; +$ASCII_text.="+-------------------------------------------------------------------------------------------+------------+\n"; $CSV_text2.="\n\"CALL HOLD TIME BREAKDOWN IN SECONDS\"\n"; $CSV_text2.="\"\",\"0\",\"5\",\"10\",\"15\",\"20\",\"25\",\"30\",\"35\",\"40\",\"45\",\"50\",\"55\",\"60\",\"90\",\"+90\",\"TOTAL\"\n"; @@ -820,7 +879,7 @@ if ($DID=='Y') $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_seconds;"; } $rslt=mysql_query($stmt, $link); -if ($DB) {$MAIN.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); $i=0; $hd_5=0; $hd10=0; $hd15=0; $hd20=0; $hd25=0; $hd30=0; $hd35=0; $hd40=0; $hd45=0; $hd50=0; $hd55=0; $hd60=0; $hd90=0; $hd99=0; @@ -867,22 +926,93 @@ $hd99 = sprintf("%5s", $hd99); $TOTALcalls = sprintf("%10s", $TOTALcalls); -$MAIN.="| $hd_0 $hd_5 $hd10 $hd15 $hd20 $hd25 $hd30 $hd35 $hd40 $hd45 $hd50 $hd55 $hd60 $hd90 $hd99 | $TOTALcalls |\n"; -$MAIN.="+-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text.="| $hd_0 $hd_5 $hd10 $hd15 $hd20 $hd25 $hd30 $hd35 $hd40 $hd45 $hd50 $hd55 $hd60 $hd90 $hd99 | $TOTALcalls |\n"; +$ASCII_text.="+-------------------------------------------------------------------------------------------+------------+\n"; $CSV_text2.="\"\",\"$hd_0\",\"$hd_5\",\"$hd10\",\"$hd15\",\"$hd20\",\"$hd25\",\"$hd30\",\"$hd35\",\"$hd40\",\"$hd45\",\"$hd50\",\"$hd55\",\"$hd60\",\"$hd90\",\"$hd99\",\"$TOTALcalls\"\n"; +if ($report_display_type=="HTML") { + $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by rd_sec order by rd_sec asc;"; + $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_seconds order by ct desc limit 1;"; + if ($DID=='Y') + { + $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by rd_sec;"; + $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_seconds order by ct desc limit 1;"; + } + if ($DB) {$GRAPH_text.=$stmt."\n";} + $ms_rslt=mysql_query($ms_stmt, $link); + $ms_row=mysql_fetch_row($ms_rslt); + $max_seconds=$ms_row[0]; + if ($max_seconds>90) {$max_seconds=91;} + for ($i=0; $i<=$max_seconds; $i++) { + $sec_ary[$i]=0; + } + + $mc_rslt=mysql_query($mc_stmt, $link); + $mc_row=mysql_fetch_row($mc_rslt); + $max_calls=$ms_row[0]; + if ($max_calls<=10) { + while ($maxcalls%5!=0) { + $maxcalls++; + } + } else if ($max_calls<=100) { + while ($maxcalls%10!=0) { + $maxcalls++; + } + } else if ($max_calls<=1000) { + while ($maxcalls%50!=0) { + $maxcalls++; + } + } else { + while ($maxcalls%500!=0) { + $maxcalls++; + } + } + $rslt=mysql_query($stmt, $link); + + $GRAPH_text="
\n"; + $GRAPH_text.=""; + $MAIN.=$GRAPH_text; + } +else + { + $MAIN.=$ASCII_text; + } + + ############################## ######### CALL DROP TIME BREAKDOWN IN SECONDS $BDdropCALLS = 0; -$MAIN.="\n"; -$MAIN.="---------- CALL DROP TIME BREAKDOWN IN SECONDS\n"; -$MAIN.="+-------------------------------------------------------------------------------------------+------------+\n"; -$MAIN.="| 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; -$MAIN.="+-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text="\n"; +$ASCII_text.="---------- CALL DROP TIME BREAKDOWN IN SECONDS\n"; +$ASCII_text.="+-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text.="| 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; +$ASCII_text.="+-------------------------------------------------------------------------------------------+------------+\n"; $CSV_text2.="\n\"CALL DROP TIME BREAKDOWN IN SECONDS\"\n"; $CSV_text2.="\"\",\"0\",\"5\",\"10\",\"15\",\"20\",\"25\",\"30\",\"35\",\"40\",\"45\",\"50\",\"55\",\"60\",\"90\",\"+90\",\"TOTAL\"\n"; @@ -893,7 +1023,7 @@ if ($DID=='Y') $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by queue_seconds;"; } $rslt=mysql_query($stmt, $link); -if ($DB) {$MAIN.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); $i=0; $dd_0=0; $dd_5=0; $dd10=0; $dd15=0; $dd20=0; $dd25=0; $dd30=0; $dd35=0; $dd40=0; $dd45=0; $dd50=0; $dd55=0; $dd60=0; $dd90=0; $dd99=0; @@ -940,23 +1070,94 @@ $dd99 = sprintf("%5s", $dd99); $BDdropCALLS = sprintf("%10s", $BDdropCALLS); -$MAIN.="| $dd_0 $dd_5 $dd10 $dd15 $dd20 $dd25 $dd30 $dd35 $dd40 $dd45 $dd50 $dd55 $dd60 $dd90 $dd99 | $BDdropCALLS |\n"; -$MAIN.="+-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text.="| $dd_0 $dd_5 $dd10 $dd15 $dd20 $dd25 $dd30 $dd35 $dd40 $dd45 $dd50 $dd55 $dd60 $dd90 $dd99 | $BDdropCALLS |\n"; +$ASCII_text.="+-------------------------------------------------------------------------------------------+------------+\n"; $CSV_text2.="\"\",\"$dd_0\",\"$dd_5\",\"$dd10\",\"$dd15\",\"$dd20\",\"$dd25\",\"$dd30\",\"$dd35\",\"$dd40\",\"$dd45\",\"$dd50\",\"$dd55\",\"$dd60\",\"$dd90\",\"$dd99\",\"$BDdropCALLS\"\n"; +if ($report_display_type=="HTML") { + $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by rd_sec order by rd_sec asc;"; + $ms_stmt="select 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 IN('DROP','XDROP') order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and status IN('DROP','XDROP') group by queue_seconds order by ct desc limit 1;"; + if ($DID=='Y') + { + $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by rd_sec;"; + $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status IN('DROP','XDROP') group by queue_seconds order by ct desc limit 1;"; + } + if ($DB) {$GRAPH_text.=$stmt."\n";} + $ms_rslt=mysql_query($ms_stmt, $link); + $ms_row=mysql_fetch_row($ms_rslt); + $max_seconds=$ms_row[0]; + if ($max_seconds>90) {$max_seconds=91;} + for ($i=0; $i<=$max_seconds; $i++) { + $sec_ary[$i]=0; + } + + $mc_rslt=mysql_query($mc_stmt, $link); + $mc_row=mysql_fetch_row($mc_rslt); + $max_calls=$ms_row[0]; + if ($max_calls<=10) { + while ($maxcalls%5!=0) { + $maxcalls++; + } + } else if ($max_calls<=100) { + while ($maxcalls%10!=0) { + $maxcalls++; + } + } else if ($max_calls<=1000) { + while ($maxcalls%50!=0) { + $maxcalls++; + } + } else { + while ($maxcalls%500!=0) { + $maxcalls++; + } + } + $rslt=mysql_query($stmt, $link); + + $GRAPH_text="
\n"; + $GRAPH_text.=""; + $MAIN.=$GRAPH_text; + } +else + { + $MAIN.=$ASCII_text; + } + + ############################## ######### CALL ANSWERED TIME AND PERCENT BREAKDOWN IN SECONDS $BDansweredCALLS = 0; -$MAIN.="\n"; -$MAIN.=" CALL ANSWERED TIME AND PERCENT BREAKDOWN IN SECONDS\n"; -$MAIN.=" +-------------------------------------------------------------------------------------------+------------+\n"; -$MAIN.=" | 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; -$MAIN.="----------+-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text="\n"; +$ASCII_text.=" CALL ANSWERED TIME AND PERCENT BREAKDOWN IN SECONDS\n"; +$ASCII_text.=" +-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text.=" | 0 5 10 15 20 25 30 35 40 45 50 55 60 90 +90 | TOTAL |\n"; +$ASCII_text.="----------+-------------------------------------------------------------------------------------------+------------+\n"; $CSV_text2.="\n\"CALL ANSWERED TIME AND PERCENT BREAKDOWN IN SECONDS\"\n"; $CSV_text2.="\"\",\"0\",\"5\",\"10\",\"15\",\"20\",\"25\",\"30\",\"35\",\"40\",\"45\",\"50\",\"55\",\"60\",\"90\",\"+90\",\"TOTAL\"\n"; @@ -967,7 +1168,7 @@ if ($DID=='Y') $stmt="select count(*),queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds;"; } $rslt=mysql_query($stmt, $link); -if ($DB) {$MAIN.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); $i=0; while ($i < $reasons_to_print) @@ -1151,12 +1352,12 @@ $answeredCUMULATIVE = "$Cad_0 $Cad_5 $Cad10 $Cad15 $Cad20 $Cad25 $Cad30 $Cad35 $ $answeredINT_PERCENT = "$pad_0 $pad_5 $pad10 $pad15 $pad20 $pad25 $pad30 $pad35 $pad40 $pad45 $pad50 $pad55 $pad60 $pad90 $pad99 | |"; $answeredCUM_PERCENT = "$pCad_0 $pCad_5 $pCad10 $pCad15 $pCad20 $pCad25 $pCad30 $pCad35 $pCad40 $pCad45 $pCad50 $pCad55 $pCad60 $pCad90 $pCad99 | |"; $answeredCUM_ANS_PERCENT = "$ApCad_0 $ApCad_5 $ApCad10 $ApCad15 $ApCad20 $ApCad25 $ApCad30 $ApCad35 $ApCad40 $ApCad45 $ApCad50 $ApCad55 $ApCad60 $ApCad90 $ApCad99 | |"; -$MAIN.="INTERVAL | $answeredTOTALs\n"; -$MAIN.="INT % | $answeredINT_PERCENT\n"; -$MAIN.="CUMULATIVE| $answeredCUMULATIVE\n"; -$MAIN.="CUM % | $answeredCUM_PERCENT\n"; -$MAIN.="CUM ANS % | $answeredCUM_ANS_PERCENT\n"; -$MAIN.="----------+-------------------------------------------------------------------------------------------+------------+\n"; +$ASCII_text.="INTERVAL | $answeredTOTALs\n"; +$ASCII_text.="INT % | $answeredINT_PERCENT\n"; +$ASCII_text.="CUMULATIVE| $answeredCUMULATIVE\n"; +$ASCII_text.="CUM % | $answeredCUM_PERCENT\n"; +$ASCII_text.="CUM ANS % | $answeredCUM_ANS_PERCENT\n"; +$ASCII_text.="----------+-------------------------------------------------------------------------------------------+------------+\n"; $CSV_text2.="\"INTERVAL\",\"$ad_0\",\"$ad_5\",\"$ad10\",\"$ad15\",\"$ad20\",\"$ad25\",\"$ad30\",\"$ad35\",\"$ad40\",\"$ad45\",\"$ad50\",\"$ad55\",\"$ad60\",\"$ad90\",\"$ad99\",\"$BDansweredCALLS\"\n"; @@ -1165,29 +1366,97 @@ $CSV_text2.="\"CUMULATIVE\",\"$Cad_0\",\"$Cad_5\",\"$Cad10\",\"$Cad15\",\"$Cad20 $CSV_text2.="\"CUM %\",\"$pCad_0\",\"$pCad_5\",\"$pCad10\",\"$pCad15\",\"$pCad20\",\"$pCad25\",\"$pCad30\",\"$pCad35\",\"$pCad40\",\"$pCad45\",\"$pCad50\",\"$pCad55\",\"$pCad60\",\"$pCad90\",\"$pCad99\"\n"; $CSV_text2.="\"CUM ANS %\",\"$ApCad_0\",\"$ApCad_5\",\"$ApCad10\",\"$ApCad15\",\"$ApCad20\",\"$ApCad25\",\"$ApCad30\",\"$ApCad35\",\"$ApCad40\",\"$ApCad45\",\"$ApCad50\",\"$ApCad55\",\"$ApCad60\",\"$ApCad90\",\"$ApCad99\"\n"; +if ($report_display_type=="HTML") { + $stmt="select count(*),round(queue_seconds) as rd_sec 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','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by rd_sec order by rd_sec asc;"; + $ms_stmt="select 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','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct 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','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds order by ct desc limit 1;"; + if ($DID=='Y') + { + $stmt="select count(*),round(queue_seconds) as rd_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by rd_sec;"; + $ms_stmt="select queue_seconds from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') order by queue_seconds desc limit 1;"; + $mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and status NOT IN('DROP','XDROP','HXFER','QVMAIL','HOLDTO','LIVE','QUEUE','TIMEOT','AFTHRS','NANQUE','INBND','MAXCAL') group by queue_seconds order by ct desc limit 1;"; + } + if ($DB) {$GRAPH_text.=$stmt."\n";} + $ms_rslt=mysql_query($ms_stmt, $link); + $ms_row=mysql_fetch_row($ms_rslt); + $max_seconds=$ms_row[0]; + if ($max_seconds>90) {$max_seconds=91;} + for ($i=0; $i<=$max_seconds; $i++) { + $sec_ary[$i]=0; + } + $mc_rslt=mysql_query($mc_stmt, $link); + $mc_row=mysql_fetch_row($mc_rslt); + $max_calls=$ms_row[0]; + if ($max_calls<=10) { + while ($maxcalls%5!=0) { + $maxcalls++; + } + } else if ($max_calls<=100) { + while ($maxcalls%10!=0) { + $maxcalls++; + } + } else if ($max_calls<=1000) { + while ($maxcalls%50!=0) { + $maxcalls++; + } + } else { + while ($maxcalls%500!=0) { + $maxcalls++; + } + } + $rslt=mysql_query($stmt, $link); + + $GRAPH_text="
\n"; + $GRAPH_text.=""; + $MAIN.=$GRAPH_text; + } +else + { + $MAIN.=$ASCII_text; + } ############################## ######### CALL HANGUP REASON STATS $TOTALcalls = 0; -$MAIN.="\n"; -$MAIN.="---------- CALL HANGUP REASON STATS DOWNLOAD\n"; -$MAIN.="+----------------------+------------+\n"; -$MAIN.="| HANGUP REASON | CALLS |\n"; -$MAIN.="+----------------------+------------+\n"; +$ASCII_text="\n"; +$ASCII_text.="---------- CALL HANGUP REASON STATS DOWNLOAD\n"; +$ASCII_text.="+----------------------+------------+\n"; +$ASCII_text.="| HANGUP REASON | CALLS |\n"; +$ASCII_text.="+----------------------+------------+\n"; $CSV_text3.="\n\"CALL HANGUP REASON STATS\"\n"; $CSV_text3.="\"HANGUP REASON\",\"CALLS\"\n"; -$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by term_reason;"; +$stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by term_reason order by term_reason;"; if ($DID=='Y') { - $stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by term_reason;"; + $stmt="select count(*),term_reason from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by term_reason order by term_reason;"; } $rslt=mysql_query($stmt, $link); -if ($DB) {$MAIN.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $reasons_to_print = mysql_num_rows($rslt); $i=0; while ($i < $reasons_to_print) @@ -1196,11 +1465,12 @@ while ($i < $reasons_to_print) $TOTALcalls = ($TOTALcalls + $row[0]); - $REASONcount = sprintf("%10s", $row[0]);while(strlen($REASONcount)>10) {$REASONcount = substr("$REASONcount", 0, -1);} + $REASONcount = sprintf("%10s", $row[0]); + while(strlen($REASONcount)>10) {$REASONcount = substr("$REASONcount", 0, -1);} $reason = sprintf("%-20s", $row[1]);while(strlen($reason)>20) {$reason = substr("$reason", 0, -1);} # if (ereg("NONE",$reason)) {$reason = 'NO ANSWER ';} - $MAIN.="| $reason | $REASONcount |\n"; + $ASCII_text.="| $reason | $REASONcount |\n"; $CSV_text3.="\"$reason\",\"$REASONcount\"\n"; $i++; @@ -1208,24 +1478,63 @@ while ($i < $reasons_to_print) $TOTALcalls = sprintf("%10s", $TOTALcalls); -$MAIN.="+----------------------+------------+\n"; -$MAIN.="| TOTAL: | $TOTALcalls |\n"; -$MAIN.="+----------------------+------------+\n"; +$ASCII_text.="+----------------------+------------+\n"; +$ASCII_text.="| TOTAL: | $TOTALcalls |\n"; +$ASCII_text.="+----------------------+------------+\n"; $CSV_text3.="\"TOTAL:\",\"$TOTALcalls\"\n"; - +if ($report_display_type=="HTML") + { + $rslt=mysql_query($stmt, $link); + $high_ct=0; $i=0; + while ($row=mysql_fetch_row($rslt)) { + if ($row[0]>$high_ct) {$high_ct=$row[0];} + $ct_ary[$i][0]=$row[0]; + $ct_ary[$i][1]=$row[1]; + $i++; + } + $GRAPH_text="
\n"; + $GRAPH_text.="\n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + for ($i=0; $i".$ct_ary[$i][1]."\n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + } + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.="
CALL HANGUP REASON STATS
REASON CALLS
\"\"".$ct_ary[$i][0]."
TOTAL CALLS:".trim($TOTALcalls)."
\n"; + $GRAPH_text.="
\n";
+	$MAIN.=$GRAPH_text;
+	}
+else
+	{
+	$MAIN.=$ASCII_text;
+	}
 
 ##############################
 #########  CALL STATUS STATS
 
 $TOTALcalls = 0;
 
-$MAIN.="\n";
-$MAIN.="---------- CALL STATUS STATS       DOWNLOAD\n";
-$MAIN.="+--------+----------------------+----------------------+------------+------------+----------+----------+\n";
-$MAIN.="| STATUS | DESCRIPTION          | CATEGORY             | CALLS      | TOTAL TIME | AVG TIME |CALLS/HOUR|\n";
-$MAIN.="+--------+----------------------+----------------------+------------+------------+----------+----------+\n";
+$ASCII_text="\n";
+$ASCII_text.="---------- CALL STATUS STATS       DOWNLOAD\n";
+$ASCII_text.="+--------+----------------------+----------------------+------------+------------+----------+----------+\n";
+$ASCII_text.="| STATUS | DESCRIPTION          | CATEGORY             | CALLS      | TOTAL TIME | AVG TIME |CALLS/HOUR|\n";
+$ASCII_text.="+--------+----------------------+----------------------+------------+------------+----------+----------+\n";
+
+$GRAPH="

"; +$GRAPH.=""; +$GRAPH.="
CALLSTOTAL TIMEAVG TIMECALLS/HR

 


"; $CSV_text4.="\n\"CALL STATUS STATS\"\n"; $CSV_text4.="\"STATUS\",\"DESCRIPTION\",\"CATEGORY\",\"CALLS\",\"TOTAL TIME\",\"AVG TIME\",\"CALLS/HOUR\"\n"; @@ -1239,9 +1548,22 @@ if ($DID=='Y') $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 uniqueid IN($unid_SQL) group by status;"; } $rslt=mysql_query($stmt, $link); -if ($DB) {$MAIN.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $statuses_to_print = mysql_num_rows($rslt); $i=0; + +######## GRAPHING ######### +$max_calls=1; +$max_total_time=1; +$max_avg_time=1; +$max_callshr=1; +$graph_header=""; +$CALLS_graph=$graph_header.""; +$TOTALTIME_graph=$graph_header.""; +$AVGTIME_graph=$graph_header.""; +$CALLSHOUR_graph=$graph_header.""; +########################### + while ($i < $statuses_to_print) { $row=mysql_fetch_row($rslt); @@ -1269,6 +1591,16 @@ while ($i < $statuses_to_print) $STATUSavg_sec = ($row[2] / $STATUScount); $STATUSavg = sec_convert($STATUSavg_sec,'H'); + if ($row[0]>$max_calls) {$max_calls=$row[0];} + if ($row[2]>$max_total_time) {$max_total_time=$row[2];} + if ($STATUSavg_sec>$max_avg_time) {$max_avg_time=$STATUSavg_sec;} + if ($STATUSrate>$max_callshr) {$max_callshr=$STATUSrate;} + $graph_stats[$i][1]=$row[0]; + $graph_stats[$i][2]=$row[2]; + $graph_stats[$i][3]=$STATUSavg_sec; + $graph_stats[$i][4]=$STATUSrate; + + $STATUScount = sprintf("%10s", $row[0]);while(strlen($STATUScount)>10) {$STATUScount = substr("$STATUScount", 0, -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);} @@ -1289,9 +1621,10 @@ while ($i < $statuses_to_print) $statcat = sprintf("%-60s", $statcat_list[$RAWstatus]); while(mb_strlen($statcat,'utf-8')>20) {$statcat = mb_substr("$statcat", 0, -1,'utf-8');} } + $graph_stats[$i][0]="$status - $status_name - $statcat"; - $MAIN.="| $status | $status_name | $statcat | $STATUScount | $STATUShours | $STATUSavg | $STATUSrate |\n"; + $ASCII_text.="| $status | $status_name | $statcat | $STATUScount | $STATUShours | $STATUSavg | $STATUSrate |\n"; $CSV_text4.="\"$status\",\"$status_name\",\"$statcat\",\"$STATUScount\",\"$STATUShours\",\"$STATUSavg\",\"$STATUSrate\"\n"; $i++; @@ -1320,21 +1653,65 @@ $TOTALhours = sprintf("%10s", $TOTALhours);while(strlen($TOTALhours)>10) {$TOTAL $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);} -$MAIN.="+--------+----------------------+----------------------+------------+------------+----------+----------+\n"; -$MAIN.="| TOTAL: | $TOTALcalls | $TOTALhours | $TOTALavg | $TOTALrate |\n"; -$MAIN.="+------------------------------------------------------+------------+------------+----------+----------+\n"; +$ASCII_text.="+--------+----------------------+----------------------+------------+------------+----------+----------+\n"; +$ASCII_text.="| TOTAL: | $TOTALcalls | $TOTALhours | $TOTALavg | $TOTALrate |\n"; +$ASCII_text.="+------------------------------------------------------+------------+------------+----------+----------+\n"; + +####### + $JS_onload="onload = function() {\n"; + $JS_onload.="\tDrawCSSGraph('CALLS', '1');\n"; + $JS_onload.="\tDrawGraph('CALLS', '1');\n"; + + for ($d=0; $d"; + $TOTALTIME_graph.=" "; + $AVGTIME_graph.=" "; + $CALLSHOUR_graph.=" "; + } + $CALLS_graph.="
CALL STATUS STATS
STATUSCALLS
TOTAL TIME
AVG TIME
CALLS/HR
".$graph_stats[$d][1]."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][2], 'H')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][3], 'H')."
".$graph_stats[$d][0]."".$graph_stats[$d][4]."
TOTAL:".trim($TOTALcalls)."
"; + $TOTALTIME_graph.="TOTAL:".trim($TOTALhours).""; + $AVGTIME_graph.="TOTAL:".trim($TOTALavg).""; + $CALLSHOUR_graph.="TOTAL:".trim($TOTALrate).""; + $JS_text.="\n"; +######## + $CSV_text4.="\"TOTAL:\",\"\",\"\",\"$TOTALcalls\",\"$TOTALhours\",\"$TOTALavg\",\"$TOTALrate\"\n"; +if ($report_display_type=="HTML") + { + $MAIN.=$GRAPH; + } +else + { + $MAIN.=$ASCII_text; + } ############################## ######### STATUS CATEGORY STATS -$MAIN.="\n"; -$MAIN.="---------- CUSTOM STATUS CATEGORY STATS
DOWNLOAD\n"; -$MAIN.="+----------------------+------------+--------------------------------+\n"; -$MAIN.="| CATEGORY | CALLS | DESCRIPTION |\n"; -$MAIN.="+----------------------+------------+--------------------------------+\n"; +$ASCII_text="\n"; +$ASCII_text.="---------- CUSTOM STATUS CATEGORY STATS DOWNLOAD\n"; +$ASCII_text.="+----------------------+------------+--------------------------------+\n"; +$ASCII_text.="| CATEGORY | CALLS | DESCRIPTION |\n"; +$ASCII_text.="+----------------------+------------+--------------------------------+\n"; $CSV_text5.="\n\"CUSTOM STATUS CATEGORY STATS\"\n"; $CSV_text5.="\"CATEGORY\",\"CALLS\",\"DESCRIPTION\"\n"; @@ -1350,7 +1727,7 @@ while ($r < $statcats_to_print) $CATcount = sprintf("%10s", $vsc_count[$r]); while(strlen($CATcount)>10) {$CATcount = substr("$CATcount", 0, -1);} $CATname = sprintf("%-30s", $vsc_name[$r]); while(strlen($CATname)>30) {$CATname = substr("$CATname", 0, -1);} - $MAIN.="| $category | $CATcount | $CATname |\n"; + $ASCII_text.="| $category | $CATcount | $CATname |\n"; $CSV_text5.="\"$category\",\"$CATcount\",\"$CATname\"\n"; } @@ -1359,22 +1736,68 @@ while ($r < $statcats_to_print) $TOTCATcalls = sprintf("%10s", $TOTCATcalls); while(strlen($TOTCATcalls)>10) {$TOTCATcalls = substr("$TOTCATcalls", 0, -1);} -$MAIN.="+----------------------+------------+--------------------------------+\n"; -$MAIN.="| TOTAL | $TOTCATcalls |\n"; -$MAIN.="+----------------------+------------+\n"; +$ASCII_text.="+----------------------+------------+--------------------------------+\n"; +$ASCII_text.="| TOTAL | $TOTCATcalls |\n"; +$ASCII_text.="+----------------------+------------+\n"; $CSV_text5.="\"TOTAL\",\"$TOTCATcalls\"\n"; +if ($report_display_type=="HTML") + { + $ct_ary=""; + $r=0; $i=0; + $high_ct=0; + while ($r < $statcats_to_print) + { + if ($vsc_id[$r] != 'UNDEFINED') + { + if ($vsc_count[$r]>$high_ct) {$high_ct=$vsc_count[$r];} + $ct_ary[$i][0]=$vsc_count[$r]; + $ct_ary[$i][1]=$vsc_id[$r]."
".$vsc_name[$r]; + $i++; + } + $r++; + } + + $GRAPH_text="
\n"; + $GRAPH_text.="\n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + for ($i=0; $i0) {$bar_width=round((300*$ct_ary[$i][0])/$high_ct);} else {$bar_width=0;} + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + } + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.="
CUSTOM STATUS CATEGORY STATS
CATEGORY CALLS
".$ct_ary[$i][1]."\"\"".$ct_ary[$i][0]."
TOTAL:".trim($TOTCATcalls)."
\n"; + $GRAPH_text.="
\n";
+	$MAIN.=$GRAPH_text;
+	}
+else 
+	{
+	$MAIN.=$ASCII_text;
+	}
+
+
 ##############################
 #########  CALL INITIAL QUEUE POSITION BREAKDOWN
 
 $TOTALcalls = 0;
 
-$MAIN.="\n";
-$MAIN.="---------- CALL INITIAL QUEUE POSITION BREAKDOWN       DOWNLOAD\n";
-$MAIN.="+-------------------------------------------------------------------------------------+------------+\n";
-$MAIN.="|     1     2     3     4     5     6     7     8     9    10    15    20    25   +25 | TOTAL      |\n";
-$MAIN.="+-------------------------------------------------------------------------------------+------------+\n";
+$ASCII_text="\n";
+$ASCII_text.="---------- CALL INITIAL QUEUE POSITION BREAKDOWN       DOWNLOAD\n";
+$ASCII_text.="+-------------------------------------------------------------------------------------+------------+\n";
+$ASCII_text.="|     1     2     3     4     5     6     7     8     9    10    15    20    25   +25 | TOTAL      |\n";
+$ASCII_text.="+-------------------------------------------------------------------------------------+------------+\n";
 
 $CSV_text6.="\n\"CALL INITIAL QUEUE POSITION BREAKDOWN\"\n";
 $CSV_text6.="\"\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"15\",\"20\",\"25\",\"+25\",\"TOTAL\"\n";
@@ -1386,7 +1809,7 @@ if ($DID=='Y')
 	$stmt="select count(*),queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_position;";
 	}
 $rslt=mysql_query($stmt, $link);
-if ($DB) {$MAIN.="$stmt\n";}
+if ($DB) {$ASCII_text.="$stmt\n";}
 $positions_to_print = mysql_num_rows($rslt);
 $i=0;
 while ($i < $positions_to_print)
@@ -1429,11 +1852,80 @@ $qp99 =	sprintf("%5s", $qp99);
 
 $TOTALcalls =		sprintf("%10s", $TOTALcalls);
 
-$MAIN.="| $qp_1 $qp_2 $qp_3 $qp_4 $qp_5 $qp_6 $qp_7 $qp_8 $qp_9 $qp10 $qp15 $qp20 $qp25 $qp99 | $TOTALcalls |\n";
-$MAIN.="+-------------------------------------------------------------------------------------+------------+\n";
+$ASCII_text.="| $qp_1 $qp_2 $qp_3 $qp_4 $qp_5 $qp_6 $qp_7 $qp_8 $qp_9 $qp10 $qp15 $qp20 $qp25 $qp99 | $TOTALcalls |\n";
+$ASCII_text.="+-------------------------------------------------------------------------------------+------------+\n";
 
 $CSV_text6.="\"\",\"$qp_1\",\"$qp_2\",\"$qp_3\",\"$qp_4\",\"$qp_5\",\"$qp_6\",\"$qp_7\",\"$qp_8\",\"$qp_9\",\"$qp10\",\"$qp15\",\"$qp20\",\"$qp25\",\"$qp99\",\"$TOTALcalls\"\n";
 
+if ($report_display_type=="HTML") 
+	{
+	$stmt="select count(*),queue_position as qp from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by qp order by qp asc;";
+	$ms_stmt="select queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) order by queue_position desc limit 1;"; 
+	$mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) group by queue_position order by ct desc limit 1;";
+	if ($DID=='Y')
+		{
+		$stmt="select count(*),queue_position as qp from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by qp order by qp asc;";
+		$ms_stmt="select queue_position from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) order by queue_position desc limit 1;"; 
+		$mc_stmt="select count(*) as ct from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) group by queue_position order by ct desc limit 1;";
+		}
+	if ($DB) {$GRAPH_text.=$stmt."\n";}
+	$ms_rslt=mysql_query($ms_stmt, $link);
+	$ms_row=mysql_fetch_row($ms_rslt);
+	$max_position=$ms_row[0];
+	if ($max_position>25) {$max_position=26;}
+	for ($i=1; $i<=$max_position; $i++) {
+		$sec_ary[$i]=0;
+	}
+
+	$mc_rslt=mysql_query($mc_stmt, $link);
+	$mc_row=mysql_fetch_row($mc_rslt);
+	$max_calls=$ms_row[0];
+	if ($max_calls<=10) {
+		while ($maxcalls%5!=0) {
+			$maxcalls++;
+		}
+	} else if ($max_calls<=100) {
+		while ($maxcalls%10!=0) {
+			$maxcalls++;
+		}
+	} else if ($max_calls<=1000) {
+		while ($maxcalls%50!=0) {
+			$maxcalls++;
+		}
+	} else {
+		while ($maxcalls%500!=0) {
+			$maxcalls++;
+		}
+	}
+	$rslt=mysql_query($stmt, $link);
+	
+	$GRAPH_text="
\n"; + $GRAPH_text.=""; + $MAIN.=$GRAPH_text; + } +else + { + $MAIN.=$ASCII_text; + } ############################## ######### USER STATS @@ -1443,22 +1935,35 @@ $TOTcalls=0; $TOTtime=0; $TOTavg=0; -$MAIN.="\n"; -$MAIN.="---------- AGENT STATS DOWNLOAD\n"; -$MAIN.="+--------------------------+------------+------------+--------+\n"; -$MAIN.="| AGENT | CALLS | TIME H:M:S |AVERAGE |\n"; -$MAIN.="+--------------------------+------------+------------+--------+\n"; +$ASCII_text="\n"; +$ASCII_text.="---------- AGENT STATS DOWNLOAD\n"; +$ASCII_text.="+--------------------------+------------+------------+--------+\n"; +$ASCII_text.="| AGENT | CALLS | TIME H:M:S |AVERAGE |\n"; +$ASCII_text.="+--------------------------+------------+------------+--------+\n"; $CSV_text7.="\n\"AGENT STATS\"\n"; $CSV_text7.="\"AGENT\",\"CALLS\",\"TIME H:M:S\",\"AVERAGE\"\n"; + +$max_calls=1; +$max_timehms=1; +$max_average=1; +$graph_stats=array(); +$GRAPH="

"; +$GRAPH.=""; +$GRAPH.="
CALLSTIME H:M:SAVERAGE

 


"; +$graph_header=""; +$CALLS_graph=$graph_header.""; +$TIMEHMS_graph=$graph_header.""; +$AVERAGE_graph=$graph_header.""; + $stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 0 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;"; if ($DID=='Y') { $stmt="select vicidial_closer_log.user,full_name,count(*),sum(length_in_sec),avg(length_in_sec) from vicidial_closer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and uniqueid IN($unid_SQL) and vicidial_closer_log.user is not null and length_in_sec is not null and length_in_sec > 0 and vicidial_closer_log.user=vicidial_users.user group by vicidial_closer_log.user;"; } $rslt=mysql_query($stmt, $link); -if ($DB) {$MAIN.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $users_to_print = mysql_num_rows($rslt); $i=0; while ($i < $users_to_print) @@ -1481,13 +1986,21 @@ while ($i < $users_to_print) $USERtotTALK = $row[3]; $USERavgTALK = $row[4]; + if ($row[2]>$max_calls) {$max_calls=$row[2];} + if ($row[3]>$max_timehms) {$max_timehms=$row[3];} + if ($row[4]>$max_average) {$max_average=$row[4];} + $graph_stats[$i][0]="$row[0] - $row[1]"; + $graph_stats[$i][1]=$row[2]; + $graph_stats[$i][2]=$row[3]; + $graph_stats[$i][3]=$row[4]; + $USERtotTALK_MS = sec_convert($USERtotTALK,'H'); $USERavgTALK_MS = sec_convert($USERavgTALK,'H'); $USERtotTALK_MS = sprintf("%9s", $USERtotTALK_MS); $USERavgTALK_MS = sprintf("%6s", $USERavgTALK_MS); - $MAIN.="| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n"; + $ASCII_text.="| $user - $full_name | $USERcalls | $USERtotTALK_MS | $USERavgTALK_MS |\n"; $CSV_text7.="\"$user - $full_name\",\"$USERcalls\",\"$USERtotTALK_MS\",\"$USERavgTALK_MS\"\n"; $i++; @@ -1509,9 +2022,49 @@ $TOTcalls = sprintf("%10s", $TOTcalls); $TOTtime = sprintf("%8s", $TOTtime); $TOTavg = sprintf("%6s", $TOTavg); -$MAIN.="+--------------------------+------------+------------+--------+\n"; -$MAIN.="| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n"; -$MAIN.="+--------------------------+------------+------------+--------+\n"; +$ASCII_text.="+--------------------------+------------+------------+--------+\n"; +$ASCII_text.="| TOTAL Agents: $TOTagents | $TOTcalls | $TOTtime | $TOTavg |\n"; +$ASCII_text.="+--------------------------+------------+------------+--------+\n"; + +for ($d=0; $d"; + $TIMEHMS_graph.=" "; + $AVERAGE_graph.=" "; +} +$CALLS_graph.="
AGENT STATS
AGENTCALLS
TIME H:M:S
AVERAGE
".$graph_stats[$d][1]."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][2], 'H')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][3], 'H')."
TOTAL:".trim($TOTALcalls)."
"; +$TIMEHMS_graph.="TOTAL:".trim($TOTtime).""; +$AVERAGE_graph.="TOTAL:".trim($TOTavg).""; +$JS_text.="\n"; +$GRAPH_text=$GRAPH; + +if ($report_display_type=="HTML") + { + $MAIN.=$GRAPH_text; + } +else + { + $MAIN.=$ASCII_text; + } $CSV_text7.="\"TOTAL Agents: $TOTagents\",\"$TOTcalls\",\"$TOTtime\",\"$TOTavg\"\n"; @@ -1619,8 +2172,9 @@ else #$hour_multiplier = round($hour_multiplier, 0); } -$MAIN.="\n"; -$MAIN.="GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS TAKEN INTO THIS IN-GROUP\n"; +$ASCII_text.="\n"; +$ASCII_text.="GRAPH IN 15 MINUTE INCREMENTS OF TOTAL CALLS TAKEN INTO THIS IN-GROUP\n"; + $k=1; $Mk=0; @@ -1649,13 +2203,17 @@ while ($k <= 102) } -$MAIN.="+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n"; -#$MAIN.="| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP | DROPS | TOTAL |\n"; -$MAIN.="| HOUR |$call_scale| DROPS | TOTAL |\n"; -$MAIN.="+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n"; +$ASCII_text.="+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n"; +#$ASCII_text.="| HOUR | GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP | DROPS | TOTAL |\n"; +$ASCII_text.="| HOUR |$call_scale| DROPS | TOTAL |\n"; +$ASCII_text.="+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n"; $CSV_text9.="\"HOUR\",\"DROPS\",\"TOTAL\"\n"; +$max_calls=1; +$graph_stats=array(); +$GRAPH_text=""; + $ZZ = '00'; $i=0; @@ -1688,11 +2246,12 @@ while ($i <= 96) else { $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); - $MAIN.="|$time|"; + $ASCII_text.="|$time|"; $CSV_text9.="\"$time\","; - $k=0; while ($k <= 102) {$MAIN.=" "; $k++;} - $MAIN.="| $hour_count[$i] |\n"; + $k=0; while ($k <= 102) {$ASCII_text.=" "; $k++;} + $ASCII_text.="| $hour_count[$i] |\n"; $CSV_text9.="\"0\",\"0\"\n"; + } } else @@ -1706,13 +2265,13 @@ while ($i <= 96) { $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); - $MAIN.="|$time|"; + $ASCII_text.="|$time|"; $CSV_text9.="\"$time\","; - $k=0; while ($k <= $Xhour_count) {$MAIN.="*"; $k++; $char_counter++;} - $MAIN.="*X"; $char_counter++; - $k=0; while ($k <= $Yhour_count) {$MAIN.=" "; $k++; $char_counter++;} - while ($char_counter <= 101) {$MAIN.=" "; $char_counter++;} - $MAIN.="| 0 | $hour_count[$i] |\n"; + $k=0; while ($k <= $Xhour_count) {$ASCII_text.="*"; $k++; $char_counter++;} + $ASCII_text.="*X"; $char_counter++; + $k=0; while ($k <= $Yhour_count) {$ASCII_text.=" "; $k++; $char_counter++;} + while ($char_counter <= 101) {$ASCII_text.=" "; $char_counter++;} + $ASCII_text.="| 0 | $hour_count[$i] |\n"; $CSV_text9.="\"0\",\"$hour_count[$i]\"\n"; } @@ -1730,27 +2289,58 @@ while ($i <= 96) $hour_count[$i] = sprintf("%-5s", $hour_count[$i]); $drop_count[$i] = sprintf("%-5s", $drop_count[$i]); - $MAIN.="|$time|"; + $ASCII_text.="|$time|"; $CSV_text9.="\"$time\",\"\""; - $k=0; while ($k <= $Xdrop_count) {$MAIN.=">"; $k++; $char_counter++;} - $MAIN.="D"; $char_counter++; - $k=0; while ($k <= $XXhour_count) {$MAIN.="*"; $k++; $char_counter++;} - $MAIN.="X"; $char_counter++; - $k=0; while ($k <= $Yhour_count) {$MAIN.=" "; $k++; $char_counter++;} - while ($char_counter <= 102) {$MAIN.=" "; $char_counter++;} - $MAIN.="| $drop_count[$i] | $hour_count[$i] |\n"; + $k=0; while ($k <= $Xdrop_count) {$ASCII_text.=">"; $k++; $char_counter++;} + $ASCII_text.="D"; $char_counter++; + $k=0; while ($k <= $XXhour_count) {$ASCII_text.="*"; $k++; $char_counter++;} + $ASCII_text.="X"; $char_counter++; + $k=0; while ($k <= $Yhour_count) {$ASCII_text.=" "; $k++; $char_counter++;} + while ($char_counter <= 102) {$ASCII_text.=" "; $char_counter++;} + $ASCII_text.="| $drop_count[$i] | $hour_count[$i] |\n"; $CSV_text9.="\"$drop_count[$i]\",\"$hour_count[$i]\"\n"; + } } + $graph_stats[$i][0]="$time"; + $graph_stats[$i][1]=trim($hour_count[$i]); + $graph_stats[$i][2]=trim($drop_count[$i]); + if (trim($hour_count[$i])>$max_calls) {$max_calls=trim($hour_count[$i]);} $i++; $h++; } -$MAIN.="+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n"; +$ASCII_text.="+------+-------------------------------------------------------------------------------------------------------+-------+-------+\n\n"; + +for ($d=0; $d\n"; + } +} +$GRAPH_text.="
GRAPH IN 15 MINUTE INCREMENTS OF TOTAL INCOMING CALLS FOR THIS GROUP
HOURDROPS / CALLS
\n"; + if ($graph_stats[$d][1]>0) { + $GRAPH_text.="
  • ".$graph_stats[$d][1]."
  • "; + if ($graph_stats[$d][2]>0) { + $GRAPH_text.="
  • ".$graph_stats[$d][2]."
  • "; + } + $GRAPH_text.="
\n"; + } else { + $GRAPH_text.="0"; + } + $GRAPH_text.="


"; +if ($report_display_type=="HTML") + { + $MAIN.=$GRAPH_text; + } +else + { + $MAIN.=$ASCII_text; + } @@ -1877,6 +2467,7 @@ if ($file_download>0) { exit; } else { echo $HEADER; + echo $JS_text; require("admin_header.php"); echo $MAIN; } diff --git a/agc_2-X/trunk/www/vicidial/AST_CLOSERsummary_hourly.php b/agc_2-X/trunk/www/vicidial/AST_CLOSERsummary_hourly.php index bce912e6..bc23c425 100644 --- a/agc_2-X/trunk/www/vicidial/AST_CLOSERsummary_hourly.php +++ b/agc_2-X/trunk/www/vicidial/AST_CLOSERsummary_hourly.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -14,6 +14,7 @@ # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 110703-1806 - Added download option # 111103-2315 - Added user_group restrictions for selecting in-groups +# 120224-0910 - Added HTML display option with bar graphs # require("dbconnect.php"); @@ -51,6 +52,8 @@ if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -260,6 +263,7 @@ $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; +$HEADER.="\n"; $HEADER.="\n"; $HEADER.="$report_name\n"; @@ -334,7 +338,11 @@ if ($bareformat < 1) $MAIN.="
DOWNLOAD | "; $MAIN.="MODIFY | "; $MAIN.="REPORTS"; - $MAIN.="


\n"; + $MAIN.="
\n"; + $MAIN.="
  Display as: "; + $MAIN.="\n
"; $MAIN.="   Exclude Outbound Drop Groups:
"; $MAIN.="   \n"; -$MAIN.="\n"; +$MAIN.="\n"; $MAIN.="\n"; +$MAIN.="  "; +$MAIN.="\n

"; $MAIN.="\n"; $MAIN.="           DOWNLOAD | MODIFY | REPORTS \n"; $MAIN.="\n"; @@ -519,18 +540,27 @@ else ### TOTALS DID SUMMARY SECTION ### if (strlen($extension[0]) > 0) { - $MAIN.="DID Summary:\n"; - $MAIN.="+--------------------+--------------------------------+------------+------------+\n"; - $MAIN.="| DID | DESCRIPTION | ROUTE | CALLS |\n"; - $MAIN.="+--------------------+--------------------------------+------------+------------+\n"; + $ASCII_text.="DID Summary:\n"; + $ASCII_text.="+--------------------+--------------------------------+------------+------------+\n"; + $ASCII_text.="| DID | DESCRIPTION | ROUTE | CALLS |\n"; + $ASCII_text.="+--------------------+--------------------------------+------------+------------+\n"; $CSV_text1.="\"DID Summary:\"\n"; $CSV_text1.="\"DID\",\"DESCRIPTION\",\"ROUTE\",\"CALLS\"\n"; + $GRAPH_text.="
\n"; + $GRAPH_text.=" \n"; + $GRAPH_text.="\n"; + $GRAPH_text.="\n"; + $GRAPH_text.="\n"; + $GRAPH_text.="\n"; + + $stats_array = array_group_count($extension, 'desc'); $stats_array_ct = count($stats_array); $d=0; + $max_calls=1; while ($d < $stats_array_ct) { $stat_description = ' *** default *** '; @@ -539,6 +569,9 @@ else $stat_record_array = explode(' ',$stats_array[$d]); $stat_count = ($stat_record_array[0] + 0); $stat_pattern = $stat_record_array[1]; + if ($stat_count>$max_calls) {$max_calls=$stat_count;} + $graph_stats[$d][0]=$stat_count; + $graph_stats[$d][1]=$stat_pattern; $stmt="select did_description,did_route from vicidial_inbound_dids where did_pattern='$stat_pattern';"; $rslt=mysql_query($stmt, $link); @@ -561,16 +594,31 @@ else $stat_pattern = "$stat_pattern"; - $MAIN.="| $stat_pattern | $stat_description | $stat_route | $stat_count |\n"; + $ASCII_text.="| $stat_pattern | $stat_description | $stat_route | $stat_count |\n"; $d++; } + for ($d=0; $d".$graph_stats[$d][1]."\n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + } + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.="
DID Summary:
DIDCALLS
\"\"".$graph_stats[$d][0]."
TOTAL CALLS:".trim($totCALLS)."
\n";
+
 			$FtotCALLS =	sprintf("%10s", $totCALLS);
 
-		$MAIN.="+--------------------+--------------------------------+------------+------------+\n";
-		$MAIN.="|                                                           TOTALS | $FtotCALLS |\n";
-		$MAIN.="+------------------------------------------------------------------+------------+\n";
+		$ASCII_text.="+--------------------+--------------------------------+------------+------------+\n";
+		$ASCII_text.="|                                                           TOTALS | $FtotCALLS |\n";
+		$ASCII_text.="+------------------------------------------------------------------+------------+\n";
 		$CSV_text1.="\"\",\"\",\"TOTALS\",\"$FtotCALLS\"\n";
+		#$MAIN.=$GRAPH;
+
 		}
 
 
@@ -622,20 +670,29 @@ else
 
 	###################################################
 	### TOTALS DATE SUMMARY SECTION ###
-	$MAIN.="\nDate Summary:\n";
-	$MAIN.="+-------------------------------------------+--------+\n";
-	$MAIN.="| SHIFT                                     |        |\n";
-	$MAIN.="| DATE-TIME RANGE                           | CALLS  |\n";
-	$MAIN.="+-------------------------------------------+--------+\n";
+	$ASCII_text.="\nDate Summary:\n";
+	$ASCII_text.="+-------------------------------------------+--------+\n";
+	$ASCII_text.="| SHIFT                                     |        |\n";
+	$ASCII_text.="| DATE-TIME RANGE                           | CALLS  |\n";
+	$ASCII_text.="+-------------------------------------------+--------+\n";
 
 	$CSV_text1.="\n\"Date Summary:\"\n";
 	$CSV_text1.="\"SHIFT DATE-TIME RANGE\",\"CALLS\"\n";
 
+	$GRAPH_text.="
\n"; + $GRAPH_text.=" \n"; + $GRAPH_text.="\n"; + $GRAPH_text.="\n"; + $GRAPH_text.="\n"; + $GRAPH_text.="\n"; + $d=0; + $max_calls=1; + $graph_stats=array(); while ($d < $DURATIONday) { if ($totCALLSdate[$d] < 1) {$totCALLSdate[$d]=0;} - + if ($totCALLSsecDATE[$d] > 0) { $totCALLSavgDATE[$d] = ($totCALLSsecDATE[$d] / $totCALLSdate[$d]); @@ -660,17 +717,45 @@ else {$totCALLSdate[$d]='';} $totCALLSdate[$d] = sprintf("%6s", $totCALLSdate[$d]); - $MAIN.="| $daySTART[$d] - $dayEND[$d] | $totCALLSdate[$d] |\n"; + if ($totCALLSdate[$d]>$max_calls) {$max_calls=$totCALLSdate[$d];} + $graph_stats[$d][0]=$totCALLSdate[$d]+0; + $graph_stats[$d][1]=substr($daySTART[$d],0,10); + + $ASCII_text.="| $daySTART[$d] - $dayEND[$d] | $totCALLSdate[$d] |\n"; $CSV_text1.="\"$daySTART[$d]\",\"$dayEND[$d]\",\"$totCALLSdate[$d]\"\n"; $d++; } + for ($d=0; $d".$graph_stats[$d][1]."\n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + } + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.=" \n"; + $GRAPH_text.="
Date Summary:
SHIFT DATE-TIME RANGECALLS
\"\"".$graph_stats[$d][0]."
TOTAL CALLS:".trim($totCALLS)."
\n";
+
+
 	$FtotCALLS =	sprintf("%6s", $totCALLS);
 
-	$MAIN.="+-------------------------------------------+--------+\n";
-	$MAIN.="|                                    TOTALS | $FtotCALLS |\n";
-	$MAIN.="+-------------------------------------------+--------+\n";
+	$ASCII_text.="+-------------------------------------------+--------+\n";
+	$ASCII_text.="|                                    TOTALS | $FtotCALLS |\n";
+	$ASCII_text.="+-------------------------------------------+--------+\n";
 	$CSV_text1.="\"TOTALS\",\"$FtotCALLS\"\n";
+	#$MAIN.=$GRAPH;
+
+	if ($report_display_type=="HTML")
+		{
+		$MAIN.=$GRAPH_text;
+		}
+	else
+		{
+		$MAIN.=$ASCII_text;
+		}
 
 
 	## FORMAT OUTPUT ##
@@ -705,16 +790,15 @@ else
 	#########  HOLD TIME, CALL AND DROP STATS 15-MINUTE INCREMENTS ####
 
 	$MAIN.="\n";
-	$MAIN.="---------- HOLD TIME, CALL AND DROP STATS\n";
+	$ASCII_text.="---------- HOLD TIME, CALL AND DROP STATS\n";
 
 	$CSV_text1.="\n\"HOLD TIME, CALL AND DROP STATS\"\n";
 
-	$MAIN.="";
-
-	$MAIN.="";
-	$MAIN.="\n";
-	$MAIN.="GRAPH IN 15 MINUTE INCREMENTS OF AVERAGE HOLD TIME FOR CALLS TAKEN INTO THIS IN-GROUP\n";
+	$ASCII_text.="";
 
+	$ASCII_text.="";
+	$ASCII_text.="\n";
+	$ASCII_text.="GRAPH IN 15 MINUTE INCREMENTS OF AVERAGE HOLD TIME FOR CALLS TAKEN INTO THIS IN-GROUP\n";
 
 	$k=1;
 	$Mk=0;
@@ -776,13 +860,20 @@ else
 		}
 
 
-	$MAIN.="+-------------+-------------------------------------------------------------------------+-------+\n";
-	$MAIN.="|    TIME     |    CALLS HANDLED                                                        |       |\n";
-	$MAIN.="| 15 MIN INT  |$call_scale| TOTAL |\n";
-	$MAIN.="+-------------+-------------------------------------------------------------------------+-------+\n";
+	$ASCII_text.="+-------------+-------------------------------------------------------------------------+-------+\n";
+	$ASCII_text.="|    TIME     |    CALLS HANDLED                                                        |       |\n";
+	$ASCII_text.="| 15 MIN INT  |$call_scale| TOTAL |\n";
+	$ASCII_text.="+-------------+-------------------------------------------------------------------------+-------+\n";
 
 	$CSV_text1.="\"TIME 15-MIN INT\",\"TOTAL\"\n";
 
+
+
+	$max_calls=1;
+	$graph_stats=array();
+	$GRAPH_text="";
+
+
 	$i=0;
 	while ($i < $TOTintervals)
 		{
@@ -803,10 +894,10 @@ else
 				$TOT_lines++;
 				$qrtQUEUEavg[$i] =	sprintf("%5s", $qrtQUEUEavg[$i]);
 				$qrtQUEUEmax[$i] =	sprintf("%5s", $qrtQUEUEmax[$i]);
-				$MAIN.="|$HMdisplay[$i]|";
+				$ASCII_text.="|$HMdisplay[$i]|";
 				$CSV_text1.="\"$HMdisplay[$i]\",";
-			#	$k=0;   while ($k <= 22) {$MAIN.=" ";   $k++;}
-			#	$MAIN.="| $qrtQUEUEavg[$i] | $qrtQUEUEmax[$i] |";
+			#	$k=0;   while ($k <= 22) {$ASCII_text.=" ";   $k++;}
+			#	$ASCII_text.="| $qrtQUEUEavg[$i] | $qrtQUEUEmax[$i] |";
 				}
 			}
 		else
@@ -819,15 +910,15 @@ else
 			$qrtQUEUEavg[$i] =	sprintf("%5s", $qrtQUEUEavg[$i]);
 			$qrtQUEUEmax[$i] =	sprintf("%5s", $qrtQUEUEmax[$i]);
 
-		#	$MAIN.="|$HMdisplay[$i]|";
-			$MAIN.="|$HMdisplay[$i]|";
+		#	$ASCII_text.="|$HMdisplay[$i]|";
+			$ASCII_text.="|$HMdisplay[$i]|";
 			$CSV_text1.="\"$HMdisplay[$i]\",\"\"";
-		#	$k=0;   while ($k <= $Xavg_hold) {$MAIN.="*";   $k++;   $char_counter++;}
-		#	if ($char_counter >= 22) {$MAIN.="H";   $char_counter++;}
-		#	else {$MAIN.="*H";   $char_counter++;   $char_counter++;}
-		#	$k=0;   while ($k <= $Yavg_hold) {$MAIN.=" ";   $k++;   $char_counter++;}
-		#		while ($char_counter <= 22) {$MAIN.=" ";   $char_counter++;}
-		#	$MAIN.="| $qrtQUEUEavg[$i] | $qrtQUEUEmax[$i] |";
+		#	$k=0;   while ($k <= $Xavg_hold) {$ASCII_text.="*";   $k++;   $char_counter++;}
+		#	if ($char_counter >= 22) {$ASCII_text.="H";   $char_counter++;}
+		#	else {$ASCII_text.="*H";   $char_counter++;   $char_counter++;}
+		#	$k=0;   while ($k <= $Yavg_hold) {$ASCII_text.=" ";   $k++;   $char_counter++;}
+		#		while ($char_counter <= 22) {$ASCII_text.=" ";   $char_counter++;}
+		#	$ASCII_text.="| $qrtQUEUEavg[$i] | $qrtQUEUEmax[$i] |";
 			}
 		### END HOLD TIME TOTALS GRAPH ###
 
@@ -844,9 +935,9 @@ else
 				{
 				if ($qrtCALLS[$i] < 1) {$qrtCALLS[$i]='';}
 				$qrtCALLS[$i] =	sprintf("%5s", $qrtCALLS[$i]);
-			#	$MAIN.="  |";
-				$k=0;   while ($k <= 72) {$MAIN.=" ";   $k++;}
-				$MAIN.="| $qrtCALLS[$i] |\n";
+			#	$ASCII_text.="  |";
+				$k=0;   while ($k <= 72) {$ASCII_text.=" ";   $k++;}
+				$ASCII_text.="| $qrtCALLS[$i] |\n";
 				$CSV_text1.="\"0\"\n";
 				}
 			}
@@ -862,13 +953,13 @@ else
 				if ($qrtCALLS[$i] < 1) {$qrtCALLS[$i]='';}
 				$qrtCALLS[$i] =	sprintf("%5s", $qrtCALLS[$i]);
 
-				$MAIN.="";
-				$k=0;   while ($k <= $Xhour_count) {$MAIN.="*";   $k++;   $char_counter++;}
-				if ($char_counter > 71) {$MAIN.="C";   $char_counter++;}
-				else {$MAIN.="*C";   $char_counter++;   $char_counter++;}
-				$k=0;   while ($k <= $Yhour_count) {$MAIN.=" ";   $k++;   $char_counter++;}
-					while ($char_counter <= 72) {$MAIN.=" ";   $char_counter++;}
-				$MAIN.="| $qrtCALLS[$i] |\n";
+				$ASCII_text.="";
+				$k=0;   while ($k <= $Xhour_count) {$ASCII_text.="*";   $k++;   $char_counter++;}
+				if ($char_counter > 71) {$ASCII_text.="C";   $char_counter++;}
+				else {$ASCII_text.="*C";   $char_counter++;   $char_counter++;}
+				$k=0;   while ($k <= $Yhour_count) {$ASCII_text.=" ";   $k++;   $char_counter++;}
+					while ($char_counter <= 72) {$ASCII_text.=" ";   $char_counter++;}
+				$ASCII_text.="| $qrtCALLS[$i] |\n";
 				$CSV_text1.="\"$qrtCALLS[$i]\"\n";
 				}
 			else
@@ -883,20 +974,23 @@ else
 				$qrtCALLS[$i] =	sprintf("%5s", $qrtCALLS[$i]);
 				$qrtDROPS[$i] =	sprintf("%5s", $qrtDROPS[$i]);
 
-				$MAIN.="";
-				$k=0;   while ($k <= $Xdrop_count) {$MAIN.=">";   $k++;   $char_counter++;}
-				$MAIN.="D";   $char_counter++;
-				$k=0;   while ($k <= $XXhour_count) {$MAIN.="*";   $k++;   $char_counter++;}
-				$MAIN.="C";   $char_counter++;
-				$k=0;   while ($k <= $Yhour_count) {$MAIN.=" ";   $k++;   $char_counter++;}
-				while ($char_counter <= 72) {$MAIN.=" ";   $char_counter++;}
+				$ASCII_text.="";
+				$k=0;   while ($k <= $Xdrop_count) {$ASCII_text.=">";   $k++;   $char_counter++;}
+				$ASCII_text.="D";   $char_counter++;
+				$k=0;   while ($k <= $XXhour_count) {$ASCII_text.="*";   $k++;   $char_counter++;}
+				$ASCII_text.="C";   $char_counter++;
+				$k=0;   while ($k <= $Yhour_count) {$ASCII_text.=" ";   $k++;   $char_counter++;}
+				while ($char_counter <= 72) {$ASCII_text.=" ";   $char_counter++;}
 
-				$MAIN.="| $qrtCALLS[$i] |\n";
+				$ASCII_text.="| $qrtCALLS[$i] |\n";
 				$CSV_text1.="\"$qrtCALLS[$i]\"\n";
 				}
 			}
 		### END CALLS TOTALS GRAPH ###
-
+		$graph_stats[$i][0]=$HMdisplay[$i];
+		$graph_stats[$i][1]=trim($qrtCALLS[$i]);
+		$graph_stats[$i][2]=trim($qrtDROPS[$i]);
+		if (trim($qrtCALLS[$i])>$max_calls) {$max_calls=$qrtCALLS[$i];}
 		$i++;
 		}
 
@@ -913,9 +1007,36 @@ else
 	$totCALLS =	sprintf("%5s", $totCALLS);
 
 
-	$MAIN.="+-------------+-------------------------------------------------------------------------+-------+\n";
-	$MAIN.="| TOTAL       |                                                                         | $totCALLS |\n";
-	$MAIN.="+-------------+-------------------------------------------------------------------------+-------+\n";
+	$ASCII_text.="+-------------+-------------------------------------------------------------------------+-------+\n";
+	$ASCII_text.="| TOTAL       |                                                                         | $totCALLS |\n";
+	$ASCII_text.="+-------------+-------------------------------------------------------------------------+-------+\n";
+
+
+	for ($d=0; $d\n";
+	}
+	$GRAPH_text.="
HOLD TIME, CALL AND DROP STATS
TIME 15-MIN INTDROPS / CALLS
\n"; + if ($graph_stats[$d][1]>0) { + $GRAPH_text.="
  • ".$graph_stats[$d][1]."
  • "; + if ($graph_stats[$d][2]>0) { + $GRAPH_text.="
  • ".$graph_stats[$d][2]."
  • "; + } + $GRAPH_text.="
\n"; + } else { + $GRAPH_text.="0"; + } + $GRAPH_text.="
TOTALS:".trim($totCALLS)."
"; + + if ($report_display_type=="HTML") + { + $MAIN.=$GRAPH_text; + } + else + { + $MAIN.=$ASCII_text; + } + $CSV_text1.="\"TOTAL\",\"$totCALLS\"\n"; @@ -953,6 +1074,8 @@ else } else { echo $HEADER; require("admin_header.php"); + + echo $MAIN; } diff --git a/agc_2-X/trunk/www/vicidial/AST_IVRfilter.php b/agc_2-X/trunk/www/vicidial/AST_IVRfilter.php index e1529ad6..af0adedf 100644 --- a/agc_2-X/trunk/www/vicidial/AST_IVRfilter.php +++ b/agc_2-X/trunk/www/vicidial/AST_IVRfilter.php @@ -80,7 +80,7 @@ $row=mysql_fetch_row($rslt); $auth=$row[0]; - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); Header("HTTP/1.0 401 Unauthorized"); diff --git a/agc_2-X/trunk/www/vicidial/AST_IVRstats.php b/agc_2-X/trunk/www/vicidial/AST_IVRstats.php index d9e3ca7c..9f5ad460 100644 --- a/agc_2-X/trunk/www/vicidial/AST_IVRstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_IVRstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # 81026-2026 - First build @@ -19,6 +19,7 @@ # 110525-1907 - Added support for outbound log analysis # 110703-1850 - Added download option # 111103-2315 - Added user_group restrictions for selecting in-groups +# 120224-0910 - Added HTML display option with bar graphs # require("dbconnect.php"); @@ -44,6 +45,8 @@ if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -56,6 +59,8 @@ if ($type == 'inbound') else {$report_name = 'Outbound IVR Report';} $db_source = 'M'; +$JS_text="\n"; $HEADER.="\n"; +$HEADER.="\n"; $HEADER.="\n"; @@ -425,7 +431,11 @@ $MAIN.=" }\n"; $MAIN.="\n"; -$MAIN.="  \n"; +$MAIN.="
Display as:  "; +$MAIN.="\n
"; +$MAIN.="    \n"; $MAIN.="\n"; $MAIN.="\n\n"; @@ -601,11 +611,30 @@ else ### put call flows and counts together for sorting again $s=0; - $MAIN.="+--------+--------+--------+--------+------+------+\n"; - $MAIN.="| | | QUEUE | QUEUE | IVR | TOTAL|\n"; - $MAIN.="| IVR | QUEUE | DROP | DROP | AVG | AVG |\n"; - $MAIN.="| CALLS | CALLS | CALLS | PERCENT| TIME | TIME | CALL PATH\n"; - $MAIN.="+--------+--------+--------+--------+------+------+------------\n"; + $ASCII_text.="+--------+--------+--------+--------+------+------+\n"; + $ASCII_text.="| | | QUEUE | QUEUE | IVR | TOTAL|\n"; + $ASCII_text.="| IVR | QUEUE | DROP | DROP | AVG | AVG |\n"; + $ASCII_text.="| CALLS | CALLS | CALLS | PERCENT| TIME | TIME | CALL PATH\n"; + $ASCII_text.="+--------+--------+--------+--------+------+------+------------\n"; + + ######## GRAPHING ######### + $graph_stats=array(); + $max_ivr_calls=1; + $max_queue_calls=1; + $max_queue_drops=1; + $max_queue_drops_percent=1; + $max_ivr_avg=1; + $max_total_avg=1; + $GRAPH=""; + $GRAPH.=""; + $GRAPH.="
IVR CALLSQUEUE CALLSQUEUE DROP CALLSQUEUE DROP PERCENTIVR AVG TIMETOTAL AVG TIME

 


"; + $IVRCALLS_graph=""; + $QUEUECALLS_graph="
IVR STATS
IVR CALLSCALL PATH
"; + $QUEUEDROPCALLS_graph="
IVR STATS
QUEUE CALLSCALL PATH
"; + $QUEUEDROPPERCENT_graph="
IVR STATS
QUEUE DROP CALLSCALL PATH
"; + $IVRAVGTIME_graph="
IVR STATS
QUEUE DROP PERCENTCALL PATH
"; + $TOTALAVGTIME_graph="
IVR STATS
IVR AVG TIMECALL PATH
"; + ########################### $CSV_text.="\"\",\"IVR CALLS\",\"QUEUE CALLS\",\"QUEUE DROP CALLS\",\"QUEUE DROP PERCENT\",\"IVR AVG TIME\",\"TOTAL AVG TIME\",\"CALL PATH\"\n"; @@ -626,7 +655,7 @@ else ##### Grab all records for the IVR for the specified time period $stmt="select status,length_in_sec from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id IN($group_SQL) and uniqueid IN($FLOWunique_calls_list[$s]);"; $rslt=mysql_query($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $vcl_statuses_to_print = mysql_num_rows($rslt); $w=0; while ($w < $vcl_statuses_to_print) @@ -645,6 +674,16 @@ else $FLOWdropPCT[$s] = ( ($FLOWdrop[$s] / $FLOWtotal[$s]) * 100); $FLOWdropPCT[$s] = round($FLOWdropPCT[$s], 2); } + + if ($FLOWsummary[0]>$max_ivr_calls) {$max_ivr_calls=$FLOWsummary[0];} + if ($FLOWtotal[$s]>$max_queue_calls) {$max_queue_calls=$FLOWtotal[$s];} + if ($FLOWdrop[$s]>$max_queue_drops) {$max_queue_drops=$FLOWdrop[$s];} + if ($FLOWdropPCT[$s]>$max_queue_drops_percent) {$max_queue_drops_percent=$FLOWdropPCT[$s];} + $graph_stats[$s][1]=$FLOWsummary[0]; + $graph_stats[$s][2]=$FLOWtotal[$s]; + $graph_stats[$s][3]=$FLOWdrop[$s]; + $graph_stats[$s][4]=$FLOWdropPCT[$s]; + $FLOWsummary[0] = sprintf("%6s", $FLOWsummary[0]); $FLOWtotal[$s] = sprintf("%6s", $FLOWtotal[$s]); $FLOWdrop[$s] = sprintf("%6s", $FLOWdrop[$s]); @@ -659,12 +698,19 @@ else $avgFLOWtotal_time[$s] = round($avgFLOWtotal_time[$s], 0); $avgFLOWtotal_time[$s] = sprintf("%4s", $avgFLOWtotal_time[$s]); + if (trim($avgFLOWivr_time[$s])>$max_ivr_avg) {$max_ivr_avg=trim($avgFLOWivr_time[$s]);} + if (trim($avgFLOWtotal_time[$s])>$max_total_avg) {$max_total_avg=trim($avgFLOWtotal_time[$s]);} + $graph_stats[$s][0]=$FLOWsummary[1]; + $graph_stats[$s][5]=trim($avgFLOWivr_time[$s]); + $graph_stats[$s][6]=trim($avgFLOWtotal_time[$s]); + + $totFLOWtotal_time = ($totFLOWtotal_time + $FLOWtotal_time[$s]); $totFLOWivr_time = ($totFLOWivr_time + $FLOWivr_time[$s]); $totFLOWtotal = ($totFLOWtotal + $FLOWtotal[$s]); $totFLOWdrop = ($totFLOWdrop + $FLOWdrop[$s]); - $MAIN.="| $FLOWsummary[0] | $FLOWtotal[$s] | $FLOWdrop[$s] | $FLOWdropPCT[$s]%| $avgFLOWivr_time[$s] | $avgFLOWtotal_time[$s] | $FLOWsummary[1]\n"; + $ASCII_text.="| $FLOWsummary[0] | $FLOWtotal[$s] | $FLOWdrop[$s] | $FLOWdropPCT[$s]%| $avgFLOWivr_time[$s] | $avgFLOWtotal_time[$s] | $FLOWsummary[1]\n"; $CSV_text.="\"\",\"$FLOWsummary[0]\",\"$FLOWtotal[$s]\",\"$FLOWdrop[$s]\",\"$FLOWdropPCT[$s]%\",\"$avgFLOWivr_time[$s]\",\"$avgFLOWtotal_time[$s]\",\"$FLOWsummary[1]\"\n"; $s++; @@ -689,12 +735,56 @@ else } $totFLOWdropPCT = sprintf("%5s", $totFLOWdropPCT); - $MAIN.="+--------+--------+--------+--------+------+------+------------\n"; - $MAIN.="| $TOTALcalls | $totFLOWtotal | $totFLOWdrop | $totFLOWdropPCT% | $TavgFLOWivr_time | $TavgFLOWtotal_time |\n"; - $MAIN.="+--------+--------+--------+--------+------+------+\n"; + $ASCII_text.="+--------+--------+--------+--------+------+------+------------\n"; + $ASCII_text.="| $TOTALcalls | $totFLOWtotal | $totFLOWdrop | $totFLOWdropPCT% | $TavgFLOWivr_time | $TavgFLOWtotal_time |\n"; + $ASCII_text.="+--------+--------+--------+--------+------+------+\n"; $CSV_text.="\"\",\"$TOTALcalls\",\"$totFLOWtotal\",\"$totFLOWdrop\",\"$totFLOWdropPCT%\",\"$TavgFLOWivr_time\",\"$TavgFLOWtotal_time\"\n"; + for ($d=0; $d".$graph_stats[$d][1].""; + $QUEUECALLS_graph.=" "; + $QUEUEDROPCALLS_graph.=" "; + $QUEUEDROPPERCENT_graph.=" "; + $IVRAVGTIME_graph.=" "; + $TOTALAVGTIME_graph.=" "; + } + $IVRCALLS_graph.="
IVR STATS
TOTAL AVG TIMECALL PATH
".$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]."
".$graph_stats[$d][5]."".$graph_stats[$d][0]."
".$graph_stats[$d][6]."".$graph_stats[$d][0]."
".trim($TOTALcalls)."TOTAL
"; + $QUEUECALLS_graph.="".trim($totFLOWtotal)."TOTAL"; + $QUEUEDROPCALLS_graph.="".trim($totFLOWdrop)."TOTAL"; + $QUEUEDROPPERCENT_graph.="".trim($totFLOWdropPCT)."%TOTAL"; + $IVRAVGTIME_graph.="".trim($TavgFLOWivr_time)."TOTAL"; + $TOTALAVGTIME_graph.="".trim($TavgFLOWtotal_time)."TOTAL"; + $JS_onload.="\tDrawGraph('IVRCALLS', '1');\n"; + $JS_text.="function DrawGraph(graph, th_id) {\n"; + $JS_text.=" var IVRCALLS_graph=\"$IVRCALLS_graph\";\n"; + $JS_text.=" var QUEUECALLS_graph=\"$QUEUECALLS_graph\";\n"; + $JS_text.=" var QUEUEDROPCALLS_graph=\"$QUEUEDROPCALLS_graph\";\n"; + $JS_text.=" var QUEUEDROPPERCENT_graph=\"$QUEUEDROPPERCENT_graph\";\n"; + $JS_text.=" var IVRAVGTIME_graph=\"$IVRAVGTIME_graph\";\n"; + $JS_text.=" var TOTALAVGTIME_graph=\"$TOTALAVGTIME_graph\";\n"; + $JS_text.="\n"; + $JS_text.=" for (var i=1; i<=6; i++) {\n"; + $JS_text.=" var cellID=\"ivrgraph\"+i;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#DDDDDD';\n"; + $JS_text.=" }\n"; + $JS_text.=" var cellID=\"ivrgraph\"+th_id;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#999999';\n"; + $JS_text.=" var graph_to_display=eval(graph+\"_graph\");\n"; + $JS_text.=" document.getElementById('ivr_stats_graph').innerHTML=graph_to_display;\n"; + $JS_text.="}\n"; + $GRAPH_text.=$GRAPH; + + if ($report_display_type=="HTML") + { + $MAIN.=$GRAPH_text; + } + else + { + $MAIN.=$ASCII_text; + } + ############################## ######### TIME STATS @@ -913,7 +1003,12 @@ else exit; } else { + $JS_onload.="}\n"; + $JS_text.=$JS_onload; + $JS_text.="\n"; + echo $HEADER; + echo $JS_text; require("admin_header.php"); echo $MAIN; } diff --git a/agc_2-X/trunk/www/vicidial/AST_LISTS_campaign_stats.php b/agc_2-X/trunk/www/vicidial/AST_LISTS_campaign_stats.php index c42b9e8a..8f29c959 100644 --- a/agc_2-X/trunk/www/vicidial/AST_LISTS_campaign_stats.php +++ b/agc_2-X/trunk/www/vicidial/AST_LISTS_campaign_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # This is a list inventory report, not a calling report. This report will show # statistics for all of the lists in the selected campaigns @@ -9,6 +9,7 @@ # CHANGES # 100916-0928 - First build # 110703-1815 - Added download option +# 120224-0910 - Added HTML display option with bar graphs # header ("Content-type: text/html; charset=utf-8"); @@ -29,12 +30,16 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); $report_name = 'Lists Campaign Statuses Report'; $db_source = 'M'; +$JS_text="\n"; + echo $HEADER; + echo $JS_text; require("admin_header.php"); echo $MAIN; } diff --git a/agc_2-X/trunk/www/vicidial/AST_OUTBOUNDsummary_interval.php b/agc_2-X/trunk/www/vicidial/AST_OUTBOUNDsummary_interval.php index 3df3755e..90fb0409 100644 --- a/agc_2-X/trunk/www/vicidial/AST_OUTBOUNDsummary_interval.php +++ b/agc_2-X/trunk/www/vicidial/AST_OUTBOUNDsummary_interval.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -14,6 +14,7 @@ # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 110703-1825 - Added download option # 111104-1205 - Added user_group and calltime restrictions +# 120224-0910 - Added HTML display option with bar graphs # require("dbconnect.php"); @@ -49,6 +50,8 @@ if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -59,6 +62,8 @@ if (strlen($include_rollover)<2) {$include_rollover='NO';} $report_name = 'Outbound Summary Interval Report'; $db_source = 'M'; +$JS_text="\n"; $HEADER.="\n"; +$HEADER.="\n"; $HEADER.="\n"; $HEADER.="$report_name\n"; @@ -391,6 +397,14 @@ if ($bareformat < 1) $MAIN.="
\n"; } + + $MAIN.="
\n"; + $MAIN.="
\n"; + $MAIN.="\n"; + $MAIN.="\n"; + $MAIN.="\n"; + $MAIN.="Date Range:
\n"; + $MAIN.=""; $MAIN.=" \n"; + $MAIN.=" to "; $MAIN.=" \n"; - $MAIN.="\n"; - $MAIN.="
\n"; - $MAIN.="\n"; - $MAIN.="\n"; - $MAIN.="\n"; - $MAIN.="Date Range:
\n"; - $MAIN.=""; - - $MAIN.=" to "; - $MAIN.="
Campaigns:
"; $MAIN.=""; + if ($report_display_type) {$MAIN.="";} + $MAIN.="\n
"; $MAIN.="
        "; $MAIN.="\n"; @@ -603,18 +612,43 @@ else ##### Loop through each campaign and gether stats if ($group_ct > 0) { - $MAIN .= "\n"; - $MAIN .= "---------- MULTI-CAMPAIGN BREAKDOWN:\n"; - $MAIN .= "+------------------------------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; - $MAIN .= "| | | SYSTEM | AGENT | | | NO | | AGENT | AGENT |\n"; - $MAIN .= "| | TOTAL | RELEASE| RELEASE| SALE | DNC | ANSWER | DROP | LOGIN | PAUSE |\n"; - $MAIN .= "| CAMPAIGN | CALLS | CALLS | CALLS | CALLS | CALLS | PERCENT| PERCENT| TIME(H:M:S)| TIME(H:M:S)|\n"; - $MAIN .= "+------------------------------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; + $ASCII_text .= "\n"; + $ASCII_text .= "---------- MULTI-CAMPAIGN BREAKDOWN:\n"; + $ASCII_text .= "+------------------------------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; + $ASCII_text .= "| | | SYSTEM | AGENT | | | NO | | AGENT | AGENT |\n"; + $ASCII_text .= "| | TOTAL | RELEASE| RELEASE| SALE | DNC | ANSWER | DROP | LOGIN | PAUSE |\n"; + $ASCII_text .= "| CAMPAIGN | CALLS | CALLS | CALLS | CALLS | CALLS | PERCENT| PERCENT| TIME(H:M:S)| TIME(H:M:S)|\n"; + $ASCII_text .= "+------------------------------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; $CSV_main.="\"MULTI-CAMPAIGN BREAKDOWN:\"\n"; $CSV_main.="\"CAMPAIGN\",\"TOTAL CALLS\",\"SYSTEM RELEASE CALLS\",\"AGENT RELEASE CALLS\",\"SALE CALLS\",\"DNC CALLS\",\"NO ANSWER PERCENT\",\"DROP PERCENT\",\"AGENT LOGIN TIME(H:M:S)\",\"AGENT PAUSE TIME(H:M:S)\"\n"; $CSV_subreports=""; + ######## GRAPHING ######### + $max_calls=1; + $max_system_release=1; + $max_agent_release=1; + $max_sales=1; + $max_dncs=1; + $max_nas=1; + $max_drops=1; + $max_login_time=1; + $max_pause_time=1; + + $GRAPH="

"; + $GRAPH.=""; + $GRAPH.="
CALLSSYSTEM RELEASE CALLSAGENT RELEASE CALLSSALE CALLSDNC CALLSNO ANSWER PERCENTDROP PERCENTAGENT LOGIN TIMEAGENT PAUSE TIME

 


"; + $graph_header=""; + $CALLS_graph=$graph_header.""; + $SYSTEMRELEASE_graph=$graph_header.""; + $AGENTRELEASE_graph=$graph_header.""; + $SALES_graph=$graph_header.""; + $DNCS_graph=$graph_header.""; + $NAS_graph=$graph_header.""; + $DROPS_graph=$graph_header.""; + $LOGINTIME_graph=$graph_header.""; + $PAUSETIME_graph=$graph_header.""; + ########################### $i=0; $TOTcalls_count=0; @@ -635,7 +669,7 @@ else ##### Gather Agent time records $stmt="select event_time,UNIX_TIMESTAMP(event_time),campaign_id,pause_sec,wait_sec,talk_sec,dispo_sec from vicidial_agent_log where event_time >= '$query_date_BEGIN' and event_time <= '$query_date_END' and campaign_id IN('$group_drop[$i]','$group[$i]');"; $rslt=mysql_query($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $AGENTtime_to_print = mysql_num_rows($rslt); $s=0; while ($s < $AGENTtime_to_print) @@ -653,7 +687,7 @@ else ##### Gather outbound calls $stmt = "SELECT status,length_in_sec,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id,uniqueid,lead_id from vicidial_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='$group[$i]';"; $rslt=mysql_query($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $calls_to_parse = mysql_num_rows($rslt); $p=0; while ($p < $calls_to_parse) @@ -680,7 +714,7 @@ else ##### Gather inbound calls from drop inbound group if selected $stmt="select drop_inbound_group from vicidial_campaigns where campaign_id='$group[$i]' $LOGallowed_campaignsSQL and drop_inbound_group NOT LIKE \"%NONE%\" and drop_inbound_group is NOT NULL and drop_inbound_group != '';"; $rslt=mysql_query($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $in_groups_to_print = mysql_num_rows($rslt); if ($in_groups_to_print > 0) { @@ -694,7 +728,7 @@ else $agent_alert_delayZ=0; $stmt="select status,length_in_sec,queue_seconds,agent_alert_delay,call_date,UNIX_TIMESTAMP(call_date),phone_number,campaign_id,closecallid,lead_id,uniqueid from vicidial_closer_log,vicidial_inbound_groups where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and group_id=campaign_id and campaign_id='$group_drop[$i]';"; $rslt=mysql_query($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $INallcalls_to_printZ = mysql_num_rows($rslt); $y=0; while ($y < $INallcalls_to_printZ) @@ -854,7 +888,7 @@ else if ($print_calls > 0) { - $MAIN.="$row[5]\t$row[6]\t$TEMPtalk\n"; + $ASCII_text.="$row[5]\t$row[6]\t$TEMPtalk\n"; $PCtemptalk = ($PCtemptalk + $TEMPtalk); } $q++; @@ -862,7 +896,7 @@ else else {$out_of_call_time++;} if ($DB) - {$MAIN.="$Hcalltime[$Chour] | AGENT: $agent_sec[$i] PAUSE: $pause_sec[$i]\n";} + {$ASCII_text.="$Hcalltime[$Chour] | AGENT: $agent_sec[$i] PAUSE: $pause_sec[$i]\n";} $p++; } @@ -992,7 +1026,7 @@ else if ($print_calls > 0) { - $MAIN.="$row[5]\t$row[6]\t$TEMPtalk\n"; + $ASCII_text.="$row[5]\t$row[6]\t$TEMPtalk\n"; $PCtemptalk = ($PCtemptalk + $TEMPtalk); } $q++; @@ -1000,7 +1034,7 @@ else else {$out_of_call_time++;} if ($DB) - {$MAIN.="$call_time > $CTstart | $call_time < $CTstop | $Cwday | $Chour | $Hcalltime[$Chour] | $talk_sec[$i]\n";} + {$ASCII_text.="$call_time > $CTstart | $call_time < $CTstop | $Cwday | $Chour | $Hcalltime[$Chour] | $talk_sec[$i]\n";} $p++; } @@ -1017,7 +1051,7 @@ else if ($print_calls > 0) { $PCtemptalkmin = ($PCtemptalk / 60); - $MAIN.="$q\t$PCtemptalk\t$PCtemptalkmin\n"; + $ASCII_text.="$q\t$PCtemptalk\t$PCtemptalkmin\n"; } if ( ($calls_count_IN[$i] > 0) and ($drop_count_OUT[$i] > 0) ) @@ -1043,6 +1077,22 @@ else if ($max_queue_seconds[$i] > $TOTmax_queue_seconds) {$TOTmax_queue_seconds = $max_queue_seconds[$i];} + if ($calls_count[$i]>$max_calls) {$max_calls=$calls_count[$i];} + if ($system_count[$i]>$max_system_release) {$max_system_release=$system_count[$i];} + if ($agent_count[$i]>$max_agent_release) {$max_agent_release=$agent_count[$i];} + if ($ptp_count[$i]>$max_sales) {$max_sales=$ptp_count[$i];} + if ($rtp_count[$i]>$max_dncs) {$max_dncs=$rtp_count[$i];} + if ($agent_sec[$i]>$max_login_time) {$max_login_time=$agent_sec[$i];} + if ($pause_sec[$i]>$max_pause_time) {$max_pause_time=$pause_sec[$i];} + $graph_stats[$i][0]="$group[$i] - $group_cname[$i]"; + $graph_stats[$i][1]=$calls_count[$i]; + $graph_stats[$i][2]=$system_count[$i]; + $graph_stats[$i][3]=$agent_count[$i]; + $graph_stats[$i][4]=$ptp_count[$i]; + $graph_stats[$i][5]=$rtp_count[$i]; + $graph_stats[$i][8]=$agent_sec[$i]; + $graph_stats[$i][9]=$pause_sec[$i]; + $agent_sec[$i] = sec_convert($agent_sec[$i],'H'); $pause_sec[$i] = sec_convert($pause_sec[$i],'H'); $talk_sec[$i] = sec_convert($talk_sec[$i],'H'); @@ -1079,25 +1129,59 @@ else $gDROPpercent = sprintf("%6.2f",$gDROPpercent); $gDROPcalls = sprintf("%6s", $drop_count[$i]); + if (trim($gNApercent)>$max_nas) {$max_nas=trim($gNApercent);} + if (trim($gDROPpercent)>$max_drops) {$max_drops=trim($gDROPpercent);} + $graph_stats[$i][6]=trim($gNApercent); + $graph_stats[$i][7]=trim($gDROPpercent); + + while(strlen($groupDISPLAY)>40) {$groupDISPLAY = substr("$groupDISPLAY", 0, -1);} - $MAIN .= "| $groupDISPLAY | $gTOTALcalls | $gSYSTEMcalls | $gAGENTcalls | $gPTPcalls | $gRTPcalls | $gNApercent%| $gDROPpercent%| $gSUMagent | $gSUMpause |"; + $ASCII_text .= "| $groupDISPLAY | $gTOTALcalls | $gSYSTEMcalls | $gAGENTcalls | $gPTPcalls | $gRTPcalls | $gNApercent%| $gDROPpercent%| $gSUMagent | $gSUMpause |"; $CSV_main.="\"$groupDISPLAY\",\"$gTOTALcalls\",\"$gSYSTEMcalls\",\"$gAGENTcalls\",\"$gPTPcalls\",\"$gRTPcalls\",\"$gNApercent%\",\"$gDROPpercent%\",\"$gSUMagent\",\"$gSUMpause\"\n"; - if ($DB) {$MAIN .= " $gDROPcalls($calls_count_IN[$i]/$drop_count_OUT[$i]) |";} - $MAIN .= "\n"; + if ($DB) {$ASCII_text .= " $gDROPcalls($calls_count_IN[$i]/$drop_count_OUT[$i]) |";} + $ASCII_text .= "\n"; ### hour by hour sumaries - $SUBoutput .= "\n---------- $group[$i] - $group_cname[$i]\nINTERVAL BREAKDOWN:\n"; - $SUBoutput .= "+---------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; - $SUBoutput .= "| | | SYSTEM | AGENT | | | NO | | AGENT | AGENT |\n"; - $SUBoutput .= "| | TOTAL | RELEASE| RELEASE| SALE | DNC | ANSWER | DROP | LOGIN | PAUSE |\n"; - $SUBoutput .= "| INTERVAL | CALLS | CALLS | CALLS | CALLS | CALLS | PERCENT| PERCENT| TIME(H:M:S)| TIME(H:M:S)|\n"; - $SUBoutput .= "+---------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; + $SUB_ASCII_text .= "\n---------- $group[$i] - $group_cname[$i]\nINTERVAL BREAKDOWN:\n"; + $SUB_ASCII_text .= "+---------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; + $SUB_ASCII_text .= "| | | SYSTEM | AGENT | | | NO | | AGENT | AGENT |\n"; + $SUB_ASCII_text .= "| | TOTAL | RELEASE| RELEASE| SALE | DNC | ANSWER | DROP | LOGIN | PAUSE |\n"; + $SUB_ASCII_text .= "| INTERVAL | CALLS | CALLS | CALLS | CALLS | CALLS | PERCENT| PERCENT| TIME(H:M:S)| TIME(H:M:S)|\n"; + $SUB_ASCII_text .= "+---------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; $CSV_subreports.="\n\n\"$group[$i] - $group_cname[$i]\"\n\"INTERVAL BREAKDOWN:\"\n"; $CSV_subreports.="\"INTERVAL\",\"TOTAL CALLS\",\"SYSTEM RELEASE CALLS\",\"AGENT RELEASE CALLS\",\"SALE CALLS\",\"DNC CALLS\",\"NO ANSWER PERCENT\",\"DROP PERCENT\",\"AGENT LOGIN TIME (H:M:S)\",\"AGENT PAUSE TIME(H:M:S)\"\n"; - $h=0; + ######## GRAPHING ######### + $SUBmax_calls=1; + $SUBmax_system_release=1; + $SUBmax_agent_release=1; + $SUBmax_sales=1; + $SUBmax_dncs=1; + $SUBmax_nas=1; + $SUBmax_drops=1; + $SUBmax_login_time=1; + $SUBmax_pause_time=1; + $SUBgraph_stats=""; + $SUBrpt_campaign=$group[$i]; + + $SUBGRAPH="

MULTI-CAMPAIGN BREAKDOWN
CAMPAIGNSTOTAL CALLS
SYSTEM RELEASE CALLS
AGENT RELEASE CALLS
SALE CALLS
DNC CALLS
NO ANSWER PERCENT
DROP PERCENT
AGENT LOGIN TIME (H:M:S)
AGENT PAUSE TIME (H:M:S)
"; + $SUBGRAPH.=""; + $SUBGRAPH.="
CALLSSYSTEM RELEASE CALLSAGENT RELEASE CALLSSALE CALLSDNC CALLSNO ANSWER PERCENTDROP PERCENTAGENT LOGIN TIMEAGENT PAUSE TIME

 


"; + $SUBgraph_header=""; + $SUBCALLS_graph=$SUBgraph_header.""; + $SUBSYSTEMRELEASE_graph=$SUBgraph_header.""; + $SUBAGENTRELEASE_graph=$SUBgraph_header.""; + $SUBSALES_graph=$SUBgraph_header.""; + $SUBDNCS_graph=$SUBgraph_header.""; + $SUBNAS_graph=$SUBgraph_header.""; + $SUBDROPS_graph=$SUBgraph_header.""; + $SUBLOGINTIME_graph=$SUBgraph_header.""; + $SUBPAUSETIME_graph=$SUBgraph_header.""; + ########################### + + $h=0; $z=0; while ($h < $interval_count) { if ($Hcalltime[$h] > 0) @@ -1148,6 +1232,24 @@ else else {$Hqueue_avg[$h] = 0;} + if ($Hcalls_count[$h]>$SUBmax_calls) {$SUBmax_calls=$Hcalls_count[$h];} + if ($Hsystem_count[$h]>$SUBmax_system_release) {$SUBmax_system_release=$Hsystem_count[$h];} + if ($Hagent_count[$h]>$SUBmax_agent_release) {$SUBmax_agent_release=$Hagent_count[$h];} + if ($Hptp_count[$h]>$SUBmax_sales) {$SUBmax_sales=$Hptp_count[$h];} + if ($Hrtp_count[$h]>$SUBmax_dncs) {$SUBmax_dncs=$Hrtp_count[$h];} + if (trim($hNApercent)>$SUBmax_nas) {$SUBmax_nas=trim($hNApercent);} + if (trim($hDROPpercent)>$SUBmax_drops) {$SUBmax_drops=trim($hDROPpercent);} + if ($Hagent_sec[$h]>$SUBmax_login_time) {$SUBmax_login_time=$Hagent_sec[$h];} + if ($Hpause_sec[$h]>$SUBmax_pause_time) {$SUBmax_pause_time=$Hpause_sec[$h];} + $SUBgraph_stats[$z][0]="$Hcalltime_HHMM[$h]"; + $SUBgraph_stats[$z][1]=$Hcalls_count[$h]; + $SUBgraph_stats[$z][2]=$Hsystem_count[$h]; + $SUBgraph_stats[$z][3]=$Hagent_count[$h]; + $SUBgraph_stats[$z][4]=$Hptp_count[$h]; + $SUBgraph_stats[$z][5]=$Hrtp_count[$h]; + $SUBgraph_stats[$z][8]=$Hagent_sec[$h]; + $SUBgraph_stats[$z][9]=$Hpause_sec[$h]; + $Hagent_sec[$h] = sec_convert($Hagent_sec[$h],'H'); $Hpause_sec[$h] = sec_convert($Hpause_sec[$h],'H'); $Htalk_sec[$h] = sec_convert($Htalk_sec[$h],'H'); @@ -1183,9 +1285,13 @@ else $hDROPcalls = sprintf("%6s", $Hdrop_count[$h]); $hPRINT = sprintf("%19s", $Hcalltime_HHMM[$h]); - $SUBoutput .= "| $hPRINT | $hTOTALcalls | $hSYSTEMcalls | $hAGENTcalls | $hPTPcalls | $hRTPcalls | $hNApercent%| $hDROPpercent%| $hSUMagent | $hSUMpause |\n"; + $SUB_ASCII_text .= "| $hPRINT | $hTOTALcalls | $hSYSTEMcalls | $hAGENTcalls | $hPTPcalls | $hRTPcalls | $hNApercent%| $hDROPpercent%| $hSUMagent | $hSUMpause |\n"; $CSV_subreports.="\"$hPRINT\",\"$hTOTALcalls\",\"$hSYSTEMcalls\",\"$hAGENTcalls\",\"$hPTPcalls\",\"$hRTPcalls\",\"$hNApercent%\",\"$hDROPpercent%\",\"$hSUMagent\",\"$hSUMpause\"\n"; - if ($DB) {$SUBoutput .= " $hDROPcalls($Hcalls_count_IN[$h]/$Hdrop_count_OUT[$h]) |\n";} + if ($DB) {$SUB_ASCII_text .= " $hDROPcalls($Hcalls_count_IN[$h]/$Hdrop_count_OUT[$h]) |\n";} + + $SUBgraph_stats[$z][6]=trim($hNApercent); + $SUBgraph_stats[$z][7]=trim($hDROPpercent); + $z++; } $h++; @@ -1234,11 +1340,55 @@ else $hTOTdrop_percent = sprintf("%6.2f",$hTOTdrop_percent); $hTOTdrop_count = sprintf("%6s", $hTOTdrop_count); - $SUBoutput .= "+---------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; - $SUBoutput .= "| TOTALS | $hTOTcalls_count | $hTOTsystem_count | $hTOTagent_count | $hTOTptp_count | $hTOTrtp_count | $hTOTna_percent%| $hTOTdrop_percent%| $hTOTagent_sec | $hTOTpause_sec |\n"; - $SUBoutput .= "+---------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; + $SUB_ASCII_text .= "+---------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; + $SUB_ASCII_text .= "| TOTALS | $hTOTcalls_count | $hTOTsystem_count | $hTOTagent_count | $hTOTptp_count | $hTOTrtp_count | $hTOTna_percent%| $hTOTdrop_percent%| $hTOTagent_sec | $hTOTpause_sec |\n"; + $SUB_ASCII_text .= "+---------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; $CSV_subreports.="\"TOTALS\",\"$hTOTcalls_count\",\"$hTOTsystem_count\",\"$hTOTagent_count\",\"$hTOTptp_count\",\"$hTOTrtp_count\",\"$hTOTna_percent%\",\"$hTOTdrop_percent%\",\"$hTOTagent_sec\",\"$hTOTpause_sec\"\n"; $i++; + + for ($d=0; $d"; + $SUBSYSTEMRELEASE_graph.=" "; + $SUBAGENTRELEASE_graph.=" "; + $SUBSALES_graph.=" "; + $SUBDNCS_graph.=" "; + $SUBNAS_graph.=" "; + $SUBDROPS_graph.=" "; + $SUBLOGINTIME_graph.=" "; + $SUBPAUSETIME_graph.=" "; + } + $SUBCALLS_graph.="
$SUBrpt_campaign - $group_cname[$i] INTERVAL BREAKDOWN:
INTERVALTOTAL CALLS
SYSTEM RELEASE CALLS
AGENT RELEASE CALLS
SALE CALLS
DNC CALLS
NO ANSWER PERCENT
DROP PERCENT
AGENT LOGIN TIME (H:M:S)
AGENT PAUSE TIME (H:M:S)
".$SUBgraph_stats[$d][1]."
".$SUBgraph_stats[$d][0]."".$SUBgraph_stats[$d][2]."
".$SUBgraph_stats[$d][0]."".$SUBgraph_stats[$d][3]."
".$SUBgraph_stats[$d][0]."".$SUBgraph_stats[$d][4]."
".$SUBgraph_stats[$d][0]."".$SUBgraph_stats[$d][5]."
".$SUBgraph_stats[$d][0]."".$SUBgraph_stats[$d][6]."%
".$SUBgraph_stats[$d][0]."".$SUBgraph_stats[$d][7]."%
".$SUBgraph_stats[$d][0]."".sec_convert($SUBgraph_stats[$d][8], 'H')."
".$SUBgraph_stats[$d][0]."".sec_convert($SUBgraph_stats[$d][9], 'H')."
TOTAL:".trim($hTOTcalls_count)."
"; + $SUBSYSTEMRELEASE_graph.="
TOTAL:".trim($hTOTsystem_count)."
"; + $SUBAGENTRELEASE_graph.="
TOTAL:".trim($hTOTagent_count)."
"; + $SUBSALES_graph.="TOTAL:".trim($hTOTptp_count).""; + $SUBDNCS_graph.="TOTAL:".trim($hTOTrtp_count).""; + $SUBNAS_graph.="TOTAL:".trim($hTOTna_percent)."%"; + $SUBDROPS_graph.="TOTAL:".trim($hTOTdrop_percent)."%"; + $SUBLOGINTIME_graph.="TOTAL:".trim($hTOTagent_sec).""; + $SUBPAUSETIME_graph.="TOTAL:".trim($hTOTpause_sec).""; + $JS_onload.="\tDraw".$SUBrpt_campaign."CampaignGraph('CALLS', '1');\n"; + $JS_text.="function Draw".$SUBrpt_campaign."CampaignGraph(graph, th_id) {\n"; + $JS_text.=" var CALLS_graph=\"$SUBCALLS_graph\";\n"; + $JS_text.=" var SYSTEMRELEASE_graph=\"$SUBSYSTEMRELEASE_graph\";\n"; + $JS_text.=" var AGENTRELEASE_graph=\"$SUBAGENTRELEASE_graph\";\n"; + $JS_text.=" var SALES_graph=\"$SUBSALES_graph\";\n"; + $JS_text.=" var DNCS_graph=\"$SUBDNCS_graph\";\n"; + $JS_text.=" var NAS_graph=\"$SUBNAS_graph\";\n"; + $JS_text.=" var DROPS_graph=\"$SUBDROPS_graph\";\n"; + $JS_text.=" var LOGINTIME_graph=\"$SUBLOGINTIME_graph\";\n"; + $JS_text.=" var PAUSETIME_graph=\"$SUBPAUSETIME_graph\";\n"; + $JS_text.="\n"; + $JS_text.=" for (var i=1; i<=9; i++) {\n"; + $JS_text.=" var cellID=\"campbreakdown".$SUBrpt_campaign."\"+i;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#DDDDDD';\n"; + $JS_text.=" }\n"; + $JS_text.=" var cellID=\"campbreakdown".$SUBrpt_campaign."\"+th_id;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#999999';\n"; + $JS_text.=" var graph_to_display=eval(graph+\"_graph\");\n"; + $JS_text.=" document.getElementById('campaign_breakdown_".$SUBrpt_campaign."').innerHTML=graph_to_display;\n"; + $JS_text.="}\n"; + $SUB_HTML_text.=$SUBGRAPH; } $rawTOTtalk_sec = $TOTtalk_sec; @@ -1288,23 +1438,66 @@ else $TOTdrop_percent = sprintf("%6.2f",$TOTdrop_percent); $TOTdrop_count = sprintf("%6s", $TOTdrop_count); - $MAIN .= "+------------------------------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; - $MAIN .= "| TOTALS Campaigns: $i | $TOTcalls_count | $TOTsystem_count | $TOTagent_count | $TOTptp_count | $TOTrtp_count | $TOTna_percent%| $TOTdrop_percent%| $TOTagent_sec | $TOTpause_sec |\n"; - $MAIN .= "+------------------------------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; + $ASCII_text .= "+------------------------------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; + $ASCII_text .= "| TOTALS Campaigns: $i | $TOTcalls_count | $TOTsystem_count | $TOTagent_count | $TOTptp_count | $TOTrtp_count | $TOTna_percent%| $TOTdrop_percent%| $TOTagent_sec | $TOTpause_sec |\n"; + $ASCII_text .= "+------------------------------------------+--------+--------+--------+--------+--------+--------+--------+------------+------------+\n"; $CSV_main.="\"TOTALS Campaigns: $i\",\"$TOTcalls_count\",\"$TOTsystem_count\",\"$TOTagent_count\",\"$TOTptp_count\",\"$TOTrtp_count\",\"$TOTna_percent%\",\"$TOTdrop_percent%\",\"$TOTagent_sec\",\"$TOTpause_sec\"\n"; } if ($costformat > 0) { - $MAIN.="
\n"; + $ASCII_text.="\n"; $inbound_cost = ($rawTOTtalk_min * $inbound_rate); $inbound_cost = sprintf("%8.2f", $inbound_cost); - $MAIN.="INBOUND $query_date to $end_date,   $rawTOTtalk_min minutes at \$$inbound_rate = \$$inbound_cost\n"; + $ASCII_text.="INBOUND $query_date to $end_date,   $rawTOTtalk_min minutes at \$$inbound_rate = \$$inbound_cost\n"; exit; } + for ($d=0; $d".$graph_stats[$d][1].""; + $SYSTEMRELEASE_graph.=" ".$graph_stats[$d][0]."".$graph_stats[$d][2].""; + $AGENTRELEASE_graph.=" ".$graph_stats[$d][0]."".$graph_stats[$d][3].""; + $SALES_graph.=" ".$graph_stats[$d][0]."".$graph_stats[$d][4].""; + $DNCS_graph.=" ".$graph_stats[$d][0]."".$graph_stats[$d][5].""; + $NAS_graph.=" ".$graph_stats[$d][0]."".$graph_stats[$d][6]."%"; + $DROPS_graph.=" ".$graph_stats[$d][0]."".$graph_stats[$d][7]."%"; + $LOGINTIME_graph.=" ".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][8], 'H').""; + $PAUSETIME_graph.=" ".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][9], 'H').""; + } + $CALLS_graph.="TOTAL:".trim($TOTcalls_count).""; + $SYSTEMRELEASE_graph.="TOTAL:".trim($TOTsystem_count).""; + $AGENTRELEASE_graph.="TOTAL:".trim($TOTagent_count).""; + $SALES_graph.="TOTAL:".trim($TOTptp_count).""; + $DNCS_graph.="TOTAL:".trim($TOTrtp_count).""; + $NAS_graph.="TOTAL:".trim($TOTna_percent)."%"; + $DROPS_graph.="TOTAL:".trim($TOTdrop_percent)."%"; + $LOGINTIME_graph.="TOTAL:".trim($TOTagent_sec).""; + $PAUSETIME_graph.="TOTAL:".trim($TOTpause_sec).""; + $JS_onload.="\tDrawMultiCampaignGraph('CALLS', '1');\n"; + $JS_text.="function DrawMultiCampaignGraph(graph, th_id) {\n"; + $JS_text.=" var CALLS_graph=\"$CALLS_graph\";\n"; + $JS_text.=" var SYSTEMRELEASE_graph=\"$SYSTEMRELEASE_graph\";\n"; + $JS_text.=" var AGENTRELEASE_graph=\"$AGENTRELEASE_graph\";\n"; + $JS_text.=" var SALES_graph=\"$SALES_graph\";\n"; + $JS_text.=" var DNCS_graph=\"$DNCS_graph\";\n"; + $JS_text.=" var NAS_graph=\"$NAS_graph\";\n"; + $JS_text.=" var DROPS_graph=\"$DROPS_graph\";\n"; + $JS_text.=" var LOGINTIME_graph=\"$LOGINTIME_graph\";\n"; + $JS_text.=" var PAUSETIME_graph=\"$PAUSETIME_graph\";\n"; + $JS_text.="\n"; + $JS_text.=" for (var i=1; i<=9; i++) {\n"; + $JS_text.=" var cellID=\"campbreakdown\"+i;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#DDDDDD';\n"; + $JS_text.=" }\n"; + $JS_text.=" var cellID=\"campbreakdown\"+th_id;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#999999';\n"; + $JS_text.=" var graph_to_display=eval(graph+\"_graph\");\n"; + $JS_text.=" document.getElementById('multi_campaign_breakdown').innerHTML=graph_to_display;\n"; + $JS_text.="}\n"; + $GRAPH_text.=$GRAPH; if ($file_download>0) { # $CSV_report=fopen("AST_OUTBOUNDsummary_interval.csv", "w"); @@ -1330,7 +1523,22 @@ else exit; } else { + $JS_onload.="}\n"; + $JS_text.=$JS_onload; + $JS_text.="\n"; + if ($report_display_type=="HTML") + { + $MAIN.=$GRAPH_text; + $SUBoutput.=$SUB_HTML_text; + } + else + { + $MAIN.=$ASCII_text; + $SUBoutput.=$SUB_ASCII_text; + } + echo "$HEADER"; + echo $JS_text; require("admin_header.php"); echo "$MAIN"; echo "$SUBoutput"; diff --git a/agc_2-X/trunk/www/vicidial/AST_VDADstats.php b/agc_2-X/trunk/www/vicidial/AST_VDADstats.php index bdad80bf..9e7d9c64 100644 --- a/agc_2-X/trunk/www/vicidial/AST_VDADstats.php +++ b/agc_2-X/trunk/www/vicidial/AST_VDADstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # 60619-1718 - Added variable filtering to eliminate SQL injection attack threat @@ -31,6 +31,7 @@ # 100814-2307 - Added display of preset dials if presets are enabled in the campaign # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 101207-1634 - Changed limits on seconds to 65000 from 36000 in vicidial_agent_log +# 120224-0910 - Added HTML display option with bar graphs # header ("Content-type: text/html; charset=utf-8"); @@ -69,6 +70,8 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} 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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -80,6 +83,8 @@ if (strlen($include_rollover)<2) {$include_rollover='NO';} $report_name = 'Outbound Calling Report'; $db_source = 'M'; +$JS_text="\n"; echo "\n"; +echo "\n"; echo "\n"; echo "$report_name\n"; $short_header=1; +$draw_graph=1; require("admin_header.php"); @@ -393,6 +400,10 @@ if ($carrier_logging_active > 0) echo "\n"; echo "\n"; } +echo "

Display as:
"; +echo "\n
"; echo "Shift:  
"; echo "\n"; +echo ""; +echo "Display as:   
"; +echo "\n

"; echo "User:
"; echo "\n"; echo "Shift:
"; @@ -694,35 +817,38 @@ echo ""; echo "\n\n
$db_source"; echo "\n"; -echo "\n"; -echo "
\n\n\n\n\n\n\n\n\n\n";
 
-$m=0;
-while ($m < $k)
+if ($report_display_type=="TEXT" || !$report_display_type) 
 	{
-	$sort_split = explode("-----",$TOPsort[$m]);
-	$i = $sort_split[1];
-	$sort_order[$m] = "$i";
+	echo "\n";
+	echo "
\n\n\n\n\n\n\n\n\n\n";
 
-	if ( ($TOPsortTALLY[$i] < 1) or ($TOPsortMAX < 1) )
-		{echo "              \n";}
-	else
+	$m=0;
+	while ($m < $k)
 		{
-		echo "              ";
-		$TOPsortPLOT = ( ($TOPsortTALLY[$i] / $TOPsortMAX) * 120 );
-		$h=0;
-		while ($h <= $TOPsortPLOT)
+		$sort_split = explode("-----",$TOPsort[$m]);
+		$i = $sort_split[1];
+		$sort_order[$m] = "$i";
+
+		if ( ($TOPsortTALLY[$i] < 1) or ($TOPsortMAX < 1) )
+			{echo "              \n";}
+		else
 			{
-			echo " ";
-			$h++;
+			echo "              ";
+			$TOPsortPLOT = ( ($TOPsortTALLY[$i] / $TOPsortMAX) * 120 );
+			$h=0;
+			while ($h <= $TOPsortPLOT)
+				{
+				echo " ";
+				$h++;
+				}
+			echo "\n";
 			}
-		echo "\n";
+		$m++;
 		}
-	$m++;
+
+	echo "\n";
 	}
-
-echo "\n";
-
 ?>
 
 
diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php
index 8ec0caa9..d2c61a8c 100644
--- a/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php
+++ b/agc_2-X/trunk/www/vicidial/AST_agent_performance_detail.php
@@ -1,7 +1,7 @@
     LICENSE: AGPLv2
+# Copyright (C) 2012  Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 #
@@ -28,7 +28,8 @@
 # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links
 # 110703-1739 - Added file download option
 # 111007-0709 - Changed user and fullname to use non-truncated for output file
-# 111104-1256 - Added user_group restrictions for selecting in-groups
+# 111104-1249 - Added user_group restrictions for selecting in-groups
+# 120224-0910 - Added HTML display option with bar graphs
 #
 
 require("dbconnect.php");
@@ -57,12 +58,16 @@ if (isset($_GET["SUBMIT"]))					{$SUBMIT=$_GET["SUBMIT"];}
 	elseif (isset($_POST["SUBMIT"]))		{$SUBMIT=$_POST["SUBMIT"];}
 if (isset($_GET["file_download"]))				{$file_download=$_GET["file_download"];}
 	elseif (isset($_POST["file_download"]))	{$file_download=$_POST["file_download"];}
+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"];}
 
 
 if (strlen($shift)<2) {$shift='ALL';}
 
 $report_name = 'Agent Performance Detail';
 $db_source = 'M';
+$JS_text="\n";
 $HTML_head.="\n";
+$HTML_head.="\n";
 
 $HTML_head.="\n";
 $HTML_head.="$report_name\n";
@@ -345,6 +351,10 @@ $HTML_text.="\n";
 $HTML_text.="\n";
 $HTML_text.="\n";
 $HTML_text.="

\n"; +$HTML_text.="Display as:
"; +$HTML_text.="\n

"; $HTML_text.="\n"; $HTML_text.="         "; @@ -423,6 +433,40 @@ $stmt="select count(*) as calls,sum(talk_sec) as talk,full_name,vicidial_users.u $rslt=mysql_query($stmt, $link); if ($DB) {$HTML_text.="$stmt\n";} $rows_to_print = mysql_num_rows($rslt); + +$graph_stats=array(); +$max_calls=1; +$max_time=1; +$max_pause=1; +$max_pauseavg=1; +$max_wait=1; +$max_waitavg=1; +$max_talk=1; +$max_talkavg=1; +$max_dispo=1; +$max_dispoavg=1; +$max_dead=1; +$max_deadavg=1; +$max_customer=1; +$max_customeravg=1; +$GRAPH="

"; +$GRAPH2=""; +$graph_header="
CALLSTIMEPAUSEPAUSE AVGWAITWAIT AVGTALKTALK AVGDISPODISPO AVGDEADDEAD AVGCUSTCUST AVG
"; +$CALLS_graph=$graph_header.""; +$TIME_graph=$graph_header.""; +$PAUSE_graph=$graph_header.""; +$PAUSEAVG_graph=$graph_header.""; +$WAIT_graph=$graph_header.""; +$WAITAVG_graph=$graph_header.""; +$TALK_graph=$graph_header.""; +$TALKAVG_graph=$graph_header.""; +$DISPO_graph=$graph_header.""; +$DISPOAVG_graph=$graph_header.""; +$DEAD_graph=$graph_header.""; +$DEADAVG_graph=$graph_header.""; +$CUST_graph=$graph_header.""; +$CUSTAVG_graph=$graph_header.""; + $i=0; while ($i < $rows_to_print) { @@ -439,6 +483,10 @@ while ($i < $rows_to_print) $status[$i] = $row[7]; $dead_sec[$i] = $row[8]; $customer_sec[$i] = ($talk_sec[$i] - $dead_sec[$i]); + + $max_varname="max_".$status[$i]; + $$max_varname=1; + if ($customer_sec[$i] < 1) {$customer_sec[$i]=0;} if ( (!eregi("-$status[$i]-", $statuses)) and (strlen($status[$i])>0) ) @@ -467,10 +515,10 @@ while ($i < $rows_to_print) $CSV_header.="\n"; $CSV_lines=''; -$HTML_text.="CALL STATS BREAKDOWN: (Statistics related to handling of calls only) [DOWNLOAD]\n"; -$HTML_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; -$HTML_text.="| USER NAME | ID | CALLS | TIME | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n"; -$HTML_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +$ASCII_text.="CALL STATS BREAKDOWN: (Statistics related to handling of calls only) [DOWNLOAD]\n"; +$ASCII_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +$ASCII_text.="| USER NAME | ID | CALLS | TIME | PAUSE |PAUSAVG | WAIT |WAITAVG | TALK |TALKAVG | DISPO |DISPAVG | DEAD |DEADAVG | CUSTOMER |CUSTAVG |$statusesHTML\n"; +$ASCII_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; ### BEGIN loop through each user ### @@ -496,6 +544,10 @@ while ($m < $k) { $Sstatus=$statusesARY[$n]; $SstatusTXT=''; + + $varname=$Sstatus."_graph"; + $$varname=$graph_header.""; + $max_varname="max_".$Sstatus; ### BEGIN loop through each stat line ### $i=0; $status_found=0; while ($i < $rows_to_print) @@ -512,6 +564,9 @@ while ($m < $k) $SstatusTXT = sprintf("%8s", $calls[$i]); $SstatusesHTML .= " $SstatusTXT |"; + if ($calls[$i]>$$max_varname) {$$max_varname=$calls[$i];} + $graph_stats[$m][(15+$n)]=($calls[$i]+0); + $CSVstatuses.=",\"$calls[$i]\""; $status_found++; @@ -522,6 +577,7 @@ while ($m < $k) { $SstatusesHTML .= " 0 |"; $CSVstatuses.=",\"0\""; + $graph_stats[$m][(15+$n)]=0; } ### END loop through each stat line ### $n++; @@ -571,6 +627,36 @@ while ($m < $k) while(mb_strlen($Suser,'utf-8')>8) {$Suser = mb_substr("$Suser", 0, -1,'utf-8');} } + if (trim($Scalls)>$max_calls) {$max_calls=trim($Scalls);} + if (trim($Stime)>$max_time) {$max_time=trim($Stime);} + if (trim($Spause_sec)>$max_pause) {$max_pause=trim($Spause_sec);} + if (trim($Spause_avg)>$max_pauseavg) {$max_pauseavg=trim($Spause_avg);} + if (trim($Swait_sec)>$max_wait) {$max_wait=trim($Swait_sec);} + if (trim($Swait_avg)>$max_waitavg) {$max_waitavg=trim($Swait_avg);} + if (trim($Stalk_sec)>$max_talk) {$max_talk=trim($Stalk_sec);} + if (trim($Stalk_avg)>$max_talkavg) {$max_talkavg=trim($Stalk_avg);} + if (trim($Sdispo_sec)>$max_dispo) {$max_dispo=trim($Sdispo_sec);} + if (trim($Sdispo_avg)>$max_dispoavg) {$max_dispoavg=trim($Sdispo_avg);} + if (trim($Sdead_sec)>$max_dead) {$max_dead=trim($Sdead_sec);} + if (trim($Sdead_avg)>$max_deadavg) {$max_deadavg=trim($Sdead_avg);} + if (trim($Scustomer_sec)>$max_customer) {$max_customer=trim($Scustomer_sec);} + if (trim($Scustomer_avg)>$max_customeravg) {$max_customeravg=trim($Scustomer_avg);} + $graph_stats[$m][0]=trim($Sfull_name)." - ".trim($Suser); + $graph_stats[$m][1]=trim($Scalls); + $graph_stats[$m][2]=trim($Stime); + $graph_stats[$m][3]=trim($Spause_sec); + $graph_stats[$m][4]=trim($Spause_avg); + $graph_stats[$m][5]=trim($Swait_sec); + $graph_stats[$m][6]=trim($Swait_avg); + $graph_stats[$m][7]=trim($Stalk_sec); + $graph_stats[$m][8]=trim($Stalk_avg); + $graph_stats[$m][9]=trim($Sdispo_sec); + $graph_stats[$m][10]=trim($Sdispo_avg); + $graph_stats[$m][11]=trim($Sdead_sec); + $graph_stats[$m][12]=trim($Sdead_avg); + $graph_stats[$m][13]=trim($Scustomer_sec); + $graph_stats[$m][14]=trim($Scustomer_avg); + $pfUSERtime_MS = sec_convert($Stime,'H'); $pfUSERtotTALK_MS = sec_convert($Stalk_sec,'H'); $pfUSERavgTALK_MS = sec_convert($Stalk_avg,'M'); @@ -615,7 +701,7 @@ while ($m < $k) if ($stage == 'TIME') {$TOPsort[$m] = '' . sprintf("%08s", $Stime) . '-----' . $m . '-----' . sprintf("%020s", $RAWuser);} if (!ereg("ID|TIME|LEADS",$stage)) - {$HTML_text.="$Toutput";} + {$ASCII_text.="$Toutput";} $m++; } @@ -637,7 +723,7 @@ if (ereg("ID|TIME|LEADS",$stage)) $sort_split = explode("-----",$TOPsort[$m]); $i = $sort_split[1]; $sort_order[$m] = "$i"; - $HTML_text.="$TOPsorted_output[$i]"; + $ASCII_text.="$TOPsorted_output[$i]"; $m++; } } @@ -655,6 +741,7 @@ while ($n < $j) $Scalls=0; $Sstatus=$statusesARY[$n]; $SUMstatusTXT=''; + $total_var=$Sstatus."_total"; ### BEGIN loop through each stat line ### $i=0; $status_found=0; while ($i < $rows_to_print) @@ -670,12 +757,14 @@ while ($n < $j) if ($status_found < 1) { $SUMstatusesHTML .= " 0 |"; + $$total_var=0; } else { $SUMstatusTXT = sprintf("%8s", $Scalls); $SUMstatusesHTML .= " $SUMstatusTXT |"; $CSVSUMstatuses.=",\"$Scalls\""; + $$total_var=$Scalls; } $n++; } @@ -740,9 +829,106 @@ while(strlen($TOTavgWAIT_MS)>6) {$TOTavgWAIT_MS = substr("$TOTavgWAIT_MS", 0, -1 while(strlen($TOTavgCUSTOMER_MS)>6) {$TOTavgCUSTOMER_MS = substr("$TOTavgCUSTOMER_MS", 0, -1);} -$HTML_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; -$HTML_text.="| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$TOTtotDEAD_MS| $TOTavgDEAD_MS |$TOTtotCUSTOMER_MS| $TOTavgCUSTOMER_MS |$SUMstatusesHTML\n"; -$HTML_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +$ASCII_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; +$ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $TOTtime_MS|$TOTtotPAUSE_MS| $TOTavgPAUSE_MS |$TOTtotWAIT_MS| $TOTavgWAIT_MS |$TOTtotTALK_MS| $TOTavgTALK_MS |$TOTtotDISPO_MS| $TOTavgDISPO_MS |$TOTtotDEAD_MS| $TOTavgDEAD_MS |$TOTtotCUSTOMER_MS| $TOTavgCUSTOMER_MS |$SUMstatusesHTML\n"; +$ASCII_text.="+-----------------+----------+--------+-----------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+----------+--------+$statusesHEAD\n"; + + +for ($e=0; $e$SstatusTXT"; +} + +for ($d=0; $d"; + $TIME_graph.=" "; + $PAUSE_graph.=" "; + $PAUSEAVG_graph.=" "; + $WAIT_graph.=" "; + $WAITAVG_graph.=" "; + $TALK_graph.=" "; + $TALKAVG_graph.=" "; + $DISPO_graph.=" "; + $DISPOAVG_graph.=" "; + $DEAD_graph.=" "; + $DEADAVG_graph.=" "; + $CUST_graph.=" "; + $CUSTAVG_graph.=" "; + + for ($e=0; $e\n"; + + $$varname.=" "; + } +} + +$CALLS_graph.="
CALL STATS BREAKDOWN: (Statistics related to handling of calls only)
USERCALLS
TIME
PAUSE
PAUSE AVG
WAIT
WAIT AVG
TALK
TALK AVG
DISPO
DISPO AVG
DEAD
DEAD AVG
CUST
CUST AVG
$Sstatus
".$graph_stats[$d][1]."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][2], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][3], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][4], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][5], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][6], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][7], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][8], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][9], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][10], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][11], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][12], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][13], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][14], 'HF')."
".$graph_stats[$d][0]."".$graph_stats[$d][($e+15)]."
TOTAL:".trim($TOTcalls)."
"; +$TIME_graph.="TOTAL:".trim($TOTtime_MS).""; +$PAUSE_graph.="TOTAL:".trim($TOTtotPAUSE_MS).""; +$PAUSEAVG_graph.="TOTAL:".trim($TOTavgPAUSE_MS).""; +$WAIT_graph.="TOTAL:".trim($TOTtotWAIT_MS).""; +$WAITAVG_graph.="TOTAL:".trim($TOTavgWAIT_MS).""; +$TALK_graph.="TOTAL:".trim($TOTtotTALK_MS).""; +$TALKAVG_graph.="TOTAL:".trim($TOTavgTALK_MS).""; +$DISPO_graph.="TOTAL:".trim($TOTtotDISPO_MS).""; +$DISPOAVG_graph.="TOTAL:".trim($TOTavgDISPO_MS).""; +$DEAD_graph.="TOTAL:".trim($TOTtotDEAD_MS).""; +$DEADAVG_graph.="TOTAL:".trim($TOTavgDEAD_MS).""; +$CUST_graph.="TOTAL:".trim($TOTtotCUSTOMER_MS).""; +$CUSTAVG_graph.="TOTAL:".trim($TOTavgCUSTOMER_MS).""; + +for ($e=0; $e"; +} + +$JS_onload.="\tDrawGraph('CALLS', '1');\n"; +$JS_text.="function DrawGraph(graph, th_id) {\n"; +$JS_text.=" var CALLS_graph=\"$CALLS_graph\";\n"; +$JS_text.=" var TIME_graph=\"$TIME_graph\";\n"; +$JS_text.=" var PAUSE_graph=\"$PAUSE_graph\";\n"; +$JS_text.=" var PAUSEAVG_graph=\"$PAUSEAVG_graph\";\n"; +$JS_text.=" var WAIT_graph=\"$WAIT_graph\";\n"; +$JS_text.=" var WAITAVG_graph=\"$WAITAVG_graph\";\n"; +$JS_text.=" var TALK_graph=\"$TALK_graph\";\n"; +$JS_text.=" var TALKAVG_graph=\"$TALKAVG_graph\";\n"; +$JS_text.=" var DISPO_graph=\"$DISPO_graph\";\n"; +$JS_text.=" var DISPOAVG_graph=\"$DISPOAVG_graph\";\n"; +$JS_text.=" var DEAD_graph=\"$DEAD_graph\";\n"; +$JS_text.=" var DEADAVG_graph=\"$DEADAVG_graph\";\n"; +$JS_text.=" var CUST_graph=\"$CUST_graph\";\n"; +$JS_text.=" var CUSTAVG_graph=\"$CUSTAVG_graph\";\n"; + +for ($e=0; $e
 


"; + +$GRAPH_text.=$JS_text.$GRAPH.$GRAPH2.$GRAPH3; + $CSV_total=eregi_replace(" ", "", "\"TOTALS\",\"AGENTS:$TOT_AGENTS\",\"$TOTcalls\",\"$TOTtime_MS\",\"$TOTtotPAUSE_MS\",\"$TOTavgPAUSE_MS\",\"$TOTtotWAIT_MS\",\"$TOTavgWAIT_MS\",\"$TOTtotTALK_MS\",\"$TOTavgTALK_MS\",\"$TOTtotDISPO_MS\",\"$TOTavgDISPO_MS\",\"$TOTtotDEAD_MS\",\"$TOTavgDEAD_MS\",\"$TOTtotCUSTOMER_MS\",\"$TOTavgCUSTOMER_MS\"$CSVSUMstatuses"); @@ -773,13 +959,7 @@ fwrite($CSV_report, $CSV_lines); fwrite($CSV_report, $CSV_total); -$HTML_text.="\n\n"; - - - - - - +$ASCII_text.="\n\n"; @@ -800,9 +980,21 @@ $PCusers='-'; $PCusersARY=$MT; $PCuser_namesARY=$MT; $k=0; + +$graph_stats=array(); +$max_total=1; +$max_nonpause=1; +$max_pause=1; +$GRAPH="

"; +$GRAPH2=""; +$graph_header="
TOTALNONPAUSEPAUSE
"; +$TOTAL_graph=$graph_header.""; +$NONPAUSE_graph=$graph_header.""; +$PAUSE_graph=$graph_header.""; + $stmt="select full_name,vicidial_users.user,sum(pause_sec),sub_status,sum(wait_sec + talk_sec + dispo_sec) from vicidial_users,vicidial_agent_log where event_time <= '$query_date_END' and event_time >= '$query_date_BEGIN' and vicidial_users.user=vicidial_agent_log.user and pause_sec<65000 $group_SQL $user_group_SQL group by user,full_name,sub_status order by user,full_name,sub_status desc limit 100000;"; $rslt=mysql_query($stmt, $link); -if ($DB) {$HTML_text.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $subs_to_print = mysql_num_rows($rslt); $i=0; while ($i < $subs_to_print) @@ -813,8 +1005,10 @@ while ($i < $subs_to_print) $PCpause_sec[$i] = $row[2]; $sub_status[$i] = $row[3]; $PCnon_pause_sec[$i] = $row[4]; + $max_varname="max_".$sub_status[$i]; + $$max_varname=1; -# echo "$sub_status[$i]|$PCpause_sec[$i]\n"; + # echo "$sub_status[$i]|$PCpause_sec[$i]\n"; # if ( (!eregi("-$sub_status[$i]-", $sub_statuses)) and (strlen($sub_status[$i])>0) ) if (!eregi("-$sub_status[$i]-", $sub_statuses)) { @@ -837,10 +1031,10 @@ while ($i < $subs_to_print) $i++; } -$HTML_text.="PAUSE CODE BREAKDOWN: [DOWNLOAD]\n\n"; -$HTML_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; -$HTML_text.="| USER NAME | ID | TOTAL | NONPAUSE | PAUSE | |$sub_statusesHTML\n"; -$HTML_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; +$ASCII_text.="PAUSE CODE BREAKDOWN: [DOWNLOAD]\n\n"; +$ASCII_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; +$ASCII_text.="| USER NAME | ID | TOTAL | NONPAUSE | PAUSE | |$sub_statusesHTML\n"; +$ASCII_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; $CSV_header="\"Agent Performance Detail $NOW_TIME\"\n"; $CSV_header.="\"Time range: $query_date_BEGIN to $query_date_END\"\n\n"; @@ -877,6 +1071,9 @@ while ($m < $k) { $Sstatus=$sub_statusesARY[$n]; $SstatusTXT=''; + $varname=$Sstatus."_graph"; + $$varname=$graph_header.""; + $max_varname="max_".$Sstatus; ### BEGIN loop through each stat line ### $i=0; $status_found=0; while ($i < $subs_to_print) @@ -892,6 +1089,10 @@ while ($m < $k) $SstatusTXT = sprintf("%8s", $pfUSERcodePAUSE_MS); $SstatusesHTML .= " $SstatusTXT |"; + + if ($PCpause_sec[$i]>$$max_varname) {$$max_varname=$PCpause_sec[$i];} + $graph_stats[$m][(4+$n)]=$PCpause_sec[$i]; + $CSV_statuses.=",\"$USERcodePAUSE_MS\""; $status_found++; } @@ -901,6 +1102,7 @@ while ($m < $k) { $SstatusesHTML .= " 0 |"; $CSV_statuses.=",\"0\""; + $graph_stats[$m][(4+$n)]=0; } ### END loop through each stat line ### $n++; @@ -909,6 +1111,7 @@ while ($m < $k) $TOTtotPAUSE=($TOTtotPAUSE + $Spause_sec); $Sfull_nameRAW = $Sfull_name; $SuserRAW = $Suser; + $graph_stats[$m][0]="$Sfull_name - $SuserRAW"; if ($non_latin < 1) { @@ -928,6 +1131,13 @@ while ($m < $k) $TOTtotNONPAUSE = ($TOTtotNONPAUSE + $Snon_pause_sec); $TOTtotTOTAL = ($TOTtotTOTAL + $Stotal_sec); + if (trim($Stotal_sec)>$max_total) {$max_total=trim($Stotal_sec);} + if (trim($Snon_pause_sec)>$max_nonpause) {$max_nonpause=trim($Snon_pause_sec);} + if (trim($Spause_sec)>$max_pause) {$max_pause=trim($Spause_sec);} + $graph_stats[$m][1]="$Stotal_sec"; + $graph_stats[$m][2]="$Snon_pause_sec"; + $graph_stats[$m][3]="$Spause_sec"; + $USERtotPAUSE_MS = sec_convert($Spause_sec,'H'); $USERtotNONPAUSE_MS = sec_convert($Snon_pause_sec,'H'); $USERtotTOTAL_MS = sec_convert($Stotal_sec,'H'); @@ -940,7 +1150,7 @@ while ($m < $k) $BOTTOMsorted_output[$m] = $BOTTOMoutput; - $HTML_text.="$BOTTOMoutput"; + $ASCII_text.="$BOTTOMoutput"; $CSV_lines.="\"$Sfull_nameRAW\"".eregi_replace(" ", "", ",\"$SuserRAW\",\"$pfUSERtotTOTAL_MS\",\"$pfUSERtotNONPAUSE_MS\",\"$pfUSERtotPAUSE_MS\",$CSV_statuses\n"); $m++; } @@ -974,6 +1184,7 @@ while ($n < $j) $Scalls=0; $Sstatus=$sub_statusesARY[$n]; $SUMstatusTXT=''; + $total_var=$Sstatus."_total"; ### BEGIN loop through each stat line ### $i=0; $status_found=0; while ($i < $subs_to_print) @@ -989,10 +1200,12 @@ while ($n < $j) if ($status_found < 1) { $SUMstatusesHTML .= " 0 |"; + $$total_var=0; } else { $TOTtotPAUSE = ($TOTtotPAUSE + $Scalls); + $$total_var=$Scalls; $USERsumstatPAUSE_MS = sec_convert($Scalls,'H'); $pfUSERsumstatPAUSE_MS = sprintf("%8s", $USERsumstatPAUSE_MS); @@ -1020,9 +1233,72 @@ while ($n < $j) while(strlen($TOTtotTOTAL_MS)>10) {$TOTtotTOTAL_MS = substr("$TOTtotTOTAL_MS", 0, -1);} -$HTML_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; -$HTML_text.="| TOTALS AGENTS:$TOT_AGENTS |$TOTtotTOTAL_MS|$TOTtotNONPAUSE_MS|$TOTtotPAUSE_MS| |$SUMstatusesHTML\n"; -$HTML_text.="+----------------------------+----------+----------+----------+ +$sub_statusesHEAD\n"; +$ASCII_text.="+-----------------+----------+----------+----------+----------+ +$sub_statusesHEAD\n"; +$ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS |$TOTtotTOTAL_MS|$TOTtotNONPAUSE_MS|$TOTtotPAUSE_MS| |$SUMstatusesHTML\n"; +$ASCII_text.="+----------------------------+----------+----------+----------+ +$sub_statusesHEAD\n"; + +for ($e=0; $e$SstatusTXT"; +} + +for ($d=0; $d"; + $NONPAUSE_graph.=" "; + $PAUSE_graph.=" "; + + for ($e=0; $e"; + } +} + +$TOTAL_graph.="
PAUSE CODE BREAKDOWN
STATUSTOTAL
NONPAUSE
PAUSE
$Sstatus
".sec_convert($graph_stats[$d][1], 'H')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][2], 'H')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][3], 'H')."
".sec_convert($graph_stats[$d][($e+4)], 'H')."
TOTAL:".trim($TOTtotTOTAL_MS)."
"; +$NONPAUSE_graph.="TOTAL:".trim($TOTtotNONPAUSE_MS).""; +$PAUSE_graph.="TOTAL:".trim($TOTtotPAUSE_MS)."%"; +for ($e=0; $e"; +} +$JS_onload.="\tDrawPauseGraph('TOTAL', '1');\n"; +$JS_text="\n"; +$GRAPH3="
 


"; + +$GRAPH_text.=$JS_text.$GRAPH.$GRAPH2.$GRAPH3.$max; + + $CSV_total=eregi_replace(" ", "", "\"TOTALS\",\"AGENTS:$TOT_AGENTS\",\"$TOTtotTOTAL_MS\",\"$TOTtotNONPAUSE_MS\",\"$TOTtotPAUSE_MS\",$CSVSUMstatuses"); @@ -1051,6 +1327,14 @@ fwrite($CSV_report, $CSV_header); fwrite($CSV_report, $CSV_lines); fwrite($CSV_report, $CSV_total); +if ($report_display_type=="HTML") + { + $HTML_text.=$GRAPH_text; + } +else + { + $HTML_text.=$ASCII_text; + } $HTML_text.="\n\n
$db_source"; $HTML_text.=""; diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_status_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_status_detail.php index 35b9461c..ba69b904 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_status_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_status_detail.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -15,7 +15,8 @@ # 100712-1324 - Added system setting slave server option # 100802-2347 - Added User Group Allowed Reports option validation and allowed campaigns restrictions # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links -# 111104-1249 - Added user_group restrictions for selecting in-groups +# 111104-1248 - Added user_group restrictions for selecting in-groups +# 120224-0910 - Added HTML display option with bar graphs # @@ -44,11 +45,15 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} 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"];} if (strlen($shift)<2) {$shift='ALL';} $report_name = 'Agent Status Detail'; $db_source = 'M'; +$JS_text="\n"; echo "\n"; + echo "\n"; echo "\n"; echo "$report_name\n"; @@ -312,13 +318,14 @@ if ($file_download < 1) require("admin_header.php"); echo "\n"; - echo "\n"; - echo "
\n";
+	$ASCII_text.="\n";
+	$ASCII_text.="\n\n\n
\n";
+	$GRAPH.="
\n";
 	}
 
 if ( (strlen($group[0]) < 1) or (strlen($user_group[0]) < 1) )
 	{
-	echo "\n";
+	echo "
\n\n\n";
 	echo "PLEASE SELECT A CAMPAIGN OR USER GROUP AND DATE-TIME ABOVE AND CLICK SUBMIT\n";
 	echo " NOTE: stats taken from shift specified\n";
 	}
@@ -352,10 +359,12 @@ else
 
 	if ($file_download < 1)
 		{
-		echo "Agent Status Detail Report                     $NOW_TIME\n";
-
-		echo "Time range: $query_date_BEGIN to $query_date_END\n\n";
-		echo "---------- AGENT Details -------------\n\n";
+		$ASCII_text.="

Agent Status Detail Report $NOW_TIME\n"; + $ASCII_text.="Time range: $query_date_BEGIN to $query_date_END\n\n"; + $ASCII_text.="---------- AGENT Details -------------\n\n"; + $GRAPH.="

Agent Status Detail Report $NOW_TIME\n"; + $GRAPH.="Time range: $query_date_BEGIN to $query_date_END\n\n"; + $GRAPH.="---------- AGENT Details -------------"; } else { @@ -379,7 +388,7 @@ else $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $rows_to_print = mysql_num_rows($rslt); - $i=0; + $i=0; $sub_status_count=0; while ($i < $rows_to_print) { $row=mysql_fetch_row($rslt); @@ -398,6 +407,12 @@ else $statusesFILE .= "$statusesTXT,"; $statuses .= "$status[$i]-"; $statusesARY[$j] = $status[$i]; + + $sub_statusesARY[$sub_status_count] = $status[$i]; + $sub_status_count++; + $max_varname="max_".$status[$i]; + $$max_varname=1; + $j++; } if (!eregi("-$user[$i]-", $users)) @@ -413,10 +428,18 @@ else if ($file_download < 1) { - echo "CALLS STATS BREAKDOWN:\n"; - echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n"; - echo "| USER NAME | ID | CALLS | CIcalls| DNC/CI%|$statusesHTML\n"; - echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n"; + $ASCII_text.="CALLS STATS BREAKDOWN:\n"; + $ASCII_text.="+-----------------+----------+--------+--------+--------+$statusesHEAD\n"; + $ASCII_text.="| USER NAME | ID | CALLS | CIcalls| DNC/CI%|$statusesHTML\n"; + $ASCII_text.="+-----------------+----------+--------+--------+--------+$statusesHEAD\n"; + + for ($i=0; $i$SstatusTXT"; + } + } else { @@ -428,6 +451,18 @@ else $m=0; $CIScountTOT=0; $DNCcountTOT=0; + + $graph_stats=array(); + $max_calls=1; + $max_cicalls=1; + $max_dncci=1; + $GRAPH.="

"; + $GRAPH2=""; + $graph_header="
CALLSCI/CALLSDNC/CI
"; + $CALLS_graph=$graph_header.""; + $CICALLS_graph=$graph_header.""; + $DNCCI_graph=$graph_header.""; + while ($m < $k) { $Suser=$usersARY[$m]; @@ -444,6 +479,9 @@ else { $Sstatus=$statusesARY[$n]; $SstatusTXT=''; + $varname=$Sstatus."_graph"; + $$varname=$graph_header.""; + $max_varname="max_".$Sstatus; ### BEGIN loop through each stat line ### $i=0; $status_found=0; while ($i < $rows_to_print) @@ -461,6 +499,10 @@ else $DNCcount = ($DNCcount + $calls[$i]); $DNCcountTOT = ($DNCcountTOT + $calls[$i]); } + + if ($calls[$i]>$$max_varname) {$$max_varname=$calls[$i];} + $graph_stats[$m][(4+$n)]=$calls[$i]; + $SstatusTXT = sprintf("%8s", $calls[$i]); $SstatusesHTML .= " $SstatusTXT |"; $SstatusesFILE .= "$SstatusTXT,"; @@ -470,6 +512,7 @@ else } if ($status_found < 1) { + $graph_stats[$m][(4+$n)]=0; $SstatusesHTML .= " 0 |"; $SstatusesFILE .= "0,"; } @@ -514,9 +557,17 @@ else # $DNCcountPCTs = sprintf("%3.2f", $DNCcountPCTs); $DNCcountPCTs = sprintf("%6s", $DNCcountPCTs); + if (trim($Scalls)>$max_calls) {$max_calls=trim($Scalls);} + if (trim($CIScount)>$max_cicalls) {$max_cicalls=trim($CIScount);} + if (trim($DNCcountPCTs)>$max_dncci) {$max_dncci=trim($DNCcountPCTs);} + $graph_stats[$m][1]=trim("$Scalls"); + $graph_stats[$m][2]=trim("$CIScount"); + $graph_stats[$m][3]=trim("$DNCcountPCTs"); + if ($file_download < 1) { $Toutput = "| $Sfull_name | $Suser | $Scalls | $CIScount | $DNCcountPCTs%|$SstatusesHTML\n"; + $graph_stats[$m][0]=trim("$user_namesARY[$m] - $usersARY[$m]"); } else { @@ -553,7 +604,7 @@ else } if (!ereg("ID|TIME|LEADS|CI|DNCCI",$stage)) if ($file_download < 1) - {echo "$Toutput";} + {$ASCII_text.="$Toutput";} else {$file_output .= "$fileToutput";} @@ -581,7 +632,7 @@ else $i = $sort_split[1]; $sort_order[$m] = "$i"; if ($file_download < 1) - {echo "$TOPsorted_output[$i]";} + {$ASCII_text.="$TOPsorted_output[$i]";} else {$file_output .= "$TOPsorted_outputFILE[$i]";} $m++; @@ -600,6 +651,7 @@ else $Scalls=0; $Sstatus=$statusesARY[$n]; $SUMstatusTXT=''; + $total_var=$Sstatus."_total"; ### BEGIN loop through each stat line ### $i=0; $status_found=0; while ($i < $rows_to_print) @@ -615,12 +667,14 @@ else if ($status_found < 1) { $SUMstatusesHTML .= " 0 |"; + $$total_var="0"; } else { $SUMstatusTXT = sprintf("%8s", $Scalls); $SUMstatusesHTML .= " $SUMstatusTXT |"; $SUMstatusesFILE .= "$SUMstatusTXT,"; + $$total_var=$Scalls; } $n++; } @@ -628,9 +682,7 @@ else $TOTcalls = sprintf("%7s", $TOTcalls); $CIScountTOT = sprintf("%7s", $CIScountTOT); - $DNCcountPCT = 0; - if ( ($DNCcountTOT > 0) and ($CIScountTOT > 0) ) - {$DNCcountPCT = ( ($DNCcountTOT / $CIScountTOT) * 100);} + $DNCcountPCT = ( ($DNCcountTOT / $CIScountTOT) * 100); $DNCcountPCT = round($DNCcountPCT,2); $DNCcountPCT = sprintf("%3.2f", $DNCcountPCT); if ( ($DNCcountTOT < 1) or ($CIScountTOT < 1) ) @@ -646,11 +698,70 @@ else if ($file_download < 1) { - echo "+-----------------+----------+--------+--------+--------+$statusesHEAD\n"; - echo "| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $CIScountTOT| $DNCcountPCT%|$SUMstatusesHTML\n"; - echo "+----------------------------+--------+--------+--------+$statusesHEAD\n"; + $ASCII_text.="+-----------------+----------+--------+--------+--------+$statusesHEAD\n"; + $ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS | $TOTcalls| $CIScountTOT| $DNCcountPCT%|$SUMstatusesHTML\n"; + $ASCII_text.="+----------------------------+--------+--------+--------+$statusesHEAD\n"; - echo "\n\n"; + $ASCII_text.="\n\n"; + + for ($e=0; $e$SstatusTXT"; + } + + for ($d=0; $d"; + $CICALLS_graph.=" "; + $DNCCI_graph.=" "; + + for ($e=0; $e\n"; + + $$varname.=" "; + } + } + + $CALLS_graph.="
CALL STATS BREAKDOWN
STATUSCALLS
CI CALLS
DNC/CI%
$Sstatus
".$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][($e+4)]."
TOTAL:".trim($TOTcalls)."
"; + $CICALLS_graph.="TOTAL:".trim($CIScountTOT).""; + $DNCCI_graph.="TOTAL:".trim($DNCcountPCT)."%"; + for ($e=0; $e"; + } + $JS_onload.="\tDrawGraph('CALLS', '1');\n"; + $JS_text.="function DrawGraph(graph, th_id) {\n"; + $JS_text.=" var CALLS_graph=\"$CALLS_graph\";\n"; + $JS_text.=" var CICALLS_graph=\"$CICALLS_graph\";\n"; + $JS_text.=" var DNCCI_graph=\"$DNCCI_graph\";\n"; + + for ($e=0; $e
 


"; + + # echo $GRAPH.$GRAPH2.$GRAPH3.$max; } else { @@ -679,6 +790,20 @@ if ($file_download > 0) exit; } +$JS_onload.="}\n"; +$JS_text.=$JS_onload; +$JS_text.="\n"; + +if ($report_display_type=="HTML") + { + echo $GRAPH.$GRAPH2.$GRAPH3; + echo $JS_text; + } +else + { + echo $ASCII_text; + } + echo "
\n"; echo "
Dates:
"; @@ -750,6 +875,10 @@ echo "\n"; echo "\n"; echo "\n"; echo "

\n"; +echo "Display as:
"; +echo "\n

"; echo "\n"; echo "
        "; @@ -762,35 +891,38 @@ echo "
"; echo "
\n\n
$db_source"; echo "\n"; -echo "\n"; -echo "
\n\n\n\n\n\n\n\n\n\n";
 
-$m=0;
-while ($m < $k)
+if (!$report_display_type || $report_display_type=="TEXT")
 	{
-	$sort_split = explode("-----",$TOPsort[$m]);
-	$i = $sort_split[1];
-	$sort_order[$m] = "$i";
+	echo "\n";
+	echo "
\n\n\n\n\n\n\n\n\n\n";
 
-	if ( ($TOPsortTALLY[$i] < 1) or ($TOPsortMAX < 1) )
-		{echo "                              \n";}
-	else
+	$m=0;
+	while ($m < $k)
 		{
-		echo "                              ";
-		$TOPsortPLOT = ( ($TOPsortTALLY[$i] / $TOPsortMAX) * 110 );
-		$h=0;
-		while ($h <= $TOPsortPLOT)
+		$sort_split = explode("-----",$TOPsort[$m]);
+		$i = $sort_split[1];
+		$sort_order[$m] = "$i";
+
+		if ( ($TOPsortTALLY[$i] < 1) or ($TOPsortMAX < 1) )
+			{echo "                              \n";}
+		else
 			{
-			echo " ";
-			$h++;
+			echo "                              ";
+			$TOPsortPLOT = ( ($TOPsortTALLY[$i] / $TOPsortMAX) * 110 );
+			$h=0;
+			while ($h <= $TOPsortPLOT)
+				{
+				echo " ";
+				$h++;
+				}
+			echo "\n";
 			}
-		echo "\n";
+		$m++;
 		}
-	$m++;
+
+	echo "\n";
 	}
-
-echo "\n";
-
 ?>
 
 
\ No newline at end of file
diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php
index c267497c..bd4c89e0 100644
--- a/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php
+++ b/agc_2-X/trunk/www/vicidial/AST_agent_time_detail.php
@@ -4,7 +4,7 @@
 # Pulls time stats per agent selectable by campaign or user group
 # should be most accurate agent stats of all of the reports
 #
-# Copyright (C) 2011  Matt Florell     LICENSE: AGPLv2
+# Copyright (C) 2012  Matt Florell     LICENSE: AGPLv2
 #
 # CHANGES
 # 90522-0723 - First build
@@ -22,6 +22,7 @@
 # 110623-0728 - Fixed user group selection bug
 # 110708-1727 - Added options.php setting for time precision
 # 111104-1248 - Added user_group restrictions for selecting in-groups
+# 120224-0910 - Added HTML display option with bar graphs
 #
 
 require("dbconnect.php");
@@ -50,12 +51,16 @@ if (isset($_GET["submit"]))					{$submit=$_GET["submit"];}
 	elseif (isset($_POST["submit"]))		{$submit=$_POST["submit"];}
 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"];}
 
 if (strlen($shift)<2) {$shift='ALL';}
 if (strlen($stage)<2) {$stage='NAME';}
 
 $report_name = 'Agent Time Detail';
 $db_source = 'M';
+$JS_text="\n";
 	echo "\n";
+	echo "\n";
 
 	echo "\n";
 	echo "$report_name\n";
@@ -375,6 +381,29 @@ else
 	if ($DB) {echo "$stmt\n";}
 	$users_to_print = mysql_num_rows($rslt);
 	$i=0;
+	$graph_stats=array();
+	$max_calls=1;
+	$max_timeclock=1;
+	$max_agenttime=1;
+	$max_wait=1;
+	$max_talk=1;
+	$max_dispo=1;
+	$max_pause=1;
+	$max_dead=1;
+	$max_customer=1;
+	$GRAPH="";
+	$GRAPH2="";
+	$graph_header="
CALLSTIME CLOCKAGENT TIMEWAITTALKDISPOPAUSEDEADCUSTOMER
"; + $CALLS_graph=$graph_header.""; + $TIMECLOCK_graph=$graph_header.""; + $AGENTTIME_graph=$graph_header.""; + $WAIT_graph=$graph_header.""; + $TALK_graph=$graph_header.""; + $DISPO_graph=$graph_header.""; + $PAUSE_graph=$graph_header.""; + $DEAD_graph=$graph_header.""; + $CUSTOMER_graph=$graph_header.""; + while ($i < $users_to_print) { $row=mysql_fetch_row($rslt); @@ -417,7 +446,7 @@ else $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $subs_to_print = mysql_num_rows($rslt); - $i=0; + $i=0; while ($i < $subs_to_print) { $row=mysql_fetch_row($rslt); @@ -434,6 +463,9 @@ else $sub_statuses .= "$sub_status[$i]-"; $sub_statusesARY[$sub_status_count] = $sub_status[$i]; $sub_status_count++; + + $max_varname="max_".$sub_status[$i]; + $$max_varname=1; } if (!eregi("-$PCuser[$i]-", $PCusers)) { @@ -536,10 +568,12 @@ else ##### BEGIN print the output to screen or put into file output variable if ($file_download < 1) { - echo "AGENT TIME BREAKDOWN:\n"; - echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; - echo "| USER NAME | ID | CALLS | TIME CLOCK | AGENT TIME | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n"; - echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + $ASCII_text.="AGENT TIME BREAKDOWN:\n"; + $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + $ASCII_text.="| USER NAME | ID | CALLS | TIME CLOCK | AGENT TIME | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n"; + $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + + } else { @@ -567,6 +601,23 @@ else $RAWcalls = $Scalls[$m]; $RAWtimeSEC = $Stime[$m]; + if (trim($Scalls[$m])>$max_calls) {$max_calls=trim($Scalls[$m]);} + if (trim($Stime[$m])>$max_agenttime) {$max_agenttime=trim($Stime[$m]);} + if (trim($Swait[$m])>$max_wait) {$max_wait=trim($Swait[$m]);} + if (trim($Stalk[$m])>$max_talk) {$max_talk=trim($Stalk[$m]);} + if (trim($Sdispo[$m])>$max_dispo) {$max_dispo=trim($Sdispo[$m]);} + if (trim($Spause[$m])>$max_pause) {$max_pause=trim($Spause[$m]);} + if (trim($Sdead[$m])>$max_dead) {$max_dead=trim($Sdead[$m]);} + if (trim($Scustomer[$m])>$max_customer) {$max_customer=trim($Scustomer[$m]);} + $graph_stats[$m][1]=trim($Scalls[$m]); + $graph_stats[$m][3]=trim($Stime[$m]); + $graph_stats[$m][4]=trim($Swait[$m]); + $graph_stats[$m][5]=trim($Stalk[$m]); + $graph_stats[$m][6]=trim($Sdispo[$m]); + $graph_stats[$m][7]=trim($Spause[$m]); + $graph_stats[$m][8]=trim($Sdead[$m]); + $graph_stats[$m][9]=trim($Scustomer[$m]); + $Swait[$m]= sec_convert($Swait[$m],$TIME_agenttimedetail); $Stalk[$m]= sec_convert($Stalk[$m],$TIME_agenttimedetail); $Sdispo[$m]= sec_convert($Sdispo[$m],$TIME_agenttimedetail); @@ -610,6 +661,10 @@ else $punches_found++; $RAWtimeTCsec = $TCtime[$n]; $TOTtimeTC = ($TOTtimeTC + $TCtime[$n]); + + if (trim($RAWtimeTCsec)>$max_timeclock) {$max_timeclock=trim($RAWtimeTCsec);} + $graph_stats[$m][2]=trim($RAWtimeTCsec); + $StimeTC[$m]= sec_convert($TCtime[$n],$TIME_agenttimedetail); $RAWtimeTC = $StimeTC[$m]; $StimeTC[$m] = sprintf("%10s", $StimeTC[$m]); @@ -619,6 +674,9 @@ else if ($punches_found < 1) { $RAWtimeTCsec = "0"; + + $graph_stats[$m][2]=0; + $StimeTC[$m] = "0:00"; if ($TIME_agenttimedetail == 'HF') {$StimeTC[$m] = "0:00:00";} @@ -648,6 +706,9 @@ else { $Sstatus=$sub_statusesARY[$n]; $SstatusTXT=''; + $varname=$Sstatus."_graph"; + $$varname=$graph_header.""; + $max_varname="max_".$Sstatus; ### BEGIN loop through each stat line ### $i=0; $status_found=0; while ( ($i < $subs_to_print) and ($status_found < 1) ) @@ -657,6 +718,9 @@ else $USERcodePAUSE_MS = sec_convert($PCpause_sec[$i],$TIME_agenttimedetail); if (strlen($USERcodePAUSE_MS)<1) {$USERcodePAUSE_MS='0';} $pfUSERcodePAUSE_MS = sprintf("%10s", $USERcodePAUSE_MS); + + if ($PCpause_sec[$i]>$$max_varname) {$$max_varname=$PCpause_sec[$i];} + $graph_stats_sub[$m][$n]=$PCpause_sec[$i]; $SstatusTXT = sprintf("%10s", $pfUSERcodePAUSE_MS); $SstatusesHTML .= " $SstatusTXT |"; @@ -711,6 +775,8 @@ else if ($file_download < 1) { $Toutput = "| $Sname[$m] | $Suser[$m] | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] | $Swait[$m] | $Stalk[$m] | $Sdispo[$m] | $Spause[$m] | $Sdead[$m] | $Scustomer[$m] | |$SstatusesHTML\n"; + $graph_stats[$m][0]=trim("$Suser[$m] - $Sname[$m]"); +#CALLS | TIME CLOCK | AGENT TIME | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | | LOGIN | TRAIN | TOILET | PRECAL | BREAK | | LUNCH | LAGGED } else { @@ -754,7 +820,7 @@ else } if (!ereg("NAME|ID|TIME|LEADS|TCLOCK",$stage)) if ($file_download < 1) - {echo "$Toutput";} + {$ASCII_text.="$Toutput";} else {$file_output .= "$fileToutput";} @@ -790,7 +856,7 @@ else $i = $sort_split[1]; $sort_order[$m] = "$i"; if ($file_download < 1) - {echo "$TOPsorted_output[$i]";} + {$ASCII_text.="$TOPsorted_output[$i]";} else {$file_output .= "$TOPsorted_outputFILE[$i]";} $m++; @@ -817,6 +883,7 @@ else $Scalls=0; $Sstatus=$sub_statusesARY[$n]; $SUMstatusTXT=''; + $total_var=$Sstatus."_total"; ### BEGIN loop through each stat line ### $i=0; $status_found=0; while ($i < $subs_to_print) @@ -832,6 +899,7 @@ else if ($status_found < 1) { $SUMstatusesHTML .= " 0 |"; + $$total_var="0"; } else { @@ -839,6 +907,7 @@ else $USERsumstatPAUSE_MS = sec_convert($Scalls,$TIME_agenttimedetail); $pfUSERsumstatPAUSE_MS = sprintf("%11s", $USERsumstatPAUSE_MS); + $$total_var="$pfUSERsumstatPAUSE_MS"; $SUMstatusTXT = sprintf("%10s", $pfUSERsumstatPAUSE_MS); $SUMstatusesHTML .= "$SUMstatusTXT |"; @@ -873,12 +942,89 @@ else if ($file_download < 1) { - echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; - echo "| TOTALS AGENTS:$hTOT_AGENTS | $hTOTcalls |$hTOTtimeTC |$hTOTALtime |$hTOTwait |$hTOTtalk |$hTOTdispo |$hTOTpause |$hTOTdead |$hTOTcustomer | |$SUMstatusesHTML\n"; - echo "+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; + $ASCII_text.="| TOTALS AGENTS:$hTOT_AGENTS | $hTOTcalls |$hTOTtimeTC |$hTOTALtime |$hTOTwait |$hTOTtalk |$hTOTdispo |$hTOTpause |$hTOTdead |$hTOTcustomer | |$SUMstatusesHTML\n"; + $ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n"; if ($AUTOLOGOUTflag > 0) {echo " * denotes AUTOLOGOUT from timeclock\n";} - echo "\n\n"; + $ASCII_text.="\n\n"; + + for ($e=0; $e$SstatusTXT"; + } + + for ($d=0; $d"; + $TIMECLOCK_graph.=" "; + $AGENTTIME_graph.=" "; + $WAIT_graph.=" "; + $TALK_graph.=" "; + $DISPO_graph.=" "; + $PAUSE_graph.=" "; + $DEAD_graph.=" "; + $CUSTOMER_graph.=" "; + + for ($e=0; $e\n"; + + $$varname.=" "; + } + } + $CALLS_graph.="
AGENT TIME BREAKDOWN
STATUSCALLS
TIME CLOCK
AGENT TIME
WAIT
TALK
DISPO
PAUSE
DEAD
CUSTOMER
$Sstatus
".$graph_stats[$d][1]."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][2], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][3], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][4], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][5], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][6], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][7], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][8], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats[$d][9], 'HF')."
".$graph_stats[$d][0]."".sec_convert($graph_stats_sub[$d][$e], 'HF')."
TOTAL:".trim($hTOTcalls)."
"; + $TIMECLOCK_graph.="TOTAL:".trim($hTOTtimeTC).""; + $AGENTTIME_graph.="TOTAL:".trim($hTOTALtime).""; + $WAIT_graph.="TOTAL:".trim($hTOTwait).""; + $TALK_graph.="TOTAL:".trim($hTOTtalk).""; + $DISPO_graph.="TOTAL:".trim($hTOTdispo).""; + $PAUSE_graph.="TOTAL:".trim($hTOTpause).""; + $DEAD_graph.="TOTAL:".trim($hTOTdead).""; + $CUSTOMER_graph.="TOTAL:".trim($hTOTcustomer).""; + for ($e=0; $e"; +# $JS_text.="var ".$Sstatus."_graph=\"".$$graph_var."\";\n"; + } + $JS_onload.="\tDrawGraph('CALLS', '1');\n"; + $JS_text.="function DrawGraph(graph, th_id) {\n"; + $JS_text.=" var CALLS_graph=\"$CALLS_graph\";\n"; + $JS_text.=" var TIMECLOCK_graph=\"$TIMECLOCK_graph\";\n"; + $JS_text.=" var AGENTTIME_graph=\"$AGENTTIME_graph\";\n"; + $JS_text.=" var WAIT_graph=\"$WAIT_graph\";\n"; + $JS_text.=" var TALK_graph=\"$TALK_graph\";\n"; + $JS_text.=" var DISPO_graph=\"$DISPO_graph\";\n"; + $JS_text.=" var PAUSE_graph=\"$PAUSE_graph\";\n"; + $JS_text.=" var DEAD_graph=\"$DEAD_graph\";\n"; + $JS_text.=" var CUSTOMER_graph=\"$CUSTOMER_graph\";\n"; + + for ($e=0; $e
 


"; + + # echo $GRAPH.$GRAPH2.$GRAPH3.$max; } else { @@ -919,6 +1065,20 @@ if ($file_download > 0) ############################################################################ ##### BEGIN HTML form section ############################################################################ +$JS_onload.="}\n"; +$JS_text.=$JS_onload; +$JS_text.="\n"; + +if ($report_display_type=="HTML") + { + echo $JS_text; + echo $GRAPH.$GRAPH2.$GRAPH3.$max; + } +else + { + echo $ASCII_text; + } + echo "
\n"; echo "
Dates:
"; echo "\n"; @@ -989,6 +1149,10 @@ echo "\n"; echo "\n"; echo "\n"; echo "

\n"; +echo "Display as:
"; +echo "\n

"; echo "\n"; echo "
        "; diff --git a/agc_2-X/trunk/www/vicidial/AST_agent_timeclock_detail.php b/agc_2-X/trunk/www/vicidial/AST_agent_timeclock_detail.php index 2773862c..ea613a6c 100644 --- a/agc_2-X/trunk/www/vicidial/AST_agent_timeclock_detail.php +++ b/agc_2-X/trunk/www/vicidial/AST_agent_timeclock_detail.php @@ -3,7 +3,7 @@ # # Pulls all timeclock records for an agent # -# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # 90602-2244 - First build @@ -12,6 +12,7 @@ # 100802-2347 - Added User Group Allowed Reports option validation # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 111104-1315 - Added user_group restrictions for selecting in-groups +# 120224-0910 - Added HTML display option with bar graphs # @@ -41,7 +42,8 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} elseif (isset($_POST["submit"])) {$submit=$_POST["submit"];} 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"];} if (strlen($shift)<2) {$shift='ALL';} if (strlen($stage)<2) {$stage='ID';} @@ -265,6 +267,7 @@ if ($file_download < 1) + \n"; @@ -380,10 +383,19 @@ else ##### BEGIN print the output to screen or put into file output variable if ($file_download < 1) { - echo "AGENT TIME-CLOCK DETAIL:\n"; - echo "+-----------------+----------+----------------------+------------+--------------------\n"; - echo "| USER NAME | ID | USER GROUP | TIME CLOCK | TIME CLOCK PUNCHES\n"; - echo "+-----------------+----------+----------------------+------------+--------------------\n"; + $ASCII_text.="AGENT TIME-CLOCK DETAIL:\n"; + $ASCII_text.="+-----------------+----------+----------------------+------------+--------------------\n"; + $ASCII_text.="| USER NAME | ID | USER GROUP | TIME CLOCK | TIME CLOCK PUNCHES\n"; + $ASCII_text.="+-----------------+----------+----------------------+------------+--------------------\n"; + + $GRAPH.="\n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + } else { @@ -402,6 +414,9 @@ else ##### BEGIN loop through each user formatting data for output $AUTOLOGOUTflag=0; $m=0; + $max_time=1; + $graph_stats=array(); + $q=0; while ( ($m < $uc) and ($m < 50000) ) { $TCdetail=''; @@ -439,6 +454,7 @@ else $TOTtimeTC = ($TOTtimeTC + $TCtime[$n]); $StimeTC[$m]= sec_convert($TCtime[$n],'H'); $RAWtimeTC = $StimeTC[$m]; + if ($RAWtimeTCsec>$max_time) {$max_time=$RAWtimeTCsec;} $StimeTC[$m] = sprintf("%10s", $StimeTC[$m]); } $n++; @@ -455,7 +471,7 @@ else $TCuserAUTOLOGOUT = ' '; $stmt="select event_epoch,event_date,login_sec,event,user_group from vicidial_timeclock_log where event_date <= '$query_date_END' and event_date >= '$query_date_BEGIN' and user='$TCuser[$m]' $TCuser_group_SQL order by event_date limit 10000000;"; $rslt=mysql_query($stmt, $link); - if ($DB) {echo "$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $TC_results = mysql_num_rows($rslt); $k=0; while ($TC_results > $k) @@ -509,6 +525,11 @@ else if ($file_download < 1) { $Toutput = "| $Sname[$m] | $Suser[$m] | $Sgroup[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $TCdetail\n"; + $graph_stats[$q][0]="$Sname[$m] - $Suser[$m] / $Sgroup[$m]"; + $graph_stats[$q][1]="$RAWtimeTCsec"; + $graph_stats[$q][2]="$TCuserAUTOLOGOUT"; + $graph_stats[$q][3]="$TCdetail"; + $q++; } else { @@ -540,7 +561,9 @@ else } if (!ereg("NAME|ID|TCLOCK|GROUP",$stage)) if ($file_download < 1) - {echo "$Toutput";} + { + $ASCII_text.="$Toutput"; + } else {$file_output .= "$fileToutput";} @@ -550,12 +573,19 @@ else $m++; } ##### END loop through each user formatting data for output - + for ($i=0; $i".$graph_stats[$i][0]."\n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + } $TOT_AGENTS = sprintf("%4s", $m); $k=$m; - if ($DB) {echo "Done analyzing... $TOTwait|$TOTtalk|$TOTdispo|$TOTpause|$TOTALtime|$TOTcalls|$uc|
\n";} + if ($DB) {$ASCII_text.="Done analyzing... $TOTwait|$TOTtalk|$TOTdispo|$TOTpause|$TOTALtime|$TOTcalls|$uc|
\n";} ### BEGIN sort through output to display properly ### @@ -577,7 +607,7 @@ else $i = $sort_split[1]; $sort_order[$m] = "$i"; if ($file_download < 1) - {echo "$TOPsorted_output[$i]";} + {$ASCII_text.="$TOPsorted_output[$i]";} else {$file_output .= "$TOPsorted_outputFILE[$i]";} $m++; @@ -606,12 +636,22 @@ else if ($file_download < 1) { - echo "+-----------------+----------+----------------------+------------+--------------------\n"; - echo "| TOTALS AGENTS:$TOT_AGENTS | |$TOTtimeTC |\n"; - echo "+----------------------------+ +------------+\n"; + $ASCII_text.="+-----------------+----------+----------------------+------------+--------------------\n"; + $ASCII_text.="| TOTALS AGENTS:$TOT_AGENTS | |$TOTtimeTC |\n"; + $ASCII_text.="+----------------------------+ +------------+\n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.=" \n"; + $GRAPH.="
AGENT TIME-CLOCK DETAIL
USER/USER GROUPTIME CLOCK TIME CLOCK PUNCHES
\"\"".sec_convert($graph_stats[$i][1], 'H').$graph_stats[$i][2]."".$graph_stats[$i][3]."
TOTALSAGENTS: $TOT_AGENTS$TOTtimeTC
\n"; if ($AUTOLOGOUTflag > 0) - {echo " * denotes AUTOLOGOUT from timeclock\n";} - echo "\n\n"; + { + $ASCII_text.=" * denotes AUTOLOGOUT from timeclock\n"; + $GRAPH.=" * denotes AUTOLOGOUT from timeclock\n"; + } + $ASCII_text.=""; + $GRAPH.=""; } else { @@ -648,6 +688,14 @@ if ($file_download > 0) exit; } +if ($report_display_type=="HTML") + { + echo $GRAPH; + } +else + { + echo $ASCII_text; + } ############################################################################ ##### BEGIN HTML form section @@ -721,6 +769,11 @@ while ($user_groups_to_print > $o) $o++; } echo "\n"; +echo "
"; +echo "Display as:   
"; +echo "\n

"; echo "
Shift:
"; echo "\n"; $HTML_text.="
 \n"; $HTML_text.="\n"; +$HTML_text.="Display as:
"; +$HTML_text.="\n

"; $HTML_text.="\n"; $HTML_text.="
        "; @@ -263,6 +271,9 @@ $HTML_text.="
";
 $i=0;
 $group_string='|';
 $group_ct = count($group);
+$JS_text.="\n";
+
+if ($report_display_type=="HTML")
+	{
+	$HTML_text.=$JS_text.$GRAPH;
+	}
+else
+	{
+	$HTML_text.=$ASCII_text;
+	}
+
 $HTML_text.="
"; if ($file_download>0) diff --git a/agc_2-X/trunk/www/vicidial/AST_dialer_inventory_report.php b/agc_2-X/trunk/www/vicidial/AST_dialer_inventory_report.php index c169b346..2cd29fde 100644 --- a/agc_2-X/trunk/www/vicidial/AST_dialer_inventory_report.php +++ b/agc_2-X/trunk/www/vicidial/AST_dialer_inventory_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Joe Johnson LICENSE: AGPLv2 # Matt Florell # # NOTES: @@ -13,6 +13,7 @@ # 111013-0054 - First build # 111106-1327 - Reformatting, other minor changes # 111230-1145 - Debugging additions and more minor changes +# 120221-2237 - Added totals, list options, other small changes # error_reporting(0); @@ -154,7 +155,7 @@ while($i < $group_ct) $i++; } -$stmt="SELECT campaign_id from vicidial_campaigns where campaign_id in (SELECT distinct campaign_id from vicidial_lists) $LOGallowed_campaignsSQL order by campaign_id;"; +$stmt="SELECT campaign_id from vicidial_campaigns where campaign_id in (SELECT distinct campaign_id from vicidial_lists where inventory_report='Y') $LOGallowed_campaignsSQL order by campaign_id;"; $rslt=mysql_query($stmt, $link); if ($DB) { echo "$stmt\n";} $campaigns_to_print = mysql_num_rows($rslt); @@ -191,7 +192,7 @@ else $group_SQL = "and campaign_id IN($group_SQL)"; } -$stmt="SELECT list_id, list_name from vicidial_lists $whereLOGallowed_campaignsSQL order by list_id, list_name;"; +$stmt="SELECT list_id, list_name from vicidial_lists where inventory_report='Y' $LOGallowed_campaignsSQL order by list_id, list_name;"; $rslt=mysql_query($stmt, $link); if ($DB) {$HTML_header.="$stmt\n";} $lists_to_print = mysql_num_rows($rslt); @@ -295,6 +296,15 @@ function GetListCount($list_id, $inventory_ptnstr) if ($SUBMIT) { + $total_list_start_inv=0; + $total_dialable_count=0; + $total_dialable_count_nofilter=0; + $total_dialable_count_oneoff=0; + $total_dialable_count_inactive=0; + $total_total_calls=0; + $total_average_call_count=0; + $total_penetration=0; + if ($snapshot_time && $report_source=="SNAPSHOT") { $rpt_header="SNAPSHOT from $snapshot_time\n"; @@ -313,7 +323,7 @@ if ($SUBMIT) } $shift_SQL_str=substr($shift_SQL_str, 0, -1); - $shift_stmt="SELECT shift_id from vicidial_shifts where report_option='Y' order by shift_start_time asc;"; + $shift_stmt="SELECT shift_id from vicidial_shifts where report_option='Y' order by report_rank, shift_start_time asc;"; if ($DBX > 0) {$HTML_header.= "|$shift_stmt|\n";} $shift_rslt=mysql_query($shift_stmt, $link); $c=0; @@ -324,19 +334,30 @@ if ($SUBMIT) $rpt_header_SHIFTS_lower.=" |"; $rpt_header_BORDER.="----------+"; $shift_ary[$c]=$shift_row["shift_id"]; + $total_varname="total_".$shift_row["shift_id"]; + $$total_varname=0; if ($DB > 0) {echo "
-$c-$shift_ary[$c]-$shift_row[shift_id]-\n";} $c++; } if ($report_type=="CAMPAIGNS") {$time_clause=$group_SQL;} if ($report_type=="LIST") {$time_clause="and list_id='$selected_list'";} - $stmt="SELECT snapshot_id,snapshot_time,list_id,list_name,campaign_id,list_lastcalldate,list_start_inv,dialable_count,dialable_count_nofilter,dialable_count_oneoff,dialable_count_inactive,average_call_count,penetration,shift_data,time_setting from dialable_inventory_snapshots where snapshot_time='$snapshot_time' and time_setting='$time_setting' $time_clause order by campaign_id, list_id;"; + $stmt="SELECT snapshot_id,snapshot_time,list_id,list_name,list_description,campaign_id,list_lastcalldate,list_start_inv,dialable_count,dialable_count_nofilter,dialable_count_oneoff,dialable_count_inactive,average_call_count,penetration,shift_data,time_setting from dialable_inventory_snapshots where snapshot_time='$snapshot_time' and time_setting='$time_setting' $time_clause order by campaign_id, list_id;"; if ($DBX > 0) {$HTML_header.= "|$stmt|\n";} $rslt=mysql_query($stmt, $link); while ($row=mysql_fetch_array($rslt)) { - $rpt_body.="| ".sprintf("%9s", $row["list_id"])." | ".sprintf("%-30s", $row["list_name"])." | ".sprintf("%8s", $row["campaign_id"])." | ".$row["list_lastcalldate"]." | ".sprintf("%9s", $row["list_start_inv"])." | ".sprintf("%8s", $row["dialable_count"])." | ".sprintf("%8s", $row["dialable_count_nofilter"])." | ".sprintf("%8s", $row["dialable_count_oneoff"])." | ".sprintf("%8s", $row["dialable_count_inactive"])." | ".sprintf("%8s", $row["average_call_count"])." | ".sprintf("%6s", $row["penetration"])."% |"; - $CSV_body.="\"$row[list_id]\",\"$row[list_name]\",\"$row[last_calldate]\",\"$row[campaign_id]\",\"$row[list_start_inv]\",\"$row[dialable_count]\",\"$row[dialable_count_nofilter]\",\"$row[dialable_count_oneoff]\",\"$row[dialable_count_inactive]\",\"$row[average_call_count]\",\"$row[penetration] %\""; + $row["list_description"]=substr($row["list_description"], 0, 30); + if (strlen($row["list_description"])>0) {$list_info=$row["list_description"];} else {$list_info=$row["list_name"];} + $rpt_body.="| ".sprintf("%9s", $row["list_id"])." | ".sprintf("%-30s", $list_info)." | ".sprintf("%8s", $row["campaign_id"])." | ".$row["list_lastcalldate"]." | ".sprintf("%9s", $row["list_start_inv"])." | ".sprintf("%8s", $row["dialable_count"])." | ".sprintf("%8s", $row["dialable_count_nofilter"])." | ".sprintf("%8s", $row["dialable_count_oneoff"])." | ".sprintf("%8s", $row["dialable_count_inactive"])." | ".sprintf("%8s", $row["average_call_count"])." | ".sprintf("%6s", $row["penetration"])."% |"; + $CSV_body.="\"$row[list_id]\",\"$list_info\",\"$row[last_calldate]\",\"$row[campaign_id]\",\"$row[list_start_inv]\",\"$row[dialable_count]\",\"$row[dialable_count_nofilter]\",\"$row[dialable_count_oneoff]\",\"$row[dialable_count_inactive]\",\"$row[average_call_count]\",\"$row[penetration] %\""; + + $total_list_start_inv+=$row["list_start_inv"]; + $total_dialable_count+=$row["dialable_count"]; + $total_dialable_count_nofilter+=$row["dialable_count_nofilter"]; + $total_dialable_count_oneoff+=$row["dialable_count_oneoff"]; + $total_dialable_count_inactive+=$row["dialable_count_inactive"]; + $total_total_calls+=($row["average_call_count"]*$row["list_start_inv"]); $shift_data_a=explode("|", $row["shift_data"]); $b=0; @@ -351,6 +372,8 @@ if ($SUBMIT) { $rpt_body.=" ".sprintf("%8s", $shift_data_b[1])." |"; $CSV_body.=",\"$shift_data_b[1]\""; + $total_varname="total_".$shift_data_b[0]; + $$total_varname+=$shift_data_b[1]; $line_match++; } if ($DB > 0) {echo "
-$a-$b-$shift_ary[$b]-$shift_data_b[0]($shift_data_b[1])-$line_match-\n";} @@ -374,7 +397,7 @@ if ($SUBMIT) $gmt_row=mysql_fetch_row($gmt_rslt); $local_offset=$gmt_row[0]; - if ($report_type=="CAMPAIGNS") {$time_clause="where list_id in (SELECT list_id from vicidial_lists where ".substr($group_SQL,4).")";} + if ($report_type=="CAMPAIGNS") {$time_clause="where list_id in (SELECT list_id from vicidial_lists where inventory_report='Y' ".substr($group_SQL,4).")";} if ($report_type=="LIST") {$time_clause="where list_id='$selected_list'";} $gmt_stmt="SELECT distinct gmt_offset_now, gmt_offset_now-($local_offset) from vicidial_list $time_clause ;"; if ($DB) {$HTML_header.=$gmt_stmt."
\n";} @@ -391,7 +414,7 @@ if ($SUBMIT) } # Get shift information - $shift_stmt="SELECT shift_id, shift_name, str_to_date(shift_start_time, '%H%i') as shift_start_time, addtime(str_to_date(shift_start_time, '%H%i'), shift_length) as shift_end_time, if(addtime(str_to_date(shift_start_time, '%H%i'), shift_length)>'23:59:59', '1', '0') as day_offset, shift_weekdays from vicidial_shifts where report_option='Y' order by shift_start_time asc;"; + $shift_stmt="SELECT shift_id, shift_name, str_to_date(shift_start_time, '%H%i') as shift_start_time, addtime(str_to_date(shift_start_time, '%H%i'), shift_length) as shift_end_time, if(addtime(str_to_date(shift_start_time, '%H%i'), shift_length)>'23:59:59', '1', '0') as day_offset, shift_weekdays from vicidial_shifts where report_option='Y' order by report_rank, shift_start_time asc;"; if ($DB) {$HTML_header.="$shift_stmt;\n";} $shift_rslt=mysql_query($shift_stmt, $link); while($shift_row=mysql_fetch_array($shift_rslt)) @@ -448,15 +471,17 @@ if ($SUBMIT) if (strlen($filter_row[0])>0) {$filter_SQL=" and $filter_row[0]";} else {$filter_SQL="";} $filter_SQL = preg_replace("/\\\/",'',$filter_SQL); - $lists_stmt="SELECT list_id, list_name, list_description, if(list_lastcalldate is null, '*** Not called *** ', list_lastcalldate) as list_lastcalldate from vicidial_lists where campaign_id='$group[$i]' $LOGallowed_campaignsSQL order by list_id asc;"; + $lists_stmt="SELECT list_id, list_name, list_description, if(list_lastcalldate is null, '*** Not called *** ', list_lastcalldate) as list_lastcalldate from vicidial_lists where campaign_id='$group[$i]' and inventory_report='Y' $LOGallowed_campaignsSQL order by list_id asc;"; if ($DB) {$HTML_header.="$lists_stmt;\n";} $lists_rslt=mysql_query($lists_stmt, $link); while ($lists_row=mysql_fetch_array($lists_rslt)) { $list_id=$lists_row["list_id"]; $list_name=$lists_row["list_name"]; + $lists_row["list_description"]=substr($lists_row["list_description"], 0, 30); $list_description=$lists_row["list_description"]; $last_calldate=$lists_row["list_lastcalldate"]; + if (strlen($list_description)>0) {$list_info=$list_description;} else {$list_info=$list_name;} $list_start_inv=0; GetListCount($list_id, $inventory_ptnstr); @@ -479,8 +504,15 @@ if ($SUBMIT) if ($list_start_inv>0) {$penetration=sprintf("%.2f", (100*($list_start_inv-$Xdialable_count)/$list_start_inv));} else {$penetration="0.00";} - $rpt_body.="| ".sprintf("%9s", $list_id)." | ".sprintf("%-30s", $list_name)." | ".sprintf("%8s", $group[$i])." | ".$last_calldate." | ".sprintf("%9s", $list_start_inv)." | ".sprintf("%8s", $Xdialable_count)." | ".sprintf("%8s", $Xdialable_count_nofilter)." | ".sprintf("%8s", $oneoff_count)." | ".sprintf("%8s", $Xdialable_inactive_count)." | ".sprintf("%8s", $average_calls)." | ".sprintf("%6s", $penetration)."% |"; - $CSV_body.="\"$list_id\",\"$list_name\",\"$last_calldate\",\"$group[$i]\",\"$list_start_inv\",\"$Xdialable_count\",\"$Xdialable_count_nofilter\",\"$oneoff_count\",\"$Xdialable_inactive_count\",\"$average_calls\",\"$penetration %\""; + $rpt_body.="| ".sprintf("%9s", $list_id)." | ".sprintf("%-30s", $list_info)." | ".sprintf("%8s", $group[$i])." | ".$last_calldate." | ".sprintf("%9s", $list_start_inv)." | ".sprintf("%8s", $Xdialable_count)." | ".sprintf("%8s", $Xdialable_count_nofilter)." | ".sprintf("%8s", $oneoff_count)." | ".sprintf("%8s", $Xdialable_inactive_count)." | ".sprintf("%8s", $average_calls)." | ".sprintf("%6s", $penetration)."% |"; + $CSV_body.="\"$list_id\",\"$list_info\",\"$last_calldate\",\"$group[$i]\",\"$list_start_inv\",\"$Xdialable_count\",\"$Xdialable_count_nofilter\",\"$oneoff_count\",\"$Xdialable_inactive_count\",\"$average_calls\",\"$penetration %\""; + + $total_list_start_inv+=$list_start_inv; + $total_dialable_count+=$Xdialable_count; + $total_dialable_count_nofilter+=$Xdialable_count_nofilter; + $total_dialable_count_oneoff+=$oneoff_count; + $total_dialable_count_inactive+=$Xdialable_inactive_count; + $total_total_calls+=$total_calls; # $stat_stmt="SELECT call_date, dayofweek(call_date) from vicidial_log where lead_id in (SELECT lead_id from vicidial_list where list_id='$list_id' and called_count<='$called_count_limit' and status in ($inventory_statuses) $filter_SQL"; # SELECT lead_id, count(*) as count from vicidial_log where extract(HOUR_MINUTE FROM call_date)>='900' and extract(HOUR_MINUTE FROM call_date)<='1700' and dayofweek(call_date) in (2,3,4,5,6) and lead_id in (SELECT lead_id from vicidial_list where list_id=41073) group by lead_id order by lead_id; @@ -548,6 +580,8 @@ if ($SUBMIT) } $shift_count=$Xdialable_count-$total_shift_count; $rpt_body.=" ".sprintf("%8s", $shift_count)." |"; + $total_varname="total_".$key; + $$total_varname+=$shift_count; $CSV_body.=",\"$shift_count\""; } $rpt_body.="\n"; @@ -558,7 +592,7 @@ if ($SUBMIT) } else if ($selected_list && $report_type=="LIST") { - $campaign_stmt="SELECT call_count_limit, call_count_target, dial_statuses, local_call_time, drop_lockout_time, v.campaign_id from vicidial_campaigns v, vicidial_lists vl where vl.list_id='$selected_list' and vl.campaign_id=v.campaign_id;"; + $campaign_stmt="SELECT call_count_limit, call_count_target, dial_statuses, local_call_time, drop_lockout_time, v.campaign_id from vicidial_campaigns v, vicidial_lists vl where inventory_report='Y' and vl.list_id='$selected_list' and vl.campaign_id=v.campaign_id;"; if ($DB) {$HTML_header.="$campaign_stmt;\n";} $campaign_rslt=mysql_query($campaign_stmt, $link); $campaign_row=mysql_fetch_row($campaign_rslt); @@ -569,7 +603,7 @@ if ($SUBMIT) $drop_lockout_time=$campaign_row[4]; $campaign_id=$campaign_row[5]; - $stmt="SELECT distinct status from vicidial_statuses where completed='N' UNION SELECT distinct status from vicidial_campaign_statuses where completed='N' and campaign_id=(SELECT campaign_id from vicidial_lists where list_id='$selected_list' $LOGallowed_campaignsSQL);"; + $stmt="SELECT distinct status from vicidial_statuses where completed='N' UNION SELECT distinct status from vicidial_campaign_statuses where completed='N' and campaign_id=(SELECT campaign_id from vicidial_lists where list_id='$selected_list' and inventory_report='Y' $LOGallowed_campaignsSQL);"; if ($DB) {$HTML_header.="$stmt\n";} $rslt=mysql_query($stmt, $link); $inactive_dial_statuses=" "; @@ -598,20 +632,25 @@ if ($SUBMIT) if (strlen($filter_row[0])>0) {$filter_SQL=" and $filter_row[0]";} else {$filter_SQL="";} $filter_SQL = preg_replace("/\\\/",'',$filter_SQL); - $lists_stmt="SELECT list_id, list_name, list_description, if(list_lastcalldate is null, '*** Not called *** ', list_lastcalldate) as list_lastcalldate, campaign_id from vicidial_lists where list_id='$selected_list' $LOGallowed_campaignsSQL order by list_id asc;"; + $lists_stmt="SELECT list_id, list_name, list_description, if(list_lastcalldate is null, '*** Not called *** ', list_lastcalldate) as list_lastcalldate, campaign_id from vicidial_lists where list_id='$selected_list' and inventory_report='Y' $LOGallowed_campaignsSQL order by list_id asc;"; if ($DB) {$HTML_header.="$lists_stmt;\n";} $lists_rslt=mysql_query($lists_stmt, $link); while ($lists_row=mysql_fetch_array($lists_rslt)) { $list_id=$lists_row["list_id"]; $list_name=$lists_row["list_name"]; + $lists_row["list_description"]=substr($lists_row["list_description"], 0, 30); $list_description=$lists_row["list_description"]; $last_calldate=$lists_row["list_lastcalldate"]; $campaign_id=$lists_row["campaign_id"]; + if (strlen($list_description)>0) {$list_info=$list_description;} else {$list_info=$list_name;} $list_call_inv=0; GetListCount($list_id, $inventory_ptnstr); if ($list_start_inv>0) {$average_calls=sprintf("%.1f", $total_calls/$list_start_inv);} else {$average_calls="0.0";} + ### For TOTAL counts, needs to be here instead of with other "total" variables further down in this particular report + $total_total_calls+=$total_calls; + $Xdialable_count_nofilter = dialable_leads($DB,$link,$local_call_time,"$dial_statuses",$selected_list,$drop_lockout_time,$call_count_limit,$single_status,""); if (strlen($inactive_dial_statuses)>1) { @@ -632,8 +671,14 @@ if ($SUBMIT) if ($list_start_inv>0) {$penetration=sprintf("%.2f", (100*($list_start_inv-$Xdialable_count)/$list_start_inv));} else {$penetration="0.00";} - $rpt_body.="| ".sprintf("%9s", $list_id)." | ".sprintf("%-30s", $list_name)." | ".sprintf("%8s", $campaign_id)." | ".$last_calldate." | ".sprintf("%9s", $list_start_inv)." | ".sprintf("%8s", $Xdialable_count)." | ".sprintf("%8s", $Xdialable_count_nofilter)." | ".sprintf("%8s", $oneoff_count)." | ".sprintf("%8s", $Xdialable_inactive_count)." | ".sprintf("%8s", $average_calls)." | ".sprintf("%6s", $penetration)."% |"; - $CSV_body.="\"$list_id\",\"$list_name\",\"$last_calldate\",\"$campaign_id\",\"$list_start_inv\",\"$Xdialable_count\",\"$Xdialable_count_nofilter\",\"$oneoff_count\",\"$Xdialable_inactive_count\",\"$average_calls\",\"$penetration %\""; + $rpt_body.="| ".sprintf("%9s", $list_id)." | ".sprintf("%-30s", $list_info)." | ".sprintf("%8s", $campaign_id)." | ".$last_calldate." | ".sprintf("%9s", $list_start_inv)." | ".sprintf("%8s", $Xdialable_count)." | ".sprintf("%8s", $Xdialable_count_nofilter)." | ".sprintf("%8s", $oneoff_count)." | ".sprintf("%8s", $Xdialable_inactive_count)." | ".sprintf("%8s", $average_calls)." | ".sprintf("%6s", $penetration)."% |"; + $CSV_body.="\"$list_id\",\"$list_info\",\"$last_calldate\",\"$campaign_id\",\"$list_start_inv\",\"$Xdialable_count\",\"$Xdialable_count_nofilter\",\"$oneoff_count\",\"$Xdialable_inactive_count\",\"$average_calls\",\"$penetration %\""; + + $total_list_start_inv+=$list_start_inv; + $total_dialable_count+=$Xdialable_count; + $total_dialable_count_nofilter+=$Xdialable_count_nofilter; + $total_dialable_count_oneoff+=$oneoff_count; + $total_dialable_count_inactive+=$Xdialable_inactive_count; $shift_ary2=$shift_ary; while (list($key, $val)=each($shift_ary2)) @@ -707,6 +752,8 @@ if ($SUBMIT) } $shift_count=$Xdialable_count-$total_shift_count; $rpt_body.=" ".sprintf("%8s", $shift_count)." |"; + $total_varname="total_".$key; + $$total_varname+=$shift_count; $CSV_body.=",\"$shift_count\""; } $rpt_body.="\n"; @@ -725,7 +772,26 @@ if ($SUBMIT) $CSV_header.="\"Date: ".date("m/d/Y")."\",\"\",\"Time: ".date("H:i a")."\"\n\n"; $CSV_header.="\"Call list\",\"List description\",\"Campaign\",\"Last call date\",\"Start Inv\",\"Call Inv Total\",\"Call Inv - No filter\",\"Call Inv - One-offs\",\"Call Inv - Inactive dialable statuses\",\"Dial Avg\",\"Pen. %\",".substr($CSV_header_SHIFTS,0,-1)."\n"; - $rpt_footer="+-----------+--------------------------------+----------+---------------------+-----------+----------+----------+----------+----------+----------+---------+$rpt_header_BORDER\n"; + $rpt_footer ="+-----------+--------------------------------+----------+---------------------+-----------+----------+----------+----------+----------+----------+---------+$rpt_header_BORDER\n"; + + #### PRINT TOTALS #### + if ($total_list_start_inv>0) {$total_average_call_count=sprintf("%.1f", $total_total_calls/$total_list_start_inv);} else {$average_calls="0.0";} + if ($total_list_start_inv>0) {$total_penetration=sprintf("%.2f", (100*($total_list_start_inv-$total_dialable_count)/$total_list_start_inv));} else {$total_penetration="0.00";} + $rpt_footer.="|".sprintf("%76s", "TOTALS")." | ".sprintf("%9s", $total_list_start_inv)." | ".sprintf("%8s", $total_dialable_count)." | ".sprintf("%8s", $total_dialable_count_nofilter)." | ".sprintf("%8s", $total_dialable_count_oneoff)." | ".sprintf("%8s", $total_dialable_count_inactive)." | ".sprintf("%8s", $total_average_call_count)." | ".sprintf("%6s", $total_penetration)."% |"; + $CSV_body.="\"\",\"\",\"\",\"TOTALS\",\"$total_list_start_inv\",\"$total_dialable_count\",\"$total_dialable_count_nofilter\",\"$total_dialable_count_oneoff\",\"$total_dialable_count_inactive\",\"$total_average_call_count\",\"$total_penetration\""; + $b=0; + while ($b < count($shift_ary)) + { + $total_varname="total_".$shift_ary[$b]; + $rpt_footer.=" ".sprintf("%8s", $$total_varname)." |"; + $CSV_body.=",\"".$$total_varname."\""; + $b++; + } + $CSV_body.="\n"; + $rpt_footer.="\n"; + ###################### + + $rpt_footer.="+-----------+--------------------------------+----------+---------------------+-----------+----------+----------+----------+----------+----------+---------+$rpt_header_BORDER\n"; } $HTML_header.="\n"; ############################### diff --git a/agc_2-X/trunk/www/vicidial/AST_inbound_daily_report.php b/agc_2-X/trunk/www/vicidial/AST_inbound_daily_report.php index ffe19eb4..1c47424f 100644 --- a/agc_2-X/trunk/www/vicidial/AST_inbound_daily_report.php +++ b/agc_2-X/trunk/www/vicidial/AST_inbound_daily_report.php @@ -7,6 +7,7 @@ # # 111119-1234 - First build # 120118-2116 - Changed headers on CSV download +# 120224-0910 - Added HTML display option with bar graphs # require("dbconnect.php"); @@ -32,6 +33,8 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -171,6 +174,7 @@ if (!preg_match("/\|$group\|/i",$groups_string)) $HEADER.="\n"; $HEADER.="\n"; +$HEADER.="\n"; $HEADER.="\n"; $HEADER.="$report_name\n"; @@ -217,6 +221,10 @@ while ($groups_to_print > $o) $o++; } $MAIN.="\n"; +$MAIN.="  "; +$MAIN.="  "; $MAIN.=""; $select_list .= "
(To select more than 1 campaign, hold down the Ctrl key and click)"; + +$select_list .= "

Select User Groups:
"; +$select_list .= ""; + $select_list .= "
"; $select_list .= "Close Panel

"; $select_list .= ""; @@ -1600,7 +1747,7 @@ else if ($adastats>1) { - $min_link='- min '; + $min_link='- min '; if ($RTajax > 0) {$min_link='';} @@ -1718,60 +1865,60 @@ if ($RTajax < 1) { if ($adastats<2) { - echo "+ VIEW MORE"; + echo "+ VIEW MORE"; } else { - echo "+ VIEW LESS"; + echo "+ VIEW LESS"; } if ($UGdisplay>0) { - echo "       HIDE USER GROUP"; + echo "       HIDE USER GROUP"; } else { - echo "       VIEW USER GROUP"; + echo "       VIEW USER GROUP"; } if ($SERVdisplay>0) { - echo "       HIDE SERVER INFO"; + echo "       HIDE SERVER INFO"; } else { - echo "       SHOW SERVER INFO"; + echo "       SHOW SERVER INFO"; } if ($CALLSdisplay>0) { - echo "       HIDE WAITING CALLS"; + echo "       HIDE WAITING CALLS"; } else { - echo "       SHOW WAITING CALLS"; + echo "       SHOW WAITING CALLS"; } if ($ALLINGROUPstats>0) { - echo "       HIDE IN-GROUP STATS"; + echo "       HIDE IN-GROUP STATS"; } else { - echo "       SHOW IN-GROUP STATS"; + echo "       SHOW IN-GROUP STATS"; } if ($PHONEdisplay>0) { - echo "       HIDE PHONES"; + echo "       HIDE PHONES"; } else { - echo "       SHOW PHONES"; + echo "       SHOW PHONES"; } if ($CUSTPHONEdisplay>0) { - echo "       HIDE CUSTPHONES"; + echo "       HIDE CUSTPHONES"; } else { - echo "       SHOW CUSTPHONES"; + echo "       SHOW CUSTPHONES"; } } @@ -2048,13 +2195,13 @@ $HTbegin = "|"; $HDstation = "----------------+"; $HTstation = " STATION |"; $HDphone = "-------------+"; -$HTphone = " PHONE |"; +$HTphone = " PHONE |"; if ($RTajax > 0) {$HTphone = " PHONE |";} $HDuser = "------------------------+"; -$HTuser = " USER "; +$HTuser = " USER "; if ($RTajax > 0) {$HTuser = " USER ";} if ($UidORname>0) @@ -2063,7 +2210,7 @@ if ($UidORname>0) {$HTuser .= "SHOW ID ";} else { - $HTuser .= "SHOW ID "; + $HTuser .= "SHOW ID "; } } else @@ -2072,7 +2219,7 @@ else {$HTuser .= "SHOW NAME";} else { - $HTuser .= "SHOW NAME"; + $HTuser .= "SHOW NAME"; } } @@ -2080,7 +2227,7 @@ $HTuser .= " INFO |"; $HDusergroup = "--------------+"; -$HTusergroup = " USER GROUP |"; +$HTusergroup = " USER GROUP |"; if ($RTajax > 0) {$HTusergroup = " USER GROUP |";} $HDsessionid = "------------------+"; @@ -2096,11 +2243,11 @@ $HTserver_ip = " SERVER IP |"; $HDcall_server_ip = "-----------------+"; $HTcall_server_ip = " CALL SERVER IP |"; $HDtime = "---------+"; -$HTtime = " MM:SS |"; +$HTtime = " MM:SS |"; if ($RTajax > 0) {$HTtime = " MM:SS |";} $HDcampaign = "------------+"; -$HTcampaign = " CAMPAIGN |"; +$HTcampaign = " CAMPAIGN |"; if ($RTajax > 0) {$HTcampaign = " CAMPAIGN |";} $HDcalls = "-------+"; @@ -2189,8 +2336,11 @@ else {$UgroupSQL = " and vicidial_live_agents.campaign_id IN($group_SQL)";} if (strlen($usergroup)<1) {$usergroupSQL = '';} else {$usergroupSQL = " and user_group='" . mysql_real_escape_string($usergroup) . "'";} +if ( (eregi('ALL-GROUPS',$user_group_string)) and (strlen($user_group_SQL) < 3) ) {$user_group_filter_SQL = '';} +else {$user_group_filter_SQL = " and vicidial_users.user_group IN($user_group_SQL)";} + $ring_agents=0; -$stmt="select extension,vicidial_live_agents.user,conf_exten,vicidial_live_agents.status,vicidial_live_agents.server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,vicidial_live_agents.campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,vicidial_live_agents.calls_today,vicidial_live_agents.callerid,lead_id,UNIX_TIMESTAMP(last_state_change),on_hook_agent,ring_callerid,agent_log_id from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $UgroupSQL $usergroupSQL order by $orderSQL;"; +$stmt="select extension,vicidial_live_agents.user,conf_exten,vicidial_live_agents.status,vicidial_live_agents.server_ip,UNIX_TIMESTAMP(last_call_time),UNIX_TIMESTAMP(last_call_finish),call_server_ip,vicidial_live_agents.campaign_id,vicidial_users.user_group,vicidial_users.full_name,vicidial_live_agents.comments,vicidial_live_agents.calls_today,vicidial_live_agents.callerid,lead_id,UNIX_TIMESTAMP(last_state_change),on_hook_agent,ring_callerid,agent_log_id from vicidial_live_agents,vicidial_users where vicidial_live_agents.user=vicidial_users.user $UgroupSQL $usergroupSQL $user_group_filter_SQL order by $orderSQL;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $talking_to_print = mysql_num_rows($rslt); diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 22b688cf..867ea436 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -1724,6 +1724,11 @@ if (isset($_GET["territory_reset"])) {$territory_reset=$_GET["territory_reset" elseif (isset($_POST["territory_reset"])) {$territory_reset=$_POST["territory_reset"];} if (isset($_GET["hopper_vlc_dup_check"])) {$hopper_vlc_dup_check=$_GET["hopper_vlc_dup_check"];} elseif (isset($_POST["hopper_vlc_dup_check"])) {$hopper_vlc_dup_check=$_POST["hopper_vlc_dup_check"];} +if (isset($_GET["inventory_report"])) {$inventory_report=$_GET["inventory_report"];} + elseif (isset($_POST["inventory_report"])) {$inventory_report=$_POST["inventory_report"];} +if (isset($_GET["report_rank"])) {$report_rank=$_GET["report_rank"];} + elseif (isset($_POST["report_rank"])) {$report_rank=$_POST["report_rank"];} + if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -2009,6 +2014,7 @@ if ($non_latin < 1) $modify_same_user_level = ereg_replace("[^0-9]","",$modify_same_user_level); $admin_hide_lead_data = ereg_replace("[^0-9]","",$admin_hide_lead_data); $max_calls_count = ereg_replace("[^0-9]","",$max_calls_count); + $report_rank = ereg_replace("[^0-9]","",$report_rank); $drop_call_seconds = ereg_replace("[^-0-9]","",$drop_call_seconds); @@ -2107,6 +2113,7 @@ if ($non_latin < 1) $completed = ereg_replace("[^NY]","",$completed); $report_option = ereg_replace("[^NY]","",$report_option); $hopper_vlc_dup_check = ereg_replace("[^NY]","",$hopper_vlc_dup_check); + $inventory_report = ereg_replace("[^NY]","",$inventory_report); $qc_enabled = ereg_replace("[^0-9NY]","",$qc_enabled); $active = ereg_replace("[^0-9NY]","",$active); @@ -3035,12 +3042,13 @@ else # 120207-1955 - Added List territory reset function # 120213-1512 - Added remote agent max stats display and campaign VLC hopper dup check option # 120221-0054 - Fixed Call Time and User Group restrictions on several pages +# 120221-1647 - Added inventory report options to lists and shifts # # 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-360a'; -$build = '120221-0054'; +$admin_version = '2.4-361a'; +$build = '120221-1647'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -3097,7 +3105,7 @@ if ($force_logout) ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,auto_dial_limit,user_territories_active,allow_custom_dialplan,callcard_enabled,admin_modify_refresh,nocache_admin FROM system_settings;"; +$stmt = "SELECT use_non_latin,auto_dial_limit,user_territories_active,allow_custom_dialplan,callcard_enabled,admin_modify_refresh,nocache_admin,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -3111,6 +3119,7 @@ if ($qm_conf_ct > 0) $SScallcard_enabled = $row[4]; $SSadmin_modify_refresh = $row[5]; $SSnocache_admin = $row[6]; + $SSwebroot_writable = $row[7]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -3135,7 +3144,7 @@ if ( ($reports_auth > 0) and ($auth < 1) ) $reports_only_user=1; } -if ($WeBRooTWritablE > 0) +if ($SSwebroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); @@ -3266,7 +3275,7 @@ if ( ($auth > 0) or ($reports_auth > 0) ) $o++; } - if ($WeBRooTWritablE > 0) + if ($SSwebroot_writable > 0) { fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfull_name|\n"); fclose($fp); @@ -3297,9 +3306,9 @@ if ( ($auth > 0) or ($reports_auth > 0) ) } else { - if ($WeBRooTWritablE > 0) + if ($SSwebroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } @@ -5709,6 +5718,11 @@ if ($ADD==99999)
Xfer-Conf Number Override - These five fields allow for you to override the Transfer Conference number presets when the lead is from this list. Default is blank. +
+ +
+ Inventory Report - If the Inventory Report is enabled on your system, this option will determine whether this list is included in the report or not. Default is Y for yes. +

@@ -6980,6 +6994,10 @@ if ($ADD==99999)
Report Option - This option allows this specific shift to show up in selected reports that support this option. +
+
+ Report Rank - This option allows you to rank shifts in selected reports that support this option. + @@ -15583,7 +15601,7 @@ if ($ADD==411) echo "
LIST MODIFIED: $list_id\n"; - $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate',reset_time='$reset_time',agent_script_override='$agent_script_override',campaign_cid_override='$campaign_cid_override',am_message_exten_override='$am_message_exten_override',drop_inbound_group_override='$drop_inbound_group_override',xferconf_a_number='$xferconf_a_number',xferconf_b_number='$xferconf_b_number',xferconf_c_number='$xferconf_c_number',xferconf_d_number='$xferconf_d_number',xferconf_e_number='$xferconf_e_number',web_form_address='" . mysql_real_escape_string($web_form_address) . "',web_form_address_two='" . mysql_real_escape_string($web_form_address_two) . "',time_zone_setting='$time_zone_setting' where list_id='$list_id';"; + $stmt="UPDATE vicidial_lists set list_name='$list_name',campaign_id='$campaign_id',active='$active',list_description='$list_description',list_changedate='$SQLdate',reset_time='$reset_time',agent_script_override='$agent_script_override',campaign_cid_override='$campaign_cid_override',am_message_exten_override='$am_message_exten_override',drop_inbound_group_override='$drop_inbound_group_override',xferconf_a_number='$xferconf_a_number',xferconf_b_number='$xferconf_b_number',xferconf_c_number='$xferconf_c_number',xferconf_d_number='$xferconf_d_number',xferconf_e_number='$xferconf_e_number',web_form_address='" . mysql_real_escape_string($web_form_address) . "',web_form_address_two='" . mysql_real_escape_string($web_form_address_two) . "',time_zone_setting='$time_zone_setting',inventory_report='$inventory_report' where list_id='$list_id';"; $rslt=mysql_query($stmt, $link); ### LOG INSERTION Admin Log Table ### @@ -16543,7 +16561,7 @@ if ($ADD==431111111) $p++; } $shift_start_time = preg_replace('/\D/', '', $shift_start_time); - $stmt="UPDATE vicidial_shifts set shift_name='$shift_name', shift_start_time='$shift_start_time', shift_length='$shift_length', shift_weekdays='$SHIFT_weekdays',report_option='$report_option',user_group='$user_group' where shift_id='$shift_id';"; + $stmt="UPDATE vicidial_shifts set shift_name='$shift_name', shift_start_time='$shift_start_time', shift_length='$shift_length', shift_weekdays='$SHIFT_weekdays',report_option='$report_option',user_group='$user_group',report_rank='$report_rank' where shift_id='$shift_id';"; $rslt=mysql_query($stmt, $link); echo "
SHIFT MODIFIED\n"; @@ -24074,7 +24092,7 @@ if ($ADD==311) echo "
\n"; + echo "\n"; + echo "\n"; @@ -27946,7 +27967,7 @@ if ($ADD==331111111) echo "
\n"; echo ""; - $stmt="SELECT list_id,list_name,campaign_id,active,list_description,list_changedate,list_lastcalldate,reset_time,agent_script_override,campaign_cid_override,am_message_exten_override,drop_inbound_group_override,xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two,time_zone_setting from vicidial_lists where list_id='$list_id' $LOGallowed_campaignsSQL;"; + $stmt="SELECT list_id,list_name,campaign_id,active,list_description,list_changedate,list_lastcalldate,reset_time,agent_script_override,campaign_cid_override,am_message_exten_override,drop_inbound_group_override,xferconf_a_number,xferconf_b_number,xferconf_c_number,xferconf_d_number,xferconf_e_number,web_form_address,web_form_address_two,time_zone_setting,inventory_report from vicidial_lists where list_id='$list_id' $LOGallowed_campaignsSQL;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $list_name = $row[1]; @@ -24096,6 +24114,7 @@ if ($ADD==311) $web_form_address = $row[17]; $web_form_address_two = $row[18]; $time_zone_setting = $row[19]; + $inventory_report = $row[20]; # grab names of global statuses and statuses in the selected campaign $stmt="SELECT status,status_name,selectable,human_answered,category,sale,dnc,customer_contact,not_interested,unworkable,scheduled_callback,completed from vicidial_statuses order by status;"; @@ -24221,6 +24240,8 @@ if ($ADD==311) echo "
Transfer-Conf Number 5 Override: $NWB#vicidial_lists-xferconf_a_dtmf$NWE
Inventory Report: $NWB#vicidial_lists-inventory_report$NWE
Time Zone Setting: $NWB#vicidial_lists-time_zone_setting$NWE
\n"; echo "\n"; + + echo "\n"; + echo "\n"; echo "
\n"; echo ""; - $stmt="SELECT shift_id,shift_name,shift_start_time,shift_length,shift_weekdays,report_option,user_group from vicidial_shifts where shift_id='$shift_id' $LOGadmin_viewable_groupsSQL;"; + $stmt="SELECT shift_id,shift_name,shift_start_time,shift_length,shift_weekdays,report_option,user_group,report_rank from vicidial_shifts where shift_id='$shift_id' $LOGadmin_viewable_groupsSQL;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $shift_name = $row[1]; @@ -27955,6 +27976,7 @@ if ($ADD==331111111) $shift_weekdays = $row[4]; $report_option = $row[5]; $user_group = $row[6]; + $report_rank = $row[7]; $shift_start_hour = substr($shift_start_time,0,2); $shift_start_min = substr($shift_start_time,2,2); @@ -28016,6 +28038,16 @@ if ($ADD==331111111) echo ">Saturday
\n"; echo "
Report Option: $NWB#vicidial_shifts-report_option$NWE
Report Rank: $NWB#vicidial_shifts-report_rank$NWE
\n"; diff --git a/agc_2-X/trunk/www/vicidial/admin_campaign_multi_alt.php b/agc_2-X/trunk/www/vicidial/admin_campaign_multi_alt.php index 1c928a46..f4cdb70a 100644 --- a/agc_2-X/trunk/www/vicidial/admin_campaign_multi_alt.php +++ b/agc_2-X/trunk/www/vicidial/admin_campaign_multi_alt.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # this screen will control the campaign settings needed for alternate number # dialing using multiple leads with the same account number and different phone @@ -12,10 +12,11 @@ # changes: # 110317-1219 - First Build # 110406-1818 - Updated logging +# 120223-2335 - Removed logging of good login passwords if webroot writable is enabled # -$admin_version = '2.4-2'; -$build = '110406-1818'; +$admin_version = '2.4-3'; +$build = '120223-2335'; require("dbconnect.php"); @@ -43,6 +44,21 @@ if (strlen($DB) < 1) {$DB=0;} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$ss_conf_ct = mysql_num_rows($rslt); +if ($ss_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + } +##### END SETTINGS LOOKUP ##### +########################################### + if ($non_latin < 1) { $PHP_AUTH_USER = ereg_replace("[^-_0-9a-zA-Z]","",$PHP_AUTH_USER); @@ -61,20 +77,6 @@ $STARTtime = date("U"); $TODAY = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); -############################################# -##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; -$rslt=mysql_query($stmt, $link); -if ($DB) {echo "$stmt\n";} -$ss_conf_ct = mysql_num_rows($rslt); -if ($ss_conf_ct > 0) - { - $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; - } -##### END SETTINGS LOOKUP ##### -########################################### - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_campaigns='1';"; if ($DB) {echo "|$stmt|\n";} @@ -88,7 +90,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $camp_multi=$row[0]; -if ($WeBRooTWritablE > 0) +if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); @@ -116,17 +118,17 @@ else $LOGmodify_campaigns = $row[1]; $LOGuser_level = $row[2]; - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/admin_listloader_third_gen.php b/agc_2-X/trunk/www/vicidial/admin_listloader_third_gen.php index 3edc9d99..8ad792d9 100644 --- a/agc_2-X/trunk/www/vicidial/admin_listloader_third_gen.php +++ b/agc_2-X/trunk/www/vicidial/admin_listloader_third_gen.php @@ -43,10 +43,11 @@ # 110424-0926 - Added option for time zone code in the owner field # 110705-1947 - Added USACAN check for prefix and areacode # 120221-0140 - Added User Group restrictions +# 120223-2318 - Removed logging of good login passwords if webroot writable is enabled # -$version = '2.4-42'; -$build = '120221-0140'; +$version = '2.4-43'; +$build = '120223-2318'; require("dbconnect.php"); @@ -154,7 +155,7 @@ $vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_ ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,admin_web_directory,custom_fields_enabled FROM system_settings;"; +$stmt = "SELECT use_non_latin,admin_web_directory,custom_fields_enabled,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -164,6 +165,7 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $admin_web_directory = $row[1]; $custom_fields_enabled = $row[2]; + $webroot_writable = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -192,7 +194,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; -if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); @@ -225,17 +227,17 @@ else echo "You do not have permissions to load leads\n"; exit; } - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } exit; @@ -538,7 +540,7 @@ if ($OK_to_process) $total=0; $good=0; $bad=0; $dup=0; $post=0; $phone_list=''; $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { $stmt_file=fopen("listloader_stmts.txt", "w"); } @@ -903,7 +905,7 @@ if ($OK_to_process) $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); if ($DB > 0) {echo "";} - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; @@ -919,7 +921,7 @@ if ($OK_to_process) ### insert good record into vicidial_list table ### $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; $multi_insert_counter=0; @@ -967,7 +969,7 @@ if ($OK_to_process) { $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} } @@ -1030,7 +1032,7 @@ if (($leadfile) && ($LF_path)) $lead_file = "/tmp/vicidial_temp_file.txt"; } $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");} $buffer=fgets($file, 4096); @@ -1318,7 +1320,7 @@ if (($leadfile) && ($LF_path)) ### insert good deal into pending_transactions table ### $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; $multi_insert_counter=0; @@ -1365,7 +1367,7 @@ if (($leadfile) && ($LF_path)) { $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} } ### LOG INSERTION Admin Log Table ### @@ -1474,7 +1476,7 @@ if (($leadfile) && ($LF_path)) $lead_file = "/tmp/vicidial_temp_file.txt"; } $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");} $buffer=fgets($file, 4096); diff --git a/agc_2-X/trunk/www/vicidial/admin_lists_custom.php b/agc_2-X/trunk/www/vicidial/admin_lists_custom.php index 40988064..fef28e1f 100644 --- a/agc_2-X/trunk/www/vicidial/admin_lists_custom.php +++ b/agc_2-X/trunk/www/vicidial/admin_lists_custom.php @@ -21,10 +21,11 @@ # 110730-1106 - Added mysql reserved words check for add-field action # 111025-1432 - Fixed case sensitivity on list fields # 120122-1349 - Force vicidial_list custom field labels to be all lower case +# 120223-2315 - Removed logging of good login passwords if webroot writable is enabled # -$admin_version = '2.4-15'; -$build = '120122-1349'; +$admin_version = '2.4-16'; +$build = '120223-2315'; require("dbconnect.php"); @@ -79,6 +80,26 @@ if (isset($_GET["ConFiRm"])) {$ConFiRm=$_GET["ConFiRm"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active,custom_fields_enabled FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $SScustom_fields_enabled = $row[4]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + if ( (strlen($action) < 2) and ($list_id > 99) ) {$action = 'MODIFY_CUSTOM_FIELDS';} @@ -137,21 +158,6 @@ $vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_ $mysql_reserved_words = '|accessible|action|add|all|alter|analyze|and|as|asc|asensitive|before|between|bigint|binary|bit|blob|both|by|call|cascade|case|change|char|character|check|collate|column|condition|constraint|continue|convert|create|cross|current_date|current_time|current_timestamp|current_user|cursor|database|databases|date|day_hour|day_microsecond|day_minute|day_second|dec|decimal|declare|default|delayed|delete|desc|describe|deterministic|distinct|distinctrow|div|double|drop|dual|each|else|elseif|enclosed|enum|escaped|exists|exit|explain|false|fetch|float|float4|float8|for|force|foreign|from|fulltext|grant|group|having|high_priority|hour_microsecond|hour_minute|hour_second|if|ignore|in|index|infile|inner|inout|insensitive|insert|int|int1|int2|int3|int4|int8|integer|interval|into|is|iterate|join|key|keys|kill|leading|leave|left|like|limit|linear|lines|load|localtime|localtimestamp|lock|long|longblob|longtext|loop|low_priority|master_ssl_verify_server_cert|match|mediumblob|mediumint|mediumtext|middleint|minute_microsecond|minute_second|mod|modifies|mysql|natural|no|no_write_to_binlog|not|null|numeric|on|optimize|option|optionally|or|order|out|outer|outfile|precision|primary|procedure|purge|range|read|read_only|read_write|reads|real|references|regexp|release|remove|rename|repeat|replace|require|restrict|return|revoke|right|rlike|schema|schemas|second_microsecond|select|sensitive|separator|set|show|smallint|spatial|specific|sql|sql_big_result|sql_calc_found_rows|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|starting|straight_join|table|terminated|text|then|time|timestamp|tinyblob|tinyint|tinytext|to|trailing|trigger|true|undo|union|unique|unlock|unsigned|update|usage|use|using|utc_date|utc_time|utc_timestamp|values|varbinary|varchar|varcharacter|varying|when|where|while|with|write|xor|year_month|zerofill|'; -############################################# -##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;"; -$rslt=mysql_query($stmt, $link); -if ($DB) {echo "$stmt\n";} -$ss_conf_ct = mysql_num_rows($rslt); -if ($ss_conf_ct > 0) - { - $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; - $SScustom_fields_enabled = $row[1]; - } -##### END SETTINGS LOOKUP ##### -########################################### - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and modify_leads='1';"; if ($DB) {echo "|$stmt|\n";} @@ -159,7 +165,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; -if ($WeBRooTWritablE > 0) +if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); @@ -188,17 +194,17 @@ else $LOGcustom_fields_modify = $row[2]; $LOGuser_level = $row[3]; - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php index 147dda88..0089068f 100644 --- a/agc_2-X/trunk/www/vicidial/admin_modify_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_modify_lead.php @@ -8,7 +8,7 @@ # just needs to enter the leadID and then they can view and modify the # information in the record for that lead # -# Copyright (C) 2011 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -45,6 +45,7 @@ # 110215-1717 - Changed empty lead_id behavior to be add-a-lead functionality # 110525-1827 - Added ivr log records display # 111103-1533 - Added admin_hide_phone_data and admin_hide_lead_data options +# 120223-2249 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -164,7 +165,7 @@ $NOW_TIME = date("Y-m-d H:i:s"); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,custom_fields_enabled FROM system_settings;"; +$stmt = "SELECT use_non_latin,custom_fields_enabled,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -173,6 +174,7 @@ if ($qm_conf_ct > 0) $row=mysql_fetch_row($rslt); $non_latin = $row[0]; $custom_fields_enabled = $row[1]; + $webroot_writable = $row[2]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -201,7 +203,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; -if ($WeBRooTWritablE > 0) +if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); @@ -227,17 +229,17 @@ else $LOGadmin_hide_lead_data = $row[2]; $LOGadmin_hide_phone_data = $row[3]; - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/admin_phones_bulk_insert.php b/agc_2-X/trunk/www/vicidial/admin_phones_bulk_insert.php index 343c084a..cb77407c 100644 --- a/agc_2-X/trunk/www/vicidial/admin_phones_bulk_insert.php +++ b/agc_2-X/trunk/www/vicidial/admin_phones_bulk_insert.php @@ -10,10 +10,11 @@ # 110712-0932 - Added extension suffix exception for non-SIP/IAX phones, added HELP # 120104-2023 - Added webphone options # 120209-1545 - Added phone context option +# 120223-2249 - Removed logging of good login passwords if webroot writable is enabled # -$admin_version = '2.4-4'; -$build = '120209-1545'; +$admin_version = '2.4-5'; +$build = '120223-2249'; require("dbconnect.php"); @@ -93,14 +94,15 @@ $NOW_TIME = date("Y-m-d H:i:s"); ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin FROM system_settings;"; +$stmt = "SELECT use_non_latin,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $ss_conf_ct = mysql_num_rows($rslt); if ($ss_conf_ct > 0) { $row=mysql_fetch_row($rslt); - $non_latin = $row[0]; + $non_latin = $row[0]; + $webroot_writable = $row[1]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -112,7 +114,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; -if ($WeBRooTWritablE > 0) +if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); @@ -141,17 +143,17 @@ else $LOGast_admin_access = $row[2]; $LOGuser_level = $row[3]; - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/admin_search_lead.php b/agc_2-X/trunk/www/vicidial/admin_search_lead.php index 3e1d31ac..62c72837 100644 --- a/agc_2-X/trunk/www/vicidial/admin_search_lead.php +++ b/agc_2-X/trunk/www/vicidial/admin_search_lead.php @@ -27,6 +27,7 @@ # 110218-1237 - Added vicidial_lead_search_log logging # 111103-1239 - Added admin_hide_phone_data and admin_hide_lead_data options # 120221-0118 - Added User Group campaign list restrictions to search queries +# 120223-2249 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -63,6 +64,26 @@ if (isset($_GET["list_id"])) {$list_id=$_GET["list_id"];} if (isset($_GET["alt_phone_search"])) {$alt_phone_search=$_GET["alt_phone_search"];} elseif (isset($_POST["alt_phone_search"])) {$alt_phone_search=$_POST["alt_phone_search"];} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); $phone = ereg_replace("[^0-9]","",$phone); @@ -80,7 +101,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; -if ($WeBRooTWritablE > 0) +if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); @@ -109,17 +130,17 @@ else $LOGadmin_hide_phone_data = $row[3]; $LOGuser_group = $row[4]; - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } exit; diff --git a/agc_2-X/trunk/www/vicidial/closer-fronter_popup.php b/agc_2-X/trunk/www/vicidial/closer-fronter_popup.php index 891e92f4..2b0383a5 100644 --- a/agc_2-X/trunk/www/vicidial/closer-fronter_popup.php +++ b/agc_2-X/trunk/www/vicidial/closer-fronter_popup.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # this is the closer popup of a specific call that starts recording the call and allows you to go and fetch info on that caller in the local CRM system. # CHANGES @@ -9,6 +9,7 @@ # 60620-1020 - Added variable filtering to eliminate SQL injection attack threat # 61201-1114 - Added lead_id and user to recording_log entry # 90508-0644 - Changed to PHP long tags +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -136,13 +137,13 @@ $browser = getenv("HTTP_USER_AGENT"); { $office_no=strtoupper($user); $password=strtoupper($pass); - $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; - $fullname = $row[0]; - fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); if ( (strlen($customer_zap_channel)>2) and (eregi('zap',$customer_zap_channel)) ) @@ -161,7 +162,7 @@ $browser = getenv("HTTP_USER_AGENT"); } else { - fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/closer-fronter_popup2.php b/agc_2-X/trunk/www/vicidial/closer-fronter_popup2.php index dac9df76..a54521ee 100644 --- a/agc_2-X/trunk/www/vicidial/closer-fronter_popup2.php +++ b/agc_2-X/trunk/www/vicidial/closer-fronter_popup2.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # this is the closer popup of a specific call that starts recording the call and allows you to go and fetch info on that caller in the local CRM system. # CHANGES @@ -9,6 +9,7 @@ # 60620-1025 - Added variable filtering to eliminate SQL injection attack threat # 61201-1114 - Added lead_id and user to recording_log entry # 90508-0644 - Changed to PHP long tags +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -148,13 +149,13 @@ $browser = getenv("HTTP_USER_AGENT"); { $office_no=strtoupper($user); $password=strtoupper($pass); - $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; - $fullname = $row[0]; - fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|$pass|$ip|$browser|$LOGfullname|\n"); + $stmt="SELECT full_name from vicidial_users where user='$user' and pass='$pass'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + fwrite ($fp, "VD_CLOSER|GOOD|$date|$user|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); if ( (strlen($customer_zap_channel)>2) and ( (eregi('zap',$customer_zap_channel)) or (eregi('iax',$customer_zap_channel)) ) ) @@ -175,7 +176,7 @@ $browser = getenv("HTTP_USER_AGENT"); } else { - fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|$pass|$ip|$browser|\n"); + fwrite ($fp, "VD_CLOSER|FAIL|$date|$user|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/closer.php b/agc_2-X/trunk/www/vicidial/closer.php index 3069c281..eda8d510 100644 --- a/agc_2-X/trunk/www/vicidial/closer.php +++ b/agc_2-X/trunk/www/vicidial/closer.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # the purpose of this script and webpage is to allow for remote or local users of the system to log in and grab phone calls that are coming inbound into the Asterisk server and being put in the parked_channels table while they hear a soundfile for a limited amount of time before being forwarded on to either a set extension or a voicemail box. This gives remote or local agents a way to grab calls without tying up their phone lines all day. The agent sees the refreshing screen of calls on park and when they want to take one they just click on it, and a small window opens that will allow them to grab the call and/or look up more information on the caller through the callerID that is given(if available) # CHANGES @@ -9,6 +9,7 @@ # 60620-1032 - Added variable filtering to eliminate SQL injection attack threat # - Added required user/pass to gain access to this page # 90508-0644 - Changed to PHP long tags +# 120223-2249 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -49,6 +50,26 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -57,44 +78,48 @@ $TODAY = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); $popup_page = './closer_popup.php'; - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $auth=$row[0]; +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; $fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); Header("HTTP/1.0 401 Unauthorized"); echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } - else +else { - if($auth>0) { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); - $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; - $fullname = $row[0]; - fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); - fclose($fp); - + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + if ($webroot_writable > 0) + { + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } } else { - fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); + fclose($fp); + } } } diff --git a/agc_2-X/trunk/www/vicidial/closer_dispo.php b/agc_2-X/trunk/www/vicidial/closer_dispo.php index 486351a4..a0367c40 100644 --- a/agc_2-X/trunk/www/vicidial/closer_dispo.php +++ b/agc_2-X/trunk/www/vicidial/closer_dispo.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # this is the closer disposition screen of a call that has been grabbed. This # allows the closer to modify customer information and disposition the call @@ -10,6 +10,7 @@ # # 60619-1641 - Added variable filtering to eliminate SQL injection attack threat # 90508-0644 - Changed to PHP long tags +# 120223-2249 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -84,6 +85,25 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -98,45 +118,49 @@ $ext_context = 'demo'; if (!isset($begin_date)) {$begin_date = $TODAY;} if (!isset($end_date)) {$end_date = $TODAY;} - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $auth=$row[0]; +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; $fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); Header("HTTP/1.0 401 Unauthorized"); echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } - else +else { - if($auth>0) { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); - $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; - $fullname = $row[0]; - fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); - fclose($fp); - + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + if ($webroot_writable > 0) + { + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } } else { - fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); + fclose($fp); + } } } diff --git a/agc_2-X/trunk/www/vicidial/closer_popup.php b/agc_2-X/trunk/www/vicidial/closer_popup.php index 57c6c6ee..19f022cf 100644 --- a/agc_2-X/trunk/www/vicidial/closer_popup.php +++ b/agc_2-X/trunk/www/vicidial/closer_popup.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # this is the closer popup of a specific call that grabs the call and allows you # to go and fetch info on that caller in the local CRM system. @@ -10,6 +10,7 @@ # # 60620-1029 - Added variable filtering to eliminate SQL injection attack threat # 90508-0644 - Changed to PHP long tags +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -50,6 +51,27 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -64,45 +86,49 @@ $FILE_datetime = $STARTtime; $ext_context = 'demo'; - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $auth=$row[0]; +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; + if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; $fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); Header("HTTP/1.0 401 Unauthorized"); echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } - else +else { - if($auth>0) { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); - $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; - $fullname = $row[0]; - fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); - fclose($fp); - + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + if ($webroot_writable > 0) + { + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } } else { - fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); + fclose($fp); + } } } @@ -213,9 +239,9 @@ if ($parked_count > 0) $stmt="UPDATE park_log set grab_time='$NOW_TIME',status='TALKING',extension='" . mysql_real_escape_string($extension) . "',user='$PHP_AUTH_USER' where parked_time='" . mysql_real_escape_string($parked_time) . "' and server_ip='" . mysql_real_escape_string($server_ip) . "' and channel='" . mysql_real_escape_string($channel) . "'"; if ($DB) {echo "|$stmt|\n";} - $fp = fopen ("./closer_SQL_updates.txt", "a"); - fwrite ($fp, "$date|$PHP_AUTH_USER|$stmt|\n"); - fclose($fp); + # $fp = fopen ("./closer_SQL_updates.txt", "a"); + # fwrite ($fp, "$date|$PHP_AUTH_USER|$stmt|\n"); + # fclose($fp); $rslt=mysql_query($stmt, $link); diff --git a/agc_2-X/trunk/www/vicidial/dbconnect.php b/agc_2-X/trunk/www/vicidial/dbconnect.php index d7b4aba9..cf109aba 100644 --- a/agc_2-X/trunk/www/vicidial/dbconnect.php +++ b/agc_2-X/trunk/www/vicidial/dbconnect.php @@ -65,7 +65,7 @@ $conf_silent_prefix = '7'; $local_AMP = '@'; $ext_context = 'default'; $recording_exten = '8309'; -$WeBRooTWritablE = '1'; +$webroot_writable = '0'; $non_latin = '0'; # set to 1 for UTF rules $AM_shift_BEGIN = '03:45:00'; $AM_shift_END = '17:45:00'; diff --git a/agc_2-X/trunk/www/vicidial/fcstats.php b/agc_2-X/trunk/www/vicidial/fcstats.php index fe1de355..4eabadb5 100644 --- a/agc_2-X/trunk/www/vicidial/fcstats.php +++ b/agc_2-X/trunk/www/vicidial/fcstats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -19,6 +19,7 @@ # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 110703-1828 - Added download option # 111104-1213 - Added user_group restrictions for selecting in-groups +# 120224-0910 - Added HTML display option with bar graphs # require("dbconnect.php"); @@ -40,6 +41,8 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +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"];} $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -49,6 +52,8 @@ if (strlen($shift)<2) {$shift='ALL';} $report_name = 'Fronter - Closer Report'; $db_source = 'M'; +$JS_text="\n"; $HTML_head.="\n"; +$HTML_head.="\n"; #if (strlen($group) > 0) # { @@ -218,6 +224,10 @@ $HTML_text.="\n"; +$HTML_text.="   "; +$HTML_text.="\n"; $HTML_text.="\n"; $HTML_text.="\n"; $HTML_text.="\n"; -$HTML_text.="           DOWNLOAD | MODIFY | REPORTS \n"; +$HTML_text.="           DOWNLOAD | MODIFY | REPORTS
Display as:
ASCII
HTML
\n"; $HTML_text.="\n\n"; $HTML_text.="
\n\n";
@@ -321,17 +331,37 @@ $CSV_fronter_header.="\"AGENT\",\"SUCCESS\",\"XFERS\",\"SUCCESS%\",\"SALE\",\"DR
 $CSV_fronter_lines="";
 $CSV_fronter_footer="";
 
-$HTML_text.="\n";
-$HTML_text.="---------- FRONTER STATS\n";
-$HTML_text.="+--------------------------+-------+--------+--------+------+------+------+\n";
-$HTML_text.="| AGENT                    |SUCCESS| XFERS  |SUCCESS%| SALE | DROP |OTHER |\n";
-$HTML_text.="+--------------------------+-------+--------+--------+------+------+------+\n";
+$ASCII_text="\n";
+$ASCII_text.="---------- FRONTER STATS\n";
+$ASCII_text.="+--------------------------+-------+--------+--------+------+------+------+\n";
+$ASCII_text.="| AGENT                    |SUCCESS| XFERS  |SUCCESS%| SALE | DROP |OTHER |\n";
+$ASCII_text.="+--------------------------+-------+--------+--------+------+------+------+\n";
+
+######## GRAPHING #########
+$graph_stats=array();
+$max_success=1;
+$max_xfers=1;
+$max_success_pct=1;
+$max_sales=1;
+$max_drops=1;
+$max_other=1;
+$GRAPH="";
+$GRAPH.="";
+$GRAPH.="
SUCCESSXFERSSUCCESS %SALEDROPOTHER

 


"; +$graph_header=""; +$SUCCESS_graph=$graph_header.""; +$XFERS_graph=$graph_header.""; +$SUCCESSPCT_graph=$graph_header.""; +$SALE_graph=$graph_header.""; +$DROP_graph=$graph_header.""; +$OTHER_graph=$graph_header.""; +########################### #$stmt="select vicidial_xfer_log.user,full_name,count(*) from vicidial_xfer_log,vicidial_users where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and vicidial_xfer_log.user is not null and vicidial_xfer_log.user=vicidial_users.user group by vicidial_xfer_log.user;"; $stmt="select user,count(distinct lead_id) from vicidial_xfer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and user is not null group by user;"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); -if ($DB) {$HTML_text.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $users_to_print = mysql_num_rows($rslt); $i=0; while ($i < $users_to_print) @@ -354,7 +384,7 @@ while ($i < $users_to_print) $stmt="select full_name from vicidial_users where user='$userRAW[$i]' $LOGadmin_viewable_groupsSQL;"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); - if ($DB) {$HTML_text.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $names_to_print = mysql_num_rows($rslt); if ($names_to_print > 0) { @@ -375,7 +405,7 @@ while ($i < $users_to_print) $stmt="select vc.status,count(distinct vc.lead_id) from vicidial_xfer_log vx, vicidial_closer_log vc where vx.call_date >= '$query_date_BEGIN' and vx.call_date <= '$query_date_END' and vc.call_date >= '$query_date_BEGIN' and vc.call_date <= '$query_date_END' and vc.campaign_id='" . mysql_real_escape_string($group) . "' and vx.campaign_id='" . mysql_real_escape_string($group) . "' and vx.user='$userRAW[$i]' and vc.lead_id=vx.lead_id and vc.xfercallid=vx.xfercallid group by vc.status;"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); - if ($DB) {$HTML_text.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $lead_ids_to_print = mysql_num_rows($rslt); $j=0; while ($j < $lead_ids_to_print) @@ -414,6 +444,19 @@ while ($i < $users_to_print) $Spct = round($Spct, 2); $Spct = sprintf("%01.2f", $Spct); + if ($sales>$max_success) {$max_success=$sales;} + if ($USERcalls[$i]>$max_xfers) {$max_xfers=$USERcalls[$i];} + if ($Spct>$max_success_pct) {$max_success_pct=$Spct;} + if ($A1>$max_sales) {$max_sales=$A1;} + if ($DROP>$max_drops) {$max_drops=$DROP;} + if ($OTHER>$max_other) {$max_other=$OTHER;} + $graph_stats[$i][0]="$user[$i] - $full_name[$i]"; + $graph_stats[$i][1]=$sales; + $graph_stats[$i][2]=$USERcalls[$i]; + $graph_stats[$i][3]=$Spct; + $graph_stats[$i][4]=$A1; + $graph_stats[$i][5]=$DROP; + $graph_stats[$i][6]=$OTHER; $A1 = sprintf("%4s", $A1); $A2 = sprintf("%4s", $A2); @@ -429,7 +472,7 @@ while ($i < $users_to_print) $sales = sprintf("%5s", $sales); $Spct = sprintf("%6s", $Spct); - $HTML_text.="| $user[$i] - $full_name[$i] | $sales | $USERcalls[$i] | $Spct%| $A1 | $DROP | $OTHER |\n"; + $ASCII_text.="| $user[$i] - $full_name[$i] | $sales | $USERcalls[$i] | $Spct%| $A1 | $DROP | $OTHER |\n"; $CSV_fronter_lines.="\"$user[$i] - $full_name[$i]\",\"$sales\",\"$USERcalls[$i]\",\"$Spct%\",\"$A1\",\"$DROP\",\"$OTHER\"\n"; $i++; @@ -460,7 +503,7 @@ $totOTHER = sprintf("%5s", $totOTHER); $stmt="select avg(queue_seconds) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "';"; $rslt=mysql_query($stmt, $link); -if ($DB) {$HTML_text.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $row=mysql_fetch_row($rslt); $AVGwait = $row[0]; @@ -475,16 +518,49 @@ $AVGwait_MS = "$AVGwait_M_int:$AVGwait_S"; $AVGwait = sprintf("%6s", $AVGwait_MS); -$HTML_text.="+--------------------------+-------+--------+--------+------+------+------+\n"; -$HTML_text.="| TOTAL FRONTERS: $TOTagents | $TOTsales | $TOTcalls | $totSpct%|$totA1 |$totDROP |$totOTHER |\n"; -$HTML_text.="+--------------------------+-------+--------+--------+------+------+------+\n"; -$HTML_text.="| Average time in Queue for customers: $AVGwait |\n"; -$HTML_text.="+--------------------------+-------+--------+--------+------+------+------+\n"; +$ASCII_text.="+--------------------------+-------+--------+--------+------+------+------+\n"; +$ASCII_text.="| TOTAL FRONTERS: $TOTagents | $TOTsales | $TOTcalls | $totSpct%|$totA1 |$totDROP |$totOTHER |\n"; +$ASCII_text.="+--------------------------+-------+--------+--------+------+------+------+\n"; +$ASCII_text.="| Average time in Queue for customers: $AVGwait |\n"; +$ASCII_text.="+--------------------------+-------+--------+--------+------+------+------+\n"; $CSV_fronter_footer.="\"TOTAL FRONTERS: $TOTagents\",\"$TOTsales\",\"$TOTcalls\",\"$totSpct%\",\"$totA1\",\"$totDROP\",\"$totOTHER\"\n"; $CSV_fronter_footer.="\"Average time in Queue for customers: $AVGwait\"\n\n\n"; - + for ($d=0; $d"; + $XFERS_graph.=" "; + $SUCCESSPCT_graph.=" "; + $SALE_graph.=" "; + $DROP_graph.=" "; + $OTHER_graph.=" "; + } + $SUCCESS_graph.="
FRONTER STATS
AGENTSUCCESS
XFERS
SUCCESS %
SALE
DROP
OTHER
".$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]."".$graph_stats[$d][5]."
".$graph_stats[$d][0]."".$graph_stats[$d][5]."
TOTAL:".trim($TOTsales)."
"; + $XFERS_graph.="
TOTAL:".trim($TOTcalls)."
"; + $SUCCESSPCT_graph.="TOTAL:".trim($totSpct)."%"; + $SALE_graph.="TOTAL:".trim($totA1).""; + $DROP_graph.="TOTAL:".trim($totDROP).""; + $OTHER_graph.="TOTAL:".trim($totOTHER).""; + $JS_onload.="\tDrawFronterGraph('SUCCESS', '1');\n"; + $JS_text.="function DrawFronterGraph(graph, th_id) {\n"; + $JS_text.=" var SUCCESS_graph=\"$SUCCESS_graph\";\n"; + $JS_text.=" var XFERS_graph=\"$XFERS_graph\";\n"; + $JS_text.=" var SUCCESSPCT_graph=\"$SUCCESSPCT_graph\";\n"; + $JS_text.=" var SALE_graph=\"$SALE_graph\";\n"; + $JS_text.=" var DROP_graph=\"$DROP_graph\";\n"; + $JS_text.=" var OTHER_graph=\"$OTHER_graph\";\n"; + $JS_text.="\n"; + $JS_text.=" for (var i=1; i<=6; i++) {\n"; + $JS_text.=" var cellID=\"frontergraph\"+i;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#DDDDDD';\n"; + $JS_text.=" }\n"; + $JS_text.=" var cellID=\"frontergraph\"+th_id;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#999999';\n"; + $JS_text.=" var graph_to_display=eval(graph+\"_graph\");\n"; + $JS_text.=" document.getElementById('fronter_graph').innerHTML=graph_to_display;\n"; + $JS_text.="}\n"; + $GRAPH_text.=$GRAPH; ############################## ######### CLOSER STATS @@ -508,20 +584,38 @@ $CSV_closer_header=""; $CSV_closer_lines=""; $CSV_closer_footer=""; -$HTML_text.="\n"; -$HTML_text.="---------- CLOSER STATS\n"; -$HTML_text.="+--------------------------+--------+------+------+------+------+-------+\n"; -$HTML_text.="| AGENT | CALLS | SALE | DROP |OTHER | SALE | CONV %|\n"; -$HTML_text.="+--------------------------+--------+------+------+------+------+-------+\n"; +$ASCII_text.="\n"; +$ASCII_text.="---------- CLOSER STATS\n"; +$ASCII_text.="+--------------------------+--------+------+------+------+------+-------+\n"; +$ASCII_text.="| AGENT | CALLS | SALE | DROP |OTHER | SALE | CONV %|\n"; +$ASCII_text.="+--------------------------+--------+------+------+------+------+-------+\n"; $CSV_closer_header="\"CLOSER STATS\"\n"; $CSV_closer_header.="\"AGENT\",\"CALLS\",\"SALE\",\"DROP\",\"OTHER\",\"SALE\",\"CONV %\"\n"; +######## GRAPHING ######### +$max_calls=1; +$max_sales=1; +$max_drops=1; +$max_other=1; +$max_sales2=1; +$max_conv_pct=1; +$GRAPH="

"; +$GRAPH.=""; +$GRAPH.="
CALLSSALESDROPOTHERSALESCONV %

 


"; +$graph_header=""; +$CALLS_graph=$graph_header.""; +$SALES_graph=$graph_header.""; +$DROP_graph=$graph_header.""; +$OTHER_graph=$graph_header.""; +$SALES2_graph=$graph_header.""; +$CONVPCT_graph=$graph_header.""; +########################### $stmt="select user,count(*) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and user is not null group by user;"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); -if ($DB) {$HTML_text.="$stmt\n";} +if ($DB) {$ASCII_text.="$stmt\n";} $users_to_print = mysql_num_rows($rslt); $i=0; while ($i < $users_to_print) @@ -543,7 +637,7 @@ while ($i < $users_to_print) $stmt="select full_name from vicidial_users where user='$userRAW[$i]' $LOGadmin_viewable_groupsSQL;"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); - if ($DB) {$HTML_text.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $names_to_print = mysql_num_rows($rslt); if ($names_to_print > 0) { @@ -564,7 +658,7 @@ while ($i < $users_to_print) $stmt="select status,count(*) from vicidial_closer_log where call_date >= '$query_date_BEGIN' and call_date <= '$query_date_END' and campaign_id='" . mysql_real_escape_string($group) . "' and user='$userRAW[$i]' group by status;"; if ($non_latin > 0) {$rslt=mysql_query("SET NAMES 'UTF8'");} $rslt=mysql_query($stmt, $link); - if ($DB) {$HTML_text.="$stmt\n";} + if ($DB) {$ASCII_text.="$stmt\n";} $lead_ids_to_print = mysql_num_rows($rslt); $j=0; while ($j < $lead_ids_to_print) @@ -647,6 +741,19 @@ while ($i < $users_to_print) $ppc = sprintf("%01.2f", $ppc); $ppc = sprintf("%4s", $ppc); + if ($USERcalls[$i]>$max_calls) {$max_calls=$USERcalls[$i];} + if ($A1>$max_sales) {$max_sales=$A1;} + if ($DROP>$max_drops) {$max_drops=$DROP;} + if ($OTHER>$max_other) {$max_other=$OTHER;} + if ($sales>$max_sales2) {$max_sales=$sales;} + if ($Cpct>$max_conv_pct) {$max_conv_pct=$Cpct;} + $graph_stats[$i][0]="$user[$i] - $full_name[$i]"; + $graph_stats[$i][1]=$USERcalls[$i]; + $graph_stats[$i][2]=$A1; + $graph_stats[$i][3]=$DROP; + $graph_stats[$i][4]=$OTHER; + $graph_stats[$i][5]=$sales; + $graph_stats[$i][6]=$Cpct; $A1 = sprintf("%4s", $A1); $A2 = sprintf("%4s", $A2); @@ -661,7 +768,7 @@ while ($i < $users_to_print) $OTHER = sprintf("%4s", $OTHER); $sales = sprintf("%4s", $sales); - $HTML_text.="| $user[$i] - $full_name[$i] | $USERcalls[$i] | $A1 | $DROP | $OTHER | $sales |$Cpct%|\n"; + $ASCII_text.="| $user[$i] - $full_name[$i] | $USERcalls[$i] | $A1 | $DROP | $OTHER | $sales |$Cpct%|\n"; $CSV_closer_lines.="\"$user[$i] - $full_name[$i]\",\"$USERcalls[$i]\",\"$A1\",\"$DROP\",\"$OTHER\",\"$sales\",\"$Cpct%\"\n"; $i++; @@ -707,14 +814,59 @@ $totDROP = sprintf("%5s", $totDROP); $totOTHER = sprintf("%5s", $totOTHER); $TOTsales = sprintf("%5s", $TOTsales); -$HTML_text.="+--------------------------+--------+------+------+------+------+-------+\n"; -$HTML_text.="| TOTAL CLOSERS: $TOTagents | $TOTcalls |$totA1 |$totDROP |$totOTHER |$TOTsales |$totCpct%|\n"; -$HTML_text.="+--------------------------+--------+------+------+------+------+-------+\n"; +$ASCII_text.="+--------------------------+--------+------+------+------+------+-------+\n"; +$ASCII_text.="| TOTAL CLOSERS: $TOTagents | $TOTcalls |$totA1 |$totDROP |$totOTHER |$TOTsales |$totCpct%|\n"; +$ASCII_text.="+--------------------------+--------+------+------+------+------+-------+\n"; $CSV_closer_footer.="\"TOTAL CLOSERS: $TOTagents\",\"$TOTcalls\",\"$totA1\",\"$totDROP\",\"$totOTHER\",\"$TOTsales\",\"$totCpct%\"\n"; + for ($d=0; $d"; + $SALES_graph.=" "; + $DROP_graph.=" "; + $OTHER_graph.=" "; + $SALES2_graph.=" "; + $CONVPCT_graph.=" "; + } + $CALLS_graph.="
CLOSER STATS
AGENTCALLS
SALES
DROP
OTHER
SALES
CONV %
".$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]."".$graph_stats[$d][5]."
".$graph_stats[$d][0]."".$graph_stats[$d][6]."%
TOTAL:".trim($TOTcalls)."
"; + $SALES_graph.="TOTAL:".trim($totA1).""; + $DROP_graph.="TOTAL:".trim($totDROP).""; + $OTHER_graph.="TOTAL:".trim($totOTHER).""; + $SALES2_graph.="TOTAL:".trim($TOTsales).""; + $CONVPCT_graph.="TOTAL:".trim($totCpct)."%"; + $JS_onload.="\tDrawCloserGraph('CALLS', '1');\n"; + $JS_text.="function DrawCloserGraph(graph, th_id) {\n"; + $JS_text.=" var CALLS_graph=\"$CALLS_graph\";\n"; + $JS_text.=" var SALES_graph=\"$SALES_graph\";\n"; + $JS_text.=" var DROP_graph=\"$DROP_graph\";\n"; + $JS_text.=" var OTHER_graph=\"$OTHER_graph\";\n"; + $JS_text.=" var SALES2_graph=\"$SALES2_graph\";\n"; + $JS_text.=" var CONVPCT_graph=\"$CONVPCT_graph\";\n"; + $JS_text.="\n"; + $JS_text.=" for (var i=1; i<=6; i++) {\n"; + $JS_text.=" var cellID=\"closergraph\"+i;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#DDDDDD';\n"; + $JS_text.=" }\n"; + $JS_text.=" var cellID=\"closergraph\"+th_id;\n"; + $JS_text.=" document.getElementById(cellID).style.backgroundColor='#999999';\n"; + $JS_text.=" var graph_to_display=eval(graph+\"_graph\");\n"; + $JS_text.=" document.getElementById('closer_graph').innerHTML=graph_to_display;\n"; + $JS_text.="}\n"; + $GRAPH_text.=$GRAPH; + + $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); + +if ($report_display_type=="HTML") { + $HTML_text.=$GRAPH_text; + } +else + { + $HTML_text.=$ASCII_text; + } + if ($DB) {$HTML_text.="\nRun Time: $RUNtime seconds|$db_source\n";} $HTML_text.="
\n"; @@ -746,7 +898,12 @@ if ($file_download > 0) } else { + $JS_onload.="}\n"; + $JS_text.=$JS_onload; + $JS_text.="\n"; + echo $HTML_head; + echo $JS_text; require("admin_header.php"); echo $HTML_text; } diff --git a/agc_2-X/trunk/www/vicidial/group_hourly_stats.php b/agc_2-X/trunk/www/vicidial/group_hourly_stats.php index 50b64a2e..28d4b8ca 100644 --- a/agc_2-X/trunk/www/vicidial/group_hourly_stats.php +++ b/agc_2-X/trunk/www/vicidial/group_hourly_stats.php @@ -10,6 +10,7 @@ # 90310-2138 - Added admin header # 90508-0644 - Changed to PHP long tags # 120221-0159 - Added User Group restrictions +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -107,13 +108,19 @@ $browser = getenv("HTTP_USER_AGENT"); $LOGfullname = $row[0]; $LOGuser_group = $row[1]; - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } } else { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); + fclose($fp); + } exit; } diff --git a/agc_2-X/trunk/www/vicidial/horizontalbargraph.css b/agc_2-X/trunk/www/vicidial/horizontalbargraph.css new file mode 100644 index 00000000..ec51244b --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/horizontalbargraph.css @@ -0,0 +1,104 @@ +td.value { + background-image: url(images/gridline58.gif); + background-repeat: repeat-x; + background-position: left top; + border-left: 1px solid #e5e5e5; + border-right: 1px solid #e5e5e5; + padding:0; + border-bottom: none; + background-color:transparent; +} +td.graph { + padding: 4px 6px; + border-bottom:1px solid #e5e5e5; + border-left:1px solid #e5e5e5; + background-color:#fff; +} +td.value img { + vertical-align: middle; + margin: 2px 2px 2px 0; + height: 10px; +} +th.thgraph { + text-align: left; + vertical-align:top; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 60%; +} +.grey_graph_cell { + background-color:#ddd; +} +.graph_span_cell { + background-color:#eee; + text-align: center; +} + +th.column_header { + text-align: left; + vertical-align:top; + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 70%; +} +td.chart_td { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 60%; + white-space:nowrap; + padding-right: 10px; +} +td.last { + border-bottom:1px solid #e5e5e5; +} +td.first { + border-top:1px solid #e5e5e5; +} +.auraltext +{ + position: absolute; + font-size: 0; + left: -1000px; +} +table.horizontalgraph { + font-family: Verdana, Arial, Helvetica, sans-serif; + background-image:url(images/bg_fade2.png); + background-position:left top; + width: 33em; +} +caption { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size:90%; + font-style:italic; +} + +.overlap_barGraph { + font-family: Verdana, Arial, Helvetica, sans-serif; + text-align: left; + margin: 1em 0; + padding: 0; + position: relative; + } + +.overlap_barGraph li { + background: #666 url(images/bar_50_percent_highlight.png) repeat-y top right; + border: 1px solid #555; + border-bottom: none; + bottom: 0.01em; + color: #FFF; + margin: 0; + padding: 0 0 0 0; + position: absolute; + list-style: none; + text-align: right; + } + +.overlap_barGraph li.p1{ + background: #999 url(images/bar.png) repeat-x top right; + color: #FFF; + white-space:nowrap; + font-weight: bold; +} +.overlap_barGraph li.p2{ + background: #666 url(images/bar_blue.png) repeat-x top right; + color: #FFF; + white-space:nowrap; + font-weight: bold; +} diff --git a/agc_2-X/trunk/www/vicidial/images/bar_blue.png b/agc_2-X/trunk/www/vicidial/images/bar_blue.png new file mode 100644 index 00000000..b9fdc880 Binary files /dev/null and b/agc_2-X/trunk/www/vicidial/images/bar_blue.png differ diff --git a/agc_2-X/trunk/www/vicidial/images/bar_green.png b/agc_2-X/trunk/www/vicidial/images/bar_green.png new file mode 100644 index 00000000..5542d5ac Binary files /dev/null and b/agc_2-X/trunk/www/vicidial/images/bar_green.png differ diff --git a/agc_2-X/trunk/www/vicidial/images/bar_purple.png b/agc_2-X/trunk/www/vicidial/images/bar_purple.png new file mode 100644 index 00000000..8c221a21 Binary files /dev/null and b/agc_2-X/trunk/www/vicidial/images/bar_purple.png differ diff --git a/agc_2-X/trunk/www/vicidial/images/bg_fade2.png b/agc_2-X/trunk/www/vicidial/images/bg_fade2.png new file mode 100644 index 00000000..49fa6a4e Binary files /dev/null and b/agc_2-X/trunk/www/vicidial/images/bg_fade2.png differ diff --git a/agc_2-X/trunk/www/vicidial/line.js b/agc_2-X/trunk/www/vicidial/line.js new file mode 100644 index 00000000..d007fe0a --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/line.js @@ -0,0 +1,183 @@ +/* This notice must remain at all times. + +graph.js +Copyright (c) Balamurugan S, 2005. sbalamurugan @ hotmail.com +Development support by Jexp, Inc http://www.jexp.com + +This package is free software. It is distributed under GPL - legalese removed, it means that you can use this for any purpose, but cannot charge for this software. Any enhancements you make to this piece of code, should be made available free to the general public! + +Latest version can be downloaded from http://www.sbmkpm.com + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +line.js provides a simple mechanism to draw line graphs. It uses +wz_jsgraphics.js which is copyright of its author. + +Usage: +var g = new line_graph(); +g.add("title1",value); +g.add("title2",value2); + +g.render("canvas_name", "graph title"); + +//where canvas_name is a div defined INSIDE body tag + +
+ + +*/ + +hD="0123456789ABCDEF"; + +function d2h(d) +{ + var h = hD.substr(d&15,1); + while(d>15) {d>>=4;h=hD.substr(d&15,1)+h;} + return h; +} + +function h2d(h) +{ + return parseInt(h,16); +} + +function line_graph(dw) +{ + this.ct = 0; + + this.data = new Array(); + this.x_name = new Array(); + this.max = -64000; //MAX INT + + this.c_array = new Array(); + this.c_array[0] = new Array(255, 192, 95); + this.c_array[1] = new Array(80, 127, 175); + this.c_array[2] = new Array(159, 87, 112); + this.c_array[3] = new Array(111, 120, 96); + this.c_array[4] = new Array(224, 119, 96); + this.c_array[5] = new Array(80, 159, 144); + this.c_array[6] = new Array(207, 88, 95); + this.c_array[7] = new Array(64, 135, 96); + this.c_array[8] = new Array(239, 160, 95); + this.c_array[9] = new Array(144, 151, 80); + this.c_array[10] = new Array(255, 136, 80); + + this.getColor = function() + { + if(this.ct >= (this.c_array.length-1)) + this.ct = 0; + else + this.ct++; + + return "#" + d2h(this.c_array[this.ct][0]) + d2h(this.c_array[this.ct][1]) + d2h(this.c_array[this.ct][2]); + } + + + this.add = function(x_name, value) + { + this.x_name.push(x_name); + this.data.push(parseInt(value,10)); + + if(value > this.max) + this.max = parseInt(value,10); + } + + this.render = function(canvas, title) + { + var jg = new jsGraphics(canvas); + + var h = 250; + var sx = 40; +// var dw = 6; + var shadow = 0; + var fnt = 8; + + var rtmax = sx + 10 + (dw+Math.round((dw/2))+shadow)*(this.data.length); + + // Draw markers + var i; + jg.setColor("black"); + for(i = 1 ; i <= 5 ; i++) + { + +// Joe J - tweak to make the y-axis intervals less nutty + if (this.max<=50) { + while (this.max%5!=0) { + this.max++; + } + } else if (this.max<=100) { + while (this.max%10!=0) { + this.max++; + } + } else if (this.max<=250) { + while (this.max%25!=0) { + this.max++; + } + } else if (this.max<=500) { + while (this.max%50!=0) { + this.max++; + } + } else if (this.max<=1000) { + while (this.max%100!=0) { + this.max++; + } + } else if (this.max<=2500) { + while (this.max%250!=0) { + this.max++; + } + } else if (this.max<=5000) { + while (this.max%500!=0) { + this.max++; + } + } else { + while (this.max%1000!=0) { + this.max++; + } + } + + + jg.drawLine(0,Math.round((h/5*i)),rtmax+20,Math.round((h/5*i))); + var ff = Math.round(this.max - (this.max / 5 * i)); + jg.drawString(ff,4,Math.round((h/5*i)-2)); + } + + // Draw the bar graph + var color = this.getColor(); + var oldx, oldy; + jg.setStroke(1); + + for(i = 0; i < this.data.length; i++) + { + var ht1 = Math.round(this.data[i]*h/this.max); + + if (this.x_name[i].match(/\+/)) + { + sx+=(2*dw); + } + + if(i >= 1) + { + jg.setColor(color); + jg.drawLine(oldx, h-oldy, sx, h-ht1); + } + + jg.setColor("red"); + jg.fillEllipse(sx-2, h-ht1-2, 5, 5); + + jg.setColor("black"); + jg.drawString(this.x_name[i], sx, h); + + oldx = sx; + oldy = ht1; + + sx = sx+dw+Math.round(dw/2)+shadow; + } + + jg.setFont("Verdana", fnt, Font.BOLD); + jg.drawStringRect(title, 0, h+fnt+4, rtmax+20, "left"); + jg.paint(); + } + +} diff --git a/agc_2-X/trunk/www/vicidial/listloaderMAIN.php b/agc_2-X/trunk/www/vicidial/listloaderMAIN.php index acd614fb..aa42de0a 100644 --- a/agc_2-X/trunk/www/vicidial/listloaderMAIN.php +++ b/agc_2-X/trunk/www/vicidial/listloaderMAIN.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell,Joe Johnson LICENSE: AGPLv2 # # this is the main frame page for the lead loading section. This is where you # would upload a file and have it inserted into vicidial_list @@ -10,6 +10,7 @@ # 60620-1149 - Added variable filtering to eliminate SQL injection attack threat # 60822-1105 - fixed for nonwritable directories # 90508-0644 - Changed to PHP long tags +# 120223-2151 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -18,6 +19,26 @@ $PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -32,12 +53,12 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; -if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICIDIAL-LEAD-LOADER\""); Header("HTTP/1.0 401 Unauthorized"); @@ -51,27 +72,27 @@ $browser = getenv("HTTP_USER_AGENT"); { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); - $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGload_leads =$row[0]; + $stmt="SELECT load_leads from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGload_leads =$row[0]; if ($LOGload_leads < 1) { echo "You do not have permissions to load leads\n"; exit; } - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/new_listloader_superL.php b/agc_2-X/trunk/www/vicidial/new_listloader_superL.php index 7cc0fd2f..a9bb278d 100644 --- a/agc_2-X/trunk/www/vicidial/new_listloader_superL.php +++ b/agc_2-X/trunk/www/vicidial/new_listloader_superL.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell,Joe Johnson LICENSE: AGPLv2 # # AST GUI lead loader from formatted file # @@ -34,11 +34,12 @@ # 100630-1609 - Added a check for invalid ListIds and filtered out ' " ; ` \ from the field # 100705-1507 - Added custom fields to field chooser, only when liast_id_override is used and only with TXT and CSV file formats # 100712-1416 - Added entry_list_id field to vicidial_list to preserve link to custom fields if any +# 120223-2148 - Removed logging of good login passwords if webroot writable is enabled # # make sure vicidial_list exists and that your file follows the formatting correctly. This page does not dedupe or do any other lead filtering actions yet at this time. -$version = '2.4-37'; -$build = '100712-1416'; +$version = '2.4-38'; +$build = '120223-2148'; require("dbconnect.php"); @@ -143,7 +144,7 @@ $vicidial_list_fields = '|lead_id|vendor_lead_code|source_id|list_id|gmt_offset_ ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,admin_web_directory,custom_fields_enabled FROM system_settings;"; +$stmt = "SELECT use_non_latin,admin_web_directory,custom_fields_enabled,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {echo "$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -153,6 +154,7 @@ if ($qm_conf_ct > 0) $non_latin = $row[0]; $admin_web_directory = $row[1]; $custom_fields_enabled = $row[2]; + $webroot_writable = $row[3]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -181,7 +183,7 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $auth=$row[0]; -if ($WeBRooTWritablE > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} +if ($webroot_writable > 0) {$fp = fopen ("./project_auth_entries.txt", "a");} $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); @@ -213,17 +215,17 @@ $browser = getenv("HTTP_USER_AGENT"); echo "You do not have permissions to load leads\n"; exit; } - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "LIST_LOAD|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { - fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "LIST_LOAD|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } @@ -409,7 +411,7 @@ echo "
"; if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { # copy($leadfile, "./vicidial_temp_file.txt"); $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { $stmt_file=fopen("listloader_stmts.txt", "w"); } @@ -724,7 +726,7 @@ echo "
"; $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); if ($DB > 0) {echo "";} - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; @@ -740,7 +742,7 @@ echo "
"; ### insert good record into vicidial_list table ### $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; $multi_insert_counter=0; @@ -778,7 +780,7 @@ echo "
"; if ($multi_insert_counter!=0) { $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} } @@ -813,7 +815,7 @@ echo "
"; # copy($leadfile, "./vicidial_temp_file.csv"); $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");} print "
Processing CSV file... \n"; @@ -1112,7 +1114,7 @@ echo "
"; $affected_rows = mysql_affected_rows($link); $lead_id = mysql_insert_id($link); if ($DB > 0) {echo "";} - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; @@ -1128,7 +1130,7 @@ echo "
"; ### insert good deal into pending_transactions table ### $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; $multi_insert_counter=0; @@ -1164,7 +1166,7 @@ echo "
"; if ($multi_insert_counter!=0) { $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} } print "

Done GOOD: $good       BAD: $bad       TOTAL: $total"; @@ -1187,7 +1189,7 @@ if ($leadfile) { if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt"); $lead_file = "./vicidial_temp_file.txt"; @@ -1198,7 +1200,7 @@ if ($leadfile) { $lead_file = "/tmp/vicidial_temp_file.txt"; } $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");} $buffer=fgets($file, 4096); @@ -1443,7 +1445,7 @@ if ($leadfile) { ### insert good deal into pending_transactions table ### $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; $multi_insert_counter=0; @@ -1479,7 +1481,7 @@ if ($leadfile) { if ($multi_insert_counter!=0) { $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} } @@ -1490,7 +1492,7 @@ if ($leadfile) { } } else if (!eregi(".csv", $leadfile_name)) { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls"); $lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls"; @@ -1515,7 +1517,7 @@ if ($leadfile) { } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv"); $lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv"; @@ -1526,7 +1528,7 @@ if ($leadfile) { $lead_file = "/tmp/vicidial_temp_file.csv"; } $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");} print "
Processing CSV file... \n"; @@ -1754,7 +1756,7 @@ if ($leadfile) { ### insert good deal into pending_transactions table ### $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values$multistmt('','$entry_date','$modify_date','$status','$user','$vendor_lead_code','$source_id','$list_id','$gmt_offset','$called_since_last_reset','$phone_code','$phone_number','$title','$first_name','$middle_initial','$last_name','$address1','$address2','$address3','$city','$state','$province','$postal_code','$country_code','$gender','$date_of_birth','$alt_phone','$email','$security_phrase','$comments',0,'2008-01-01 00:00:00','$rank','$owner','0');"; $rslt=mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} $multistmt=''; $multi_insert_counter=0; @@ -1789,7 +1791,7 @@ if ($leadfile) { if ($multi_insert_counter!=0) { $stmtZ = "INSERT INTO vicidial_list (lead_id,entry_date,modify_date,status,user,vendor_lead_code,source_id,list_id,gmt_offset_now,called_since_last_reset,phone_code,phone_number,title,first_name,middle_initial,last_name,address1,address2,address3,city,state,province,postal_code,country_code,gender,date_of_birth,alt_phone,email,security_phrase,comments,called_count,last_local_call_time,rank,owner,entry_list_id) values".substr($multistmt, 0, -1).";"; mysql_query($stmtZ, $link); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {fwrite($stmt_file, $stmtZ."\r\n");} } @@ -1865,7 +1867,7 @@ if ($leadfile) { if (!eregi(".csv", $leadfile_name) && !eregi(".xls", $leadfile_name)) { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt"); $lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.txt"; @@ -1876,7 +1878,7 @@ if ($leadfile) { $lead_file = "/tmp/vicidial_temp_file.txt"; } $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");} $buffer=fgets($file, 4096); @@ -1924,7 +1926,7 @@ if ($leadfile) { } else if (!eregi(".csv", $leadfile_name)) { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls"); $lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.xls"; @@ -1947,7 +1949,7 @@ if ($leadfile) { } else { - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) { copy($LF_path, "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv"); $lead_file = "$WeBServeRRooT/$admin_web_directory/vicidial_temp_file.csv"; @@ -1959,7 +1961,7 @@ if ($leadfile) { } $file=fopen("$lead_file", "r"); - if ($WeBRooTWritablE > 0) + if ($webroot_writable > 0) {$stmt_file=fopen("$WeBServeRRooT/$admin_web_directory/listloader_stmts.txt", "w");} print "
Processing CSV file... \n"; diff --git a/agc_2-X/trunk/www/vicidial/phone_stats.php b/agc_2-X/trunk/www/vicidial/phone_stats.php index 6a7ee6aa..322d67ca 100644 --- a/agc_2-X/trunk/www/vicidial/phone_stats.php +++ b/agc_2-X/trunk/www/vicidial/phone_stats.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # # changes: @@ -9,6 +9,7 @@ # - Added required user/pass to gain access to this page # 60927-1548 - Changed to vicidial_users for authentication # 90508-0644 - Changed to PHP long tags +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -37,6 +38,25 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); @@ -47,37 +67,38 @@ $admin_page = './admin.php'; if (!isset($begin_date)) {$begin_date = $TODAY;} if (!isset($end_date)) {$end_date = $TODAY;} - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $auth=$row[0]; +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7 and view_reports='1';"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; $fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICI-ASTERISK\""); Header("HTTP/1.0 401 Unauthorized"); echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } - else +else { - if($auth>0) { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); - $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; - fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); - fclose($fp); - + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + if ($webroot_writable > 0) + { + fwrite ($fp, "ASTERISK|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } ##### get server listing for dynamic pulldown $stmt="SELECT fullname from phones where server_ip='$server_ip' and extension='$extension'"; $rsltx=mysql_query($stmt, $link); @@ -86,8 +107,11 @@ $browser = getenv("HTTP_USER_AGENT"); } else { - fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "ASTERISK|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); + fclose($fp); + } } } diff --git a/agc_2-X/trunk/www/vicidial/realtime_report.php b/agc_2-X/trunk/www/vicidial/realtime_report.php index ab42c581..6b05fbc1 100644 --- a/agc_2-X/trunk/www/vicidial/realtime_report.php +++ b/agc_2-X/trunk/www/vicidial/realtime_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # live real-time stats for the VICIDIAL Auto-Dialer all servers # @@ -19,10 +19,11 @@ # 110316-2216 - Added Agent, Carrier and Preset options.php settings # 110516-2128 - IE fix # 110526-1807 - Added webphone_auto_answer option +# 120223-1917 - Added multi-user-group options # -$version = '2.4-8'; -$build = '110526-1807'; +$version = '2.4-9'; +$build = '120223-1917'; header ("Content-type: text/html; charset=utf-8"); @@ -44,6 +45,8 @@ if (isset($_GET["groups"])) {$groups=$_GET["groups"];} elseif (isset($_POST["groups"])) {$groups=$_POST["groups"];} if (isset($_GET["usergroup"])) {$usergroup=$_GET["usergroup"];} elseif (isset($_POST["usergroup"])) {$usergroup=$_POST["usergroup"];} +if (isset($_GET["user_group_filter"])) {$user_group_filter=$_GET["user_group_filter"];} + elseif (isset($_POST["user_group_filter"])) {$user_group_filter=$_POST["user_group_filter"];} if (isset($_GET["DB"])) {$DB=$_GET["DB"];} elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} if (isset($_GET["adastats"])) {$adastats=$_GET["adastats"];} @@ -265,6 +268,86 @@ if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } + +if ($auth) + { + $office_no=strtoupper($PHP_AUTH_USER); + $password=strtoupper($PHP_AUTH_PW); + $stmt="SELECT user_id,user,pass,full_name,user_level,user_group,phone_login,phone_pass,delete_users,delete_user_groups,delete_lists,delete_campaigns,delete_ingroups,delete_remote_agents,load_leads,campaign_detail,ast_admin_access,ast_delete_phones,delete_scripts,modify_leads,hotkeys_active,change_agent_campaign,agent_choose_ingroups,closer_campaigns,scheduled_callbacks,agentonly_callbacks,agentcall_manual,vicidial_recording,vicidial_transfers,delete_filters,alter_agent_interface_options,closer_default_blended,delete_call_times,modify_call_times,modify_users,modify_campaigns,modify_lists,modify_scripts,modify_filters,modify_ingroups,modify_usergroups,modify_remoteagents,modify_servers,view_reports,vicidial_recording_override,alter_custdata_override,qc_enabled,qc_user_level,qc_pass,qc_finish,qc_commit,add_timeclock_log,modify_timeclock_log,delete_timeclock_log,alter_custphone_override,vdc_agent_api_access,modify_inbound_dids,delete_inbound_dids,active,alert_enabled,download_lists,agent_shift_enforcement_override,manager_shift_enforcement_override,shift_override_flag,export_reports,delete_from_dnc,email,user_code,territory,allow_alerts,callcard_admin,force_change_password,modify_shifts,modify_phones,modify_carriers,modify_labels,modify_statuses,modify_voicemail,modify_audiostore,modify_moh,modify_tts,modify_contacts,modify_same_user_level from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfull_name =$row[3]; + $LOGuser_level =$row[4]; + $LOGuser_group =$row[5]; + $LOGdelete_users =$row[8]; + $LOGdelete_user_groups =$row[9]; + $LOGdelete_lists =$row[10]; + $LOGdelete_campaigns =$row[11]; + $LOGdelete_ingroups =$row[12]; + $LOGdelete_remote_agents =$row[13]; + $LOGload_leads =$row[14]; + $LOGcampaign_detail =$row[15]; + $LOGast_admin_access =$row[16]; + $LOGast_delete_phones =$row[17]; + $LOGdelete_scripts =$row[18]; + $LOGdelete_filters =$row[29]; + $LOGalter_agent_interface =$row[30]; + $LOGdelete_call_times =$row[32]; + $LOGmodify_call_times =$row[33]; + $LOGmodify_users =$row[34]; + $LOGmodify_campaigns =$row[35]; + $LOGmodify_lists =$row[36]; + $LOGmodify_scripts =$row[37]; + $LOGmodify_filters =$row[38]; + $LOGmodify_ingroups =$row[39]; + $LOGmodify_usergroups =$row[40]; + $LOGmodify_remoteagents =$row[41]; + $LOGmodify_servers =$row[42]; + $LOGview_reports =$row[43]; + $LOGmodify_dids =$row[56]; + $LOGdelete_dids =$row[57]; + $LOGmanager_shift_enforcement_override=$row[61]; + $LOGexport_reports =$row[64]; + $LOGdelete_from_dnc =$row[65]; + $LOGcallcard_admin =$row[70]; + $LOGforce_change_password =$row[71]; + $LOGmodify_shifts =$row[72]; + $LOGmodify_phones =$row[73]; + $LOGmodify_carriers =$row[74]; + $LOGmodify_labels =$row[75]; + $LOGmodify_statuses =$row[76]; + $LOGmodify_voicemail =$row[77]; + $LOGmodify_audiostore =$row[78]; + $LOGmodify_moh =$row[79]; + $LOGmodify_tts =$row[80]; + $LOGmodify_contacts =$row[81]; + $LOGmodify_same_user_level =$row[82]; + + $stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups,admin_viewable_call_times from vicidial_user_groups where user_group='$LOGuser_group';"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGallowed_campaigns = $row[0]; + $LOGallowed_reports = $row[1]; + $LOGadmin_viewable_groups = $row[2]; + $LOGadmin_viewable_call_times = $row[3]; + + $LOGadmin_viewable_groupsSQL=''; + $valLOGadmin_viewable_groupsSQL=''; + $vmLOGadmin_viewable_groupsSQL=''; + if ( (!eregi("--ALL--",$LOGadmin_viewable_groups)) and (strlen($LOGadmin_viewable_groups) > 3) ) + { + $rawLOGadmin_viewable_groupsSQL = preg_replace("/ -/",'',$LOGadmin_viewable_groups); + $rawLOGadmin_viewable_groupsSQL = preg_replace("/ /","','",$rawLOGadmin_viewable_groupsSQL); + $LOGadmin_viewable_groupsSQL = "and user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; + $whereLOGadmin_viewable_groupsSQL = "where user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; + $valLOGadmin_viewable_groupsSQL = "and val.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; + $vmLOGadmin_viewable_groupsSQL = "and vm.user_group IN('---ALL---','$rawLOGadmin_viewable_groupsSQL')"; + } + else + {$admin_viewable_groupsALL=1;} + + } + # and (preg_match("/MONITOR|BARGE|HIJACK/",$monitor_active) ) ) if ( (!isset($monitor_phone)) or (strlen($monitor_phone)<1) ) { @@ -346,6 +429,22 @@ while($i < $group_ct) } $group_SQL = eregi_replace(",$",'',$group_SQL); +$i=0; +$user_group_string='|'; +$user_group_ct = count($user_group_filter); +while($i < $user_group_ct) + { +# if ( (preg_match("/ $user_group_filter[$i] /",$regexLOGallowed_campaigns)) or (preg_match("/ALL-/",$LOGallowed_campaigns)) ) +# { + $user_group_string .= "$user_group_filter[$i]|"; + $user_group_SQL .= "'$user_group_filter[$i]',"; + $usergroupQS .= "&user_group_filter[]=$user_group_filter[$i]"; +# } + + $i++; + } +$user_group_SQL = eregi_replace(",$",'',$user_group_SQL); + ### if no campaigns selected, display all if ( ($group_ct < 1) or (strlen($group_string) < 2) ) { @@ -354,6 +453,15 @@ if ( ($group_ct < 1) or (strlen($group_string) < 2) ) $group = 'ALL-ACTIVE'; $groupQS .= "&groups[]=ALL-ACTIVE"; } +### if no user groups selected, display all +$user_group_none=0; +if ( ($user_group_ct < 1) or (strlen($user_group_string) < 2) ) + { + $user_group_filter[0] = 'ALL-GROUPS'; + $user_group_string = '|ALL-GROUPS|'; + $usergroupQS .= "&user_group_filter[]=ALL-GROUPS"; + $user_group_none=1; + } if ( (ereg("--NONE--",$group_string) ) or ($group_ct < 1) ) { @@ -376,17 +484,43 @@ else $group_SQLwhere = "where campaign_id IN($group_SQL)"; } +if ( (ereg("--NONE--",$user_group_string) ) or ($user_group_ct < 1) ) + { + $all_active_groups = 0; + $user_group_SQL = "''"; +# $user_group_SQLand = "and FALSE"; +# $user_group_SQLwhere = "where FALSE"; + } +elseif ( eregi('ALL-GROUPS',$user_group_string) ) + { + $all_active_groups = 1; +# $user_group_SQL = ''; + $user_group_SQL = "'$rawLOGadmin_viewable_groupsSQL'"; +# $group_SQLand = "and campaign_id IN($allactivecampaigns)"; +# $group_SQLwhere = "where campaign_id IN($allactivecampaigns)"; + } +else + { + $all_active_groups = 0; +# $user_group_SQLand = "and user_group IN($user_group_SQL)"; +# $user_group_SQLwhere = "where user_group IN($user_group_SQL)"; + } -$stmt="select user_group from vicidial_user_groups;"; +$stmt="select user_group, group_name from vicidial_user_groups $whereLOGadmin_viewable_groupsSQL order by user_group;"; $rslt=mysql_query($stmt, $link); if (!isset($DB)) {$DB=0;} if ($DB) {echo "$stmt\n";} $usergroups_to_print = mysql_num_rows($rslt); $i=0; +$usergroups[$i]='ALL-GROUPS'; +$usergroupnames[$i] = 'All user groups'; +$i++; +$usergroups_to_print++; while ($i < $usergroups_to_print) { $row=mysql_fetch_row($rslt); $usergroups[$i] =$row[0]; + $usergroupnames[$i] =$row[1]; $i++; } @@ -397,7 +531,7 @@ $NFE = ''; $F=''; $FG=''; $B=''; $BG=''; $select_list = "
Select Campaigns:
"; -$select_list .= ""; $o=0; while ($groups_to_print > $o) { @@ -408,7 +542,26 @@ while ($groups_to_print > $o) $o++; } $select_list .= ""; -$select_list .= "
(To select more than 1 campaign, hold down the Ctrl key and click)"; +$select_list .= "
(To select more than 1 campaign, hold down the Ctrl key and click)"; + +$select_list .= "

Select User Groups:
"; +$select_list .= ""; + $select_list .= "
"; $select_list .= "Close Panel

"; $select_list .= ""; @@ -710,6 +863,7 @@ var user = ''; var pass = ''; var RR = ''; var groupQS = ''; +var usergroupQS = ''; var DB = ''; var adastats = ''; var SIPmonitorLINK = ''; @@ -1014,7 +1168,7 @@ function gather_realtime_content() } if (xmlhttp) { - RTupdate_query = "RTajax=1&DB=" + DB + "" + groupQS + "&adastats=" + adastats + "&SIPmonitorLINK=" + SIPmonitorLINK + "&IAXmonitorLINK=" + IAXmonitorLINK + "&usergroup=" + usergroup + "&UGdisplay=" + UGdisplay + "&UidORname=" + UidORname + "&orderby=" + orderby + "&SERVdisplay=" + SERVdisplay + "&CALLSdisplay=" + CALLSdisplay + "&PHONEdisplay=" + PHONEdisplay + "&CUSTPHONEdisplay=" + CUSTPHONEdisplay + "&with_inbound=" + with_inbound + "&monitor_active=" + monitor_active + "&monitor_phone=" + monitor_phone + "&ALLINGROUPstats=" + ALLINGROUPstats + "&DROPINGROUPstats=" + DROPINGROUPstats + "&NOLEADSalert=" + NOLEADSalert + "&CARRIERstats=" + CARRIERstats + "&PRESETstats=" + PRESETstats + "&AGENTtimeSTATS=" + AGENTtimeSTATS + ""; + RTupdate_query = "RTajax=1&DB=" + DB + "" + groupQS + usergroupQS + "&adastats=" + adastats + "&SIPmonitorLINK=" + SIPmonitorLINK + "&IAXmonitorLINK=" + IAXmonitorLINK + "&usergroup=" + usergroup + "&UGdisplay=" + UGdisplay + "&UidORname=" + UidORname + "&orderby=" + orderby + "&SERVdisplay=" + SERVdisplay + "&CALLSdisplay=" + CALLSdisplay + "&PHONEdisplay=" + PHONEdisplay + "&CUSTPHONEdisplay=" + CUSTPHONEdisplay + "&with_inbound=" + with_inbound + "&monitor_active=" + monitor_active + "&monitor_phone=" + monitor_phone + "&ALLINGROUPstats=" + ALLINGROUPstats + "&DROPINGROUPstats=" + DROPINGROUPstats + "&NOLEADSalert=" + NOLEADSalert + "&CARRIERstats=" + CARRIERstats + "&PRESETstats=" + PRESETstats + "&AGENTtimeSTATS=" + AGENTtimeSTATS + ""; xmlhttp.open('POST', 'AST_timeonVDADall.php'); xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=UTF-8'); @@ -1160,12 +1314,30 @@ function update_variables(task_option,task_choice,force_reload) } } groupQS = temp_camp_choices; + + var temp_usergroup_choices = ''; + var selCampObj = document.getElementById('user_group_filter[]'); + var i; + var count = 0; + var selected_all=0; + for (i=0; i LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # grab: $server_ip $station $session_id # @@ -10,6 +10,7 @@ # 60620-1011 - Added variable filtering to eliminate SQL injection attack threat # - Added required user/pass to gain access to this page # 90508-0644 - Changed to PHP long tags +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -30,16 +31,35 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; - if ($DB) {echo "|$stmt|\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $auth=$row[0]; +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1';"; +if ($DB) {echo "|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); Header("HTTP/1.0 401 Unauthorized"); @@ -53,26 +73,25 @@ $MYSQL_datetime = date("Y-m-d H:i:s"); $FILE_datetime = date("Ymd-His_"); $secX = $STARTtime; - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $auth=$row[0]; +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 7;"; +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; $fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); Header("HTTP/1.0 401 Unauthorized"); echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } - else +else { - if($auth>0) { $office_no=strtoupper($PHP_AUTH_USER); @@ -81,20 +100,25 @@ $browser = getenv("HTTP_USER_AGENT"); $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $LOGfullname=$row[0]; - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } } else { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); + fclose($fp); + } } $stmt="SELECT full_name from vicidial_users where user='$user';"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $full_name = $row[0]; - } diff --git a/agc_2-X/trunk/www/vicidial/recording_lookup.php b/agc_2-X/trunk/www/vicidial/recording_lookup.php index 1b662b20..6712f837 100644 --- a/agc_2-X/trunk/www/vicidial/recording_lookup.php +++ b/agc_2-X/trunk/www/vicidial/recording_lookup.php @@ -24,13 +24,14 @@ ### remove temp files # 1 7 * * * /usr/bin/find /usr/local/apache2/htdocs/vicidial/temp/ -maxdepth 1 -type f -mtime +1 -print | xargs rm -f # -# Copyright (C) 2008 Matt Florell LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # 71015-0845 - First build # 71112-1347 - added GSM option # 90508-0644 - Changed to PHP long tags +# 120223-2129 - Removed logging of good login passwords if webroot writable is enabled # $STARTtime = date("U"); @@ -48,24 +49,24 @@ if (isset($_GET["QUERY_recid"])) {$QUERY_recid=$_GET["QUERY_recid"];} $web_server = '1.1.1.1'; $US='_'; - if( (eregi("VDC",$PHP_AUTH_USER)) or (eregi("VDC",$PHP_AUTH_PW)) ) +if( (eregi("VDC",$PHP_AUTH_USER)) or (eregi("VDC",$PHP_AUTH_PW)) ) { -# $package=''; + # $package=''; } - else +else { - Header("WWW-Authenticate: Basic realm=\"VICI-VERIF\""); - Header("HTTP/1.0 401 Unauthorized"); - echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; - exit; + Header("WWW-Authenticate: Basic realm=\"VICI-VERIF\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; + exit; } - $fp = fopen ("/usr/local/apache2/htdocs/vicidial/auth_entries.txt", "a"); - $date = date("r"); - $ip = getenv("REMOTE_ADDR"); - $browser = getenv("HTTP_USER_AGENT"); - fwrite ($fp, "AUTH|VDC |$date|$username|$passwd|$ip|$QUERY_recid|$browser|\n"); - fclose($fp); +# $fp = fopen ("/usr/local/apache2/htdocs/vicidial/auth_entries.txt", "a"); +# $date = date("r"); +# $ip = getenv("REMOTE_ADDR"); +# $browser = getenv("HTTP_USER_AGENT"); +# fwrite ($fp, "AUTH|VDC |$date|$username|$passwd|$ip|$QUERY_recid|$browser|\n"); +# fclose($fp); ?> @@ -82,74 +83,73 @@ echo "

\n"; #echo "
\n"; if (strlen($QUERY_recid)<10) -{ -echo "Please enter a recording ID(customer phone number) below:\n"; -} -else -{ -$logs_to_print=0; -echo "searching for: $QUERY_recid\n"; -echo "
\n";
-
-	$stmt="select recording_id,lead_id,user,filename,location,start_time,length_in_sec from recording_log where filename LIKE \"%$QUERY_recid%\" order by recording_id desc LIMIT 1;";
-	$rslt=mysql_query($stmt, $linkAST);
-	$logs_to_print = mysql_num_rows($rslt);
-#echo "|$stmt|";
-
-$u=0;
-if ($logs_to_print)
 	{
-	$row=mysql_fetch_row($rslt);
-	$phone = $QUERY_recid;
-	$recording_id = $row[0]; 
-	$lead_id =		$row[1]; 
-	$user =			$row[2];
-	$filename =		$row[3];
-	$location =		$row[4];
-	$start_time =	$row[5];
-	$length_in_sec = $row[6];
-		$AUDname =	explode("/",$location);
-		$AUDnamect =	(count($AUDname)) - 1;
-
-	
-	eregi_replace('10.10.10.16','10.10.10.16',$AUDname[$AUDnamect]);
-
-	echo "Call Date/Time:        $start_time\n";
-	echo "Recording Length:      $length_in_sec\n";
-	echo "Phone Number:          $phone\n";
-	echo "Recording ID:          $recording_id\n";
-	echo "Agent:                 $user\n";
-#	echo "filename:              $filename\n";
-#	echo "Location:              $location\n";
-#	echo "AUDname:               $AUDname[$AUDnamect]\n";
-	echo "Unique ID:             $lead_id\n";
-
-$fileGSM=$AUDname[$AUDnamect];
-$locationGSM=$location;
-$fileGSM = eregi_replace('.wav','.gsm',$fileGSM);
-if (!eregi('gsm',$locationGSM))
-{
-$locationGSM = eregi_replace('10.10.10.16','10.10.10.16/GSM',$locationGSM);
-$locationGSM = eregi_replace('.wav','.gsm',$locationGSM);
-}
-	passthru("/usr/local/apache2/htdocs/vicidial/wget --output-document=/usr/local/apache2/htdocs/vicidial/temp/$AUDname[$AUDnamect] $location\n");
-	passthru("/usr/local/apache2/htdocs/vicidial/wget --output-document=/usr/local/apache2/htdocs/vicidial/temp/$fileGSM $locationGSM\n");
-
-	echo "Link Uncompressed WAV: $AUDname[$AUDnamect]\n";
-	echo "Link Compressed GSM:   $fileGSM\n";
-
+	echo "Please enter a recording ID(customer phone number) below:\n";
 	}
-
 else
 	{
-	echo "ERROR:        $QUERY_recid\n";
+	$logs_to_print=0;
+	echo "searching for: $QUERY_recid\n";
+	echo "
\n";
+
+		$stmt="select recording_id,lead_id,user,filename,location,start_time,length_in_sec from recording_log where filename LIKE \"%$QUERY_recid%\" order by recording_id desc LIMIT 1;";
+		$rslt=mysql_query($stmt, $linkAST);
+		$logs_to_print = mysql_num_rows($rslt);
+	#echo "|$stmt|";
+
+	$u=0;
+	if ($logs_to_print)
+		{
+		$row=mysql_fetch_row($rslt);
+		$phone = $QUERY_recid;
+		$recording_id = $row[0]; 
+		$lead_id =		$row[1]; 
+		$user =			$row[2];
+		$filename =		$row[3];
+		$location =		$row[4];
+		$start_time =	$row[5];
+		$length_in_sec = $row[6];
+			$AUDname =	explode("/",$location);
+			$AUDnamect =	(count($AUDname)) - 1;
+
+		
+		eregi_replace('10.10.10.16','10.10.10.16',$AUDname[$AUDnamect]);
+
+		echo "Call Date/Time:        $start_time\n";
+		echo "Recording Length:      $length_in_sec\n";
+		echo "Phone Number:          $phone\n";
+		echo "Recording ID:          $recording_id\n";
+		echo "Agent:                 $user\n";
+	#	echo "filename:              $filename\n";
+	#	echo "Location:              $location\n";
+	#	echo "AUDname:               $AUDname[$AUDnamect]\n";
+		echo "Unique ID:             $lead_id\n";
+
+		$fileGSM=$AUDname[$AUDnamect];
+		$locationGSM=$location;
+		$fileGSM = eregi_replace('.wav','.gsm',$fileGSM);
+		if (!eregi('gsm',$locationGSM))
+			{
+			$locationGSM = eregi_replace('10.10.10.16','10.10.10.16/GSM',$locationGSM);
+			$locationGSM = eregi_replace('.wav','.gsm',$locationGSM);
+			}
+		passthru("/usr/local/apache2/htdocs/vicidial/wget --output-document=/usr/local/apache2/htdocs/vicidial/temp/$AUDname[$AUDnamect] $location\n");
+		passthru("/usr/local/apache2/htdocs/vicidial/wget --output-document=/usr/local/apache2/htdocs/vicidial/temp/$fileGSM $locationGSM\n");
+
+		echo "Link Uncompressed WAV: $AUDname[$AUDnamect]\n";
+		echo "Link Compressed GSM:   $fileGSM\n";
+		}
+
+	else
+		{
+		echo "ERROR:        $QUERY_recid\n";
+		}
+
+
+	echo "
\n"; + } - -echo "
\n"; - -} - $ENDtime = date("U"); $RUNtime = ($ENDtime - $STARTtime); diff --git a/agc_2-X/trunk/www/vicidial/remote_dispo.php b/agc_2-X/trunk/www/vicidial/remote_dispo.php index bef1008b..930e0eb6 100644 --- a/agc_2-X/trunk/www/vicidial/remote_dispo.php +++ b/agc_2-X/trunk/www/vicidial/remote_dispo.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # this is the remote agent disposition screen for calls sent to remote agents. # This allows the remote agent to modify customer information and disposition @@ -11,6 +11,7 @@ # # 60619-1626 - Added variable filtering to eliminate SQL injection attack threat # 90508-0644 - Changed to PHP long tags +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # @@ -100,6 +101,25 @@ if (isset($_GET["submit"])) {$submit=$_GET["submit"];} if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,webroot_writable,outbound_autodial_active,user_territories_active FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {echo "$stmt\n";} +$qm_conf_ct = mysql_num_rows($rslt); +$i=0; +while ($i < $qm_conf_ct) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $webroot_writable = $row[1]; + $SSoutbound_autodial_active = $row[2]; + $user_territories_active = $row[3]; + $i++; + } +##### END SETTINGS LOOKUP ##### +########################################### + $STARTtime = date("U"); $TODAY = date("Y-m-d"); $NOW_TIME = date("Y-m-d H:i:s"); @@ -114,46 +134,49 @@ $PHP_AUTH_USER = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_USER); $PHP_AUTH_PW = ereg_replace("[^0-9a-zA-Z]","",$PHP_AUTH_PW); - - $stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $auth=$row[0]; +$stmt="SELECT count(*) from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 2;"; +if ($DB) {echo "$stmt\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$auth=$row[0]; $fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); - if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) +if( (strlen($PHP_AUTH_USER)<2) or (strlen($PHP_AUTH_PW)<2) or (!$auth)) { Header("WWW-Authenticate: Basic realm=\"VICIDIAL-CLOSER\""); Header("HTTP/1.0 401 Unauthorized"); echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; } - else +else { - if($auth>0) { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); - $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; - if ($DB) {echo "$stmt\n";} - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; - $fullname = $row[0]; - fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); - fclose($fp); - + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + if ($DB) {echo "$stmt\n";} + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + $fullname = $row[0]; + if ($webroot_writable > 0) + { + fwrite ($fp, "VD_CLOSER|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } } else { - fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); - fclose($fp); + if ($webroot_writable > 0) + { + fwrite ($fp, "VD_CLOSER|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); + fclose($fp); + } } } diff --git a/agc_2-X/trunk/www/vicidial/timeclock_edit.php b/agc_2-X/trunk/www/vicidial/timeclock_edit.php index 4e60fdf6..a7436be6 100644 --- a/agc_2-X/trunk/www/vicidial/timeclock_edit.php +++ b/agc_2-X/trunk/www/vicidial/timeclock_edit.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -9,6 +9,7 @@ # 80701-1323 - functional beta version done # 90310-2109 - Added admin header # 90508-0644 - Changed to PHP long tags +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # header ("Content-type: text/html; charset=utf-8"); @@ -110,7 +111,7 @@ $browser = getenv("HTTP_USER_AGENT"); $modify_timeclock_log = $row[1]; if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -118,7 +119,7 @@ $browser = getenv("HTTP_USER_AGENT"); { if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/timeclock_report.php b/agc_2-X/trunk/www/vicidial/timeclock_report.php index 0f302a6f..9888389a 100644 --- a/agc_2-X/trunk/www/vicidial/timeclock_report.php +++ b/agc_2-X/trunk/www/vicidial/timeclock_report.php @@ -1,7 +1,7 @@ LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell LICENSE: AGPLv2 # # CHANGES # @@ -17,6 +17,7 @@ # 100914-1326 - Added lookup for user_level 7 users to set to reports only which will remove other admin links # 110703-1830 - Added download option # 111104-1314 - Added user_group restrictions for selecting in-groups +# 120224-0910 - Added HTML display option with bar graphs # require("dbconnect.php"); @@ -45,6 +46,8 @@ if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +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"];} if (strlen($shift)<2) {$shift='ALL';} if (strlen($order)<2) {$order='hours_down';} @@ -204,6 +207,7 @@ $HEADER.="-->\n"; $HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; +$HEADER.="\n"; $HEADER.="\n"; $HEADER.="\n"; @@ -305,8 +309,13 @@ $MAIN.="<SELECT SIZE=5 NAME=user_group[] multiple>\n"; } $MAIN.="</SELECT>\n"; -$MAIN.="</TD></TD><TD ALIGN=LEFT VALIGN=TOP>\n"; -$MAIN.="<font class=\"select_bold\"><B>Order:</B></font><BR>\n"; +$MAIN.="</TD></TD><TD ALIGN=LEFT VALIGN=TOP><font class=\"select_bold\">"; +$MAIN.="Display as:<BR>"; +$MAIN.="<select name='report_display_type'>"; +if ($report_display_type) {$MAIN.="<option value='$report_display_type' selected>$report_display_type</option>";} +$MAIN.="<option value='TEXT'>TEXT</option><option value='HTML'>HTML</option></select>\n<BR>\n"; +$MAIN.="</font></TD><TD ALIGN=LEFT VALIGN=TOP>\n"; +$MAIN.="<font class=\"select_bold\"><B>Order:</B><BR>\n"; $MAIN.="<SELECT SIZE=1 NAME=order>\n"; $MAIN.="<option selected value=\"$order\">$order</option>\n"; $MAIN.="<option value=\"\">--</option>\n"; @@ -318,7 +327,9 @@ $MAIN.="<option>name_up</option>\n"; $MAIN.="<option>name_down</option>\n"; $MAIN.="<option>group_up</option>\n"; $MAIN.="<option>group_down</option>\n"; -$MAIN.="</SELECT><BR><CENTER>\n"; +$MAIN.="</SELECT>\n"; +$MAIN.="</font><CENTER>\n"; + $MAIN.="</TD><TD ALIGN=LEFT VALIGN=TOP>\n"; $MAIN.="<font class=\"select_bold\"><B>User:</B></font><BR>\n"; @@ -337,27 +348,12 @@ $MAIN.="<PRE><FONT SIZE=3>\n"; $MAIN.="User Timeclock Report $NOW_TIME\n"; - -$MAIN.="Time range: $query_date to $end_date\n\n"; -$MAIN.="---------- USER TIMECLOCK DETAILS -------------\n"; -$MAIN.="These totals do NOT include any active sessions\n</PRE>\n"; - $CSV_text.="\"User Timeclock Report - $NOW_TIME\"\n"; $CSV_text.="\"Time range: $query_date to $end_date\"\n"; $CSV_text.="\"---------- USER TIMECLOCK DETAILS -------------\"\n"; $CSV_text.="\"These totals do NOT include any active sessions\"\n\n"; -$MAIN.="<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3><TR BGCOLOR=BLACK>\n"; -$MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">#</TD>\n"; -$MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">  USER  </TD>\n"; -$MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">  NAME  </TD>\n"; -$MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">  GROUP  </TD>\n"; -$MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">  HOURS  </TD>\n"; -$MAIN.="</TR>\n"; - -$CSV_text.="\"\",\"#\",\"USER\",\"NAME\",\"GROUP\",\"HOURS\"\n"; - $order_SQL=''; if ($order == 'hours_up') {$order_SQL = "order by login";} if ($order == 'hours_down') {$order_SQL = "order by login desc";} @@ -372,79 +368,145 @@ if (strlen($user) > 0) {$user_SQL = "and vicidial_timeclock_log.user='$user'";} else {$user_SQL='';} $stmt="select vicidial_users.user,full_name,sum(login_sec) as login,vicidial_timeclock_log.user_group from vicidial_users,vicidial_timeclock_log where event IN('LOGIN','START') and event_date >= '$query_date 00:00:00' and event_date <= '$end_date 23:59:59' and vicidial_users.user=vicidial_timeclock_log.user $user_SQL $user_group_SQL group by vicidial_users.user,vicidial_timeclock_log.user_group $order_SQL limit 100000;"; -$rslt=mysql_query($stmt, $link); -if ($DB) {$MAIN.="$stmt\n";} -$rows_to_print = mysql_num_rows($rslt); -$i=0; -while ($i < $rows_to_print) - { - $dbHOURS=0; - $row=mysql_fetch_row($rslt); - $user_id[$i] = $row[0]; - $full_name[$i] = $row[1]; - $login_sec[$i] = $row[2]; $TOTlogin_sec = ($TOTlogin_sec + $row[2]); - $u_group[$i] = $row[3]; - if ($login_sec[$i] > 0) + +if (!$report_display_type || $report_display_type=="TEXT") + { + $MAIN.="Time range: $query_date to $end_date\n\n"; + $MAIN.="---------- USER TIMECLOCK DETAILS -------------\n"; + $MAIN.="These totals do NOT include any active sessions\n</PRE>\n"; + $MAIN.="<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=3><TR BGCOLOR=BLACK>\n"; + $MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">#</TD>\n"; + $MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">  USER  </TD>\n"; + $MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">  NAME  </TD>\n"; + $MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">  GROUP  </TD>\n"; + $MAIN.="<TD ALIGN=CENTER><FONT class=\"header_white\">  HOURS  </TD>\n"; + $MAIN.="</TR>\n"; + + $CSV_text.="\"\",\"#\",\"USER\",\"NAME\",\"GROUP\",\"HOURS\"\n"; + + $rslt=mysql_query($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $rows_to_print = mysql_num_rows($rslt); + $i=0; + + while ($i < $rows_to_print) { - $dbHOURS = ($login_sec[$i] / 3600); - $dbHOURS = round($dbHOURS, 2); - $dbHOURS = sprintf("%01.2f", $dbHOURS); + $dbHOURS=0; + $row=mysql_fetch_row($rslt); + $user_id[$i] = $row[0]; + $full_name[$i] = $row[1]; + $login_sec[$i] = $row[2]; $TOTlogin_sec = ($TOTlogin_sec + $row[2]); + $u_group[$i] = $row[3]; + + if ($login_sec[$i] > 0) + { + $dbHOURS = ($login_sec[$i] / 3600); + $dbHOURS = round($dbHOURS, 2); + $dbHOURS = sprintf("%01.2f", $dbHOURS); + } + else + {$dbHOURS='0.00';} + + $hours[$i] = $dbHOURS; + $hoursSORT[$i] = "$dbHOURS-----$i"; + + $i++; + } + + + $j=0; + while ($j < $rows_to_print) + { + + $hours_split = explode("-----",$hoursSORT[$j]); + $i = $hours_split[1]; + + if (eregi("1$|3$|5$|7$|9$", $j)) + {$bgcolor='bgcolor="#B9CBFD"';} + else + {$bgcolor='bgcolor="#9BB9FB"';} + + $MAIN.="<TR $bgcolor>\n"; + $MAIN.="<TD ALIGN=LEFT><FONT class=\"data_records_fix_small\">$j</TD>\n"; + $MAIN.="<TD><FONT class=\"data_records\"><A HREF=\"user_status.php?user=$user_id[$i]\">$user_id[$i]</A> </TD>\n"; + $MAIN.="<TD><FONT class=\"data_records\">$full_name[$i] </TD>\n"; + $MAIN.="<TD><FONT class=\"data_records\">$u_group[$i] </TD>\n"; + $MAIN.="<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $hours[$i]</TD>\n"; + $MAIN.="</TR>\n"; + $CSV_text.="\"\",\"$j\",\"$user_id[$i]\",\"$full_name[$i]\",\"$u_group[$i]\",\"$hours[$i]\"\n"; + + $j++; + } + + + if ($TOTlogin_sec > 0) + { + $TOTdbHOURS = ($TOTlogin_sec / 3600); + $TOTdbHOURS = round($TOTdbHOURS, 0); + $TOTdbHOURS = sprintf("%01.0f", $TOTdbHOURS); } else - {$dbHOURS='0.00';} + {$TOTdbHOURS='0.00';} - $hours[$i] = $dbHOURS; - $hoursSORT[$i] = "$dbHOURS-----$i"; - - $i++; - } + $TOThours = $TOTdbHOURS; -$j=0; -while ($j < $rows_to_print) - { - $hours_split = explode("-----",$hoursSORT[$j]); - $i = $hours_split[1]; - - if (eregi("1$|3$|5$|7$|9$", $j)) - {$bgcolor='bgcolor="#B9CBFD"';} - else - {$bgcolor='bgcolor="#9BB9FB"';} - - $MAIN.="<TR $bgcolor>\n"; - $MAIN.="<TD ALIGN=LEFT><FONT class=\"data_records_fix_small\">$j</TD>\n"; - $MAIN.="<TD><FONT class=\"data_records\"><A HREF=\"user_status.php?user=$user_id[$i]\">$user_id[$i]</A> </TD>\n"; - $MAIN.="<TD><FONT class=\"data_records\">$full_name[$i] </TD>\n"; - $MAIN.="<TD><FONT class=\"data_records\">$u_group[$i] </TD>\n"; - $MAIN.="<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $hours[$i]</TD>\n"; + $MAIN.="<TR BGCOLOR=#E6E6E6>\n"; + $MAIN.="<TD ALIGN=LEFT COLSPAN=4><FONT class=\"data_records\">TOTALS</TD>\n"; + $MAIN.="<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $TOThours</TD>\n"; $MAIN.="</TR>\n"; - $CSV_text.="\"\",\"$j\",\"$user_id[$i]\",\"$full_name[$i]\",\"$u_group[$i]\",\"$hours[$i]\"\n"; + $CSV_text.="\"\",\"TOTALS\",\"\",\"\",\"\",\"$TOThours\"\n"; - $j++; + $MAIN.="</TABLE>\n"; } - - -if ($TOTlogin_sec > 0) +else { - $TOTdbHOURS = ($TOTlogin_sec / 3600); - $TOTdbHOURS = round($TOTdbHOURS, 0); - $TOTdbHOURS = sprintf("%01.0f", $TOTdbHOURS); + ######## GRAPHING ######### + $rslt=mysql_query($stmt, $link); + $high_ct=0; $i=0; + while ($row=mysql_fetch_row($rslt)) { + + if ($row[2] > 0) + { + $dbHOURS = ($row[2] / 3600); + $dbHOURS = round($dbHOURS, 2); + $dbHOURS = sprintf("%01.2f", $dbHOURS); + } + else + {$dbHOURS='0.00';} + + if ($dbHOURS>$high_ct) {$high_ct=$dbHOURS;} + $ct_ary[$i][0]="$row[1] ($row[0]) - $row[3]"; + $ct_ary[$i][1]=$dbHOURS; + $i++; + } + if ($high_ct<1) {$high_ct*=10;} + $MAIN.="</PRE>\n"; + $MAIN.="<table cellspacing=\"0\" cellpadding=\"0\" summary=\"CALL HANGUP REASON STATS\" class=\"horizontalgraph\">\n"; + $MAIN.=" <caption align=\"top\">USER TIMECLOCK DETAILS<br /><font size='-1'>Time range: $query_date to $end_date<br/>These totals do NOT include any active sessions</font><br /></caption>\n"; + $MAIN.=" <tr>\n"; + $MAIN.=" <th class=\"thgraph\" scope=\"col\">USER </th>\n"; + $MAIN.=" <th class=\"thgraph\" scope=\"col\">HOURS </th>\n"; + $MAIN.=" </tr>\n"; + for ($i=0; $i<count($ct_ary); $i++) { + if ($i==0) {$class=" first";} else if (($i+1)==count($ct_ary)) {$class=" last";} else {$class="";} + $MAIN.=" <tr>\n"; + $MAIN.=" <td class=\"chart_td$class\">".$ct_ary[$i][0]."</td>\n"; + $MAIN.=" <td class=\"chart_td value$class\"><img src=\"images/bar.png\" alt=\"\" width=\"".round(400*$ct_ary[$i][1]/$high_ct)."\" height=\"16\" />".$ct_ary[$i][1]."</td>\n"; + $MAIN.=" </tr>\n"; + } + $MAIN.=" <tr>\n"; + $MAIN.=" <th class=\"thgraph\" scope=\"col\">TOTAL HOURS:</th>\n"; + $MAIN.=" <th class=\"thgraph\" scope=\"col\">".trim($TOThours)."</th>\n"; + $MAIN.=" </tr>\n"; + $MAIN.="</table>\n"; + $MAIN.="<PRE>\n"; + ########################### } -else - {$TOTdbHOURS='0.00';} - -$TOThours = $TOTdbHOURS; -$MAIN.="<TR BGCOLOR=#E6E6E6>\n"; -$MAIN.="<TD ALIGN=LEFT COLSPAN=4><FONT class=\"data_records\">TOTALS</TD>\n"; -$MAIN.="<TD ALIGN=RIGHT><FONT class=\"data_records_fix\"> $TOThours</TD>\n"; -$MAIN.="</TR>\n"; -$CSV_text.="\"\",\"TOTALS\",\"\",\"\",\"\",\"$TOThours\"\n"; - -$MAIN.="</TABLE>\n"; $MAIN.="</CENTER>\n"; $MAIN.="</BODY></HTML>\n"; diff --git a/agc_2-X/trunk/www/vicidial/timeclock_status.php b/agc_2-X/trunk/www/vicidial/timeclock_status.php index f0ff90c7..2cc13695 100644 --- a/agc_2-X/trunk/www/vicidial/timeclock_status.php +++ b/agc_2-X/trunk/www/vicidial/timeclock_status.php @@ -101,7 +101,6 @@ $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $reports_only_user=$row[0]; -$fp = fopen ("./project_auth_entries.txt", "a"); $date = date("r"); $ip = getenv("REMOTE_ADDR"); $browser = getenv("HTTP_USER_AGENT"); diff --git a/agc_2-X/trunk/www/vicidial/user_group_bulk_change.php b/agc_2-X/trunk/www/vicidial/user_group_bulk_change.php index c2d4fe73..ea59142a 100644 --- a/agc_2-X/trunk/www/vicidial/user_group_bulk_change.php +++ b/agc_2-X/trunk/www/vicidial/user_group_bulk_change.php @@ -9,6 +9,7 @@ # 90310-2144 - Added admin header # 90508-0644 - Changed to PHP long tags # 120221-0025 - Added in User Group restrictions +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # header ("Content-type: text/html; charset=utf-8"); @@ -91,7 +92,7 @@ else $LOGuser_group = $row[3]; if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -99,7 +100,7 @@ else { if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } exit; diff --git a/agc_2-X/trunk/www/vicidial/user_stats.php b/agc_2-X/trunk/www/vicidial/user_stats.php index a19f980a..78ae20cb 100644 --- a/agc_2-X/trunk/www/vicidial/user_stats.php +++ b/agc_2-X/trunk/www/vicidial/user_stats.php @@ -1,7 +1,7 @@ <?php # user_stats.php # -# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # # CHANGES # @@ -33,6 +33,7 @@ # 110718-1204 - Added skipped manual dial leads display # 111103-1050 - Added admin_hide_phone_data and admin_hide_lead_data options # 111106-1105 - Added user_group restrictions +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # @@ -45,7 +46,7 @@ $db_source = 'M'; ############################################# ##### START SYSTEM_SETTINGS LOOKUP ##### -$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,user_territories_active FROM system_settings;"; +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db,user_territories_active,webroot_writable FROM system_settings;"; $rslt=mysql_query($stmt, $link); if ($DB) {$MAIN.="$stmt\n";} $qm_conf_ct = mysql_num_rows($rslt); @@ -57,6 +58,7 @@ if ($qm_conf_ct > 0) $slave_db_server = $row[2]; $reports_use_slave_db = $row[3]; $user_territories_active = $row[4]; + $webroot_writable = $row[5]; } ##### END SETTINGS LOOKUP ##### ########################################### @@ -136,8 +138,11 @@ $LOGuser_group = $row[1]; $LOGadmin_hide_lead_data = $row[2]; $LOGadmin_hide_phone_data = $row[3]; -fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); -fclose($fp); +if ($webroot_writable > 0) + { + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); + fclose($fp); + } $stmt="SELECT allowed_campaigns,allowed_reports,admin_viewable_groups from vicidial_user_groups where user_group='$LOGuser_group';"; if ($DB) {$MAIN.="|$stmt|\n";} diff --git a/agc_2-X/trunk/www/vicidial/user_status.php b/agc_2-X/trunk/www/vicidial/user_status.php index faa2f3c8..ab3eb70b 100644 --- a/agc_2-X/trunk/www/vicidial/user_status.php +++ b/agc_2-X/trunk/www/vicidial/user_status.php @@ -1,7 +1,7 @@ <?php # user_status.php # -# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # # CHANGES # @@ -19,6 +19,7 @@ # 110124-1134 - Small query fix for large queue_log tables # 110224-2350 - Small QM logout fix # 110420-0344 - Added DEAD/PARK agent statuses +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # header ("Content-type: text/html; charset=utf-8"); @@ -104,7 +105,7 @@ else $modify_timeclock_log = $row[2]; if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } } @@ -112,7 +113,7 @@ else { if ($webroot_writable > 0) { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); echo "Invalid Username/Password: |$PHP_AUTH_USER|$PHP_AUTH_PW|\n"; exit; diff --git a/agc_2-X/trunk/www/vicidial/vdremote.php b/agc_2-X/trunk/www/vicidial/vdremote.php index a4c1d7e8..8534815d 100644 --- a/agc_2-X/trunk/www/vicidial/vdremote.php +++ b/agc_2-X/trunk/www/vicidial/vdremote.php @@ -4,7 +4,7 @@ # make sure you have added a user to the vicidial_users MySQL table with at # least user_level 4 to access this page the first time # -# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # # Changes # 50307-1721 - First version @@ -13,10 +13,11 @@ # 60619-1603 - Added variable filtering to eliminate SQL injection attack threat # 90508-0644 - Changed to PHP long tags # 91129-2249 - Replaced SELECT STAR in SQL queries, formatting fixes +# 120223-2135 - Removed logging of good login passwords if webroot writable is enabled # -$version = '2.2.0'; -$build = '91129-2249'; +$version = '2.2.4-7'; +$build = '120223-2135'; require("dbconnect.php"); @@ -124,12 +125,12 @@ else $server_ip=$row[1]; if (!$number_of_lines) {$number_of_lines=$row[2];} - fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VDremote|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } else { - fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); echo "This remote agent does not exist: |$PHP_AUTH_USER|\n"; exit; @@ -137,7 +138,7 @@ else } else { - fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VDremote|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } } diff --git a/agc_2-X/trunk/www/vicidial/verticalbargraph.css b/agc_2-X/trunk/www/vicidial/verticalbargraph.css new file mode 100644 index 00000000..1ecf1941 --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/verticalbargraph.css @@ -0,0 +1,57 @@ + +.verticalBarGraph { + border-bottom: 1px solid #FFF; + height: 200px; + margin: 0; + padding: 0; + position: relative; + } + +.verticalBarGraph li { + border: 1px solid #555; + border-bottom: none; + bottom: 0; + list-style:none; + margin: 0; + padding: 0; + position: relative; + text-align: center; + width: 39px; + } + +.barGraph { + background: url(images/horizontal_grid_line_50_pixel.png) bottom left; + border-bottom: 3px solid #333; + font: 9px Helvetica, Geneva, sans-serif; + height: 200px; + margin: 1em 0; + padding: 0; + position: relative; + } + +.barGraph li { + background: #666 url(images/bar_50_percent_highlight.png) repeat-y top right; + border: 1px solid #555; + border-bottom: none; + bottom: 0; + color: #FFF; + margin: 0; + padding: 0 0 0 0; + position: absolute; + list-style: none; + text-align: center; + width: 39px; + } + +.barGraph li.p1{ + background-color:#FFFFFF; + color: #000; +} +/* +.barGraph li.p2{ background-color:#AAAAAA } +.barGraph li.p3{ background-color:#888888 } +.barGraph li.p4{ background-color:#666666 } +*/ +.barGraph li.p2{ background-color:#B66 } +.barGraph li.p3{ background-color:#944 } +.barGraph li.p4{ background-color:#722 } diff --git a/agc_2-X/trunk/www/vicidial/voice_lab.php b/agc_2-X/trunk/www/vicidial/voice_lab.php index 8b9621f6..2eaaf88c 100644 --- a/agc_2-X/trunk/www/vicidial/voice_lab.php +++ b/agc_2-X/trunk/www/vicidial/voice_lab.php @@ -4,7 +4,7 @@ # This script is designed to broadcast a recorded message or allow a person to # speak to all agents logged into a VICIDIAL campaign. # -# Copyright (C) 2009 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 +# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2 # # # CHANGES @@ -12,6 +12,7 @@ # 61220-1050 - First Build # 70115-1246 - Added ability to define an exten to play # 90508-0644 - Changed to PHP long tags +# 120223-2124 - Removed logging of good login passwords if webroot writable is enabled # require("dbconnect.php"); @@ -70,21 +71,20 @@ $browser = getenv("HTTP_USER_AGENT"); } else { - if($auth>0) { $office_no=strtoupper($PHP_AUTH_USER); $password=strtoupper($PHP_AUTH_PW); - $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; - $rslt=mysql_query($stmt, $link); - $row=mysql_fetch_row($rslt); - $LOGfullname=$row[0]; - fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|$LOGfullname|\n"); + $stmt="SELECT full_name from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW'"; + $rslt=mysql_query($stmt, $link); + $row=mysql_fetch_row($rslt); + $LOGfullname=$row[0]; + fwrite ($fp, "VICIDIAL|GOOD|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|$LOGfullname|\n"); fclose($fp); } else { - fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|$PHP_AUTH_PW|$ip|$browser|\n"); + fwrite ($fp, "VICIDIAL|FAIL|$date|$PHP_AUTH_USER|XXXX|$ip|$browser|\n"); fclose($fp); } @@ -92,7 +92,6 @@ $browser = getenv("HTTP_USER_AGENT"); $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $full_name = $row[0]; - } @@ -140,91 +139,8 @@ echo "<META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=utf-8\">\n" <?php if ($NEW_VOICE_LAB > 0) -{ + { if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) ) - { - echo "<br><br><br>TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW<br>\n"; - - echo "<br>or, you can enter an extension that you want played below<form action=$PHP_SELF method=POST>\n"; - echo "<input type=hidden name=PLAY_MESSAGE value=2>\n"; - echo "<input type=hidden name=session_id value=8600900>\n"; - echo "<input type=hidden name=server_ip value=$server_ip>\n"; - echo "<input type=hidden name=campaign_id value=$campaign_id>\n"; - echo "Message Extension<input type=text name=message>\n"; - echo "<input type=submit name=submit value='PLAY THIS MESSAGE'>\n"; - echo "</form><BR><BR><BR>\n"; - - $S='*'; - $D_s_ip = explode('.', $server_ip); - if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} - if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} - if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} - if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} - if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} - if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} - if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} - if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} - $remote_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$session_id"; - - $thirty_minutes_old = mktime(date("H"), date("i"), date("s")-30, date("m"), date("d"), date("Y")); - $past_thirty = date("Y-m-d H:i:s",$thirty_minutes_old); - - $stmt="SELECT conf_exten,server_ip,user from vicidial_live_agents where last_update_time > '$past_thirty' and campaign_id='$campaign_id';"; - $rslt=mysql_query($stmt, $link); - $agents_to_loop = mysql_num_rows($rslt); - $agents_sessions[0]=''; - $agents_servers[0]=''; - $agents_users[0]=''; - - $o=0; - while ($agents_to_loop > $o) - { - $rowx=mysql_fetch_row($rslt); - $agents_sessions[$o] = "$rowx[0]"; - $agents_servers[$o] = "$rowx[1]"; - $agents_users[$o] = "$rowx[2]"; - $o++; - } - - $o=0; - while ($agents_to_loop > $o) - { - if ($agents_servers[$o] == "$server_ip") - {$dial_string = $session_id;} - else - {$dial_string = $remote_dialstring;} - - $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$agents_servers[$o]','','Originate','VL$FILE_datetime$o','Channel: $local_DEF$dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $agents_sessions[$o]','Priority: 1','Callerid: VL$FILE_datetime$o','','','','','')"; - echo "|$stmt|\n<BR><BR>\n"; - $rslt=mysql_query($stmt, $link); - - echo "LOGGED IN USER $agents_users[$o] at session $agents_sessions[$o] on server $agents_servers[$o]\n"; - - $o++; - } - - - - echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n"; - echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n"; - echo "<input type=hidden name=session_id value=8600900>\n"; - echo "<input type=hidden name=server_ip value=$server_ip>\n"; - echo "<input type=hidden name=campaign_id value=$campaign_id>\n"; - echo "<input type=submit name=submit value='KILL THIS VOICE LAB'>\n"; - echo "</form><BR><BR><BR>\n"; - } - else - { - echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n"; - echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n"; - echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n"; - } -} -else -{ - if ($PLAY_MESSAGE > 0) - { - if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) && (strlen($message) > 0) ) { echo "<br><br><br>TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW<br>\n"; @@ -237,14 +153,56 @@ else echo "<input type=submit name=submit value='PLAY THIS MESSAGE'>\n"; echo "</form><BR><BR><BR>\n"; - $nn='99'; - $n='9'; + $S='*'; + $D_s_ip = explode('.', $server_ip); + if (strlen($D_s_ip[0])<2) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[0])<3) {$D_s_ip[0] = "0$D_s_ip[0]";} + if (strlen($D_s_ip[1])<2) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[1])<3) {$D_s_ip[1] = "0$D_s_ip[1]";} + if (strlen($D_s_ip[2])<2) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[2])<3) {$D_s_ip[2] = "0$D_s_ip[2]";} + if (strlen($D_s_ip[3])<2) {$D_s_ip[3] = "0$D_s_ip[3]";} + if (strlen($D_s_ip[3])<3) {$D_s_ip[3] = "0$D_s_ip[3]";} + $remote_dialstring = "$D_s_ip[0]$S$D_s_ip[1]$S$D_s_ip[2]$S$D_s_ip[3]$S$session_id"; - $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VL$FILE_datetime$nn','Channel: $local_DEF$n$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $message','Priority: 1','Callerid: VL$FILE_datetime$nn','','','','','')"; - echo "|$stmt|\n<BR><BR>\n"; + $thirty_minutes_old = mktime(date("H"), date("i"), date("s")-30, date("m"), date("d"), date("Y")); + $past_thirty = date("Y-m-d H:i:s",$thirty_minutes_old); + + $stmt="SELECT conf_exten,server_ip,user from vicidial_live_agents where last_update_time > '$past_thirty' and campaign_id='$campaign_id';"; $rslt=mysql_query($stmt, $link); + $agents_to_loop = mysql_num_rows($rslt); + $agents_sessions[0]=''; + $agents_servers[0]=''; + $agents_users[0]=''; + + $o=0; + while ($agents_to_loop > $o) + { + $rowx=mysql_fetch_row($rslt); + $agents_sessions[$o] = "$rowx[0]"; + $agents_servers[$o] = "$rowx[1]"; + $agents_users[$o] = "$rowx[2]"; + $o++; + } + + $o=0; + while ($agents_to_loop > $o) + { + if ($agents_servers[$o] == "$server_ip") + {$dial_string = $session_id;} + else + {$dial_string = $remote_dialstring;} + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$agents_servers[$o]','','Originate','VL$FILE_datetime$o','Channel: $local_DEF$dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $agents_sessions[$o]','Priority: 1','Callerid: VL$FILE_datetime$o','','','','','')"; + echo "|$stmt|\n<BR><BR>\n"; + $rslt=mysql_query($stmt, $link); + + echo "LOGGED IN USER $agents_users[$o] at session $agents_sessions[$o] on server $agents_servers[$o]\n"; + + $o++; + } + - echo "MESSAGE $message played at session $session_id on server $server_ip\n"; echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n"; echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n"; @@ -263,50 +221,91 @@ else } else { - echo "<br>Start a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n"; - echo "<input type=hidden name=NEW_VOICE_LAB value=2>\n"; - echo "<input type=hidden name=session_id value=8600900>\n"; - echo "Your Server: <select size=1 name=server_ip>$servers_list</select>\n"; - echo "<BR>\n"; - echo "Campaign: <select size=1 name=campaign_id>$campaigns_list</select>"; - echo "<BR>\n"; - echo "<input type=submit name=submit value=submit>\n"; - echo "</form><BR><BR><BR>\n"; + if ($PLAY_MESSAGE > 0) + { + if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) && (strlen($message) > 0) ) + { + echo "<br><br><br>TO START YOUR VOICE LAB, DIAL 9$session_id ON YOUR PHONE NOW<br>\n"; + + echo "<br>or, you can enter an extension that you want played below<form action=$PHP_SELF method=POST>\n"; + echo "<input type=hidden name=PLAY_MESSAGE value=2>\n"; + echo "<input type=hidden name=session_id value=8600900>\n"; + echo "<input type=hidden name=server_ip value=$server_ip>\n"; + echo "<input type=hidden name=campaign_id value=$campaign_id>\n"; + echo "Message Extension<input type=text name=message>\n"; + echo "<input type=submit name=submit value='PLAY THIS MESSAGE'>\n"; + echo "</form><BR><BR><BR>\n"; + + $nn='99'; + $n='9'; + + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VL$FILE_datetime$nn','Channel: $local_DEF$n$session_id$local_AMP$ext_context','Context: $ext_context','Exten: $message','Priority: 1','Callerid: VL$FILE_datetime$nn','','','','','')"; + echo "|$stmt|\n<BR><BR>\n"; + $rslt=mysql_query($stmt, $link); + + echo "MESSAGE $message played at session $session_id on server $server_ip\n"; + + echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n"; + echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n"; + echo "<input type=hidden name=session_id value=8600900>\n"; + echo "<input type=hidden name=server_ip value=$server_ip>\n"; + echo "<input type=hidden name=campaign_id value=$campaign_id>\n"; + echo "<input type=submit name=submit value='KILL THIS VOICE LAB'>\n"; + echo "</form><BR><BR><BR>\n"; + } + else + { + echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n"; + echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n"; + } + } + else + { + echo "<br>Start a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n"; + echo "<input type=hidden name=NEW_VOICE_LAB value=2>\n"; + echo "<input type=hidden name=session_id value=8600900>\n"; + echo "Your Server: <select size=1 name=server_ip>$servers_list</select>\n"; + echo "<BR>\n"; + echo "Campaign: <select size=1 name=campaign_id>$campaigns_list</select>"; + echo "<BR>\n"; + echo "<input type=submit name=submit value=submit>\n"; + echo "</form><BR><BR><BR>\n"; - echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n"; - echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n"; - echo "<input type=hidden name=session_id value=8600900>\n"; - echo "Your Server: <select size=1 name=server_ip>$servers_list</select>\n"; - echo "<BR>\n"; - echo "Campaign: <select size=1 name=campaign_id>$campaigns_list</select>"; - echo "<BR>\n"; - echo "<input type=submit name=submit value=submit>\n"; - echo "</form><BR><BR><BR>\n"; + echo "<br>Kill a Voice Lab Session: 8600900<form action=$PHP_SELF method=POST>\n"; + echo "<input type=hidden name=KILL_VOICE_LAB value=2>\n"; + echo "<input type=hidden name=session_id value=8600900>\n"; + echo "Your Server: <select size=1 name=server_ip>$servers_list</select>\n"; + echo "<BR>\n"; + echo "Campaign: <select size=1 name=campaign_id>$campaigns_list</select>"; + echo "<BR>\n"; + echo "<input type=submit name=submit value=submit>\n"; + echo "</form><BR><BR><BR>\n"; + } } -} if ($KILL_VOICE_LAB > 1) -{ + { if ( (strlen($server_ip) > 6) && (strlen($session_id) > 6) && (strlen($campaign_id) > 2) ) - { - $kill_dial_string = "5555$session_id"; - $hangup_exten='8300'; - $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VLK$FILE_datetime','Channel: $local_DEF$kill_dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $hangup_exten','Priority: 1','Callerid: VLK$FILE_datetime','','','','','')"; - echo "|$stmt|\n<BR><BR>\n"; - $rslt=mysql_query($stmt, $link); + { + $kill_dial_string = "5555$session_id"; + $hangup_exten='8300'; + $stmt="INSERT INTO vicidial_manager values('','','$MYSQL_datetime','NEW','N','$server_ip','','Originate','VLK$FILE_datetime','Channel: $local_DEF$kill_dial_string$local_AMP$ext_context','Context: $ext_context','Exten: $hangup_exten','Priority: 1','Callerid: VLK$FILE_datetime','','','','','')"; + echo "|$stmt|\n<BR><BR>\n"; + $rslt=mysql_query($stmt, $link); - echo "VOICELAB SESSION KILLED: $session_id at $server_ip | $KILL_VOICE_LAB\n"; - } + echo "VOICELAB SESSION KILLED: $session_id at $server_ip | $KILL_VOICE_LAB\n"; + } else - { - echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n"; - echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n"; - echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n"; - } + { + echo "ERROR!!!! Not all info entered properly\n<BR><BR>\n"; + echo "|$server_ip| |$session_id| |$campaign_id|\n<BR><BR>\n"; + echo "<a href=\"$PHP_SELF\">Back to main voicelab screen</a>\n<BR><BR>\n"; + } -} + } ?> diff --git a/agc_2-X/trunk/www/vicidial/wz_jsgraphics.js b/agc_2-X/trunk/www/vicidial/wz_jsgraphics.js new file mode 100644 index 00000000..c0ed67c2 --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/wz_jsgraphics.js @@ -0,0 +1,943 @@ +/* This notice must be untouched at all times. + +wz_jsgraphics.js v. 2.33 +The latest version is available at +http://www.walterzorn.com +or http://www.devira.com +or http://www.walterzorn.de + +Copyright (c) 2002-2004 Walter Zorn. All rights reserved. +Created 3. 11. 2002 by Walter Zorn (Web: http://www.walterzorn.com ) +Last modified: 24. 10. 2005 + +Performance optimizations for Internet Explorer +by Thomas Frank and John Holdsworth. +fillPolygon method implemented by Matthieu Haller. + +High Performance JavaScript Graphics Library. +Provides methods +- to draw lines, rectangles, ellipses, polygons + with specifiable line thickness, +- to fill rectangles and ellipses +- to draw text. +NOTE: Operations, functions and branching have rather been optimized +to efficiency and speed than to shortness of source code. + +LICENSE: LGPL + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License (LGPL) as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA, +or see http://www.gnu.org/copyleft/lesser.html +*/ + + +var jg_ihtm, jg_ie, jg_fast, jg_dom, jg_moz, +jg_n4 = (document.layers && typeof document.classes != "undefined"); + + +function chkDHTM(x, i) +{ + x = document.body || null; + jg_ie = x && typeof x.insertAdjacentHTML != "undefined"; + jg_dom = (x && !jg_ie && + typeof x.appendChild != "undefined" && + typeof document.createRange != "undefined" && + typeof (i = document.createRange()).setStartBefore != "undefined" && + typeof i.createContextualFragment != "undefined"); + jg_ihtm = !jg_ie && !jg_dom && x && typeof x.innerHTML != "undefined"; + jg_fast = jg_ie && document.all && !window.opera; + jg_moz = jg_dom && typeof x.style.MozOpacity != "undefined"; +} + + +function pntDoc() +{ + this.wnd.document.write(jg_fast? this.htmRpc() : this.htm); + this.htm = ''; +} + + +function pntCnvDom() +{ + var x = document.createRange(); + x.setStartBefore(this.cnv); + x = x.createContextualFragment(jg_fast? this.htmRpc() : this.htm); + this.cnv.appendChild(x); + this.htm = ''; +} + + +function pntCnvIe() +{ + this.cnv.insertAdjacentHTML("BeforeEnd", jg_fast? this.htmRpc() : this.htm); + this.htm = ''; +} + + +function pntCnvIhtm() +{ + this.cnv.innerHTML += this.htm; + this.htm = ''; +} + + +function pntCnv() +{ + this.htm = ''; +} + + +function mkDiv(x, y, w, h) +{ + this.htm += '<div style="position:absolute;'+ + 'left:' + x + 'px;'+ + 'top:' + y + 'px;'+ + 'width:' + w + 'px;'+ + 'height:' + h + 'px;'+ + 'clip:rect(0,'+w+'px,'+h+'px,0);'+ + 'background-color:' + this.color + + (!jg_moz? ';overflow:hidden' : '')+ + ';"><\/div>'; +} + + +function mkDivIe(x, y, w, h) +{ + this.htm += '%%'+this.color+';'+x+';'+y+';'+w+';'+h+';'; +} + + +function mkDivPrt(x, y, w, h) +{ + this.htm += '<div style="position:absolute;'+ + 'border-left:' + w + 'px solid ' + this.color + ';'+ + 'left:' + x + 'px;'+ + 'top:' + y + 'px;'+ + 'width:0px;'+ + 'height:' + h + 'px;'+ + 'clip:rect(0,'+w+'px,'+h+'px,0);'+ + 'background-color:' + this.color + + (!jg_moz? ';overflow:hidden' : '')+ + ';"><\/div>'; +} + + +function mkLyr(x, y, w, h) +{ + this.htm += '<layer '+ + 'left="' + x + '" '+ + 'top="' + y + '" '+ + 'width="' + w + '" '+ + 'height="' + h + '" '+ + 'bgcolor="' + this.color + '"><\/layer>\n'; +} + + +var regex = /%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g; +function htmRpc() +{ + return this.htm.replace( + regex, + '<div style="overflow:hidden;position:absolute;background-color:'+ + '$1;left:$2;top:$3;width:$4;height:$5"></div>\n'); +} + + +function htmPrtRpc() +{ + return this.htm.replace( + regex, + '<div style="overflow:hidden;position:absolute;background-color:'+ + '$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n'); +} + + +function mkLin(x1, y1, x2, y2) +{ + if (x1 > x2) + { + var _x2 = x2; + var _y2 = y2; + x2 = x1; + y2 = y1; + x1 = _x2; + y1 = _y2; + } + var dx = x2-x1, dy = Math.abs(y2-y1), + x = x1, y = y1, + yIncr = (y1 > y2)? -1 : 1; + + if (dx >= dy) + { + var pr = dy<<1, + pru = pr - (dx<<1), + p = pr-dx, + ox = x; + while ((dx--) > 0) + { + ++x; + if (p > 0) + { + this.mkDiv(ox, y, x-ox, 1); + y += yIncr; + p += pru; + ox = x; + } + else p += pr; + } + this.mkDiv(ox, y, x2-ox+1, 1); + } + + else + { + var pr = dx<<1, + pru = pr - (dy<<1), + p = pr-dy, + oy = y; + if (y2 <= y1) + { + while ((dy--) > 0) + { + if (p > 0) + { + this.mkDiv(x++, y, 1, oy-y+1); + y += yIncr; + p += pru; + oy = y; + } + else + { + y += yIncr; + p += pr; + } + } + this.mkDiv(x2, y2, 1, oy-y2+1); + } + else + { + while ((dy--) > 0) + { + y += yIncr; + if (p > 0) + { + this.mkDiv(x++, oy, 1, y-oy); + p += pru; + oy = y; + } + else p += pr; + } + this.mkDiv(x2, oy, 1, y2-oy+1); + } + } +} + + +function mkLin2D(x1, y1, x2, y2) +{ + if (x1 > x2) + { + var _x2 = x2; + var _y2 = y2; + x2 = x1; + y2 = y1; + x1 = _x2; + y1 = _y2; + } + var dx = x2-x1, dy = Math.abs(y2-y1), + x = x1, y = y1, + yIncr = (y1 > y2)? -1 : 1; + + var s = this.stroke; + if (dx >= dy) + { + if (dx > 0 && s-3 > 0) + { + var _s = (s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy) / dx; + _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1; + } + else var _s = s; + var ad = Math.ceil(s/2); + + var pr = dy<<1, + pru = pr - (dx<<1), + p = pr-dx, + ox = x; + while ((dx--) > 0) + { + ++x; + if (p > 0) + { + this.mkDiv(ox, y, x-ox+ad, _s); + y += yIncr; + p += pru; + ox = x; + } + else p += pr; + } + this.mkDiv(ox, y, x2-ox+ad+1, _s); + } + + else + { + if (s-3 > 0) + { + var _s = (s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy) / dy; + _s = (!(s-4)? Math.ceil(_s) : Math.round(_s)) + 1; + } + else var _s = s; + var ad = Math.round(s/2); + + var pr = dx<<1, + pru = pr - (dy<<1), + p = pr-dy, + oy = y; + if (y2 <= y1) + { + ++ad; + while ((dy--) > 0) + { + if (p > 0) + { + this.mkDiv(x++, y, _s, oy-y+ad); + y += yIncr; + p += pru; + oy = y; + } + else + { + y += yIncr; + p += pr; + } + } + this.mkDiv(x2, y2, _s, oy-y2+ad); + } + else + { + while ((dy--) > 0) + { + y += yIncr; + if (p > 0) + { + this.mkDiv(x++, oy, _s, y-oy+ad); + p += pru; + oy = y; + } + else p += pr; + } + this.mkDiv(x2, oy, _s, y2-oy+ad+1); + } + } +} + + +function mkLinDott(x1, y1, x2, y2) +{ + if (x1 > x2) + { + var _x2 = x2; + var _y2 = y2; + x2 = x1; + y2 = y1; + x1 = _x2; + y1 = _y2; + } + var dx = x2-x1, dy = Math.abs(y2-y1), + x = x1, y = y1, + yIncr = (y1 > y2)? -1 : 1, + drw = true; + if (dx >= dy) + { + var pr = dy<<1, + pru = pr - (dx<<1), + p = pr-dx; + while ((dx--) > 0) + { + if (drw) this.mkDiv(x, y, 1, 1); + drw = !drw; + if (p > 0) + { + y += yIncr; + p += pru; + } + else p += pr; + ++x; + } + if (drw) this.mkDiv(x, y, 1, 1); + } + + else + { + var pr = dx<<1, + pru = pr - (dy<<1), + p = pr-dy; + while ((dy--) > 0) + { + if (drw) this.mkDiv(x, y, 1, 1); + drw = !drw; + y += yIncr; + if (p > 0) + { + ++x; + p += pru; + } + else p += pr; + } + if (drw) this.mkDiv(x, y, 1, 1); + } +} + + +function mkOv(left, top, width, height) +{ + var a = width>>1, b = height>>1, + wod = width&1, hod = (height&1)+1, + cx = left+a, cy = top+b, + x = 0, y = b, + ox = 0, oy = b, + aa = (a*a)<<1, bb = (b*b)<<1, + st = (aa>>1)*(1-(b<<1)) + bb, + tt = (bb>>1) - aa*((b<<1)-1), + w, h; + while (y > 0) + { + if (st < 0) + { + st += bb*((x<<1)+3); + tt += (bb<<1)*(++x); + } + else if (tt < 0) + { + st += bb*((x<<1)+3) - (aa<<1)*(y-1); + tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3); + w = x-ox; + h = oy-y; + if (w&2 && h&2) + { + this.mkOvQds(cx, cy, -x+2, ox+wod, -oy, oy-1+hod, 1, 1); + this.mkOvQds(cx, cy, -x+1, x-1+wod, -y-1, y+hod, 1, 1); + } + else this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, oy-h+hod, w, h); + ox = x; + oy = y; + } + else + { + tt -= aa*((y<<1)-3); + st -= (aa<<1)*(--y); + } + } + this.mkDiv(cx-a, cy-oy, a-ox+1, (oy<<1)+hod); + this.mkDiv(cx+ox+wod, cy-oy, a-ox+1, (oy<<1)+hod); +} + + +function mkOv2D(left, top, width, height) +{ + var s = this.stroke; + width += s-1; + height += s-1; + var a = width>>1, b = height>>1, + wod = width&1, hod = (height&1)+1, + cx = left+a, cy = top+b, + x = 0, y = b, + aa = (a*a)<<1, bb = (b*b)<<1, + st = (aa>>1)*(1-(b<<1)) + bb, + tt = (bb>>1) - aa*((b<<1)-1); + + if (s-4 < 0 && (!(s-2) || width-51 > 0 && height-51 > 0)) + { + var ox = 0, oy = b, + w, h, + pxl, pxr, pxt, pxb, pxw; + while (y > 0) + { + if (st < 0) + { + st += bb*((x<<1)+3); + tt += (bb<<1)*(++x); + } + else if (tt < 0) + { + st += bb*((x<<1)+3) - (aa<<1)*(y-1); + tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3); + w = x-ox; + h = oy-y; + + if (w-1) + { + pxw = w+1+(s&1); + h = s; + } + else if (h-1) + { + pxw = s; + h += 1+(s&1); + } + else pxw = h = s; + this.mkOvQds(cx, cy, -x+1, ox-pxw+w+wod, -oy, -h+oy+hod, pxw, h); + ox = x; + oy = y; + } + else + { + tt -= aa*((y<<1)-3); + st -= (aa<<1)*(--y); + } + } + this.mkDiv(cx-a, cy-oy, s, (oy<<1)+hod); + this.mkDiv(cx+a+wod-s+1, cy-oy, s, (oy<<1)+hod); + } + + else + { + var _a = (width-((s-1)<<1))>>1, + _b = (height-((s-1)<<1))>>1, + _x = 0, _y = _b, + _aa = (_a*_a)<<1, _bb = (_b*_b)<<1, + _st = (_aa>>1)*(1-(_b<<1)) + _bb, + _tt = (_bb>>1) - _aa*((_b<<1)-1), + + pxl = new Array(), + pxt = new Array(), + _pxb = new Array(); + pxl[0] = 0; + pxt[0] = b; + _pxb[0] = _b-1; + while (y > 0) + { + if (st < 0) + { + st += bb*((x<<1)+3); + tt += (bb<<1)*(++x); + pxl[pxl.length] = x; + pxt[pxt.length] = y; + } + else if (tt < 0) + { + st += bb*((x<<1)+3) - (aa<<1)*(y-1); + tt += (bb<<1)*(++x) - aa*(((y--)<<1)-3); + pxl[pxl.length] = x; + pxt[pxt.length] = y; + } + else + { + tt -= aa*((y<<1)-3); + st -= (aa<<1)*(--y); + } + + if (_y > 0) + { + if (_st < 0) + { + _st += _bb*((_x<<1)+3); + _tt += (_bb<<1)*(++_x); + _pxb[_pxb.length] = _y-1; + } + else if (_tt < 0) + { + _st += _bb*((_x<<1)+3) - (_aa<<1)*(_y-1); + _tt += (_bb<<1)*(++_x) - _aa*(((_y--)<<1)-3); + _pxb[_pxb.length] = _y-1; + } + else + { + _tt -= _aa*((_y<<1)-3); + _st -= (_aa<<1)*(--_y); + _pxb[_pxb.length-1]--; + } + } + } + + var ox = 0, oy = b, + _oy = _pxb[0], + l = pxl.length, + w, h; + for (var i = 0; i < l; i++) + { + if (typeof _pxb[i] != "undefined") + { + if (_pxb[i] < _oy || pxt[i] < oy) + { + x = pxl[i]; + this.mkOvQds(cx, cy, -x+1, ox+wod, -oy, _oy+hod, x-ox, oy-_oy); + ox = x; + oy = pxt[i]; + _oy = _pxb[i]; + } + } + else + { + x = pxl[i]; + this.mkDiv(cx-x+1, cy-oy, 1, (oy<<1)+hod); + this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); + ox = x; + oy = pxt[i]; + } + } + this.mkDiv(cx-a, cy-oy, 1, (oy<<1)+hod); + this.mkDiv(cx+ox+wod, cy-oy, 1, (oy<<1)+hod); + } +} + + +function mkOvDott(left, top, width, height) +{ + var a = width>>1, b = height>>1, + wod = width&1, hod = height&1, + cx = left+a, cy = top+b, + x = 0, y = b, + aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1, + st = (aa2>>1)*(1-(b<<1)) + bb, + tt = (bb>>1) - aa2*((b<<1)-1), + drw = true; + while (y > 0) + { + if (st < 0) + { + st += bb*((x<<1)+3); + tt += (bb<<1)*(++x); + } + else if (tt < 0) + { + st += bb*((x<<1)+3) - aa4*(y-1); + tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3); + } + else + { + tt -= aa2*((y<<1)-3); + st -= aa4*(--y); + } + if (drw) this.mkOvQds(cx, cy, -x, x+wod, -y, y+hod, 1, 1); + drw = !drw; + } +} + + +function mkRect(x, y, w, h) +{ + var s = this.stroke; + this.mkDiv(x, y, w, s); + this.mkDiv(x+w, y, s, h); + this.mkDiv(x, y+h, w+s, s); + this.mkDiv(x, y+s, s, h-s); +} + + +function mkRectDott(x, y, w, h) +{ + this.drawLine(x, y, x+w, y); + this.drawLine(x+w, y, x+w, y+h); + this.drawLine(x, y+h, x+w, y+h); + this.drawLine(x, y, x, y+h); +} + + +function jsgFont() +{ + this.PLAIN = 'font-weight:normal;'; + this.BOLD = 'font-weight:bold;'; + this.ITALIC = 'font-style:italic;'; + this.ITALIC_BOLD = this.ITALIC + this.BOLD; + this.BOLD_ITALIC = this.ITALIC_BOLD; +} +var Font = new jsgFont(); + + +function jsgStroke() +{ + this.DOTTED = -1; +} +var Stroke = new jsgStroke(); + + +function jsGraphics(id, wnd) +{ + this.setColor = new Function('arg', 'this.color = arg.toLowerCase();'); + + this.setStroke = function(x) + { + this.stroke = x; + if (!(x+1)) + { + this.drawLine = mkLinDott; + this.mkOv = mkOvDott; + this.drawRect = mkRectDott; + } + else if (x-1 > 0) + { + this.drawLine = mkLin2D; + this.mkOv = mkOv2D; + this.drawRect = mkRect; + } + else + { + this.drawLine = mkLin; + this.mkOv = mkOv; + this.drawRect = mkRect; + } + }; + + + this.setPrintable = function(arg) + { + this.printable = arg; + if (jg_fast) + { + this.mkDiv = mkDivIe; + this.htmRpc = arg? htmPrtRpc : htmRpc; + } + else this.mkDiv = jg_n4? mkLyr : arg? mkDivPrt : mkDiv; + }; + + + this.setFont = function(fam, sz, sty) + { + this.ftFam = fam; + this.ftSz = sz; + this.ftSty = sty || Font.PLAIN; + }; + + + this.drawPolyline = this.drawPolyLine = function(x, y, s) + { + for (var i=0 ; i<x.length-1 ; i++ ) + this.drawLine(x[i], y[i], x[i+1], y[i+1]); + }; + + + this.fillRect = function(x, y, w, h) + { + this.mkDiv(x, y, w, h); + }; + + + this.drawPolygon = function(x, y) + { + this.drawPolyline(x, y); + this.drawLine(x[x.length-1], y[x.length-1], x[0], y[0]); + }; + + + this.drawEllipse = this.drawOval = function(x, y, w, h) + { + this.mkOv(x, y, w, h); + }; + + + this.fillEllipse = this.fillOval = function(left, top, w, h) + { + var a = (w -= 1)>>1, b = (h -= 1)>>1, + wod = (w&1)+1, hod = (h&1)+1, + cx = left+a, cy = top+b, + x = 0, y = b, + ox = 0, oy = b, + aa2 = (a*a)<<1, aa4 = aa2<<1, bb = (b*b)<<1, + st = (aa2>>1)*(1-(b<<1)) + bb, + tt = (bb>>1) - aa2*((b<<1)-1), + pxl, dw, dh; + if (w+1) while (y > 0) + { + if (st < 0) + { + st += bb*((x<<1)+3); + tt += (bb<<1)*(++x); + } + else if (tt < 0) + { + st += bb*((x<<1)+3) - aa4*(y-1); + pxl = cx-x; + dw = (x<<1)+wod; + tt += (bb<<1)*(++x) - aa2*(((y--)<<1)-3); + dh = oy-y; + this.mkDiv(pxl, cy-oy, dw, dh); + this.mkDiv(pxl, cy+y+hod, dw, dh); + ox = x; + oy = y; + } + else + { + tt -= aa2*((y<<1)-3); + st -= aa4*(--y); + } + } + this.mkDiv(cx-a, cy-oy, w+1, (oy<<1)+hod); + }; + + +/* fillPolygon method, implemented by Matthieu Haller. +This javascript function is an adaptation of the gdImageFilledPolygon for Walter Zorn lib. +C source of GD 1.8.4 found at http://www.boutell.com/gd/ + +THANKS to Kirsten Schulz for the polygon fixes! + +The intersection finding technique of this code could be improved +by remembering the previous intertersection, and by using the slope. +That could help to adjust intersections to produce a nice +interior_extrema. */ + this.fillPolygon = function(array_x, array_y) + { + var i; + var y; + var miny, maxy; + var x1, y1; + var x2, y2; + var ind1, ind2; + var ints; + + var n = array_x.length; + + if (!n) return; + + + miny = array_y[0]; + maxy = array_y[0]; + for (i = 1; i < n; i++) + { + if (array_y[i] < miny) + miny = array_y[i]; + + if (array_y[i] > maxy) + maxy = array_y[i]; + } + for (y = miny; y <= maxy; y++) + { + var polyInts = new Array(); + ints = 0; + for (i = 0; i < n; i++) + { + if (!i) + { + ind1 = n-1; + ind2 = 0; + } + else + { + ind1 = i-1; + ind2 = i; + } + y1 = array_y[ind1]; + y2 = array_y[ind2]; + if (y1 < y2) + { + x1 = array_x[ind1]; + x2 = array_x[ind2]; + } + else if (y1 > y2) + { + y2 = array_y[ind1]; + y1 = array_y[ind2]; + x2 = array_x[ind1]; + x1 = array_x[ind2]; + } + else continue; + + // modified 11. 2. 2004 Walter Zorn + if ((y >= y1) && (y < y2)) + polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1); + + else if ((y == maxy) && (y > y1) && (y <= y2)) + polyInts[ints++] = Math.round((y-y1) * (x2-x1) / (y2-y1) + x1); + } + polyInts.sort(integer_compare); + for (i = 0; i < ints; i+=2) + this.mkDiv(polyInts[i], y, polyInts[i+1]-polyInts[i]+1, 1); + } + }; + + + this.drawString = function(txt, x, y) + { + this.htm += '<div style="position:absolute;white-space:nowrap;'+ + 'left:' + x + 'px;'+ + 'top:' + y + 'px;'+ + 'font-family:' + this.ftFam + ';'+ + 'font-size:' + this.ftSz + ';'+ + 'color:' + this.color + ';' + this.ftSty + '">'+ + txt + + '<\/div>'; + }; + + +/* drawStringRect() added by Rick Blommers. +Allows to specify the size of the text rectangle and to align the +text both horizontally (e.g. right) and vertically within that rectangle */ + this.drawStringRect = function(txt, x, y, width, halign) + { + this.htm += '<div style="position:absolute;overflow:hidden;'+ + 'left:' + x + 'px;'+ + 'top:' + y + 'px;'+ + 'width:'+width +'px;'+ + 'text-align:'+halign+';'+ + 'font-family:' + this.ftFam + ';'+ + 'font-size:' + this.ftSz + ';'+ + 'color:' + this.color + ';' + this.ftSty + '">'+ + txt + + '<\/div>'; + }; + + + this.drawImage = function(imgSrc, x, y, w, h, a) + { + this.htm += '<div style="position:absolute;'+ + 'left:' + x + 'px;'+ + 'top:' + y + 'px;'+ + 'width:' + w + ';'+ + 'height:' + h + ';">'+ + '<img src="' + imgSrc + '" width="' + w + '" height="' + h + '"' + (a? (' '+a) : '') + '>'+ + '<\/div>'; + }; + + + this.clear = function() + { + this.htm = ""; + if (this.cnv) this.cnv.innerHTML = this.defhtm; + }; + + + this.mkOvQds = function(cx, cy, xl, xr, yt, yb, w, h) + { + this.mkDiv(xr+cx, yt+cy, w, h); + this.mkDiv(xr+cx, yb+cy, w, h); + this.mkDiv(xl+cx, yb+cy, w, h); + this.mkDiv(xl+cx, yt+cy, w, h); + }; + + this.setStroke(1); + this.setFont('verdana,geneva,helvetica,sans-serif', String.fromCharCode(0x31, 0x32, 0x70, 0x78), Font.PLAIN); + this.color = '#000000'; + this.htm = ''; + this.wnd = wnd || window; + + if (!(jg_ie || jg_dom || jg_ihtm)) chkDHTM(); + if (typeof id != 'string' || !id) this.paint = pntDoc; + else + { + this.cnv = document.all? (this.wnd.document.all[id] || null) + : document.getElementById? (this.wnd.document.getElementById(id) || null) + : null; + this.defhtm = (this.cnv && this.cnv.innerHTML)? this.cnv.innerHTML : ''; + this.paint = jg_dom? pntCnvDom : jg_ie? pntCnvIe : jg_ihtm? pntCnvIhtm : pntCnv; + } + + this.setPrintable(false); +} + + + +function integer_compare(x,y) +{ + return (x < y) ? -1 : ((x > y)*1); +} +