Added Max Stats download feature to admin.php
Added extended vicidial_list fields option Added TNM duplicate delete and DOB format options to CLI lead loader Added talk time % column to the Agent Time Detail report git-svn-id: svn://192.168.202.10@1839 3d104415-ff17-0410-8863-d5cf3c621b8a
This commit is contained in:
@@ -76,6 +76,8 @@ OTHER CHANGES:
|
||||
enabled in System Settings. Calls must be passed from an outbound
|
||||
campaign or an in-group.
|
||||
|
||||
8. Added ability to download the Max System Stats and display by date range.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# NOTE: the machine this is run on must have a servers entry in the database
|
||||
#
|
||||
# Copyright (C) 2011 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
#
|
||||
# CHANGES
|
||||
@@ -53,9 +53,10 @@
|
||||
# 110424-0948 - Added time-zone-code-gmt option to use time zone code from the owner field
|
||||
# 110705-1913 - Added options for USACAN prefix(no 0 or 1) and valid areacode filtering
|
||||
# 110929-1423 - Added new format for abbreviated timezone in owner(pipe30tz) and list creation options
|
||||
# 120713-1009 - Added new --duplicate-tnm-delete option to check for a duplicate phone with different title and delete existing if found in same list
|
||||
#
|
||||
|
||||
$version = '110929-1423';
|
||||
$version = '120713-1009';
|
||||
|
||||
$secX = time();
|
||||
$MT[0]='';
|
||||
@@ -173,6 +174,9 @@ if (length($ARGV[0])>1)
|
||||
print " [--duplicate-system-check] = checks for the same phone number in the entire system before inserting lead\n";
|
||||
print " [--duplicate-tap-list-check] = checks for the same title/alt-number in the same list ID before inserting lead\n";
|
||||
print " [--duplicate-tap-system-check] = checks for the same title/alt-number in the entire system before inserting lead\n";
|
||||
print " [--duplicate-tnm-delete] = checks for same phone and title in same list then deletes original if title is different\n";
|
||||
print " [--dob-mmddyyy] = checks for slashes in the date of birth field and formats from MM/DD/YYYY to MySQL\n";
|
||||
print " [--dob-ddmmyyy] = checks for slashes in the date of birth field and formats from DD/MM/YYYY to MySQL\n";
|
||||
print " [--postal-code-gmt] = checks for the time zone based on the postal code given where available\n";
|
||||
print " [--time-zone-code-gmt] = checks for the time zone based on the owner field time zone code given where available\n";
|
||||
print " [--ftp-pull] = grabs lead files from a remote FTP server, uses REPORTS FTP login information\n";
|
||||
@@ -326,6 +330,21 @@ if (length($ARGV[0])>1)
|
||||
$duptapchecksys=1;
|
||||
if ($q < 1) {print "\n----- DUPLICATE TITLE/ALT-PHONE SYSTEM CHECK -----\n\n";}
|
||||
}
|
||||
if ($args =~ /-duplicate-tnm-delete/i)
|
||||
{
|
||||
$duptnmdelete=1;
|
||||
if ($q < 1) {print "\n----- DUPLICATE TITLE DIFF DELETE -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--dob-mmddyyy/i)
|
||||
{
|
||||
$dob_mmddyyy=1;
|
||||
if ($q < 1) {print "\n----- DOB FORMAT MMDDYYYY -----\n\n";}
|
||||
}
|
||||
if ($args =~ /--dob-ddmmyyy/i)
|
||||
{
|
||||
$dob_ddmmyyy=1;
|
||||
if ($q < 1) {print "\n----- DOB FORMAT DDMMYYYY -----\n\n";}
|
||||
}
|
||||
if ($args =~ /-postal-code-gmt/i)
|
||||
{
|
||||
$postalgmt=1;
|
||||
@@ -614,7 +633,7 @@ foreach(@FILES)
|
||||
$new_list_id = "$list_id_prefix$listdate$x";
|
||||
while ( ($xloop < 10000) && ($dup_list_id > 0) )
|
||||
{
|
||||
$stmtA = "select count(*) from vicidial_lists where list_id='$new_list_id';";
|
||||
$stmtA = "SELECT count(*) from vicidial_lists where list_id='$new_list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1199,7 +1218,7 @@ foreach(@FILES)
|
||||
}
|
||||
|
||||
### look up the custom CID to use for this state
|
||||
$stmtA = "select cid from vicidial_custom_cid where state='$state';";
|
||||
$stmtA = "SELECT cid from vicidial_custom_cid where state='$state';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -1311,7 +1330,7 @@ foreach(@FILES)
|
||||
}
|
||||
|
||||
### look up the custom CID to use for this state
|
||||
$stmtA = "select cid from vicidial_custom_cid where state='$state';";
|
||||
$stmtA = "SELECT cid from vicidial_custom_cid where state='$state';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -1432,7 +1451,7 @@ foreach(@FILES)
|
||||
}
|
||||
|
||||
### look up the custom CID to use for this state
|
||||
$stmtA = "select cid from vicidial_custom_cid where state='$state';";
|
||||
$stmtA = "SELECT cid from vicidial_custom_cid where state='$state';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -1517,7 +1536,7 @@ foreach(@FILES)
|
||||
}
|
||||
|
||||
### look up the custom CID to use for this state
|
||||
$stmtA = "select cid from vicidial_custom_cid where state='$state';";
|
||||
$stmtA = "SELECT cid from vicidial_custom_cid where state='$state';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -1610,13 +1629,13 @@ foreach(@FILES)
|
||||
$called_count = $m[23]; $called_count =~ s/\D|\r|\n|\t//gi; if (length($called_count)<1) {$called_count=0;}
|
||||
$status = $m[24]; $status =~ s/ |\r|\n|\t//gi; if (length($status)<1) {$status='NEW';}
|
||||
$insert_date = $m[25]; $insert_date =~ s/\r|\n|\t|[a-zA-Z]//gi; if (length($insert_date)<6) {$insert_date=$pulldate0;}
|
||||
if ($insert_date =~ /\//)
|
||||
{
|
||||
@iD = split(/\//, $insert_date);
|
||||
$iD[0] = sprintf("%02d", $iD[0]);
|
||||
$iD[1] = sprintf("%02d", $iD[1]);
|
||||
$insert_date = "$iD[2]-$iD[0]-$iD[1]";
|
||||
}
|
||||
if ($insert_date =~ /\//)
|
||||
{
|
||||
@iD = split(/\//, $insert_date);
|
||||
$iD[0] = sprintf("%02d", $iD[0]);
|
||||
$iD[1] = sprintf("%02d", $iD[1]);
|
||||
$insert_date = "$iD[2]-$iD[0]-$iD[1]";
|
||||
}
|
||||
$multi_alt_phones = $m[26];
|
||||
|
||||
$map_count=0;
|
||||
@@ -1661,6 +1680,20 @@ foreach(@FILES)
|
||||
{
|
||||
$phone_code = $forcephonecode; # set phone_code to override value
|
||||
}
|
||||
if ( ($dob_mmddyyy > 0) && ($date_of_birth =~ /\//) )
|
||||
{
|
||||
@iD = split(/\//, $date_of_birth);
|
||||
$iD[0] = sprintf("%02d", $iD[0]);
|
||||
$iD[1] = sprintf("%02d", $iD[1]);
|
||||
$date_of_birth = "$iD[2]-$iD[0]-$iD[1]";
|
||||
}
|
||||
if ( ($dob_ddmmyyy > 0) && ($date_of_birth =~ /\//) )
|
||||
{
|
||||
@iD = split(/\//, $date_of_birth);
|
||||
$iD[0] = sprintf("%02d", $iD[0]);
|
||||
$iD[1] = sprintf("%02d", $iD[1]);
|
||||
$date_of_birth = "$iD[2]-$iD[1]-$iD[0]";
|
||||
}
|
||||
|
||||
if ($DBX) {print "$a|$phone_number\n";}
|
||||
|
||||
@@ -1681,7 +1714,7 @@ foreach(@FILES)
|
||||
if ( ($usacan_areacode_check > 0) && ($valid_lead > 0) )
|
||||
{
|
||||
$USarea = substr($phone_number, 0, 3);
|
||||
$stmtA = "select count(*) from vicidial_phone_codes where areacode='$USarea' and country_code='1';";
|
||||
$stmtA = "SELECT count(*) from vicidial_phone_codes where areacode='$USarea' and country_code='1';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1702,7 +1735,7 @@ foreach(@FILES)
|
||||
if ($dupchecksys > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select count(*) from vicidial_list where phone_number='$phone_number';";
|
||||
$stmtA = "SELECT count(*) from vicidial_list where phone_number='$phone_number';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1724,7 +1757,7 @@ foreach(@FILES)
|
||||
if ($dupcheck > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;";
|
||||
$stmtA = "SELECT list_id from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1748,7 +1781,7 @@ foreach(@FILES)
|
||||
$dup_lead=0;
|
||||
$dup_lists='';
|
||||
|
||||
$stmtA = "select count(*) from vicidial_lists where list_id='$list_id';";
|
||||
$stmtA = "SELECT count(*) from vicidial_lists where list_id='$list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1757,7 +1790,7 @@ foreach(@FILES)
|
||||
$sthA->finish();
|
||||
if ($ci_recs > 0)
|
||||
{
|
||||
$stmtA = "select campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
$stmtA = "SELECT campaign_id from vicidial_lists where list_id='$list_id';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1765,7 +1798,7 @@ foreach(@FILES)
|
||||
$dup_camp = $aryA[0];
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "select list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$stmtA = "SELECT list_id from vicidial_lists where campaign_id='$dup_camp';";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -1779,7 +1812,7 @@ foreach(@FILES)
|
||||
$sthA->finish();
|
||||
|
||||
chop($dup_lists);
|
||||
$stmtA = "select list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$stmtA = "SELECT list_id from vicidial_list where phone_number='$phone_number' and list_id IN($dup_lists) limit 1;";
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
$sthArows=$sthA->rows;
|
||||
@@ -1803,7 +1836,7 @@ foreach(@FILES)
|
||||
if ($duptapchecksys > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select count(*) from vicidial_list where title='$title' and alt_phone='$alt_phone';";
|
||||
$stmtA = "SELECT count(*) from vicidial_list where title='$title' and alt_phone='$alt_phone';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1825,7 +1858,7 @@ foreach(@FILES)
|
||||
if ($duptapchecklist > 0)
|
||||
{
|
||||
$dup_lead=0;
|
||||
$stmtA = "select list_id from vicidial_list where title='$title' and alt_phone='$alt_phone' and list_id='$list_id' limit 1;";
|
||||
$stmtA = "SELECT list_id from vicidial_list where title='$title' and alt_phone='$alt_phone' and list_id='$list_id' limit 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1843,7 +1876,35 @@ foreach(@FILES)
|
||||
{$dup_lead++;}
|
||||
}
|
||||
}
|
||||
##### Check for duplicate phone with different title in vicidial_list table for one list_id, delete if different #####
|
||||
if ( ($dup_lead > 0) && ($duptnmdelete > 0) )
|
||||
{
|
||||
$tnm_delete=0;
|
||||
$tnm_lead_id='';
|
||||
$stmtA = "SELECT lead_id,title from vicidial_list where phone_number='$phone_number' and list_id='$list_id' limit 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$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;
|
||||
$tnm_lead_id = $aryA[0];
|
||||
$tnm_title_check = $aryA[1];
|
||||
if ( (length($tnm_title_check) > 0) && (length($title) > 0) && ($tnm_title_check !~ /^$title$/) )
|
||||
{$tnm_delete++;}
|
||||
}
|
||||
$sthA->finish();
|
||||
if ($tnm_delete > 0)
|
||||
{
|
||||
$stmtZ = "DELETE FROM vicidial_list where lead_id='$tnm_lead_id' limit 1;";
|
||||
if (!$T) {$affected_rows = $dbhA->do($stmtZ); } # or die "Couldn't execute query: |$stmtZ|\n";
|
||||
if($DB){print STDERR "\n|$affected_rows|$tnm_title_check|$title|$tnm_lead_id|$list_id|$stmtZ|\n";}
|
||||
$tnm_delete_count++;
|
||||
}
|
||||
}
|
||||
|
||||
##### final checks before inserting the lead
|
||||
if ( (length($phone_number)>6) && ($dup_lead < 1) && ($valid_lead > 0) )
|
||||
{
|
||||
if ( ($duptapchecklist > 0) || ($duptapchecksys > 0) )
|
||||
@@ -1867,7 +1928,7 @@ foreach(@FILES)
|
||||
{
|
||||
if ($phone_code =~ /^1$/)
|
||||
{
|
||||
$stmtA = "select postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
|
||||
$stmtA = "SELECT postal_code,state,GMT_offset,DST,DST_range,country,country_code from vicidial_postal_codes where country_code='$phone_code' and postal_code LIKE \"$postal_code%\";";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1893,7 +1954,7 @@ foreach(@FILES)
|
||||
$dst='N';
|
||||
$gmt_offset=0;
|
||||
|
||||
$stmtA="select GMT_offset from vicidial_phone_codes where tz_code='$owner' and country_code='$phone_code' limit 1;";
|
||||
$stmtA="SELECT GMT_offset from vicidial_phone_codes where tz_code='$owner' and country_code='$phone_code' limit 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1907,7 +1968,7 @@ foreach(@FILES)
|
||||
}
|
||||
$sthA->finish();
|
||||
|
||||
$stmtA = "select distinct DST_range from vicidial_phone_codes where tz_code='$owner' and country_code='$phone_code' order by DST_range desc limit 1;";
|
||||
$stmtA = "SELECT distinct DST_range from vicidial_phone_codes where tz_code='$owner' and country_code='$phone_code' order by DST_range desc limit 1;";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1927,7 +1988,7 @@ foreach(@FILES)
|
||||
### UNITED STATES ###
|
||||
if ($phone_code =~ /^1$/)
|
||||
{
|
||||
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||
$stmtA = "SELECT country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1947,7 +2008,7 @@ foreach(@FILES)
|
||||
### MEXICO ###
|
||||
if ($phone_code =~ /^52$/)
|
||||
{
|
||||
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||
$stmtA = "SELECT country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and areacode='$USarea';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1967,7 +2028,7 @@ foreach(@FILES)
|
||||
### AUSTRALIA ###
|
||||
if ($phone_code =~ /^61$/)
|
||||
{
|
||||
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
|
||||
$stmtA = "SELECT country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code' and state='$state';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -1987,7 +2048,7 @@ foreach(@FILES)
|
||||
### ALL OTHER COUNTRY CODES ###
|
||||
if (!$PC_processed)
|
||||
{
|
||||
$stmtA = "select country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
|
||||
$stmtA = "SELECT country_code,country,areacode,state,GMT_offset,DST,DST_range,geographic_description from vicidial_phone_codes where country_code='$phone_code';";
|
||||
if($DBX){print STDERR "\n|$stmtA|\n";}
|
||||
$sthA = $dbhA->prepare($stmtA) or die "preparing: ",$dbhA->errstr;
|
||||
$sthA->execute or die "executing: $stmtA ", $dbhA->errstr;
|
||||
@@ -2206,6 +2267,8 @@ foreach(@FILES)
|
||||
{$Falert .= "DUPLICATES: $f\n";}
|
||||
if ($h > 0)
|
||||
{$Falert .= "INVALID PHONES: $h\n";}
|
||||
if ($tnm_delete_count > 0)
|
||||
{$Falert .= "TNM DELETE COUNT: $tnm_delete_count\n";}
|
||||
|
||||
if ($q < 1) {print "$Falert";}
|
||||
print Sout "$Falert";
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
Extended vicidial_list fields 2012-07-13
|
||||
|
||||
|
||||
These fields were added to allow for more complex Call Menu setups with an
|
||||
additional 20 TINYINT fields allowed for DTMF Log data storage.
|
||||
|
||||
To enable this feature, you must make the database changes shown at the bottom,
|
||||
and the options.php file needs to have $extended_vl_fields set to '1'.
|
||||
|
||||
|
||||
|
||||
Database changes:
|
||||
|
||||
ALTER TABLE vicidial_list
|
||||
ADD q01 TINYINT(1) default '-1',
|
||||
ADD q02 TINYINT(1) default '-1',
|
||||
ADD q03 TINYINT(1) default '-1',
|
||||
ADD q04 TINYINT(1) default '-1',
|
||||
ADD q05 TINYINT(1) default '-1',
|
||||
ADD q06 TINYINT(1) default '-1',
|
||||
ADD q07 TINYINT(1) default '-1',
|
||||
ADD q08 TINYINT(1) default '-1',
|
||||
ADD q09 TINYINT(1) default '-1',
|
||||
ADD q10 TINYINT(1) default '-1',
|
||||
ADD q11 TINYINT(1) default '-1',
|
||||
ADD q12 TINYINT(1) default '-1',
|
||||
ADD q13 TINYINT(1) default '-1',
|
||||
ADD q14 TINYINT(1) default '-1',
|
||||
ADD q15 TINYINT(1) default '-1',
|
||||
ADD q16 TINYINT(1) default '-1',
|
||||
ADD q17 TINYINT(1) default '-1',
|
||||
ADD q18 TINYINT(1) default '-1',
|
||||
ADD q19 TINYINT(1) default '-1',
|
||||
ADD q20 TINYINT(1) default '-1';
|
||||
|
||||
@@ -392,13 +392,14 @@ else
|
||||
$max_dead=1;
|
||||
$max_customer=1;
|
||||
$GRAPH="<a name='timegraph'/><table border='0' cellpadding='0' cellspacing='2' width='800'>";
|
||||
$GRAPH2="<tr><th class='column_header grey_graph_cell' id='timegraph1'><a href='#' onClick=\"DrawGraph('CALLS', '1'); return false;\">CALLS</a></th><th class='column_header grey_graph_cell' id='timegraph2'><a href='#' onClick=\"DrawGraph('TIMECLOCK', '2'); return false;\">TIME CLOCK</a></th><th class='column_header grey_graph_cell' id='timegraph3'><a href='#' onClick=\"DrawGraph('AGENTTIME', '3'); return false;\">AGENT TIME</a></th><th class='column_header grey_graph_cell' id='timegraph4'><a href='#' onClick=\"DrawGraph('WAIT', '4'); return false;\">WAIT</a></th><th class='column_header grey_graph_cell' id='timegraph5'><a href='#' onClick=\"DrawGraph('TALK', '5'); return false;\">TALK</a></th><th class='column_header grey_graph_cell' id='timegraph6'><a href='#' onClick=\"DrawGraph('DISPO', '6'); return false;\">DISPO</a></th><th class='column_header grey_graph_cell' id='timegraph7'><a href='#' onClick=\"DrawGraph('PAUSE', '7'); return false;\">PAUSE</a></th><th class='column_header grey_graph_cell' id='timegraph8'><a href='#' onClick=\"DrawGraph('DEAD', '8'); return false;\">DEAD</a></th><th class='column_header grey_graph_cell' id='timegraph9'><a href='#' onClick=\"DrawGraph('CUSTOMER', '9'); return false;\">CUSTOMER</a></th>";
|
||||
$GRAPH2="<tr><th class='column_header grey_graph_cell' id='timegraph1'><a href='#' onClick=\"DrawGraph('CALLS', '1'); return false;\">CALLS</a></th><th class='column_header grey_graph_cell' id='timegraph2'><a href='#' onClick=\"DrawGraph('TIMECLOCK', '2'); return false;\">TIME CLOCK</a></th><th class='column_header grey_graph_cell' id='timegraph3'><a href='#' onClick=\"DrawGraph('AGENTTIME', '3'); return false;\">AGENT TIME</a></th><th class='column_header grey_graph_cell' id='timegraph4'><a href='#' onClick=\"DrawGraph('WAIT', '4'); return false;\">WAIT</a></th><th class='column_header grey_graph_cell' id='timegraph5'><a href='#' onClick=\"DrawGraph('TALK', '5'); return false;\">TALK</a></th><th class='column_header grey_graph_cell' id='timegraph10'><a href='#' onClick=\"DrawGraph('TALKPCT', '10'); return false;\">TALKTIME%</a></th><th class='column_header grey_graph_cell' id='timegraph6'><a href='#' onClick=\"DrawGraph('DISPO', '6'); return false;\">DISPO</a></th><th class='column_header grey_graph_cell' id='timegraph7'><a href='#' onClick=\"DrawGraph('PAUSE', '7'); return false;\">PAUSE</a></th><th class='column_header grey_graph_cell' id='timegraph8'><a href='#' onClick=\"DrawGraph('DEAD', '8'); return false;\">DEAD</a></th><th class='column_header grey_graph_cell' id='timegraph9'><a href='#' onClick=\"DrawGraph('CUSTOMER', '9'); return false;\">CUSTOMER</a></th>";
|
||||
$graph_header="<table cellspacing='0' cellpadding='0' class='horizontalgraph'><caption align='top'>AGENT TIME BREAKDOWN</caption><tr><th class='thgraph' scope='col'>STATUS</th>";
|
||||
$CALLS_graph=$graph_header."<th class='thgraph' scope='col'>CALLS </th></tr>";
|
||||
$TIMECLOCK_graph=$graph_header."<th class='thgraph' scope='col'>TIME CLOCK</th></tr>";
|
||||
$AGENTTIME_graph=$graph_header."<th class='thgraph' scope='col'>AGENT TIME</th></tr>";
|
||||
$WAIT_graph=$graph_header."<th class='thgraph' scope='col'>WAIT</th></tr>";
|
||||
$TALK_graph=$graph_header."<th class='thgraph' scope='col'>TALK</th></tr>";
|
||||
$TALKPCT_graph=$graph_header."<th class='thgraph' scope='col'>TALK TIME %</th></tr>";
|
||||
$DISPO_graph=$graph_header."<th class='thgraph' scope='col'>DISPO</th></tr>";
|
||||
$PAUSE_graph=$graph_header."<th class='thgraph' scope='col'>PAUSE</th></tr>";
|
||||
$DEAD_graph=$graph_header."<th class='thgraph' scope='col'>DEAD</th></tr>";
|
||||
@@ -569,15 +570,15 @@ else
|
||||
if ($file_download < 1)
|
||||
{
|
||||
$ASCII_text.="AGENT TIME BREAKDOWN:\n";
|
||||
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
|
||||
$ASCII_text.="| <a href=\"$LINKbase&stage=NAME\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=TCLOCK\">TIME CLOCK</a> | <a href=\"$LINKbase&stage=TIME\">AGENT TIME</a> | WAIT | TALK | DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n";
|
||||
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
|
||||
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
|
||||
$ASCII_text.="| <a href=\"$LINKbase&stage=NAME\">USER NAME</a> | <a href=\"$LINKbase&stage=ID\">ID</a> | <a href=\"$LINKbase&stage=LEADS\">CALLS</a> | <a href=\"$LINKbase&stage=TCLOCK\">TIME CLOCK</a> | <a href=\"$LINKbase&stage=TIME\">AGENT TIME</a> | WAIT | TALK | TALK TIME %| DISPO | PAUSE | DEAD | CUSTOMER | |$sub_statusesHTML\n";
|
||||
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$file_output .= "USER,ID,CALLS,TIME CLOCK,AGENT TIME,WAIT,TALK,DISPO,PAUSE,DEAD,CUSTOMER$sub_statusesFILE\n";
|
||||
$file_output .= "USER,ID,CALLS,TIME CLOCK,AGENT TIME,WAIT,TALK,TALK TIME %,DISPO,PAUSE,DEAD,CUSTOMER$sub_statusesFILE\n";
|
||||
}
|
||||
##### END print the output to screen or put into file output variable
|
||||
|
||||
@@ -597,6 +598,7 @@ else
|
||||
$SstatusesHTML='';
|
||||
$SstatusesFILE='';
|
||||
$Stime[$m] = ($Swait[$m] + $Stalk[$m] + $Sdispo[$m] + $Spause[$m]);
|
||||
$Stalkpct[$m]=(100*$Stalk[$m]/$Stime[$m]);
|
||||
$RAWuser = $Suser[$m];
|
||||
$RAWcalls = $Scalls[$m];
|
||||
$RAWtimeSEC = $Stime[$m];
|
||||
@@ -609,6 +611,7 @@ else
|
||||
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]);}
|
||||
if (trim($Stalkpct[$m])>$max_talkpct) {$max_talkpct=trim($Stalkpct[$m]);}
|
||||
$graph_stats[$m][1]=trim($Scalls[$m]);
|
||||
$graph_stats[$m][3]=trim($Stime[$m]);
|
||||
$graph_stats[$m][4]=trim($Swait[$m]);
|
||||
@@ -617,7 +620,9 @@ else
|
||||
$graph_stats[$m][7]=trim($Spause[$m]);
|
||||
$graph_stats[$m][8]=trim($Sdead[$m]);
|
||||
$graph_stats[$m][9]=trim($Scustomer[$m]);
|
||||
$graph_stats[$m][10]=trim(sprintf("%01.2f", $Stalkpct[$m]));
|
||||
|
||||
$Stalkpct[$m]= sprintf("%01.2f", $Stalkpct[$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);
|
||||
@@ -633,6 +638,7 @@ else
|
||||
$RAWpause = $Spause[$m];
|
||||
$RAWdead = $Sdead[$m];
|
||||
$RAWcustomer = $Scustomer[$m];
|
||||
$RAWtalkpct = $Stalkpct[$m];
|
||||
|
||||
$n=0;
|
||||
$user_name_found=0;
|
||||
@@ -747,6 +753,7 @@ else
|
||||
}
|
||||
### END loop through each status ###
|
||||
|
||||
$Stalkpct[$m]= sprintf("%9s", $Stalkpct[$m])."%";
|
||||
$Swait[$m]= sprintf("%10s", $Swait[$m]);
|
||||
$Stalk[$m]= sprintf("%10s", $Stalk[$m]);
|
||||
$Sdispo[$m]= sprintf("%10s", $Sdispo[$m]);
|
||||
@@ -774,7 +781,7 @@ else
|
||||
|
||||
if ($file_download < 1)
|
||||
{
|
||||
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?user=$RAWuser\">$Suser[$m]</a> | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] | $Swait[$m] | $Stalk[$m] | $Sdispo[$m] | $Spause[$m] | $Sdead[$m] | $Scustomer[$m] | |$SstatusesHTML\n";
|
||||
$Toutput = "| $Sname[$m] | <a href=\"./user_stats.php?user=$RAWuser\">$Suser[$m]</a> | $Scalls[$m] | $StimeTC[$m]$TCuserAUTOLOGOUT| $Stime[$m] | $Swait[$m] | $Stalk[$m] | $Stalkpct[$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
|
||||
}
|
||||
@@ -783,11 +790,12 @@ else
|
||||
if (strlen($RAWtime)<1) {$RAWtime='0';}
|
||||
if (strlen($RAWwait)<1) {$RAWwait='0';}
|
||||
if (strlen($RAWtalk)<1) {$RAWtalk='0';}
|
||||
if (strlen($RAWtalkpct)<0) {$RAWtalkpct='0.0%';}
|
||||
if (strlen($RAWdispo)<1) {$RAWdispo='0';}
|
||||
if (strlen($RAWpause)<1) {$RAWpause='0';}
|
||||
if (strlen($RAWdead)<1) {$RAWdead='0';}
|
||||
if (strlen($RAWcustomer)<1) {$RAWcustomer='0';}
|
||||
$fileToutput = "$RAWname,$RAWuser,$RAWcalls,$RAWtimeTC,$RAWtime,$RAWwait,$RAWtalk,$RAWdispo,$RAWpause,$RAWdead,$RAWcustomer$SstatusesFILE\n";
|
||||
$fileToutput = "$RAWname,$RAWuser,$RAWcalls,$RAWtimeTC,$RAWtime,$RAWwait,$RAWtalk,$RAWtalkpct %,$RAWdispo,$RAWpause,$RAWdead,$RAWcustomer$SstatusesFILE\n";
|
||||
}
|
||||
|
||||
$TOPsorted_output[$m] = $Toutput;
|
||||
@@ -918,6 +926,7 @@ else
|
||||
### END loop through each status ###
|
||||
|
||||
### call function to calculate and print dialable leads
|
||||
$TOTtalkpct=sprintf("%01.2f", (100*$TOTtalk/$TOTALtime));
|
||||
$TOTwait = sec_convert($TOTwait,$TIME_agenttimedetail);
|
||||
$TOTtalk = sec_convert($TOTtalk,$TIME_agenttimedetail);
|
||||
$TOTdispo = sec_convert($TOTdispo,$TIME_agenttimedetail);
|
||||
@@ -927,6 +936,7 @@ else
|
||||
$TOTALtime = sec_convert($TOTALtime,$TIME_agenttimedetail);
|
||||
$TOTtimeTC = sec_convert($TOTtimeTC,$TIME_agenttimedetail);
|
||||
|
||||
$hTOTtalkpct = sprintf("%10s", $TOTtalkpct)."%";
|
||||
$hTOTcalls = sprintf("%8s", $TOTcalls);
|
||||
$hTOTwait = sprintf("%11s", $TOTwait);
|
||||
$hTOTtalk = sprintf("%11s", $TOTtalk);
|
||||
@@ -939,12 +949,12 @@ else
|
||||
###### END LAST LINE TOTALS FORMATTING ##########
|
||||
|
||||
|
||||
|
||||
|
||||
if ($file_download < 1)
|
||||
{
|
||||
$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";
|
||||
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
|
||||
$ASCII_text.="| TOTALS AGENTS:$hTOT_AGENTS | $hTOTcalls |$hTOTtimeTC |$hTOTALtime |$hTOTwait |$hTOTtalk |$hTOTtalkpct |$hTOTdispo |$hTOTpause |$hTOTdead |$hTOTcustomer | |$SUMstatusesHTML\n";
|
||||
$ASCII_text.="+-----------------+----------+----------+------------+------------+------------+------------+------------+------------+------------+------------+------------+ +$sub_statusesHEAD\n";
|
||||
if ($AUTOLOGOUTflag > 0)
|
||||
{echo " * denotes AUTOLOGOUT from timeclock\n";}
|
||||
$ASCII_text.="\n\n</PRE>";
|
||||
@@ -967,6 +977,7 @@ else
|
||||
$PAUSE_graph.=" <tr><td class='chart_td$class'>".$graph_stats[$d][0]."</td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(400*$graph_stats[$d][7]/$max_pause)."' height='16' />".sec_convert($graph_stats[$d][7], 'HF')."</td></tr>";
|
||||
$DEAD_graph.=" <tr><td class='chart_td$class'>".$graph_stats[$d][0]."</td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(400*$graph_stats[$d][8]/$max_dead)."' height='16' />".sec_convert($graph_stats[$d][8], 'HF')."</td></tr>";
|
||||
$CUSTOMER_graph.=" <tr><td class='chart_td$class'>".$graph_stats[$d][0]."</td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(400*$graph_stats[$d][9]/$max_customer)."' height='16' />".sec_convert($graph_stats[$d][9], 'HF')."</td></tr>";
|
||||
$TALKPCT_graph.=" <tr><td class='chart_td$class'>".$graph_stats[$d][0]."</td><td nowrap class='chart_td value$class'><img src='images/bar.png' alt='' width='".round(400*$graph_stats[$d][10]/$max_talkpct)."' height='16' />".$graph_stats[$d][10]." %</td></tr>";
|
||||
|
||||
for ($e=0; $e<count($sub_statusesARY); $e++) {
|
||||
$Sstatus=$sub_statusesARY[$e];
|
||||
@@ -986,6 +997,7 @@ else
|
||||
$PAUSE_graph.="<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>".trim($hTOTpause)."</th></tr></table>";
|
||||
$DEAD_graph.="<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>".trim($hTOTdead)."</th></tr></table>";
|
||||
$CUSTOMER_graph.="<tr><th class='thgraph' scope='col'>TOTAL:</th><th class='thgraph' scope='col'>".trim($hTOTcustomer)."</th></tr></table>";
|
||||
$TALKPCT_graph.="<tr><th class='thgraph' scope='col'>AVERAGE:</th><th class='thgraph' scope='col'>".trim($hTOTtalkpct)."</th></tr></table>";
|
||||
for ($e=0; $e<count($sub_statusesARY); $e++) {
|
||||
$Sstatus=$sub_statusesARY[$e];
|
||||
$total_var=$Sstatus."_total";
|
||||
@@ -1004,6 +1016,7 @@ else
|
||||
$JS_text.=" var PAUSE_graph=\"$PAUSE_graph\";\n";
|
||||
$JS_text.=" var DEAD_graph=\"$DEAD_graph\";\n";
|
||||
$JS_text.=" var CUSTOMER_graph=\"$CUSTOMER_graph\";\n";
|
||||
$JS_text.=" var TALKPCT_graph=\"$TALKPCT_graph\";\n";
|
||||
|
||||
for ($e=0; $e<count($sub_statusesARY); $e++) {
|
||||
$Sstatus=$sub_statusesARY[$e];
|
||||
@@ -1022,13 +1035,13 @@ else
|
||||
$JS_text.=" document.getElementById('agent_time_detail_graph').innerHTML=graph_to_display;\n";
|
||||
$JS_text.="}\n";
|
||||
|
||||
$GRAPH3="<tr><td colspan='".(9+$sub_status_count)."' class='graph_span_cell'><span id='agent_time_detail_graph'><BR> <BR></span></td></tr></table><BR><BR>";
|
||||
$GRAPH3="<tr><td colspan='".(10+$sub_status_count)."' class='graph_span_cell'><span id='agent_time_detail_graph'><BR> <BR></span></td></tr></table><BR><BR>";
|
||||
|
||||
# echo $GRAPH.$GRAPH2.$GRAPH3.$max;
|
||||
}
|
||||
else
|
||||
{
|
||||
$file_output .= "TOTALS,$TOT_AGENTS,$TOTcalls,$TOTtimeTC,$TOTALtime,$TOTwait,$TOTtalk,$TOTdispo,$TOTpause,$TOTdead,$TOTcustomer$SUMstatusesFILE\n";
|
||||
$file_output .= "TOTALS,$TOT_AGENTS,$TOTcalls,$TOTtimeTC,$TOTALtime,$TOTwait,$TOTtalk,$TOTtalkpct %,$TOTdispo,$TOTpause,$TOTdead,$TOTcustomer$SUMstatusesFILE\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+84
-11
@@ -1724,6 +1724,10 @@ 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["download_max_system_stats_metric"])) {$download_max_system_stats_metric=$_GET["download_max_system_stats_metric"];}
|
||||
elseif (isset($_POST["download_max_system_stats_metric"])) {$download_max_system_stats_metric=$_POST["download_max_system_stats_metric"];}
|
||||
if (isset($_GET["download_max_system_stats_metric_name"])) {$download_max_system_stats_metric_name=$_GET["download_max_system_stats_metric_name"];}
|
||||
elseif (isset($_POST["download_max_system_stats_metric_name"])) {$download_max_system_stats_metric_name=$_POST["download_max_system_stats_metric_name"];}
|
||||
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"];}
|
||||
@@ -1755,6 +1759,58 @@ if (strlen($dial_status) > 0)
|
||||
$status = $dial_status;
|
||||
}
|
||||
|
||||
if ($download_max_system_stats_metric_name) {
|
||||
if (!$query_date) {$query_date=date("Y-m-d", time()-(29*86400));}
|
||||
if (!$end_date) {
|
||||
$end_date=date("Y-m-d", time());
|
||||
} else if (strtotime($end_date)>strtotime(date("Y-m-d"))) {
|
||||
$end_date=date("Y-m-d");
|
||||
}
|
||||
if ($query_date>$end_date) {$query_date=$end_date;}
|
||||
|
||||
$num_graph_days = ceil(abs(strtotime($end_date) - strtotime($query_date)) / 86400)+1;
|
||||
$CSV_text="";
|
||||
|
||||
if ($download_max_system_stats_metric_name=="ALL" || $download_max_system_stats_metric_name=="total call count in and out") {
|
||||
download_max_system_stats($campaign_id,$num_graph_days,'system','total_calls','total call count in and out',$end_date);
|
||||
}
|
||||
if ($download_max_system_stats_metric_name=="ALL" || $download_max_system_stats_metric_name=="total inbound call count") {
|
||||
download_max_system_stats($campaign_id,$num_graph_days,'system','total_calls_inbound_all','total inbound call count',$end_date);
|
||||
}
|
||||
if ($download_max_system_stats_metric_name=="ALL" || $download_max_system_stats_metric_name=="total outbound call count") {
|
||||
download_max_system_stats($campaign_id,$num_graph_days,'system','total_calls_outbound_all','total outbound call count',$end_date);
|
||||
}
|
||||
if ($download_max_system_stats_metric_name=="ALL" || $download_max_system_stats_metric_name=="most concurrent calls in and out") {
|
||||
download_max_system_stats($campaign_id,$num_graph_days,'system','(max_inbound + max_outbound)','most concurrent calls in and out',$end_date);
|
||||
}
|
||||
if ($download_max_system_stats_metric_name=="ALL" || $download_max_system_stats_metric_name=="most concurrent calls inbound total") {
|
||||
download_max_system_stats($campaign_id,$num_graph_days,'system','max_inbound','most concurrent calls inbound total',$end_date);
|
||||
}
|
||||
if ($download_max_system_stats_metric_name=="ALL" || $download_max_system_stats_metric_name=="most concurrent calls outbound total") {
|
||||
download_max_system_stats($campaign_id,$num_graph_days,'system','max_outbound','most concurrent calls outbound total',$end_date);
|
||||
}
|
||||
if ($download_max_system_stats_metric_name=="ALL" || $download_max_system_stats_metric_name=="most concurrent agents") {
|
||||
download_max_system_stats($campaign_id,$num_graph_days,'system','max_agents','most concurrent agents',$end_date);
|
||||
}
|
||||
|
||||
$FILE_TIME = date("Ymd-His");
|
||||
$CSVfilename = "MAX_SYSTEM_STATS_$US$FILE_TIME.csv";
|
||||
$CSV_text=preg_replace('/ +\"/', '"', $CSV_text);
|
||||
$CSV_text=preg_replace('/\" +/', '"', $CSV_text);
|
||||
header('Content-type: application/octet-stream');
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
#############################################
|
||||
##### START SYSTEM_SETTINGS LOOKUP #####
|
||||
$stmt = "SELECT use_non_latin,enable_queuemetrics_logging,enable_vtiger_integration,qc_features_active,outbound_autodial_active,sounds_central_control_active,enable_second_webform,user_territories_active,custom_fields_enabled,admin_web_directory,webphone_url,first_login_trigger,hosted_settings,default_phone_registration_password,default_phone_login_password,default_server_password,test_campaign_calls,active_voicemail_server,voicemail_timezones,default_voicemail_timezone,default_local_gmt,campaign_cid_areacodes_enabled,pllb_grouping_limit,did_ra_extensions_enabled,expanded_list_stats,contacts_enabled,alt_log_server_ip,alt_log_dbname,alt_log_login,alt_log_pass,tables_use_alt_log_db,call_menu_qualify_enabled FROM system_settings;";
|
||||
@@ -3078,12 +3134,13 @@ else
|
||||
# 120526-0827 - Added User Group User Login Report
|
||||
# 120529-2112 - Added safe_harbor_audio_field campaign option
|
||||
# 120706-1255 - Added Max stats date range and call menu qualify_sql options
|
||||
# 120713-2123 - Added max stats download link and extended_vl option
|
||||
#
|
||||
|
||||
# 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.6-371a';
|
||||
$build = '120706-1255';
|
||||
$admin_version = '2.6-372a';
|
||||
$build = '120713-2123';
|
||||
|
||||
$STARTtime = date("U");
|
||||
$SQLdate = date("Y-m-d H:i:s");
|
||||
@@ -26660,8 +26717,17 @@ if ($ADD==3511)
|
||||
{
|
||||
echo "<option selected value=\"0\">0 - No DTMF Logging</option><option value=\"1\">1 - DTMF Logging Enabled</option>\n";
|
||||
}
|
||||
|
||||
if (file_exists('options.php'))
|
||||
{require('options.php');}
|
||||
$extended_vl_fields_OPTIONS='';
|
||||
if ($extended_vl_fields > 0)
|
||||
{
|
||||
$extended_vl_fields_OPTIONS = '<option>q01</option><option>q02</option><option>q03</option><option>q04</option><option>q05</option><option>q06</option><option>q07</option><option>q08</option><option>q09</option><option>q10</option><option>q11</option><option>q12</option><option>q13</option><option>q14</option><option>q15</option><option>q16</option><option>q17</option><option>q18</option><option>q19</option><option>q20</option>';
|
||||
}
|
||||
|
||||
echo "</select>$NWB#vicidial_call_menu-dtmf_log$NWE Log Field: \n";
|
||||
echo "<select size=1 name=dtmf_field><option>NONE</option><option>vendor_lead_code</option><option>source_id</option><option>phone_code</option><option>title</option><option>first_name</option><option>middle_initial</option><option>last_name</option><option>address1</option><option>address2</option><option>address3</option><option>city</option><option>state</option><option>province</option><option>postal_code</option><option>country_code</option><option>alt_phone</option><option>email</option><option>security_phrase</option><option>comments</option><option>rank</option><option>owner</option><option>status</option><option>user</option><option SELECTED>$dtmf_field</option></select>$NWB#vicidial_call_menu-dtmf_field$NWE</td></tr>\n";
|
||||
echo "<select size=1 name=dtmf_field><option>NONE</option><option>vendor_lead_code</option><option>source_id</option><option>phone_code</option><option>title</option><option>first_name</option><option>middle_initial</option><option>last_name</option><option>address1</option><option>address2</option><option>address3</option><option>city</option><option>state</option><option>province</option><option>postal_code</option><option>country_code</option><option>alt_phone</option><option>email</option><option>security_phrase</option><option>comments</option><option>rank</option><option>owner</option><option>status</option><option>user</option><option SELECTED>$dtmf_field</option>$extended_vl_fields_OPTIONS</select>$NWB#vicidial_call_menu-dtmf_field$NWE</td></tr>\n";
|
||||
|
||||
echo "<tr><td align=center colspan=2> <input type=submit name=SUBMIT value=SUBMIT> </td></tr>\n";
|
||||
echo "<tr bgcolor=#B6D3FC><td align=CENTER colspan=2> Call Menu Options: </td></tr>\n";
|
||||
@@ -33267,7 +33333,7 @@ if ($ADD==999992)
|
||||
echo "o_cal.a_tpl.yearscroll = false;\n";
|
||||
echo "// o_cal.a_tpl.weekstart = 1; // Monday week start\n";
|
||||
echo "</script> <input type='submit' name='max_system_stats_submit' VALUE='ADJUST DATE RANGE'><input type='hidden' name='ADD' value='$ADD'><input type='hidden' name='stage' value='$stage'></form><BR>\n";
|
||||
echo "<center><TABLE width=$section_width cellspacing=5 cellpadding=2>\n";
|
||||
echo "<center><a href='$PHP_SELF?query_date=$query_date&end_date=$end_date&max_system_stats_submit=$max_system_stats_submit&ADD=$ADD&stage=$stage&download_max_system_stats_metric_name=ALL'>[DOWNLOAD ALL]</a><TABLE width=$section_width cellspacing=5 cellpadding=2>\n";
|
||||
|
||||
if ( (preg_match("/Maximum System Stats/",$LOGallowed_reports)) or (preg_match("/ALL REPORTS/",$LOGallowed_reports)) )
|
||||
{
|
||||
@@ -33284,31 +33350,38 @@ if ($ADD==999992)
|
||||
}
|
||||
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'total_calls','total call count in and out',0,$end_date);
|
||||
$download_link="<font size='-2'><a href='$PHP_SELF?query_date=$query_date&end_date=$end_date&max_system_stats_submit=$max_system_stats_submit&ADD=$ADD&stage=$stage&download_max_system_stats_metric_name=total+call+count+in+and+out'>[DOWNLOAD]</a></font>";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'total_calls','total call count in and out',0,$end_date,$download_link);
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'total_calls_inbound_all','total inbound call count',0,$end_date);
|
||||
$download_link="<font size='-2'><a href='$PHP_SELF?query_date=$query_date&end_date=$end_date&max_system_stats_submit=$max_system_stats_submit&ADD=$ADD&stage=$stage&download_max_system_stats_metric_name=total+inbound+call+count'>[DOWNLOAD]</a></font>";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'total_calls_inbound_all','total inbound call count',0,$end_date,$download_link);
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'total_calls_outbound_all','total outbound call count',0,$end_date);
|
||||
$download_link="<font size='-2'><a href='$PHP_SELF?query_date=$query_date&end_date=$end_date&max_system_stats_submit=$max_system_stats_submit&ADD=$ADD&stage=$stage&download_max_system_stats_metric_name=total+outbound+call+count'>[DOWNLOAD]</a></font>";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'total_calls_outbound_all','total outbound call count',0,$end_date,$download_link);
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'(max_inbound + max_outbound)','most concurrent calls in and out',0,$end_date);
|
||||
$download_link="<font size='-2'><a href='$PHP_SELF?query_date=$query_date&end_date=$end_date&max_system_stats_submit=$max_system_stats_submit&ADD=$ADD&stage=$stage&download_max_system_stats_metric_name=most+concurrent+calls+in+and+out'>[DOWNLOAD]</a></font>";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'(max_inbound + max_outbound)','most concurrent calls in and out',0,$end_date,$download_link);
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'max_inbound','most concurrent calls inbound total',0,$end_date);
|
||||
$download_link="<font size='-2'><a href='$PHP_SELF?query_date=$query_date&end_date=$end_date&max_system_stats_submit=$max_system_stats_submit&ADD=$ADD&stage=$stage&download_max_system_stats_metric_name=most+concurrent+calls+inbound+total'>[DOWNLOAD]</a></font>";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'max_inbound','most concurrent calls inbound total',0,$end_date,$download_link);
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'max_outbound','most concurrent calls outbound total',0,$end_date);
|
||||
$download_link="<font size='-2'><a href='$PHP_SELF?query_date=$query_date&end_date=$end_date&max_system_stats_submit=$max_system_stats_submit&ADD=$ADD&stage=$stage&download_max_system_stats_metric_name=most+concurrent+calls+outbound+total'>[DOWNLOAD]</a></font>";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'max_outbound','most concurrent calls outbound total',0,$end_date,$download_link);
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr bgcolor=#B6D3FC><td align=center colspan=2>\n";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'max_agents','most concurrent agents',0,$end_date);
|
||||
$download_link="<font size='-2'><a href='$PHP_SELF?query_date=$query_date&end_date=$end_date&max_system_stats_submit=$max_system_stats_submit&ADD=$ADD&stage=$stage&download_max_system_stats_metric_name=most+concurrent+agents'>[DOWNLOAD]</a></font>";
|
||||
horizontal_bar_chart($campaign_id,$num_graph_days,'system',$link,'max_agents','most concurrent agents',0,$end_date,$download_link);
|
||||
echo "</td></tr>\n";
|
||||
}
|
||||
else
|
||||
|
||||
@@ -22,10 +22,11 @@
|
||||
# 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
|
||||
# 120713-2101 - Added extended_vl_fields option
|
||||
#
|
||||
|
||||
$admin_version = '2.4-16';
|
||||
$build = '120223-2315';
|
||||
$admin_version = '2.4-17';
|
||||
$build = '120713-2101';
|
||||
|
||||
|
||||
require("dbconnect.php");
|
||||
@@ -153,8 +154,16 @@ $STARTtime = date("U");
|
||||
$TODAY = date("Y-m-d");
|
||||
$NOW_TIME = date("Y-m-d H:i:s");
|
||||
|
||||
if (file_exists('options.php'))
|
||||
{require('options.php');}
|
||||
|
||||
$vicidial_list_fields = '|lead_id|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|status|entry_date|entry_list_id|modify_date|user|';
|
||||
|
||||
if ($extended_vl_fields > 0)
|
||||
{
|
||||
$vicidial_list_fields = '|lead_id|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|status|entry_date|entry_list_id|modify_date|user|q01|q02|q03|q04|q05|q06|q07|q08|q09|q10|q11|q12|q13|q14|q15|q16|q17|q18|q19|q20|';
|
||||
}
|
||||
|
||||
$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|';
|
||||
|
||||
|
||||
+105
-10
@@ -13,6 +13,7 @@
|
||||
# 111222-2124 - Added max stats bar chart function
|
||||
# 120125-1235 - Small changes to max stats function to allow for total system stats
|
||||
# 120213-1417 - Changes to allow for ra stats
|
||||
# 120713-2137 - Added download function for max stats
|
||||
#
|
||||
|
||||
##### reformat seconds into HH:MM:SS or MM:SS #####
|
||||
@@ -102,28 +103,35 @@ function array_group_count($array, $sort = false)
|
||||
|
||||
|
||||
##### bar chart using max stats data #####
|
||||
function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$metric_name,$more_link)
|
||||
function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$metric_name,$more_link,$END_DATE,$download_link)
|
||||
{
|
||||
$stats_start_time = time();
|
||||
$Bstats_date[0]=date("Y-m-d");
|
||||
if ($END_DATE)
|
||||
{
|
||||
$Bstats_date[0]=$END_DATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$Bstats_date[0]=date("Y-m-d");
|
||||
}
|
||||
$Btotal_calls[0]=0;
|
||||
$link_text='';
|
||||
$max_count=0;
|
||||
$i=0;
|
||||
$NWB = " <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999";
|
||||
$NWB = "$download_link <a href=\"javascript:openNewWindow('$PHP_SELF?ADD=99999";
|
||||
$NWE = "')\"><IMG SRC=\"help.gif\" WIDTH=20 HEIGHT=20 BORDER=0 ALT=\"HELP\" ALIGN=TOP></A>";
|
||||
|
||||
|
||||
### get stats for last X days
|
||||
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_flag='OPEN';";
|
||||
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_flag='OPEN' and stats_date<='$Bstats_date[0]';";
|
||||
if ($metric=='total_calls_inbound_all')
|
||||
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_type='INGROUP' and stats_flag='OPEN' group by stats_date;";}
|
||||
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_type='INGROUP' and stats_flag='OPEN' and stats_date<='$Bstats_date[0]' group by stats_date;";}
|
||||
if ($metric=='total_calls_outbound_all')
|
||||
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_type='CAMPAIGN' and stats_flag='OPEN' group by stats_date;";}
|
||||
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_type='CAMPAIGN' and stats_flag='OPEN' and stats_date<='$Bstats_date[0]' group by stats_date;";}
|
||||
if ($metric=='ra_total_calls')
|
||||
{$stmt="SELECT stats_date,total_calls from vicidial_daily_ra_stats where stats_flag='OPEN' and user='$campaign_id';";}
|
||||
{$stmt="SELECT stats_date,total_calls from vicidial_daily_ra_stats where stats_flag='OPEN' and stats_date<='$Bstats_date[0]' and user='$campaign_id';";}
|
||||
if ($metric=='ra_concurrent_calls')
|
||||
{$stmt="SELECT stats_date,max_calls from vicidial_daily_ra_stats where stats_flag='OPEN' and user='$campaign_id';";}
|
||||
{$stmt="SELECT stats_date,max_calls from vicidial_daily_ra_stats where stats_flag='OPEN' and stats_date<='$Bstats_date[0]' and user='$campaign_id';";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$Xstats_to_print = mysql_num_rows($rslt);
|
||||
if ($Xstats_to_print > 0)
|
||||
@@ -137,8 +145,6 @@ function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$met
|
||||
$stats_start_time = mktime(10, 10, 10, $stats_date_ARRAY[1], $stats_date_ARRAY[2], $stats_date_ARRAY[0]);
|
||||
while($i <= $days_graph)
|
||||
{
|
||||
$i++;
|
||||
$stats_start_time = ($stats_start_time - 86400);
|
||||
$Bstats_date[$i] = date("Y-m-d", $stats_start_time);
|
||||
$Btotal_calls[$i]=0;
|
||||
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_date='$Bstats_date[$i]';";
|
||||
@@ -150,6 +156,7 @@ function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$met
|
||||
{$stmt="SELECT stats_date,total_calls from vicidial_daily_ra_stats where stats_date='$Bstats_date[$i]' and user='$campaign_id';";}
|
||||
if ($metric=='ra_concurrent_calls')
|
||||
{$stmt="SELECT stats_date,max_calls from vicidial_daily_ra_stats where stats_date='$Bstats_date[$i]' and user='$campaign_id';";}
|
||||
echo "<!-- $i) $stmt \\-->\n";
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$Ystats_to_print = mysql_num_rows($rslt);
|
||||
if ($Ystats_to_print > 0)
|
||||
@@ -158,6 +165,8 @@ function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$met
|
||||
$Btotal_calls[$i] = $rowx[1];
|
||||
if ($max_count < $Btotal_calls[$i]) {$max_count = $Btotal_calls[$i];}
|
||||
}
|
||||
$i++;
|
||||
$stats_start_time = ($stats_start_time - 86400);
|
||||
}
|
||||
if ($max_count < 1)
|
||||
{echo "<!-- no max stats cache summary information available -->";}
|
||||
@@ -188,4 +197,90 @@ function horizontal_bar_chart($campaign_id,$days_graph,$title,$link,$metric,$met
|
||||
echo "</table>\n";
|
||||
}
|
||||
}
|
||||
|
||||
##### bar chart using max stats data #####
|
||||
function download_max_system_stats($campaign_id,$days_graph,$title,$metric,$metric_name,$END_DATE)
|
||||
{
|
||||
global $CSV_text, $link;
|
||||
$stats_start_time = time();
|
||||
if ($END_DATE)
|
||||
{
|
||||
$Bstats_date[0]=$END_DATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
$Bstats_date[0]=date("Y-m-d");
|
||||
}
|
||||
$Btotal_calls[0]=0;
|
||||
$link_text='';
|
||||
$i=0;
|
||||
|
||||
### get stats for last X days
|
||||
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_flag='OPEN' and stats_date<='$Bstats_date[0]';";
|
||||
if ($metric=='total_calls_inbound_all')
|
||||
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_type='INGROUP' and stats_flag='OPEN' and stats_date<='$Bstats_date[0]' group by stats_date;";}
|
||||
if ($metric=='total_calls_outbound_all')
|
||||
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_type='CAMPAIGN' and stats_flag='OPEN' and stats_date<='$Bstats_date[0]' group by stats_date;";}
|
||||
if ($metric=='ra_total_calls')
|
||||
{$stmt="SELECT stats_date,total_calls from vicidial_daily_ra_stats where stats_flag='OPEN' and stats_date<='$Bstats_date[0]' and user='$campaign_id';";}
|
||||
if ($metric=='ra_concurrent_calls')
|
||||
{$stmt="SELECT stats_date,max_calls from vicidial_daily_ra_stats where stats_flag='OPEN' and stats_date<='$Bstats_date[0]' and user='$campaign_id';";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$Xstats_to_print = mysql_num_rows($rslt);
|
||||
if ($Xstats_to_print > 0)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$Bstats_date[0] = $rowx[0];
|
||||
$Btotal_calls[0] = $rowx[1];
|
||||
if ($max_count < $Btotal_calls[0]) {$max_count = $Btotal_calls[0];}
|
||||
}
|
||||
$stats_date_ARRAY = explode("-",$Bstats_date[0]);
|
||||
$stats_start_time = mktime(10, 10, 10, $stats_date_ARRAY[1], $stats_date_ARRAY[2], $stats_date_ARRAY[0]);
|
||||
while($i <= $days_graph)
|
||||
{
|
||||
$Bstats_date[$i] = date("Y-m-d", $stats_start_time);
|
||||
$Btotal_calls[$i]=0;
|
||||
$stmt="SELECT stats_date,$metric from vicidial_daily_max_stats where campaign_id='$campaign_id' and stats_date='$Bstats_date[$i]';";
|
||||
if ($metric=='total_calls_inbound_all')
|
||||
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_date='$Bstats_date[$i]' and stats_type='INGROUP' group by stats_date;";}
|
||||
if ($metric=='total_calls_outbound_all')
|
||||
{$stmt="SELECT stats_date,sum(total_calls) from vicidial_daily_max_stats where stats_date='$Bstats_date[$i]' and stats_type='CAMPAIGN' group by stats_date;";}
|
||||
if ($metric=='ra_total_calls')
|
||||
{$stmt="SELECT stats_date,total_calls from vicidial_daily_ra_stats where stats_date='$Bstats_date[$i]' and user='$campaign_id';";}
|
||||
if ($metric=='ra_concurrent_calls')
|
||||
{$stmt="SELECT stats_date,max_calls from vicidial_daily_ra_stats where stats_date='$Bstats_date[$i]' and user='$campaign_id';";}
|
||||
$rslt=mysql_query($stmt, $link);
|
||||
$Ystats_to_print = mysql_num_rows($rslt);
|
||||
if ($Ystats_to_print > 0)
|
||||
{
|
||||
$rowx=mysql_fetch_row($rslt);
|
||||
$Btotal_calls[$i] = $rowx[1];
|
||||
if ($max_count < $Btotal_calls[$i]) {$max_count = $Btotal_calls[$i];}
|
||||
}
|
||||
$i++;
|
||||
$stats_start_time = ($stats_start_time - 86400);
|
||||
}
|
||||
|
||||
if ($title=='campaign') {$out_in_type=' outbound';}
|
||||
if ($title=='in-group') {$out_in_type=' inbound';}
|
||||
$CSV_text.="\"$days_graph Day $out_in_type $metric_name for this $title\"\n";
|
||||
|
||||
if ($max_count < 1)
|
||||
{$CSV_text.="\"no max stats cache summary information available\"\n";}
|
||||
else
|
||||
{
|
||||
$CSV_text.="\"DATE\",\"$metric_name\"\n";
|
||||
|
||||
$i=0;
|
||||
while($i < $days_graph)
|
||||
{
|
||||
$bar_width = intval($max_multi * $Btotal_calls[$i]);
|
||||
if ($Btotal_calls[$i] < 1) {$Btotal_calls[$i] = "-none-";}
|
||||
$CSV_text.="\"$Bstats_date[$i]\",\"$Btotal_calls[$i]\"\n";
|
||||
$i++;
|
||||
}
|
||||
|
||||
$CSV_text.="\n\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -4,7 +4,7 @@
|
||||
# downloads the entire contents of a vicidial list ID to a flat text file
|
||||
# that is tab delimited
|
||||
#
|
||||
# Copyright (C) 2010 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
# Copyright (C) 2012 Matt Florell <vicidial@gmail.com> LICENSE: AGPLv2
|
||||
#
|
||||
# CHANGES
|
||||
#
|
||||
@@ -20,6 +20,7 @@
|
||||
# 100924-1609 - Added ALL-LISTS option for downloading everything
|
||||
# 100929-1919 - Fixed ALL-LISTS download option to include custom fields
|
||||
# 101004-2108 - Added generic custom column headers for custom fields
|
||||
# 120713-2110 - Added extended_vl_fields option
|
||||
#
|
||||
|
||||
require("dbconnect.php");
|
||||
@@ -112,6 +113,16 @@ if ( (!preg_match("/$report_name/",$LOGallowed_reports)) and (!preg_match("/ALL
|
||||
exit;
|
||||
}
|
||||
|
||||
if (file_exists('options.php'))
|
||||
{require('options.php');}
|
||||
$extended_vl_fields_SQL='';
|
||||
$extended_vl_fields_HEADER='';
|
||||
if ($extended_vl_fields > 0)
|
||||
{
|
||||
$extended_vl_fields_SQL = ',q01,q02,q03,q04,q05,q06,q07,q08,q09,q10,q11,q12,q13,q14,q15,q16,q17,q18,q19,q20';
|
||||
$extended_vl_fields_HEADER = "\tq01\tq02\tq03\tq04\tq05\tq06\tq07\tq08\tq09\tq10\tq11\tq12\tq13\tq14\tq15\tq16\tq17\tq18\tq19\tq20";
|
||||
}
|
||||
|
||||
$LOGallowed_campaignsSQL='';
|
||||
if ( (!eregi("-ALL",$LOGallowed_campaigns)) )
|
||||
{
|
||||
@@ -304,13 +315,13 @@ else
|
||||
{
|
||||
$TXTfilename = "LIST_$list_id$US$FILE_TIME.txt";
|
||||
$list_id_header='';
|
||||
$stmt="select 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 from vicidial_list where list_id='$list_id';";
|
||||
$stmt="select 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 $extended_vl_fields_SQL from vicidial_list where list_id='$list_id';";
|
||||
if ($list_id=='ALL-LISTS')
|
||||
{
|
||||
$list_id_header="list_id\t";
|
||||
$stmt="select list_id,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 from vicidial_list where list_id > 0;";
|
||||
$stmt="select list_id,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 $extended_vl_fields_SQL from vicidial_list where list_id > 0;";
|
||||
}
|
||||
$header_row = $list_id_header . "lead_id\tentry_date\tmodify_date\tstatus\tuser\tvendor_lead_code\tsource_id\tlist_id\tgmt_offset_now\tcalled_since_last_reset\tphone_code\tphone_number\ttitle\tfirst_name\tmiddle_initial\tlast_name\taddress1\taddress2\taddress3\tcity\tstate\tprovince\tpostal_code\tcountry_code\tgender\tdate_of_birth\talt_phone\temail\tsecurity_phrase\tcomments\tcalled_count\tlast_local_call_time\trank\towner";
|
||||
$header_row = $list_id_header . "lead_id\tentry_date\tmodify_date\tstatus\tuser\tvendor_lead_code\tsource_id\tlist_id\tgmt_offset_now\tcalled_since_last_reset\tphone_code\tphone_number\ttitle\tfirst_name\tmiddle_initial\tlast_name\taddress1\taddress2\taddress3\tcity\tstate\tprovince\tpostal_code\tcountry_code\tgender\tdate_of_birth\talt_phone\temail\tsecurity_phrase\tcomments\tcalled_count\tlast_local_call_time\trank\towner$extended_vl_fields_HEADER";
|
||||
$header_columns='';
|
||||
}
|
||||
|
||||
@@ -342,16 +353,21 @@ while ($i < $leads_to_print)
|
||||
else
|
||||
{
|
||||
$row[29] = preg_replace("/\n|\r/",'!N',$row[29]);
|
||||
$extended_vl_fields_DATA='';
|
||||
|
||||
if ($list_id=='ALL-LISTS')
|
||||
{
|
||||
$row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\t$row[34]";
|
||||
if ($extended_vl_fields > 0)
|
||||
{$extended_vl_fields_DATA = "\t$row[33]\t$row[34]\t$row[35]\t$row[36]\t$row[37]\t$row[38]\t$row[39]\t$row[40]\t$row[41]\t$row[42]\t$row[43]\t$row[44]\t$row[45]\t$row[46]\t$row[47]\t$row[48]\t$row[49]\t$row[50]\t$row[51]\t$row[52]";}
|
||||
$row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]\t$row[34]$extended_vl_fields_DATA";
|
||||
$export_list_id[$i] = $row[0];
|
||||
$export_lead_id[$i] = $row[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
$row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]";
|
||||
if ($extended_vl_fields > 0)
|
||||
{$extended_vl_fields_DATA = "\t$row[34]\t$row[35]\t$row[36]\t$row[37]\t$row[38]\t$row[39]\t$row[40]\t$row[41]\t$row[42]\t$row[43]\t$row[44]\t$row[45]\t$row[46]\t$row[47]\t$row[48]\t$row[49]\t$row[50]\t$row[51]\t$row[52]\t$row[53]";}
|
||||
$row_data[$i] .= "$row[0]\t$row[1]\t$row[2]\t$row[3]\t$row[4]\t$row[5]\t$row[6]\t$row[7]\t$row[8]\t$row[9]\t$row[10]\t$row[11]\t$row[12]\t$row[13]\t$row[14]\t$row[15]\t$row[16]\t$row[17]\t$row[18]\t$row[19]\t$row[20]\t$row[21]\t$row[22]\t$row[23]\t$row[24]\t$row[25]\t$row[26]\t$row[27]\t$row[28]\t$row[29]\t$row[30]\t$row[31]\t$row[32]\t$row[33]$extended_vl_fields_DATA";
|
||||
$export_list_id[$i] = $list_id;
|
||||
$export_lead_id[$i] = $row[0];
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
# 110708-1730 - Added precision time setting
|
||||
# 120102-2112 - Added inventory_allow_realtime option
|
||||
# 120213-1500 - Added option to log non-agent-API calls
|
||||
# 120713-1915 - Added option for extended vicidial_list fields for long surveys
|
||||
#
|
||||
|
||||
# used by the realtime_report.php script
|
||||
@@ -63,5 +64,7 @@ $inventory_allow_realtime = 0; # allow real-time report generation for inventory
|
||||
# used by non-agent-API for non-admin functions
|
||||
$api_url_log = 0; # log non-agent-api calls to the vicidial_url_log
|
||||
|
||||
# extended vicidial_list fields for long surveys(requires database schema change)
|
||||
$extended_vl_fields = 0;
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user