From eb8f732fbedc2ed5f935ee8cdddf28b6f848d948 Mon Sep 17 00:00:00 2001 From: mattf Date: Tue, 9 Aug 2011 20:34:24 +0000 Subject: [PATCH] Added noanswer logging feature to System Settings, will log only auto-dial calls that are not answered to a separate table Added new Team Performance Detail report to the Reports page. This is a fairly detailed and database-intensive report that summarizes several user-grouped statistics git-svn-id: svn://192.168.202.10@1708 3d104415-ff17-0410-8863-d5cf3c621b8a --- agc_2-X/trunk/UPGRADE | 7 + agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl | 54 ++ agc_2-X/trunk/bin/AST_VDauto_dial.pl | 173 +++- agc_2-X/trunk/bin/AST_VDsales_export.pl | 4 +- .../trunk/extras/MySQL_AST_CREATE_tables.sql | 36 +- agc_2-X/trunk/extras/upgrade_2.4.sql | 39 + .../TO_BE_TRANSLATED_2.4.txt | 6 + .../vicidial/AST_team_performance_detail.php | 776 ++++++++++++++++++ agc_2-X/trunk/www/vicidial/admin.php | 86 +- 9 files changed, 1170 insertions(+), 11 deletions(-) create mode 100644 agc_2-X/trunk/www/vicidial/AST_team_performance_detail.php diff --git a/agc_2-X/trunk/UPGRADE b/agc_2-X/trunk/UPGRADE index edc98c6b..2b30be1a 100644 --- a/agc_2-X/trunk/UPGRADE +++ b/agc_2-X/trunk/UPGRADE @@ -670,6 +670,13 @@ OTHER CHANGES: dial statuses so that the other leads tied by vendor_lead_code in the campaign's lists are not deactivated. +152. Added noanswer logging feature to System Settings, will log only auto-dial + calls that are not answered to a separate table + +153. Added new Team Performance Detail report to the Reports page. This is a + fairly detailed and database-intensive report that summarizes several + user-grouped statistics + diff --git a/agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl b/agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl index e32f6447..553e2c13 100644 --- a/agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl +++ b/agc_2-X/trunk/bin/ADMIN_archive_log_tables.pl @@ -32,6 +32,7 @@ # 110430-1442 - Added queue-log and closer-log options, changed quiet to --quiet flag # 110525-1040 - Added vicidial_outbound_ivr_log archiving # 110801-2140 - Added vicidial_url_log table purging and vicidial_log_extended to rolling processes +# 110808-0055 - Added vicidial_log_noanswer process # ### begin parsing run-time options ### @@ -404,6 +405,7 @@ if (!$T) } + ##### vicidial_log_extended $stmtA = "SELECT count(*) from vicidial_log_extended;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; @@ -454,6 +456,58 @@ if (!$T) } + + ##### vicidial_log_noanswer + $stmtA = "SELECT count(*) from vicidial_log_noanswer;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $vicidial_log_noanswer_count = $aryA[0]; + } + $sthA->finish(); + + $stmtA = "SELECT count(*) from vicidial_log_noanswer_archive;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $vicidial_log_noanswer_archive_count = $aryA[0]; + } + $sthA->finish(); + + if (!$Q) {print "\nProcessing vicidial_log_noanswer table... ($vicidial_log_noanswer_count|$vicidial_log_noanswer_archive_count)\n";} + $stmtA = "INSERT IGNORE INTO vicidial_log_noanswer_archive SELECT * from vicidial_log_noanswer;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + + $sthArows = $sthA->rows; + if (!$Q) {print "$sthArows rows inserted into vicidial_log_noanswer_archive table \n";} + + $rv = $sthA->err(); + if (!$rv) + { + $stmtA = "DELETE FROM vicidial_log_noanswer WHERE call_date < '$del_time';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows = $sthA->rows; + if (!$Q) {print "$sthArows rows deleted from vicidial_log_noanswer table \n";} + + $stmtA = "optimize table vicidial_log_noanswer;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + + $stmtA = "optimize table vicidial_log_noanswer_archive;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + } + + + ##### server_performance $stmtA = "SELECT count(*) from server_performance;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; diff --git a/agc_2-X/trunk/bin/AST_VDauto_dial.pl b/agc_2-X/trunk/bin/AST_VDauto_dial.pl index e6a15c28..b5b5ae01 100644 --- a/agc_2-X/trunk/bin/AST_VDauto_dial.pl +++ b/agc_2-X/trunk/bin/AST_VDauto_dial.pl @@ -104,6 +104,7 @@ # 110602-0953 - Added dl_diff_target_method option # 110723-1256 - Added extra debug for vac deletes and fix for long ring/drop time # 110731-2127 - Added sections for handling MULTI_LEAD auto-alt-dial and na-call-url functions +# 110809-1516 - Added section for noanswer logging # @@ -381,9 +382,12 @@ while($one_day_interval > 0) $event_string="SERVER CALLS PER SECOND MAXIMUM SET TO: $outbound_calls_per_second |$per_call_delay|"; &event_logger; + + + ############################################# ##### Check if auto-dialing is enabled - $stmtA = "SELECT outbound_autodial_active FROM system_settings;"; + $stmtA = "SELECT outbound_autodial_active,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db FROM system_settings;"; $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; $sthArows=$sthA->rows; @@ -391,6 +395,12 @@ while($one_day_interval > 0) { @aryA = $sthA->fetchrow_array; $outbound_autodial_active = $aryA[0]; + $noanswer_log = $aryA[1]; + $alt_log_server_ip = $aryA[2]; + $alt_log_dbname = $aryA[3]; + $alt_log_login = $aryA[4]; + $alt_log_pass = $aryA[5]; + $tables_use_alt_log_db = $aryA[6]; } $sthA->finish(); @@ -2544,7 +2554,10 @@ while($one_day_interval > 0) $stmtA = "UPDATE vicidial_list SET status='MLINAT' where lead_id IN($MLnonmatch_leadids);"; $affected_rows = $dbhA->do($stmtA); - $event_string = " ML status non-match accounts inactivated: $MLnonmatch_leadids|$affected_rows|MLINAT"; + $stmtB = "DELETE FROM vicidial_hopper where lead_id IN($MLnonmatch_leadids);"; + $affected_rowsH = $dbhA->do($stmtB); + + $event_string = " ML status non-match accounts inactivated: $MLnonmatch_leadids|$affected_rows|$affected_rowsH|MLINAT"; &event_logger; } @@ -2859,6 +2872,162 @@ while($one_day_interval > 0) } + ############################################################################### + ###### sixth, if noanswer_log is enabled in the system settings then look for + ###### unprocessed entries for this server_ip and process them. + ############################################################################### + $MLincall='|INCALL|QUEUE|DISPO|'; + $MLnoanswer='|NA|B|AB|DC|ADC|CPDATB|CPDB|CPDNA|CPDREJ|CPDINV|CPDSUA|CPDSI|CPDSNC|CPDSR|CPDSUK|CPDSV|CPDUK|CPDERR|'; + + if ($noanswer_log =~ /Y/) + { + $event_string = " NO-ANSWER log check: $noanswer_log, active, checking unprocessed calls..."; + &event_logger; + + @MLuniqueid = @MT; + @MLleadid = @MT; + @MLcalldate = @MT; + @MLcallerid = @MT; + @MLflag = @MT; + @MLcampaign = @MT; + @MLstatus = @MT; + + $stmtA = "SELECT uniqueid,lead_id,call_date,caller_code FROM vicidial_log_extended where server_ip='$server_ip' and call_date > \"$RMSQLdate\" and noanswer_processed='N' order by call_date,lead_id limit 100000;"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + $vle_count=0; + $vle_auto_count=0; + while ($sthArows > $vle_count) + { + $MLflag[$vle_count] = 0; + @aryA = $sthA->fetchrow_array; + if ($aryA[3] =~ /^V/) + { + $vle_auto_count++; + $MLflag[$vle_count] = 1; + } + $MLuniqueid[$vle_count] = $aryA[0]; + $MLleadid[$vle_count] = $aryA[1]; + $MLcalldate[$vle_count] = $aryA[2]; + $MLcallerid[$vle_count] = $aryA[3]; + $vle_count++; + } + $sthA->finish(); + + $event_string = " NO-ANSWER log vle records count: $vle_count|$vle_auto_count"; + &event_logger; + + $vle_count=0; + foreach(@MLuniqueid) + { + if ($MLflag[$vle_count] > 0) + { + $vac_count=0; + $stmtA = "SELECT count(*) FROM vicidial_auto_calls where callerid='$MLcallerid[$vle_count]' and lead_id='$MLleadid[$vle_count]';"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $vac_count = $aryA[0]; + } + if ($vac_count < 1) + { + $stmtA = "SELECT status FROM vicidial_log where uniqueid='$MLuniqueid[$vle_count]' and lead_id='$MLleadid[$vle_count]' and call_date > \"$RMSQLdate\";"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + $MLstatus[$vle_count] = $aryA[0]; + + if ($MLincall !~ /\|$MLstatus[$vle_count]\|/i) + { + if ($MLnoanswer =~ /\|$MLstatus[$vle_count]\|/i) + { + if ( ($tables_use_alt_log_db =~ / vicidial_log_noanswer /i) && (length($alt_log_server_ip)>4) && (length($alt_log_dbname)>4) ) + { + $stmtA = "SELECT uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial FROM vicidial_log where uniqueid='$MLuniqueid[$vle_count]' and lead_id='$MLleadid[$vle_count]' and call_date > \"$RMSQLdate\";"; + $sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr; + $sthA->execute or die "executing: $stmtA ", $dbhA->errstr; + $sthArows=$sthA->rows; + if ($sthArows > 0) + { + @aryA = $sthA->fetchrow_array; + + $dbhD = DBI->connect("DBI:mysql:$alt_log_dbname:$alt_log_server_ip:3306", "$alt_log_login", "$alt_log_pass") + or die "Couldn't connect to database: " . DBI->errstr; + + if ($DB) {print "CONNECTED TO ALT-LOG DATABASE: $alt_log_server_ip|$alt_log_dbname\n";} + + $stmtD = "INSERT INTO vicidial_log_noanswer SET uniqueid='$aryA[0]',lead_id='$aryA[1]',list_id='$aryA[2]',campaign_id='$aryA[3]',call_date='$aryA[4]',start_epoch='$aryA[5]',end_epoch='$aryA[6]',length_in_sec='$aryA[7]',status='$aryA[8]',phone_code='$aryA[9]',phone_number='$aryA[10]',user='$aryA[11]',comments='$aryA[12]',processed='$aryA[13]',user_group='$aryA[14]',term_reason='$aryA[15]',alt_dial='$aryA[16]',caller_code='$MLcallerid[$vle_count]';"; + $affected_rows = $dbhD->do($stmtD); + + $dbhD->disconnect(); + } + else + { + $event_string = " VNA ERROR: $MLcallerid[$vle_count]|$MLuniqueid[$vle_count]|$MLleadid[$vle_count]"; + &event_logger; + } + } + else + { + ### insert vicidial_log_noanswer entry + $stmtA = "INSERT INTO vicidial_log_noanswer SELECT uniqueid,lead_id,list_id,campaign_id,call_date,start_epoch,end_epoch,length_in_sec,status,phone_code,phone_number,user,comments,processed,user_group,term_reason,alt_dial,\"$MLcallerid[$vle_count]\" from vicidial_log where uniqueid='$MLuniqueid[$vle_count]' and lead_id='$MLleadid[$vle_count]' LIMIT 1;"; + $affected_rows = $dbhA->do($stmtA); + } + + ### set noanswer to Y for processed + $stmtB = "UPDATE vicidial_log_extended SET noanswer_processed='Y' where uniqueid='$MLuniqueid[$vle_count]' and call_date='$MLcalldate[$vle_count]' and lead_id='$MLleadid[$vle_count]';"; + $affected_rowsB = $dbhA->do($stmtB); + + $event_string = " VNA match, log processed: $MLcallerid[$vle_count]|$affected_rows|$affected_rowsB"; + &event_logger; + } + else + { + ### set noanswer record to U for unqualified for noanswer logging + $stmtA = "UPDATE vicidial_log_extended SET noanswer_processed='U' where uniqueid='$MLuniqueid[$vle_count]' and call_date='$MLcalldate[$vle_count]' and lead_id='$MLleadid[$vle_count]';"; + $affected_rows = $dbhA->do($stmtA); + + $event_string = " VNA no-match, log processed: $MLcallerid[$vle_count]|$affected_rows"; + &event_logger; + } + } + else + { + $event_string = " VNA status in-call, do nothing: $MLcallerid[$vle_count]|$MLuniqueid[$vle_count]|$MLstatus[$vle_count]"; + &event_logger; + } + } + else + { + $event_string = " VNA status no vicidial_log record, do nothing: $MLcallerid[$vle_count]|$MLuniqueid[$vle_count]|$MLstatus[$vle_count]"; + &event_logger; + } + } + else + { + $event_string = " VNA active call, do nothing: $MLcallerid[$vle_count]"; + &event_logger; + } + } + else + { + ### set noanswer record to U for unqualified for noanswer logging + $stmtA = "UPDATE vicidial_log_extended SET noanswer_processed='U' where uniqueid='$MLuniqueid[$vle_count]' and call_date='$MLcalldate[$vle_count]' and lead_id='$MLleadid[$vle_count]';"; + $affected_rows = $dbhA->do($stmtA); + } + $vle_count++; + } + } + + + ############################################################################### ###### last, wait for a little bit and repeat the loop ############################################################################### diff --git a/agc_2-X/trunk/bin/AST_VDsales_export.pl b/agc_2-X/trunk/bin/AST_VDsales_export.pl index 72c77ff9..a044ec89 100644 --- a/agc_2-X/trunk/bin/AST_VDsales_export.pl +++ b/agc_2-X/trunk/bin/AST_VDsales_export.pl @@ -194,7 +194,9 @@ if (length($ARGV[0])>1) $time = timelocal(0,0,2,$cli_date[2],$cli_date[1],$cli_date[0]); } } - if (!$Q) {print "\n----- DATE OVERRIDE: $shipdate -----\n\n";} + $start_date = $shipdate; + $start_date =~ s/-//gi; + if (!$Q) {print "\n----- DATE OVERRIDE: $shipdate($start_date) -----\n\n";} } else { 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 e8aa7259..d9c66da8 100644 --- a/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql +++ b/agc_2-X/trunk/extras/MySQL_AST_CREATE_tables.sql @@ -1421,7 +1421,13 @@ test_campaign_calls ENUM('0','1') default '0', agents_calls_reset ENUM('0','1') default '1', voicemail_timezones TEXT, default_voicemail_timezone VARCHAR(30) default 'eastern', -default_local_gmt VARCHAR(6) default '-5.00' +default_local_gmt VARCHAR(6) default '-5.00', +noanswer_log ENUM('Y','N') default 'N', +alt_log_server_ip VARCHAR(50) default '', +alt_log_dbname VARCHAR(50) default '', +alt_log_login VARCHAR(50) default '', +alt_log_pass VARCHAR(50) default '', +tables_use_alt_log_db VARCHAR(2000) default '' ); CREATE TABLE vicidial_campaigns_list_mix ( @@ -2422,6 +2428,29 @@ url_response TEXT, index (uniqueid) ); +CREATE TABLE vicidial_log_noanswer ( +uniqueid VARCHAR(20) PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +list_id BIGINT(14) UNSIGNED, +campaign_id VARCHAR(8), +call_date DATETIME, +start_epoch INT(10) UNSIGNED, +end_epoch INT(10) UNSIGNED, +length_in_sec INT(10), +status VARCHAR(6), +phone_code VARCHAR(10), +phone_number VARCHAR(18), +user VARCHAR(20), +comments VARCHAR(255), +processed ENUM('Y','N'), +user_group VARCHAR(20), +term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE') default 'NONE', +alt_dial VARCHAR(6) default 'NONE', +caller_code VARCHAR(30) NOT NULL, +index (lead_id), +index (call_date) +); + ALTER TABLE vicidial_campaign_server_stats ENGINE=MEMORY; @@ -2557,6 +2586,7 @@ CREATE INDEX phone_number on vicidial_xfer_log (phone_number); CREATE INDEX phone_number on vicidial_closer_log (phone_number); CREATE INDEX date_user on vicidial_closer_log (call_date,user); CREATE INDEX comment_a on live_inbound_log (comment_a); +CREATE UNIQUE INDEX vicidial_campaign_statuses_key on vicidial_campaign_statuses(status, campaign_id); CREATE TABLE call_log_archive LIKE call_log; @@ -2581,7 +2611,9 @@ CREATE TABLE vicidial_outbound_ivr_log_archive LIKE vicidial_outbound_ivr_log; CREATE TABLE vicidial_log_extended_archive LIKE vicidial_log_extended; CREATE UNIQUE INDEX vlea on vicidial_log_extended_archive (uniqueid,call_date,lead_id); -UPDATE system_settings SET db_schema_version='1291',db_schema_update_date=NOW(); +CREATE TABLE vicidial_log_noanswer_archive LIKE vicidial_log_noanswer; + +UPDATE system_settings SET db_schema_version='1292',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 8357b184..865ca0ff 100644 --- a/agc_2-X/trunk/extras/upgrade_2.4.sql +++ b/agc_2-X/trunk/extras/upgrade_2.4.sql @@ -937,3 +937,42 @@ CREATE TABLE vicidial_log_extended_archive LIKE vicidial_log_extended; CREATE UNIQUE INDEX vlea on vicidial_log_extended_archive (uniqueid,call_date,lead_id); UPDATE system_settings SET db_schema_version='1291',db_schema_update_date=NOW() where db_schema_version < 1291; + +CREATE UNIQUE INDEX vicidial_campaign_statuses_key on vicidial_campaign_statuses(status, campaign_id); + +ALTER TABLE system_settings ADD noanswer_log ENUM('Y','N') default 'N'; +ALTER TABLE system_settings ADD alt_log_server_ip VARCHAR(50) default ''; +ALTER TABLE system_settings ADD alt_log_dbname VARCHAR(50) default ''; +ALTER TABLE system_settings ADD alt_log_login VARCHAR(50) default ''; +ALTER TABLE system_settings ADD alt_log_pass VARCHAR(50) default ''; +ALTER TABLE system_settings ADD tables_use_alt_log_db VARCHAR(2000) default ''; + +CREATE TABLE vicidial_log_noanswer ( +uniqueid VARCHAR(20) PRIMARY KEY NOT NULL, +lead_id INT(9) UNSIGNED NOT NULL, +list_id BIGINT(14) UNSIGNED, +campaign_id VARCHAR(8), +call_date DATETIME, +start_epoch INT(10) UNSIGNED, +end_epoch INT(10) UNSIGNED, +length_in_sec INT(10), +status VARCHAR(6), +phone_code VARCHAR(10), +phone_number VARCHAR(18), +user VARCHAR(20), +comments VARCHAR(255), +processed ENUM('Y','N'), +user_group VARCHAR(20), +term_reason ENUM('CALLER','AGENT','QUEUETIMEOUT','ABANDON','AFTERHOURS','NONE') default 'NONE', +alt_dial VARCHAR(6) default 'NONE', +caller_code VARCHAR(30) NOT NULL, +index (lead_id), +index (call_date) +); + +CREATE TABLE vicidial_log_noanswer_archive LIKE vicidial_log_noanswer; + +ALTER TABLE vicidial_log_extended ADD noanswer_processed ENUM('N','Y','U') default 'N'; + +UPDATE system_settings SET db_schema_version='1292',db_schema_update_date=NOW() where db_schema_version < 1292; + 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 635f846e..c6073d35 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 @@ -687,6 +687,12 @@ This option is only used for agents that are logged in with phones that have the Please wait for the whole page to load before submitting the form|| In-Group Calldate|| This is the last date and time that a call was directed to this inbound group|| +No-Answer Log|| +This option will log the auto-dial calls that are not answered to a separate table. Default is N|| +Alt-Log DB Server|| +This is the alternate log database server. This is optional, and allows some logs to be written to a separate database. Default is empty|| +Alt-Log Tables|| +These are the tables that are available for logging on the alternate log database server. Default is blank|| lead_report_export.php diff --git a/agc_2-X/trunk/www/vicidial/AST_team_performance_detail.php b/agc_2-X/trunk/www/vicidial/AST_team_performance_detail.php new file mode 100644 index 00000000..56601f2a --- /dev/null +++ b/agc_2-X/trunk/www/vicidial/AST_team_performance_detail.php @@ -0,0 +1,776 @@ + LICENSE: AGPLv2 +# +# CHANGES +# +# 110802-2041 - First build +# 110804-0049 - Added First Call Resolution +# + +require("dbconnect.php"); +require("functions.php"); + +$PHP_AUTH_USER=$_SERVER['PHP_AUTH_USER']; +$PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; +$PHP_SELF=$_SERVER['PHP_SELF']; +if (isset($_GET["query_date_D"])) {$query_date_D=$_GET["query_date_D"];} + elseif (isset($_POST["query_date_D"])) {$query_date_D=$_POST["query_date_D"];} +if (isset($_GET["end_date_D"])) {$end_date_D=$_GET["end_date_D"];} + elseif (isset($_POST["end_date_D"])) {$end_date_D=$_POST["end_date_D"];} +if (isset($_GET["query_date_T"])) {$query_date_T=$_GET["query_date_T"];} + elseif (isset($_POST["query_date_T"])) {$query_date_T=$_POST["query_date_T"];} +if (isset($_GET["end_date_T"])) {$end_date_T=$_GET["end_date_T"];} + elseif (isset($_POST["end_date_T"])) {$end_date_T=$_POST["end_date_T"];} +if (isset($_GET["group"])) {$group=$_GET["group"];} + elseif (isset($_POST["group"])) {$group=$_POST["group"];} +if (isset($_GET["user_group"])) {$user_group=$_GET["user_group"];} + elseif (isset($_POST["user_group"])) {$user_group=$_POST["user_group"];} +if (isset($_GET["file_download"])) {$file_download=$_GET["file_download"];} + elseif (isset($_POST["file_download"])) {$file_download=$_POST["file_download"];} +if (isset($_GET["DB"])) {$DB=$_GET["DB"];} + elseif (isset($_POST["DB"])) {$DB=$_POST["DB"];} +if (isset($_GET["SUBMIT"])) {$SUBMIT=$_GET["SUBMIT"];} + elseif (isset($_POST["SUBMIT"])) {$SUBMIT=$_POST["SUBMIT"];} + + +$report_name = 'Team Performance Detail'; +$db_source = 'M'; + +############################################# +##### START SYSTEM_SETTINGS LOOKUP ##### +$stmt = "SELECT use_non_latin,outbound_autodial_active,slave_db_server,reports_use_slave_db FROM system_settings;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {$HTML_text.="$stmt\n";} +if ($archive_tbl) {$agent_log_table="vicidial_agent_log_archive";} else {$agent_log_table="vicidial_agent_log";} +$qm_conf_ct = mysql_num_rows($rslt); +if ($qm_conf_ct > 0) + { + $row=mysql_fetch_row($rslt); + $non_latin = $row[0]; + $outbound_autodial_active = $row[1]; + $slave_db_server = $row[2]; + $reports_use_slave_db = $row[3]; + } +##### END SETTINGS LOOKUP ##### +########################################### + +###################################### +if ( (strlen($slave_db_server)>5) and (preg_match("/$report_name/",$reports_use_slave_db)) ) + { + mysql_close($link); + $use_slave_server=1; + $db_source = 'S'; + require("dbconnect.php"); + $HTML_text.="\n"; + } + +$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' and active='Y';"; +if ($DB) {$HTML_text.="|$stmt|\n";} +if ($non_latin > 0) { $rslt=mysql_query("SET NAMES 'UTF8'");} +$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' and active='Y';"; +if ($DB) {$HTML_text.="|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$reports_only_user=$row[0]; + +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; + } + +$stmt="SELECT user_group from vicidial_users where user='$PHP_AUTH_USER' and pass='$PHP_AUTH_PW' and user_level > 6 and view_reports='1' and active='Y';"; +if ($DB) {$HTML_text.="|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$LOGuser_group = $row[0]; + +$stmt="SELECT allowed_campaigns,allowed_reports from vicidial_user_groups where user_group='$LOGuser_group';"; +if ($DB) {$HTML_text.="|$stmt|\n";} +$rslt=mysql_query($stmt, $link); +$row=mysql_fetch_row($rslt); +$LOGallowed_campaigns = $row[0]; +$LOGallowed_reports = $row[1]; + +if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) + { + Header("WWW-Authenticate: Basic realm=\"VICI-PROJECTS\""); + Header("HTTP/1.0 401 Unauthorized"); + echo "You are not allowed to view this report: |$PHP_AUTH_USER|$report_name|\n"; + exit; + } + +$LOGallowed_campaignsSQL=''; +$whereLOGallowed_campaignsSQL=''; +if ( (!eregi("-ALL",$LOGallowed_campaigns)) ) + { + $rawLOGallowed_campaignsSQL = preg_replace("/ -/",'',$LOGallowed_campaigns); + $rawLOGallowed_campaignsSQL = preg_replace("/ /","','",$rawLOGallowed_campaignsSQL); + $LOGallowed_campaignsSQL = "and campaign_id IN('$rawLOGallowed_campaignsSQL')"; + $whereLOGallowed_campaignsSQL = "where campaign_id IN('$rawLOGallowed_campaignsSQL')"; + } +$regexLOGallowed_campaigns = " $LOGallowed_campaigns "; +###################################### + +$MT[0]=''; +$NOW_DATE = date("Y-m-d"); +$NOW_TIME = date("Y-m-d H:i:s"); +$STARTtime = date("U"); +if (!isset($group)) {$group = '';} +if (!isset($query_date_D)) {$query_date_D=$NOW_DATE;} +if (!isset($end_date_D)) {$end_date_D=$NOW_DATE;} +if (!isset($query_date_T)) {$query_date_T="00:00:00";} +if (!isset($end_date_T)) {$end_date_T="23:59:59";} + + +$i=0; +$group_string='|'; +$group_ct = count($group); +while($i < $group_ct) + { + $group_string .= "$group[$i]|"; + $i++; + } + +$stmt="select campaign_id from vicidial_campaigns $whereLOGallowed_campaignsSQL order by campaign_id;"; +$rslt=mysql_query($stmt, $link); +if ($DB) {$HTML_text.="$stmt\n";} +$campaigns_to_print = mysql_num_rows($rslt); +$i=0; +while ($i < $campaigns_to_print) + { + $row=mysql_fetch_row($rslt); + $groups[$i] =$row[0]; + if (ereg("-ALL",$group_string) ) + {$group[$i] = $groups[$i];} + $i++; + } + +####################################### +for ($i=0; $i\n"; +$HTML_head.="\n"; +$HTML_head.=" \n"; + +$query_date="$query_date_D $query_date_T"; +$end_date="$end_date_D $end_date_T"; + +$HTML_head.="\n"; +$HTML_head.="\n"; + +$HTML_head.="\n"; +$HTML_head.="$report_name$group_S\n"; + +$HTML_text.="
"; + +$HTML_text.="
\n"; +$HTML_text.="
Dates:
"; +$HTML_text.="\n"; +$HTML_text.="\n"; +$HTML_text.="Date Range:
\n"; + +$HTML_text.="\n"; +$HTML_text.="\n"; +$HTML_text.=""; + +$HTML_text.="\n"; + +$HTML_text.="   "; + +$HTML_text.="
to
"; + +$HTML_text.="\n"; + +$HTML_text.="   "; + +$HTML_text.="
Campaigns:
"; +$HTML_text.="\n"; + +$HTML_text.="
Teams/User Groups:
"; +$HTML_text.="\n"; +$HTML_text.="
\n"; +$HTML_text.="\n"; +$HTML_text.="         "; + +$HTML_text.="          \n"; +$HTML_text.="DOWNLOAD |"; +$HTML_text.=" REPORTS \n"; +$HTML_text.="\n"; +$HTML_text.="
"; +$HTML_text.="
\n\n"; + +if ($SUBMIT=="SUBMIT") + { + # Sale counts per rep + $stmt="select max(event_time), vicidial_agent_log.user, vicidial_agent_log.lead_id, vicidial_list.status as current_status from vicidial_agent_log, vicidial_list where event_time>='$query_date' and event_time<='$end_date' $group_SQL and vicidial_agent_log.status in (select status from vicidial_campaign_statuses where sale='Y' $group_SQL UNION select status from vicidial_statuses where sale='Y') and vicidial_agent_log.lead_id=vicidial_list.lead_id group by vicidial_agent_log.user, vicidial_agent_log.lead_id"; + if ($DB) {$HTML_text.="$stmt\n";} + $rslt=mysql_query($stmt, $link); + while ($row=mysql_fetch_array($rslt)) + { + $lead_id=$row["lead_id"]; + $user=$row["user"]; + $current_status=$row["current_status"]; + if (eregi("QCCANC", $current_status)) + { + $cancel_array[$row["user"]]++; + } + else if (eregi("QCFAIL", $current_status)) + { + $incomplete_array[$row["user"]]++; + } + else + { + $sale_array[$row["user"]]++; + + # Get actual talk time for all calls made by the user for this particular lead. If cancelled and incomplete sales are to have their times + # counted towards sales talk time, move the below lines OUTSIDE the curly bracket below, so the query runs regardless of what "type" of + # sale it is. + $sale_time_stmt="select sum(talk_sec)-sum(dead_sec) from vicidial_agent_log where user='$user' and lead_id='$lead_id' $group_SQL"; + if ($DB) {$HTML_text.="$sale_time_stmt\n";} + $sale_time_rslt=mysql_query($sale_time_stmt, $link); + $sale_time_row=mysql_fetch_row($sale_time_rslt); + $sales_talk_time_array[$row["user"]]+=$sale_time_row[0]; + } + } + + $HTML_text.="
";
+	$total_average_sale_time=0;
+	$total_average_contact_time=0;
+	$total_talk_time=0; 
+	$total_system_time=0; 
+	$total_calls=0;	
+	$total_leads=0;
+	$total_contacts=0;
+	$total_sales=0;
+	$total_inc_sales=0;
+	$total_cnc_sales=0;
+	$total_callbacks=0;
+	$total_stcall=0;
+
+	for($i=0; $i<$user_group_ct; $i++) 
+		{
+		$group_average_sale_time=0;
+		$group_average_contact_time=0;
+		$group_talk_time=0; 
+		$group_system_time=0; 
+		$group_calls=0;	
+		$group_leads=0;
+		$group_contacts=0;
+		$group_sales=0;
+		$group_inc_sales=0;
+		$group_cnc_sales=0;
+		$group_callbacks=0;
+		$group_stcall=0;
+		$name_stmt="select group_name from vicidial_user_groups where user_group='$user_group[$i]'";
+		$name_rslt=mysql_query($name_stmt, $link);
+		$name_row=mysql_fetch_row($name_rslt);
+		$group_name=$name_row[0];
+
+		$HTML_text.="--- TEAM: $user_group[$i] - $group_name\n";
+		$CSV_text.="\"\",\"TEAM: $user_group[$i] - $group_name\"\n";
+
+		#### USER COUNTS
+		$user_stmt="select distinct vicidial_users.full_name, vicidial_users.user from vicidial_users, vicidial_agent_log where vicidial_users.user_group='$user_group[$i]' and vicidial_users.user=vicidial_agent_log.user and vicidial_agent_log.user_group='$user_group[$i]'  and vicidial_agent_log.event_time>='$query_date' and vicidial_agent_log.event_time<='$end_date' and vicidial_agent_log.campaign_id in ($group_SQL_str) order by full_name, user";
+		if ($DB) {$HTML_text.="$user_stmt\n";}
+		$user_rslt=mysql_query($user_stmt, $link);
+		if (mysql_num_rows($user_rslt)>0) 
+			{
+			$j=0;
+			$HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+-------------+-----------+-------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n";
+			$HTML_text.="| Agent Name                               | Agent ID   | Calls | Leads | Contacts | Contact Ratio | System Time | Talk Time | Sales | Sales to Leads Ratio | Sales to Contacts Ratio | Sales Per Hour | Incomplete Sales | Cancelled Sales | Callbacks | First Call Resolution | Average Sale Time | Average Contact Time |\n";
+			$HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+-------------+-----------+-------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n";
+			$CSV_text.="\"\",\"Agent Name\",\"Agent ID\",\"Calls\",\"Leads\",\"Contacts\",\"Contact Ratio\",\"System Time\",\"Talk Time\",\"Sales\",\"Sales to Leads Ratio\",\"Sales to Contacts Ratio\",\"Sales Per Hour\",\"Incomplete Sales\",\"Cancelled Sales\",\"Callbacks\",\"First Call Resolution\",\"Average Sale Time\",\"Average Contact Time\"\n";
+			while ($user_row=mysql_fetch_array($user_rslt)) 
+				{
+				$j++;
+				$contacts=0;
+				$callbacks=0;
+				$stcall=0;
+				$calls=0;
+				$leads=0;
+				$system_time=0;
+				$talk_time=0;
+				# For each user
+				$user=$user_row["user"];
+				$sale_array[$user]+=0;  # For agents with no sales logged
+				$incomplete_array[$user]+=0;  # For agents with no QCFAIL logged
+				$cancel_array[$user]+=0;  # For agents with no QCCANC logged
+
+				# Leads 
+				$lead_stmt="select count(distinct lead_id) from vicidial_agent_log where lead_id is not null and event_time>='$query_date' and event_time<='$end_date' $group_SQL and user='$user' and user_group='$user_group[$i]'";
+				if ($DB) {$HTML_text.="$lead_stmt\n";}
+				$lead_rslt=mysql_query($lead_stmt, $link);
+				$lead_row=mysql_fetch_row($lead_rslt);
+				$leads=$lead_row[0];
+
+				# Callbacks 
+				$callback_stmt="select count(*) from vicidial_callbacks where status in ('ACTIVE', 'LIVE') $group_SQL and user='$user' and user_group='$user_group[$i]'";
+				if ($DB) {$HTML_text.="$callback_stmt\n";}
+				$callback_rslt=mysql_query($callback_stmt, $link);
+				$callback_row=mysql_fetch_row($callback_rslt);
+				$callbacks=$callback_row[0];
+
+				$stat_stmt="select val.status, vs.customer_contact, sum(val.talk_sec), sum(val.pause_sec), sum(val.wait_sec), sum(val.dispo_sec), sum(val.dead_sec), count(*) from vicidial_agent_log val, vicidial_statuses vs where val.user='$user' and val.user_group='$user_group[$i]' and val.event_time>='$query_date' and val.event_time<='$end_date' and val.status=vs.status and vs.status in (select status from vicidial_statuses) and val.campaign_id in ($group_SQL_str) group by status, customer_contact UNION select val.status, vs.customer_contact, sum(val.talk_sec), sum(val.pause_sec), sum(val.wait_sec), sum(val.dispo_sec), sum(val.dead_sec), count(*) from vicidial_agent_log val, vicidial_campaign_statuses vs where val.campaign_id in ($group_SQL_str) and val.user='$user' and val.user_group='$user_group[$i]' and val.event_time>='$query_date' and val.event_time<='$end_date' and val.status=vs.status and val.campaign_id=vs.campaign_id and vs.status in (select distinct status from vicidial_campaign_statuses where ".substr($group_SQL, 4).") group by status, customer_contact";
+				if ($DB) {$HTML_text.="$stat_stmt\n";}
+				$stat_rslt=mysql_query($stat_stmt, $link);
+				while ($stat_row=mysql_fetch_row($stat_rslt)) 
+					{
+					if ($stat_row[1]=="Y") 
+						{
+						$contacts+=$stat_row[7]; 
+						$contact_talk_time+=($stat_row[2]-$stat_row[6]);
+
+						$group_contact_talk_time+=($stat_row[2]-$stat_row[6]);
+						}
+					# if ($stat_row[2]=="Y") {$callbacks+=$stat_row[8];}
+					$calls+=$stat_row[7];
+					$talk_time+=($stat_row[2]-$stat_row[6]);
+					$system_time+=($stat_row[2]+$stat_row[4]+$stat_row[5]);
+					}
+				$user_talk_time =		sec_convert($talk_time,'H'); 
+				$group_talk_time+=$talk_time;
+				$user_system_time =		sec_convert($system_time,'H'); 
+				$talk_hours=$talk_time/3600;
+				$group_system_time+=$system_time;
+
+				if ($sale_array[$user]>0) {$average_sale_time=sec_convert(round($sales_talk_time_array[$user]/$sale_array[$user]), 'H');} else {$average_sale_time="00:00";}
+				$group_sales_talk_time+=$sales_talk_time_array[$user];
+				if ($contacts>0) {$average_contact_time=sec_convert(round($contact_talk_time/$contacts), 'H');} else {$average_contact_time="00:00";}
+
+				$HTML_text.="| ".sprintf("%-40s", $user_row["full_name"]);
+				$HTML_text.=" | ".sprintf("%10s", "$user")."";
+				$HTML_text.=" | ".sprintf("%5s", $calls);	$group_calls+=$calls;
+				$HTML_text.=" | ".sprintf("%5s", $leads);	$group_leads+=$leads;
+				$HTML_text.=" | ".sprintf("%8s", $contacts);  $group_contacts+=$contacts;
+				if ($leads>0) 
+					{
+					$contact_ratio=sprintf("%.2f", (100*$contacts/$leads));
+					}
+				else 
+					{
+					$contact_ratio="0.00";
+					}
+				$HTML_text.=" | ".sprintf("%12s", $contact_ratio)."%";
+				$HTML_text.=" | ".sprintf("%11s", $user_system_time);
+				$HTML_text.=" | ".sprintf("%9s", $user_talk_time);
+				$HTML_text.=" | ".sprintf("%5s", $sale_array[$user]);	$group_sales+=$sale_array[$user];
+				if ($leads>0) 
+					{
+					$sales_ratio=sprintf("%.2f", (100*$sale_array[$user]/$leads));
+					}
+				else 
+					{
+					$sales_ratio="0.00";
+					}
+				$HTML_text.=" | ".sprintf("%19s", $sales_ratio)."%";
+				if ($contacts>0) 
+					{
+					$sale_contact_ratio=sprintf("%.2f", (100*$sale_array[$user]/$contacts));
+					}
+				else 
+					{
+					$sale_contact_ratio=0;
+					}
+				$HTML_text.=" | ".sprintf("%22s", $sale_contact_ratio)."%";
+				if ($talk_hours>0) 
+					{
+					$sales_per_hour=sprintf("%.2f", ($sale_array[$user]/$talk_hours));
+					}
+				else 
+					{
+					$sales_per_hour="0.00";
+					}
+				if ( ($calls>0) and ($leads>0) )
+					{
+					$stcall=sprintf("%.2f", ($calls/$leads));
+					}
+				else 
+					{
+					$stcall="0.00";
+					}
+				$HTML_text.=" | ".sprintf("%14s", $sales_per_hour);
+				$HTML_text.=" | ".sprintf("%16s", $incomplete_array[$user]);  $group_inc_sales+=$incomplete_array[$user];
+				$HTML_text.=" | ".sprintf("%15s", $cancel_array[$user]);  $group_cnc_sales+=$cancel_array[$user];
+				$HTML_text.=" | ".sprintf("%9s", $callbacks);  $group_callbacks+=$callbacks;
+				$HTML_text.=" | ".sprintf("%21s", $stcall);	# first call resolution
+				$HTML_text.=" | ".sprintf("%17s", $average_sale_time);
+				$HTML_text.=" | ".sprintf("%20s", $average_contact_time)." |\n";
+				$CSV_text.="\"$j\",\"$user_row[full_name]\",\"$user\",\"$calls\",\"$leads\",\"$contacts\",\"$contact_ratio %\",\"$user_system_time\",\"$user_talk_time\",\"$sale_array[$user]\",\"$sales_ratio\",\"$sale_contact_ratio\",\"$sales_per_hour\",\"$incomplete_array[$user]\",\"$cancel_array[$user]\",\"$callbacks\",\"$stcall\",\"$average_sale_time\",\"$average_contact_time\"\n";
+				}
+
+			##### GROUP TOTALS #############
+			if ($group_sales>0) 
+				{
+				$group_average_sale_time=sec_convert(round($group_sales_talk_time/$group_sales), 'H');
+				} 
+			else 
+				{
+				$group_average_sale_time="00:00:00";
+				}
+			if ($group_contacts>0) 
+				{
+				$group_average_contact_time=sec_convert(round($group_contact_talk_time/$group_contacts), 'H');
+				} 
+			else 
+				{
+				$group_average_contact_time="00:00:00";
+				}
+			$group_talk_hours=$group_talk_time/3600;
+
+			$GROUP_text.="| ".sprintf("%40s", "$group_name");
+			$GROUP_text.=" | ".sprintf("%10s", "$user_group[$i]");
+
+			$HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+-------------+-----------+-------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n";
+			$HTML_text.="| ".sprintf("%40s", "");
+			$HTML_text.=" | ".sprintf("%10s", "TOTALS:");
+
+			$TOTAL_text=" | ".sprintf("%5s", $group_calls);	
+			$TOTAL_text.=" | ".sprintf("%5s", $group_leads);
+			$TOTAL_text.=" | ".sprintf("%8s", $group_contacts);
+			if ($group_leads>0) 
+				{
+				$group_contact_ratio=sprintf("%.2f", (100*$group_contacts/$group_leads));
+				} 
+			else 
+				{
+				$group_contact_ratio="0.00";
+				}
+			$TOTAL_text.=" | ".sprintf("%12s", $group_contact_ratio)."%";
+			$TOTAL_text.=" | ".sprintf("%11s", sec_convert($group_system_time,'H'));
+			$TOTAL_text.=" | ".sprintf("%9s", sec_convert($group_talk_time,'H'));
+			$TOTAL_text.=" | ".sprintf("%5s", $group_sales);
+			if ($group_leads>0) 
+				{
+				$group_sales_ratio=sprintf("%.2f", (100*$group_sales/$group_leads));
+				} 
+			else 
+				{
+				$group_sales_ratio="0.00";
+				}	
+			$TOTAL_text.=" | ".sprintf("%19s", $group_sales_ratio)."%";
+			if ($group_contacts>0) 
+				{
+				$group_sale_contact_ratio=sprintf("%.2f", (100*$group_sales/$group_contacts));
+				} 
+			else 
+				{
+				$group_sale_contact_ratio=0;
+				}
+			$TOTAL_text.=" | ".sprintf("%22s", $group_sale_contact_ratio)."%";
+			if ($group_talk_hours>0) 
+				{
+				$group_sales_per_hour=sprintf("%.2f", ($group_sales/$group_talk_hours));
+				} 
+			else 
+				{
+				$group_sales_per_hour="0.00";
+				}
+			if ( ($group_calls>0) and ($group_leads>0) )
+				{
+				$group_stcall=sprintf("%.2f", ($group_calls/$group_leads));
+				} 
+			else 
+				{
+				$group_stcall="0.00";
+				}
+			$TOTAL_text.=" | ".sprintf("%14s", $group_sales_per_hour);
+			$TOTAL_text.=" | ".sprintf("%16s", $group_inc_sales);
+			$TOTAL_text.=" | ".sprintf("%15s", $group_cnc_sales);
+			$TOTAL_text.=" | ".sprintf("%9s", $group_callbacks);
+			$TOTAL_text.=" | ".sprintf("%21s", $group_stcall); 	# first call resolution
+			$TOTAL_text.=" | ".sprintf("%17s", $group_average_sale_time);
+			$TOTAL_text.=" | ".sprintf("%20s", $group_average_contact_time)." |\n";
+
+			$HTML_text.=$TOTAL_text;
+			$GROUP_text.=$TOTAL_text;
+
+			$HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+-------------+-----------+-------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n";
+			$HTML_text.="\n\n";
+
+			$CSV_text.="\"\",\"\",\"TOTALS:\",\"$group_calls\",\"$group_leads\",\"$group_contacts\",\"$group_contact_ratio %\",\"".sec_convert($group_system_time,'H')."\",\"".sec_convert($group_talk_time,'H')."\",\"$group_sales\",\"$group_sales_ratio\",\"$group_sale_contact_ratio\",\"$group_sales_per_hour\",\"$group_inc_sales\",\"$group_cnc_sales\",\"$group_callbacks\",\"$group_stcall\",\"$group_average_sale_time\",\"$group_average_contact_time\"\n";
+			$GROUP_CSV_text.="\"$i\",\"$group_name\",\"$user_group[$i]\",\"$group_calls\",\"$group_leads\",\"$group_contacts\",\"$group_contact_ratio %\",\"".sec_convert($group_system_time,'H')."\",\"".sec_convert($group_talk_time,'H')."\",\"$group_sales\",\"$group_sales_ratio\",\"$group_sale_contact_ratio\",\"$group_sales_per_hour\",\"$group_inc_sales\",\"$group_cnc_sales\",\"$group_callbacks\",\"$group_stcall\",\"$group_average_sale_time\",\"$group_average_contact_time\"\n";
+			$CSV_text.="\n\n";
+
+			$total_calls+=$group_calls;
+			$total_leads+=$group_leads;
+			$total_contacts+=$group_contacts;
+			$total_system_time+=$group_system_time;
+			$total_talk_time+=$group_talk_time;
+			$total_sales+=$group_sales;
+			$total_inc_sales+=$group_inc_sales;
+			$total_cnc_sales+=$group_cnc_sales;
+			$total_callbacks+=$group_callbacks;
+			$total_stcall+=$group_stcall; 	# first call resolution
+			$total_sales_talk_time+=$group_sales_talk_time;
+			$total_contact_talk_time+=$group_contact_talk_time;
+
+			#flush();
+			} 
+		else 
+			{
+			$HTML_text.="    **** NO AGENTS FOUND UNDER THESE REPORT PARAMETERS ****\n\n";
+			$CSV_text.="\"\",\"**** NO AGENTS FOUND UNDER THESE REPORT PARAMETERS ****\"\n\n";
+			}
+		}
+
+	$HTML_text.="--- CALL CENTER TOTAL\n";
+	$HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+-------------+-----------+-------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n";
+	$HTML_text.="| Team Name                                | Team ID    | Calls | Leads | Contacts | Contact Ratio | System Time | Talk Time | Sales | Sales to Leads Ratio | Sales to Contacts Ratio | Sales Per Hour | Incomplete Sales | Cancelled Sales | Callbacks | First Call Resolution | Average Sale Time | Average Contact Time |\n";
+	$HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+-------------+-----------+-------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n";
+	$HTML_text.=$GROUP_text;
+	$HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+-------------+-----------+-------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n";
+
+	if ($total_sales>0) 
+		{
+		$total_average_sale_time=sec_convert(round($total_sales_talk_time/$total_sales), 'H');
+		} 
+	else 
+		{
+		$total_average_sale_time="00:00:00";
+		}
+	if ($total_contacts>0) 
+		{
+		$total_average_contact_time=sec_convert(round($total_contact_talk_time/$total_contacts), 'H');
+		} 
+	else 
+		{
+		$total_average_contact_time="00:00:00";
+		}
+	$total_talk_hours=$total_talk_time/3600;
+
+	$HTML_text.="| ".sprintf("%40s", "");
+	$HTML_text.=" | ".sprintf("%10s", "TOTALS:");
+	$HTML_text.=" | ".sprintf("%5s", $total_calls);	
+	$HTML_text.=" | ".sprintf("%5s", $total_leads);
+	$HTML_text.=" | ".sprintf("%8s", $total_contacts);
+	if ($total_leads>0) 
+		{
+		$total_contact_ratio=sprintf("%.2f", (100*$total_contacts/$total_leads));
+		} 
+	else 
+		{
+		$total_contact_ratio="0.00";
+		}
+	$HTML_text.=" | ".sprintf("%12s", $total_contact_ratio)."%";
+	$HTML_text.=" | ".sprintf("%11s", sec_convert($total_system_time,'H'));
+	$HTML_text.=" | ".sprintf("%9s", sec_convert($total_talk_time,'H'));
+	$HTML_text.=" | ".sprintf("%5s", $total_sales);
+	if ($total_leads>0) 
+		{
+		$total_sales_ratio=sprintf("%.2f", (100*$total_sales/$total_leads));
+		} 
+	else 
+		{
+		$total_sales_ratio="0.00";
+		}	
+	$HTML_text.=" | ".sprintf("%19s", $total_sales_ratio)."%";
+	if ($total_contacts>0) 
+		{
+		$total_sale_contact_ratio=sprintf("%.2f", (100*$total_sales/$total_contacts));
+		} 
+	else 
+		{
+		$total_sale_contact_ratio=0;
+		}
+	$HTML_text.=" | ".sprintf("%22s", $total_sale_contact_ratio)."%";
+	if ($total_talk_hours>0) 
+		{
+		$total_sales_per_hour=sprintf("%.2f", ($total_sales/$total_talk_hours));
+		} 
+	else 
+		{
+		$total_sales_per_hour="0.00";
+		}
+	if ( ($total_calls>0) and ($total_leads>0) )
+		{
+		$total_stcall=sprintf("%.2f", ($total_calls/$total_leads));
+		} 
+	else 
+		{
+		$total_stcall="0.00";
+		}
+	$HTML_text.=" | ".sprintf("%14s", $total_sales_per_hour);
+	$HTML_text.=" | ".sprintf("%16s", $total_inc_sales);
+	$HTML_text.=" | ".sprintf("%15s", $total_cnc_sales);
+	$HTML_text.=" | ".sprintf("%9s", $total_callbacks);
+	$HTML_text.=" | ".sprintf("%21s", $total_stcall); 	# first call resolution
+	$HTML_text.=" | ".sprintf("%17s", $total_average_sale_time);
+	$HTML_text.=" | ".sprintf("%20s", $total_average_contact_time)." |\n";
+	$HTML_text.="+------------------------------------------+------------+-------+-------+----------+---------------+-------------+-----------+-------+----------------------+-------------------------+----------------+------------------+-----------------+-----------+-----------------------+-------------------+----------------------+\n";
+	$HTML_text.="
"; + $HTML_text.="\n"; + $HTML_text.="\n"; + + $CSV_text.="\"\",\"CALL CENTER TOTAL\"\n"; + $CSV_text.="\"\",\"Team Name\",\"Team ID\",\"Calls\",\"Leads\",\"Contacts\",\"Contact Ratio\",\"System Time\",\"Talk Time\",\"Sales\",\"Sales to Leads Ratio\",\"Sales to Contacts Ratio\",\"Sales Per Hour\",\"Incomplete Sales\",\"Cancelled Sales\",\"Callbacks\",\"First Call Resolution\",\"Average Sale Time\",\"Average Contact Time\"\n"; + $CSV_text.=$GROUP_CSV_text; + $CSV_text.="\"\",\"\",\"TOTALS:\",\"$total_calls\",\"$total_leads\",\"$total_contacts\",\"$total_contact_ratio %\",\"".sec_convert($total_system_time,'H')."\",\"".sec_convert($total_talk_time,'H')."\",\"$total_sales\",\"$total_sales_ratio\",\"$total_sale_contact_ratio\",\"$total_sales_per_hour\",\"$total_inc_sales\",\"$total_cnc_sales\",\"$total_callbacks\",\"$total_stcall\",\"$total_average_sale_time\",\"$total_average_contact_time\"\n"; + } + +if ($file_download>0) + { + $FILE_TIME = date("Ymd-His"); + $CSVfilename = "AST_team_performance_detail_$US$FILE_TIME.csv"; + $CSV_text=preg_replace('/\n +,/', ',', $CSV_text); + $CSV_text=preg_replace('/ +\"/', '"', $CSV_text); + $CSV_text=preg_replace('/\" +/', '"', $CSV_text); + + // We'll be outputting a TXT file + header('Content-type: application/octet-stream'); + // It will be called LIST_101_20090209-121212.txt + header("Content-Disposition: attachment; filename=\"$CSVfilename\""); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + ob_clean(); + flush(); + + echo "$CSV_text"; + + exit; + } +else + { + header("Content-type: text/html; charset=utf-8"); + + echo $HTML_head; + $short_header=1; + require("admin_header.php"); + echo $HTML_text; + flush(); + } +?> diff --git a/agc_2-X/trunk/www/vicidial/admin.php b/agc_2-X/trunk/www/vicidial/admin.php index 0348fd9f..accd2c47 100644 --- a/agc_2-X/trunk/www/vicidial/admin.php +++ b/agc_2-X/trunk/www/vicidial/admin.php @@ -98,9 +98,11 @@ $PHP_AUTH_PW=$_SERVER['PHP_AUTH_PW']; $PHP_SELF=$_SERVER['PHP_SELF']; $QUERY_STRING = getenv("QUERY_STRING"); -$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Export Calls Report, Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Single Agent Daily , User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List'; +$Vreports = 'NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Export Calls Report, Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Single Agent Daily , User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List'; -$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Export Calls Report , Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Single Agent Daily , User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Custom Reports Links, CallCard Search'; +$UGreports = 'ALL REPORTS, NONE, Real-Time Main Report, Real-Time Campaign Summary , Inbound Report, Inbound Service Level Report, Inbound Summary Hourly Report, Inbound DID Report, Inbound IVR Report, Outbound Calling Report, Outbound Summary Interval Report, Outbound IVR Report, Fronter - Closer Report, Lists Campaign Statuses Report, Export Calls Report , Export Leads Report , Agent Time Detail, Agent Status Detail, Agent Performance Detail, Team Performance Detail, Single Agent Daily , User Timeclock Report, User Group Timeclock Status Report, User Timeclock Detail Report , Server Performance Report, Administration Change Log, List Update Stats, User Stats, User Time Sheet, Download List, Custom Reports Links, CallCard Search'; + +$Vtables = 'NONE,vicidial_log_noanswer'; ###################################################################################################### ###################################################################################################### @@ -1597,6 +1599,18 @@ if (isset($_GET["on_hook_cid"])) {$on_hook_cid=$_GET["on_hook_cid"];} elseif (isset($_POST["on_hook_cid"])) {$on_hook_cid=$_POST["on_hook_cid"];} if (isset($_GET["form_end"])) {$form_end=$_GET["form_end"];} elseif (isset($_POST["form_end"])) {$form_end=$_POST["form_end"];} +if (isset($_GET["noanswer_log"])) {$noanswer_log=$_GET["noanswer_log"];} + elseif (isset($_POST["noanswer_log"])) {$noanswer_log=$_POST["noanswer_log"];} +if (isset($_GET["alt_log_server_ip"])) {$alt_log_server_ip=$_GET["alt_log_server_ip"];} + elseif (isset($_POST["alt_log_server_ip"])) {$alt_log_server_ip=$_POST["alt_log_server_ip"];} +if (isset($_GET["alt_log_dbname"])) {$alt_log_dbname=$_GET["alt_log_dbname"];} + elseif (isset($_POST["alt_log_dbname"])) {$alt_log_dbname=$_POST["alt_log_dbname"];} +if (isset($_GET["alt_log_login"])) {$alt_log_login=$_GET["alt_log_login"];} + elseif (isset($_POST["alt_log_login"])) {$alt_log_login=$_POST["alt_log_login"];} +if (isset($_GET["alt_log_pass"])) {$alt_log_pass=$_GET["alt_log_pass"];} + elseif (isset($_POST["alt_log_pass"])) {$alt_log_pass=$_POST["alt_log_pass"];} +if (isset($_GET["tables_use_alt_log_db"])) {$tables_use_alt_log_db=$_GET["tables_use_alt_log_db"];} + elseif (isset($_POST["tables_use_alt_log_db"])) {$tables_use_alt_log_db=$_POST["tables_use_alt_log_db"];} if (isset($script_id)) {$script_id= strtoupper($script_id);} @@ -1940,6 +1954,7 @@ if ($non_latin < 1) $auto_pause_precall = ereg_replace("[^NY]","",$auto_pause_precall); $auto_resume_precall = ereg_replace("[^NY]","",$auto_resume_precall); $webphone_auto_answer = ereg_replace("[^NY]","",$webphone_auto_answer); + $noanswer_log = ereg_replace("[^NY]","",$noanswer_log); $qc_enabled = ereg_replace("[^0-9NY]","",$qc_enabled); $active = ereg_replace("[^0-9NY]","",$active); @@ -2253,6 +2268,10 @@ if ($non_latin < 1) $queuemetrics_phone_environment = ereg_replace("[^-\|\/\._0-9a-zA-Z]","",$queuemetrics_phone_environment); $active_twin_server_ip = ereg_replace("[^-\|\/\._0-9a-zA-Z]","",$active_twin_server_ip); $safe_harbor_audio = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$safe_harbor_audio); + $alt_log_server_ip = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$alt_log_server_ip); + $alt_log_dbname = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$alt_log_dbname); + $alt_log_login = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$alt_log_login); + $alt_log_pass = ereg_replace("[^-\/\|\._0-9a-zA-Z]","",$alt_log_pass); ### ALPHA-NUMERIC and underscore and dash and comma $logins_list = ereg_replace("[^-\,\_0-9a-zA-Z]","",$logins_list); @@ -2809,12 +2828,14 @@ else # 110730-2249 - Added DISPO_SELECT_DISABLED option for the Dispo Disable setting in campaigns # 110731-0245 - Added na_call_url options to campaigns and in-groups # 110801-0833 - Added on_hook_cid option for in-groups +# 110802-2053 - Added links to Team Performance Detail Report +# 110809-1547 - Added no-answer log and alt-log server system settings # # 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-327a'; -$build = '110801-0833'; +$admin_version = '2.4-329a'; +$build = '110809-1547'; $STARTtime = date("U"); $SQLdate = date("Y-m-d H:i:s"); @@ -7641,6 +7662,21 @@ if ($ADD==99999)
Reload Dialplan On Servers - This option allows you to force a reload of the dialplan on all Asterisk servers in the cluster. If you made changes in the Custom Dialplan Entry above you should set this to 1 and submit to have those changes go into effect on the servers. +
+ +
+ No-Answer Log - This option will log the auto-dial calls that are not answered to a separate table. Default is N. + +
+
+
+ Alt-Log DB Server - This is the alternate log database server. This is optional, and allows some logs to be written to a separate database. Default is empty. + +
+
+
+ Alt-Log Tables - These are the tables that are available for logging on the alternate log database server. Default is blank. +

@@ -16111,7 +16147,17 @@ if ($ADD==411111111111111) } $reports_use_slave_db = preg_replace("/,$/","",$new_field_value); - $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='" . mysql_real_escape_string($webphone_url) . "',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled',queuemetrics_callstatus='$queuemetrics_callstatus',default_codecs='$default_codecs',admin_web_directory='$admin_web_directory',label_title='$label_title',label_first_name='$label_first_name',label_middle_initial='$label_middle_initial',label_last_name='$label_last_name',label_address1='$label_address1',label_address2='$label_address2',label_address3='$label_address3',label_city='$label_city',label_state='$label_state',label_province='$label_province',label_postal_code='$label_postal_code',label_vendor_lead_code='$label_vendor_lead_code',label_gender='$label_gender',label_phone_number='$label_phone_number',label_phone_code='$label_phone_code',label_alt_phone='$label_alt_phone',label_security_phrase='$label_security_phrase',label_email='$label_email',label_comments='$label_comments',custom_fields_enabled='$custom_fields_enabled',slave_db_server='$slave_db_server',reports_use_slave_db='$reports_use_slave_db',webphone_systemkey='$webphone_systemkey',first_login_trigger='$first_login_trigger',default_phone_registration_password='$default_phone_registration_password',default_phone_login_password='$default_phone_login_password',default_server_password='$default_server_password',admin_modify_refresh='$admin_modify_refresh',nocache_admin='$nocache_admin',generate_cross_server_exten='$generate_cross_server_exten',queuemetrics_addmember_enabled='$queuemetrics_addmember_enabled',queuemetrics_dispo_pause='$queuemetrics_dispo_pause',label_hide_field_logs='$label_hide_field_logs',queuemetrics_pe_phone_append='$queuemetrics_pe_phone_append',test_campaign_calls='$test_campaign_calls',agents_calls_reset='$agents_calls_reset',default_voicemail_timezone='$default_voicemail_timezone',default_local_gmt='$default_local_gmt';"; + $m=0; + $altlog_count = count($tables_use_alt_log_db); + $altlog_array = $tables_use_alt_log_db; + while ($m < $altlog_count) + { + $new_altlog_value .= "$altlog_array[$m],"; + $m++; + } + $tables_use_alt_log_db = preg_replace("/,$/","",$new_altlog_value); + + $stmt="UPDATE system_settings set use_non_latin='$use_non_latin',webroot_writable='$webroot_writable',enable_queuemetrics_logging='$enable_queuemetrics_logging',queuemetrics_server_ip='$queuemetrics_server_ip',queuemetrics_dbname='$queuemetrics_dbname',queuemetrics_login='$queuemetrics_login',queuemetrics_pass='$queuemetrics_pass',queuemetrics_url='$queuemetrics_url',queuemetrics_log_id='$queuemetrics_log_id',queuemetrics_eq_prepend='$queuemetrics_eq_prepend',vicidial_agent_disable='$vicidial_agent_disable',allow_sipsak_messages='$allow_sipsak_messages',admin_home_url='$admin_home_url',enable_agc_xfer_log='$enable_agc_xfer_log',timeclock_end_of_day='$timeclock_end_of_day',vdc_header_date_format='$vdc_header_date_format',vdc_customer_date_format='$vdc_customer_date_format',vdc_header_phone_format='$vdc_header_phone_format',vdc_agent_api_active='$vdc_agent_api_active',enable_vtiger_integration='$enable_vtiger_integration',vtiger_server_ip='$vtiger_server_ip',vtiger_dbname='$vtiger_dbname',vtiger_login='$vtiger_login',vtiger_pass='$vtiger_pass',vtiger_url='$vtiger_url',qc_features_active='$qc_features_active',outbound_autodial_active='$outbound_autodial_active',outbound_calls_per_second='$outbound_calls_per_second',enable_tts_integration='$enable_tts_integration',agentonly_callback_campaign_lock='$agentonly_callback_campaign_lock',sounds_central_control_active='$sounds_central_control_active',sounds_web_server='$sounds_web_server',sounds_web_directory='$sounds_web_directory',active_voicemail_server='$active_voicemail_server',auto_dial_limit='$auto_dial_limit',user_territories_active='$user_territories_active',allow_custom_dialplan='$allow_custom_dialplan',enable_second_webform='$enable_second_webform',default_webphone='$default_webphone',default_external_server_ip='$default_external_server_ip',webphone_url='" . mysql_real_escape_string($webphone_url) . "',enable_agc_dispo_log='$enable_agc_dispo_log',custom_dialplan_entry='$custom_dialplan_entry',queuemetrics_loginout='$queuemetrics_loginout',callcard_enabled='$callcard_enabled',queuemetrics_callstatus='$queuemetrics_callstatus',default_codecs='$default_codecs',admin_web_directory='$admin_web_directory',label_title='$label_title',label_first_name='$label_first_name',label_middle_initial='$label_middle_initial',label_last_name='$label_last_name',label_address1='$label_address1',label_address2='$label_address2',label_address3='$label_address3',label_city='$label_city',label_state='$label_state',label_province='$label_province',label_postal_code='$label_postal_code',label_vendor_lead_code='$label_vendor_lead_code',label_gender='$label_gender',label_phone_number='$label_phone_number',label_phone_code='$label_phone_code',label_alt_phone='$label_alt_phone',label_security_phrase='$label_security_phrase',label_email='$label_email',label_comments='$label_comments',custom_fields_enabled='$custom_fields_enabled',slave_db_server='$slave_db_server',reports_use_slave_db='$reports_use_slave_db',webphone_systemkey='$webphone_systemkey',first_login_trigger='$first_login_trigger',default_phone_registration_password='$default_phone_registration_password',default_phone_login_password='$default_phone_login_password',default_server_password='$default_server_password',admin_modify_refresh='$admin_modify_refresh',nocache_admin='$nocache_admin',generate_cross_server_exten='$generate_cross_server_exten',queuemetrics_addmember_enabled='$queuemetrics_addmember_enabled',queuemetrics_dispo_pause='$queuemetrics_dispo_pause',label_hide_field_logs='$label_hide_field_logs',queuemetrics_pe_phone_append='$queuemetrics_pe_phone_append',test_campaign_calls='$test_campaign_calls',agents_calls_reset='$agents_calls_reset',default_voicemail_timezone='$default_voicemail_timezone',default_local_gmt='$default_local_gmt',noanswer_log='$noanswer_log',alt_log_server_ip='$alt_log_server_ip',alt_log_dbname='$alt_log_dbname',alt_log_login='$alt_log_login',alt_log_pass='$alt_log_pass',tables_use_alt_log_db='$tables_use_alt_log_db';"; $rslt=mysql_query($stmt, $link); if ($reload_dialplan_on_servers > 0) @@ -27115,7 +27161,7 @@ if ($ADD==311111111111111) echo "\n"; echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo "\n"; @@ -29844,6 +29916,8 @@ if ($ADD==999999) {echo "
  • Agent Status Detail\n";} if ( (preg_match("/Agent Performance Detail/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {echo "
  • Agent Performance Detail\n";} + if ( (preg_match("/Team Performance Detail/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) + {echo "
  • Team Performance Detail\n";} if ( (preg_match("/Single Agent Daily/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) ) {echo "
  • Single Agent Daily\n";} if ( (preg_match("/User Stats/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
  • \n"; echo ""; - $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt from system_settings;"; + $stmt="SELECT version,install_date,use_non_latin,webroot_writable,enable_queuemetrics_logging,queuemetrics_server_ip,queuemetrics_dbname,queuemetrics_login,queuemetrics_pass,queuemetrics_url,queuemetrics_log_id,queuemetrics_eq_prepend,vicidial_agent_disable,allow_sipsak_messages,admin_home_url,enable_agc_xfer_log,db_schema_version,auto_user_add_value,timeclock_end_of_day,timeclock_last_reset_date,vdc_header_date_format,vdc_customer_date_format,vdc_header_phone_format,vdc_agent_api_active,qc_last_pull_time,enable_vtiger_integration,vtiger_server_ip,vtiger_dbname,vtiger_login,vtiger_pass,vtiger_url,qc_features_active,outbound_autodial_active,outbound_calls_per_second,enable_tts_integration,agentonly_callback_campaign_lock,sounds_central_control_active,sounds_web_server,sounds_web_directory,active_voicemail_server,auto_dial_limit,user_territories_active,allow_custom_dialplan,db_schema_update_date,enable_second_webform,default_webphone,default_external_server_ip,webphone_url,enable_agc_dispo_log,custom_dialplan_entry,queuemetrics_loginout,callcard_enabled,queuemetrics_callstatus,default_codecs,admin_web_directory,label_title,label_first_name,label_middle_initial,label_last_name,label_address1,label_address2,label_address3,label_city,label_state,label_province,label_postal_code,label_vendor_lead_code,label_gender,label_phone_number,label_phone_code,label_alt_phone,label_security_phrase,label_email,label_comments,custom_fields_enabled,slave_db_server,reports_use_slave_db,webphone_systemkey,first_login_trigger,default_phone_registration_password,default_phone_login_password,default_server_password,admin_modify_refresh,nocache_admin,generate_cross_server_exten,queuemetrics_addmember_enabled,queuemetrics_dispo_pause,label_hide_field_logs,queuemetrics_pe_phone_append,test_campaign_calls,agents_calls_reset,default_voicemail_timezone,default_local_gmt,noanswer_log,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db from system_settings;"; $rslt=mysql_query($stmt, $link); $row=mysql_fetch_row($rslt); $version = $row[0]; @@ -27211,6 +27257,12 @@ if ($ADD==311111111111111) $agents_calls_reset = $row[90]; $default_voicemail_timezone = $row[91]; $default_local_gmt = $row[92]; + $noanswer_log = $row[93]; + $alt_log_server_ip = $row[94]; + $alt_log_dbname = $row[95]; + $alt_log_login = $row[96]; + $alt_log_pass = $row[97]; + $tables_use_alt_log_db = $row[98]; echo "
    MODIFY VICIDIAL SYSTEM SETTINGS
    \n"; echo "\n"; @@ -27464,6 +27516,26 @@ if ($ADD==311111111111111) echo "
    Webphone URL: $NWB#settings-webphone_url$NWE
    Webphone System Key: $NWB#settings-webphone_systemkey$NWE
    No-Answer Log: $NWB#settings-noanswer_log$NWE
    Alt-Log DB Server: $NWB#settings-alt_log_server_ip$NWE
    Alt-Log DB Name: $NWB#settings-alt_log_server_ip$NWE
    Alt-Log DB Login: $NWB#settings-alt_log_server_ip$NWE
    Alt-Log DB Password: $NWB#settings-alt_log_server_ip$NWE
    Alt-Log Tables: $NWB#settings-tables_use_alt_log_db$NWE
    Enable QueueMetrics Logging: $NWB#settings-enable_queuemetrics_logging$NWE
    QueueMetrics Server IP: $NWB#settings-queuemetrics_server_ip$NWE
    QueueMetrics DB Name: $NWB#settings-queuemetrics_dbname$NWE