diff --git a/www/vicidial/AST_LISTS_pass_report.php b/www/vicidial/AST_LISTS_pass_report.php index cd66c824..6f995bbb 100644 --- a/www/vicidial/AST_LISTS_pass_report.php +++ b/www/vicidial/AST_LISTS_pass_report.php @@ -9,6 +9,7 @@ # CHANGES # 140116-0839 - First build based upon AST_LISTS_campaign_stats.php # 140121-0707 - Fixed small issue in List select mode +# 140124-0650 - Changed column formats, made data collection more efficient # $startMS = microtime(); @@ -307,35 +308,6 @@ while ($lrow=mysqli_fetch_row($list_rslt)) } $lists_id_str=substr($lists_id_str,0,-1); -$stmt="select vsc_id,vsc_name from vicidial_status_categories;"; -$rslt=mysql_to_mysqli($stmt, $link); -if ($DB) {echo "$stmt\n";} -$statcats_to_print = mysqli_num_rows($rslt); -$i=0; -while ($i < $statcats_to_print) - { - $row=mysqli_fetch_row($rslt); - $vsc_id[$i] = $row[0]; - $vsc_name[$i] = $row[1]; - - $category_statuses=""; - $status_stmt="select distinct status from vicidial_statuses where category='$row[0]' UNION select distinct status from vicidial_campaign_statuses where category='$row[0]' $group_SQLand"; - if ($DB) {echo "$status_stmt\n";} - $status_rslt=mysql_to_mysqli($status_stmt, $link); - while ($status_row=mysqli_fetch_row($status_rslt)) - { - $category_statuses.="'$status_row[0]',"; - } - $category_statuses=substr($category_statuses, 0, -1); - - $category_stmt="select count(*) from vicidial_list where status in ($category_statuses) and list_id IN($lists_id_str)"; - if ($DB) {echo "$category_stmt\n";} - $category_rslt=mysql_to_mysqli($category_stmt, $link); - $category_row=mysqli_fetch_row($category_rslt); - $vsc_count[$i] = $category_row[0]; - $i++; - } - ### BEGIN gather all statuses that are in status flags ### $human_answered_statuses=''; @@ -513,90 +485,90 @@ else $OUToutput .= "---------- LIST ID SUMMARY DOWNLOAD\n"; $OUToutput .= "+------------+------------------------------------------+----------+------------+----------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; $OUToutput .= "\n"; $OUToutput .= "| FIRST | | | LEAD | |"; - $OUToutput .= " CONTACTS| CONTACTS| CONTACTS| CONTACTS| CONTACTS|"; - $OUToutput .= " CNT RATE| CNT RATE| CNT RATE| CNT RATE| CNT RATE|"; - $OUToutput .= " SALES | SALES | SALES | SALES | SALES |"; - $OUToutput .= "CONV RATE|CONV RATE|CONV RATE|CONV RATE|CONV RATE|"; - $OUToutput .= " DNC | DNC | DNC | DNC | DNC |"; - $OUToutput .= " DNC RATE| DNC RATE| DNC RATE| DNC RATE| DNC RATE|"; - $OUToutput .= "CUST CONT|CUST CONT|CUST CONT|CUST CONT|CUST CONT|"; - $OUToutput .= "CUCT RATE|CUCT RATE|CUCT RATE|CUCT RATE|CUCT RATE|"; - $OUToutput .= "UNWORKABL|UNWORKABL|UNWORKABL|UNWORKABL|UNWORKABL|"; - $OUToutput .= "UNWK RATE|UNWK RATE|UNWK RATE|UNWK RATE|UNWK RATE|"; - $OUToutput .= "SCHEDL CB|SCHEDL CB|SCHEDL CB|SCHEDL CB|SCHEDL CB|"; - $OUToutput .= "SHCB RATE|SHCB RATE|SHCB RATE|SHCB RATE|SHCB RATE|"; - $OUToutput .= "COMPLETED|COMPLETED|COMPLETED|COMPLETED|COMPLETED|"; - $OUToutput .= "COMP RATE|COMP RATE|COMP RATE|COMP RATE|COMP RATE|"; + $OUToutput .= " CONTACTS| CONTACTS| CONTACTS| CONTACTS| CONTACTS| CONTACTS|"; + $OUToutput .= " CNT RATE| CNT RATE| CNT RATE| CNT RATE| CNT RATE| CNT RATE|"; + $OUToutput .= " SALES | SALES | SALES | SALES | SALES | SALES |"; + $OUToutput .= "CONV RATE|CONV RATE|CONV RATE|CONV RATE|CONV RATE|CONV RATE|"; + $OUToutput .= " DNC | DNC | DNC | DNC | DNC | DNC |"; + $OUToutput .= " DNC RATE| DNC RATE| DNC RATE| DNC RATE| DNC RATE| DNC RATE|"; + $OUToutput .= "CUST CONT|CUST CONT|CUST CONT|CUST CONT|CUST CONT|CUST CONT|"; + $OUToutput .= "CUCT RATE|CUCT RATE|CUCT RATE|CUCT RATE|CUCT RATE|CUCT RATE|"; + $OUToutput .= "UNWORKABL|UNWORKABL|UNWORKABL|UNWORKABL|UNWORKABL|UNWORKABL|"; + $OUToutput .= "UNWK RATE|UNWK RATE|UNWK RATE|UNWK RATE|UNWK RATE|UNWK RATE|"; + $OUToutput .= "SCHEDL CB|SCHEDL CB|SCHEDL CB|SCHEDL CB|SCHEDL CB|SCHEDL CB|"; + $OUToutput .= "SHCB RATE|SHCB RATE|SHCB RATE|SHCB RATE|SHCB RATE|SHCB RATE|"; + $OUToutput .= "COMPLETED|COMPLETED|COMPLETED|COMPLETED|COMPLETED|COMPLETED|"; + $OUToutput .= "COMP RATE|COMP RATE|COMP RATE|COMP RATE|COMP RATE|COMP RATE|"; $OUToutput .= "\n"; $OUToutput .= "| LOAD DATE | LIST ID and NAME | CAMPAIGN | COUNT | ACTIVE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; - $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 3 Total | LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; + $OUToutput .= " 1st PASS| 2nd PASS| 3rd PASS| 4th PASS| 5th PASS| LIFE |"; $OUToutput .= "\n"; $OUToutput .= "+------------+------------------------------------------+----------+------------+----------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; $OUToutput .= "\n"; $CSV_text1.="\"LIST ID SUMMARY\"\n"; $CSV_text1.="\"FIRST LOAD DATE\",\"LIST\",\"CAMPAIGN\",\"LEADS\",\"ACTIVE\""; - $CSV_text1.=",\"CONTACTS 1st PASS\",\"CONTACTS 2nd PASS\",\"CONTACTS 3rd PASS\",\"CONTACTS 3 Total\",\"CONTACTS LIFE\""; - $CSV_text1.=",\"CNT RATE 1st PASS\",\"CNT RATE 2nd PASS\",\"CNT RATE 3rd PASS\",\"CNT RATE 3 Total\",\"CNT RATE LIFE\""; - $CSV_text1.=",\"SALES 1st PASS\",\"SALES 2nd PASS\",\"SALES 3rd PASS\",\"SALES 3 Total\",\"SALES LIFE\""; - $CSV_text1.=",\"CONV RATE 1st PASS\",\"CONV RATE 2nd PASS\",\"CONV RATE 3rd PASS\",\"CONV RATE 3 Total\",\"CONV RATE LIFE\""; - $CSV_text1.=",\"DNC 1st PASS\",\"DNC 2nd PASS\",\"DNC 3rd PASS\",\"DNC 3 Total\",\"DNC LIFE\""; - $CSV_text1.=",\"DNC RATE 1st PASS\",\"DNC RATE 2nd PASS\",\"DNC RATE 3rd PASS\",\"DNC RATE 3 Total\",\"DNC RATE LIFE\""; - $CSV_text1.=",\"CUSTOMER CONTACT 1st PASS\",\"CUSTOMER CONTACT 2nd PASS\",\"CUSTOMER CONTACT 3rd PASS\",\"CUSTOMER CONTACT 3 Total\",\"CUSTOMER CONTACT LIFE\""; - $CSV_text1.=",\"CUSTOMER CONTACT RATE 1st PASS\",\"CUSTOMER CONTACT RATE 2nd PASS\",\"CUSTOMER CONTACT RATE 3rd PASS\",\"CUSTOMER CONTACT RATE 3 Total\",\"CUSTOMER CONTACT RATE LIFE\""; - $CSV_text1.=",\"UNWORKABLE 1st PASS\",\"UNWORKABLE 2nd PASS\",\"UNWORKABLE 3rd PASS\",\"UNWORKABLE 3 Total\",\"UNWORKABLE LIFE\""; - $CSV_text1.=",\"UNWORKABLE RATE 1st PASS\",\"UNWORKABLE RATE 2nd PASS\",\"UNWORKABLE RATE 3rd PASS\",\"UNWORKABLE RATE 3 Total\",\"UNWORKABLE RATE LIFE\""; - $CSV_text1.=",\"SCHEDULED CALLBACK 1st PASS\",\"SCHEDULED CALLBACK 2nd PASS\",\"SCHEDULED CALLBACK 3rd PASS\",\"SCHEDULED CALLBACK 3 Total\",\"SCHEDULED CALLBACK LIFE\""; - $CSV_text1.=",\"SCHEDULED CALLBACK RATE 1st PASS\",\"SCHEDULED CALLBACK RATE 2nd PASS\",\"SCHEDULED CALLBACK RATE 3rd PASS\",\"SCHEDULED CALLBACK RATE 3 Total\",\"SCHEDULED CALLBACK RATE LIFE\""; - $CSV_text1.=",\"COMPLETED 1st PASS\",\"COMPLETED 2nd PASS\",\"COMPLETED 3rd PASS\",\"COMPLETED 3 Total\",\"COMPLETED LIFE\""; - $CSV_text1.=",\"COMPLETED RATE 1st PASS\",\"COMPLETED RATE 2nd PASS\",\"COMPLETED RATE 3rd PASS\",\"COMPLETED RATE 3 Total\",\"COMPLETED RATE LIFE\""; + $CSV_text1.=",\"CONTACTS 1st PASS\",\"CONTACTS 2nd PASS\",\"CONTACTS 3rd PASS\",\"CONTACTS 4th PASS\",\"CONTACTS 5th PASS\",\"CONTACTS LIFE\""; + $CSV_text1.=",\"CNT RATE 1st PASS\",\"CNT RATE 2nd PASS\",\"CNT RATE 3rd PASS\",\"CNT RATE 4th PASS\",\"CNT RATE 5th PASS\",\"CNT RATE LIFE\""; + $CSV_text1.=",\"SALES 1st PASS\",\"SALES 2nd PASS\",\"SALES 3rd PASS\",\"SALES 4th PASS\",\"SALES 5th PASS\",\"SALES LIFE\""; + $CSV_text1.=",\"CONV RATE 1st PASS\",\"CONV RATE 2nd PASS\",\"CONV RATE 3rd PASS\",\"CONV RATE 4th PASS\",\"CONV RATE 5th PASS\",\"CONV RATE LIFE\""; + $CSV_text1.=",\"DNC 1st PASS\",\"DNC 2nd PASS\",\"DNC 3rd PASS\",\"DNC 4th PASS\",\"DNC 5th PASS\",\"DNC LIFE\""; + $CSV_text1.=",\"DNC RATE 1st PASS\",\"DNC RATE 2nd PASS\",\"DNC RATE 3rd PASS\",\"DNC RATE 4th PASS\",\"DNC RATE 5th PASS\",\"DNC RATE LIFE\""; + $CSV_text1.=",\"CUSTOMER CONTACT 1st PASS\",\"CUSTOMER CONTACT 2nd PASS\",\"CUSTOMER CONTACT 3rd PASS\",\"CUSTOMER CONTACT 4th PASS\",\"CUSTOMER CONTACT 5th PASS\",\"CUSTOMER CONTACT LIFE\""; + $CSV_text1.=",\"CUSTOMER CONTACT RATE 1st PASS\",\"CUSTOMER CONTACT RATE 2nd PASS\",\"CUSTOMER CONTACT RATE 3rd PASS\",\"CUSTOMER CONTACT RATE 4th PASS\",\"CUSTOMER CONTACT RATE 5th PASS\",\"CUSTOMER CONTACT RATE LIFE\""; + $CSV_text1.=",\"UNWORKABLE 1st PASS\",\"UNWORKABLE 2nd PASS\",\"UNWORKABLE 3rd PASS\",\"UNWORKABLE 4th PASS\",\"UNWORKABLE 5th PASS\",\"UNWORKABLE LIFE\""; + $CSV_text1.=",\"UNWORKABLE RATE 1st PASS\",\"UNWORKABLE RATE 2nd PASS\",\"UNWORKABLE RATE 3rd PASS\",\"UNWORKABLE RATE 4th PASS\",\"UNWORKABLE RATE 5th PASS\",\"UNWORKABLE RATE LIFE\""; + $CSV_text1.=",\"SCHEDULED CALLBACK 1st PASS\",\"SCHEDULED CALLBACK 2nd PASS\",\"SCHEDULED CALLBACK 3rd PASS\",\"SCHEDULED CALLBACK 4th PASS\",\"SCHEDULED CALLBACK 5th PASS\",\"SCHEDULED CALLBACK LIFE\""; + $CSV_text1.=",\"SCHEDULED CALLBACK RATE 1st PASS\",\"SCHEDULED CALLBACK RATE 2nd PASS\",\"SCHEDULED CALLBACK RATE 3rd PASS\",\"SCHEDULED CALLBACK RATE 4th PASS\",\"SCHEDULED CALLBACK RATE 5th PASS\",\"SCHEDULED CALLBACK RATE LIFE\""; + $CSV_text1.=",\"COMPLETED 1st PASS\",\"COMPLETED 2nd PASS\",\"COMPLETED 3rd PASS\",\"COMPLETED 4th PASS\",\"COMPLETED 5th PASS\",\"COMPLETED LIFE\""; + $CSV_text1.=",\"COMPLETED RATE 1st PASS\",\"COMPLETED RATE 2nd PASS\",\"COMPLETED RATE 3rd PASS\",\"COMPLETED RATE 4th PASS\",\"COMPLETED RATE 5th PASS\",\"COMPLETED RATE LIFE\""; $CSV_text1.="\n"; $max_calls=1; $graph_stats=array(); @@ -609,6 +581,7 @@ else $lists_id_str.="'$lrow[0]',"; } $lists_id_str=substr($lists_id_str,0,-1); + if (strlen($lists_id_str)<3) {$lists_id_str="''";} $stmt="select count(*),list_id from vicidial_list where list_id IN($lists_id_str) group by list_id;"; $rslt=mysql_to_mysqli($stmt, $link); @@ -670,7 +643,7 @@ else ######################################################## ########## BEGIN CONTACTS (Human-Answer flag) ########## - $HA_count=0; $HA_one_count=0; $HA_two_count=0; $HA_three_count=0; + $HA_count=0; $HA_one_count=0; $HA_two_count=0; $HA_three_count=0; $HA_four_count=0; $HA_five_count=0; $HA_all_count=0; $stmt="select count(*) from vicidial_list where status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); @@ -696,19 +669,39 @@ else $HA_three_results = mysqli_num_rows($rslt); if ($HA_three_results > 0) {$row=mysqli_fetch_row($rslt); $HA_three_count = $row[0];} - $HA_threeT_count = ($HA_one_count + $HA_two_count + $HA_three_count); + $stmt="select count(*) from vicidial_log where called_count='4' and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $HA_four_results = mysqli_num_rows($rslt); + if ($HA_four_results > 0) + {$row=mysqli_fetch_row($rslt); $HA_four_count = $row[0];} + $stmt="select count(*) from vicidial_log where called_count='5' and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $HA_five_results = mysqli_num_rows($rslt); + if ($HA_five_results > 0) + {$row=mysqli_fetch_row($rslt); $HA_five_count = $row[0];} + $stmt="select count(distinct lead_id) from vicidial_log where status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $HA_all_results = mysqli_num_rows($rslt); + if ($HA_all_results > 0) + {$row=mysqli_fetch_row($rslt); $HA_all_count = $row[0];} + if ($HA_all_count > $HA_count) {$HA_count = $HA_all_count;} $HA_countS = sprintf("%7s", $HA_count); while(strlen($HA_countS)>7) {$HA_countS = substr("$HA_countS", 0, -1);} $HA_one_countS = sprintf("%7s", $HA_one_count); while(strlen($HA_one_countS)>7) {$HA_one_countS = substr("$HA_one_countS", 0, -1);} $HA_two_countS = sprintf("%7s", $HA_two_count); while(strlen($HA_two_countS)>7) {$HA_two_countS = substr("$HA_two_countS", 0, -1);} $HA_three_countS = sprintf("%7s", $HA_three_count); while(strlen($HA_three_countS)>7) {$HA_three_countS = substr("$HA_three_countS", 0, -1);} - $HA_threeT_countS = sprintf("%7s", $HA_threeT_count); while(strlen($HA_threeT_countS)>7) {$HA_threeT_countS = substr("$HA_threeT_countS", 0, -1);} + $HA_four_countS = sprintf("%7s", $HA_four_count); while(strlen($HA_four_countS)>7) {$HA_four_countS = substr("$HA_four_countS", 0, -1);} + $HA_five_countS = sprintf("%7s", $HA_five_count); while(strlen($HA_five_countS)>7) {$HA_five_countS = substr("$HA_five_countS", 0, -1);} $HA_count_tot = ($HA_count + $HA_count_tot); $HA_one_count_tot = ($HA_one_count + $HA_one_count_tot); $HA_two_count_tot = ($HA_two_count + $HA_two_count_tot); $HA_three_count_tot = ($HA_three_count + $HA_three_count_tot); - $HA_threeT_count_tot = ($HA_threeT_count + $HA_threeT_count_tot); + $HA_four_count_tot = ($HA_four_count + $HA_four_count_tot); + $HA_five_count_tot = ($HA_five_count + $HA_five_count_tot); ########## END CONTACTS (Human-Answer flag) ########## ######################################################## @@ -717,56 +710,40 @@ else ######################################################## ########## BEGIN CONTACT RATIO (Human-Answer flag out of total leads percentage) ########## - $HR_count=0; $HR_one_count=0; $HR_two_count=0; $HR_three_count=0; - - $stmt="select count(*) from vicidial_list where status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $HR_results = mysqli_num_rows($rslt); - if ($HR_results > 0) - {$row=mysqli_fetch_row($rslt); $HR_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $HR_one_results = mysqli_num_rows($rslt); - if ($HR_one_results > 0) - {$row=mysqli_fetch_row($rslt); $HR_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $HR_two_results = mysqli_num_rows($rslt); - if ($HR_two_results > 0) - {$row=mysqli_fetch_row($rslt); $HR_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($human_answered_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $HR_three_results = mysqli_num_rows($rslt); - if ($HR_three_results > 0) - {$row=mysqli_fetch_row($rslt); $HR_three_count = $row[0];} - $HR_threeT_count = ($HR_one_count + $HR_two_count + $HR_three_count); + $HR_count=$HA_count; + $HR_one_count=$HA_one_count; + $HR_two_count=$HA_two_count; + $HR_three_count=$HA_three_count; + $HR_four_count=$HA_four_count; + $HR_five_count=$HA_five_count; + $HR_all_count=$HA_all_count; $HR_count_pct=0; $HR_one_count_pct=0; $HR_two_count_pct=0; $HR_three_count_pct=0; - $HR_threeT_count_pct=0; + $HR_four_count_pct=0; + $HR_five_count_pct=0; if ( ($HR_count > 0) and ($LISTIDcalls[$i] > 0) ) {$HR_count_pct = (($HR_count / $LISTIDcalls[$i]) * 100);} if ( ($HR_one_count > 0) and ($LISTIDcalls[$i] > 0) ) {$HR_one_count_pct = (($HR_one_count / $LISTIDcalls[$i]) * 100);} if ( ($HR_two_count > 0) and ($LISTIDcalls[$i] > 0) ) {$HR_two_count_pct = (($HR_two_count / $LISTIDcalls[$i]) * 100);} if ( ($HR_three_count > 0) and ($LISTIDcalls[$i] > 0) ) {$HR_three_count_pct = (($HR_three_count / $LISTIDcalls[$i]) * 100);} - if ( ($HR_threeT_count > 0) and ($LISTIDcalls[$i] > 0) ) {$HR_threeT_count_pct = (($HR_threeT_count / $LISTIDcalls[$i]) * 100);} + if ( ($HR_four_count > 0) and ($LISTIDcalls[$i] > 0) ) {$HR_four_count_pct = (($HR_four_count / $LISTIDcalls[$i]) * 100);} + if ( ($HR_five_count > 0) and ($LISTIDcalls[$i] > 0) ) {$HR_five_count_pct = (($HR_five_count / $LISTIDcalls[$i]) * 100);} $HR_countS = sprintf("%6.2f", $HR_count_pct); while(strlen($HR_countS)>7) {$HR_countS = substr("$HR_countS", 0, -1);} $HR_one_countS = sprintf("%6.2f", $HR_one_count_pct); while(strlen($HR_one_countS)>7) {$HR_one_countS = substr("$HR_one_countS", 0, -1);} $HR_two_countS = sprintf("%6.2f", $HR_two_count_pct); while(strlen($HR_two_countS)>7) {$HR_two_countS = substr("$HR_two_countS", 0, -1);} $HR_three_countS = sprintf("%6.2f", $HR_three_count_pct); while(strlen($HR_three_countS)>7) {$HR_three_countS = substr("$HR_three_countS", 0, -1);} - $HR_threeT_countS = sprintf("%6.2f", $HR_threeT_count_pct); while(strlen($HR_threeT_countS)>7) {$HR_threeT_countS = substr("$HR_threeT_countS", 0, -1);} + $HR_four_countS = sprintf("%6.2f", $HR_four_count_pct); while(strlen($HR_four_countS)>7) {$HR_four_countS = substr("$HR_four_countS", 0, -1);} + $HR_five_countS = sprintf("%6.2f", $HR_five_count_pct); while(strlen($HR_five_countS)>7) {$HR_five_countS = substr("$HR_five_countS", 0, -1);} $HR_count_tot = ($HR_count + $HR_count_tot); $HR_one_count_tot = ($HR_one_count + $HR_one_count_tot); $HR_two_count_tot = ($HR_two_count + $HR_two_count_tot); $HR_three_count_tot = ($HR_three_count + $HR_three_count_tot); - $HR_threeT_count_tot = ($HR_threeT_count + $HR_threeT_count_tot); + $HR_four_count_tot = ($HR_four_count + $HR_four_count_tot); + $HR_five_count_tot = ($HR_five_count + $HR_five_count_tot); ########## END CONTACT RATIO (Human-Answer flag out of total leads percentage) ########## ######################################################## @@ -775,7 +752,7 @@ else ######################################################## ########## BEGIN SALES (Sales flag) ########## - $SA_count=0; $SA_one_count=0; $SA_two_count=0; $SA_three_count=0; + $SA_count=0; $SA_one_count=0; $SA_two_count=0; $SA_three_count=0; $SA_four_count=0; $SA_five_count=0; $SA_all_count=0; $stmt="select count(*) from vicidial_list where status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); @@ -801,19 +778,39 @@ else $SA_three_results = mysqli_num_rows($rslt); if ($SA_three_results > 0) {$row=mysqli_fetch_row($rslt); $SA_three_count = $row[0];} - $SA_threeT_count = ($SA_one_count + $SA_two_count + $SA_three_count); + $stmt="select count(*) from vicidial_log where called_count='4' and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $SA_four_results = mysqli_num_rows($rslt); + if ($SA_four_results > 0) + {$row=mysqli_fetch_row($rslt); $SA_four_count = $row[0];} + $stmt="select count(*) from vicidial_log where called_count='5' and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $SA_five_results = mysqli_num_rows($rslt); + if ($SA_five_results > 0) + {$row=mysqli_fetch_row($rslt); $SA_five_count = $row[0];} + $stmt="select count(distinct lead_id) from vicidial_log where status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $SA_all_results = mysqli_num_rows($rslt); + if ($SA_all_results > 0) + {$row=mysqli_fetch_row($rslt); $SA_all_count = $row[0];} + if ($SA_all_count > $SA_count) {$SA_count = $SA_all_count;} $SA_countS = sprintf("%7s", $SA_count); while(strlen($SA_countS)>7) {$SA_countS = substr("$SA_countS", 0, -1);} $SA_one_countS = sprintf("%7s", $SA_one_count); while(strlen($SA_one_countS)>7) {$SA_one_countS = substr("$SA_one_countS", 0, -1);} $SA_two_countS = sprintf("%7s", $SA_two_count); while(strlen($SA_two_countS)>7) {$SA_two_countS = substr("$SA_two_countS", 0, -1);} $SA_three_countS = sprintf("%7s", $SA_three_count); while(strlen($SA_three_countS)>7) {$SA_three_countS = substr("$SA_three_countS", 0, -1);} - $SA_threeT_countS = sprintf("%7s", $SA_threeT_count); while(strlen($SA_threeT_countS)>7) {$SA_threeT_countS = substr("$SA_threeT_countS", 0, -1);} + $SA_four_countS = sprintf("%7s", $SA_four_count); while(strlen($SA_four_countS)>7) {$SA_four_countS = substr("$SA_four_countS", 0, -1);} + $SA_five_countS = sprintf("%7s", $SA_five_count); while(strlen($SA_five_countS)>7) {$SA_five_countS = substr("$SA_five_countS", 0, -1);} $SA_count_tot = ($SA_count + $SA_count_tot); $SA_one_count_tot = ($SA_one_count + $SA_one_count_tot); $SA_two_count_tot = ($SA_two_count + $SA_two_count_tot); $SA_three_count_tot = ($SA_three_count + $SA_three_count_tot); - $SA_threeT_count_tot = ($SA_threeT_count + $SA_threeT_count_tot); + $SA_four_count_tot = ($SA_four_count + $SA_four_count_tot); + $SA_five_count_tot = ($SA_five_count + $SA_five_count_tot); ########## END SALES (Sales flag) ########## ######################################################## @@ -822,56 +819,40 @@ else ######################################################## ########## BEGIN CONV SALES RATIO (Sales flag out of total leads percentage) ########## - $SR_count=0; $SR_one_count=0; $SR_two_count=0; $SR_three_count=0; - - $stmt="select count(*) from vicidial_list where status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $SR_results = mysqli_num_rows($rslt); - if ($SR_results > 0) - {$row=mysqli_fetch_row($rslt); $SR_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $SR_one_results = mysqli_num_rows($rslt); - if ($SR_one_results > 0) - {$row=mysqli_fetch_row($rslt); $SR_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $SR_two_results = mysqli_num_rows($rslt); - if ($SR_two_results > 0) - {$row=mysqli_fetch_row($rslt); $SR_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($sale_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $SR_three_results = mysqli_num_rows($rslt); - if ($SR_three_results > 0) - {$row=mysqli_fetch_row($rslt); $SR_three_count = $row[0];} - $SR_threeT_count = ($SR_one_count + $SR_two_count + $SR_three_count); + $SR_count=$SA_count; + $SR_one_count=$SA_one_count; + $SR_two_count=$SA_two_count; + $SR_three_count=$SA_three_count; + $SR_four_count=$SA_four_count; + $SR_five_count=$SA_five_count; + $SR_all_count=$SA_all_count; $SR_count_pct=0; $SR_one_count_pct=0; $SR_two_count_pct=0; $SR_three_count_pct=0; - $SR_threeT_count_pct=0; + $SR_four_count_pct=0; + $SR_five_count_pct=0; if ( ($SR_count > 0) and ($LISTIDcalls[$i] > 0) ) {$SR_count_pct = (($SR_count / $LISTIDcalls[$i]) * 100);} if ( ($SR_one_count > 0) and ($LISTIDcalls[$i] > 0) ) {$SR_one_count_pct = (($SR_one_count / $LISTIDcalls[$i]) * 100);} if ( ($SR_two_count > 0) and ($LISTIDcalls[$i] > 0) ) {$SR_two_count_pct = (($SR_two_count / $LISTIDcalls[$i]) * 100);} if ( ($SR_three_count > 0) and ($LISTIDcalls[$i] > 0) ) {$SR_three_count_pct = (($SR_three_count / $LISTIDcalls[$i]) * 100);} - if ( ($SR_threeT_count > 0) and ($LISTIDcalls[$i] > 0) ) {$SR_threeT_count_pct = (($SR_threeT_count / $LISTIDcalls[$i]) * 100);} + if ( ($SR_four_count > 0) and ($LISTIDcalls[$i] > 0) ) {$SR_four_count_pct = (($SR_four_count / $LISTIDcalls[$i]) * 100);} + if ( ($SR_five_count > 0) and ($LISTIDcalls[$i] > 0) ) {$SR_five_count_pct = (($SR_five_count / $LISTIDcalls[$i]) * 100);} $SR_countS = sprintf("%6.2f", $SR_count_pct); while(strlen($SR_countS)>7) {$SR_countS = substr("$SR_countS", 0, -1);} $SR_one_countS = sprintf("%6.2f", $SR_one_count_pct); while(strlen($SR_one_countS)>7) {$SR_one_countS = substr("$SR_one_countS", 0, -1);} $SR_two_countS = sprintf("%6.2f", $SR_two_count_pct); while(strlen($SR_two_countS)>7) {$SR_two_countS = substr("$SR_two_countS", 0, -1);} $SR_three_countS = sprintf("%6.2f", $SR_three_count_pct); while(strlen($SR_three_countS)>7) {$SR_three_countS = substr("$SR_three_countS", 0, -1);} - $SR_threeT_countS = sprintf("%6.2f", $SR_threeT_count_pct); while(strlen($SR_threeT_countS)>7) {$SR_threeT_countS = substr("$SR_threeT_countS", 0, -1);} + $SR_four_countS = sprintf("%6.2f", $SR_four_count_pct); while(strlen($SR_four_countS)>7) {$SR_four_countS = substr("$SR_four_countS", 0, -1);} + $SR_five_countS = sprintf("%6.2f", $SR_five_count_pct); while(strlen($SR_five_countS)>7) {$SR_five_countS = substr("$SR_five_countS", 0, -1);} $SR_count_tot = ($SR_count + $SR_count_tot); $SR_one_count_tot = ($SR_one_count + $SR_one_count_tot); $SR_two_count_tot = ($SR_two_count + $SR_two_count_tot); $SR_three_count_tot = ($SR_three_count + $SR_three_count_tot); - $SR_threeT_count_tot = ($SR_threeT_count + $SR_threeT_count_tot); + $SR_four_count_tot = ($SR_four_count + $SR_four_count_tot); + $SR_five_count_tot = ($SR_five_count + $SR_five_count_tot); ########## END CONV SALES RATIO (Sales flag out of total leads percentage) ########## ######################################################## @@ -880,7 +861,7 @@ else ######################################################## ########## BEGIN DNC (DNC flag) ########## - $DN_count=0; $DN_one_count=0; $DN_two_count=0; $DN_three_count=0; + $DN_count=0; $DN_one_count=0; $DN_two_count=0; $DN_three_count=0; $DN_four_count=0; $DN_five_count=0; $DN_all_count=0; $stmt="select count(*) from vicidial_list where status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); @@ -906,19 +887,39 @@ else $DN_three_results = mysqli_num_rows($rslt); if ($DN_three_results > 0) {$row=mysqli_fetch_row($rslt); $DN_three_count = $row[0];} - $DN_threeT_count = ($DN_one_count + $DN_two_count + $DN_three_count); + $stmt="select count(*) from vicidial_log where called_count='4' and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $DN_four_results = mysqli_num_rows($rslt); + if ($DN_four_results > 0) + {$row=mysqli_fetch_row($rslt); $DN_four_count = $row[0];} + $stmt="select count(*) from vicidial_log where called_count='5' and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $DN_five_results = mysqli_num_rows($rslt); + if ($DN_five_results > 0) + {$row=mysqli_fetch_row($rslt); $DN_five_count = $row[0];} + $stmt="select count(distinct lead_id) from vicidial_log where status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $DN_all_results = mysqli_num_rows($rslt); + if ($DN_all_results > 0) + {$row=mysqli_fetch_row($rslt); $DN_all_count = $row[0];} + if ($DN_all_count > $DN_count) {$DN_count = $DN_all_count;} $DN_countS = sprintf("%7s", $DN_count); while(strlen($DN_countS)>7) {$DN_countS = substr("$DN_countS", 0, -1);} $DN_one_countS = sprintf("%7s", $DN_one_count); while(strlen($DN_one_countS)>7) {$DN_one_countS = substr("$DN_one_countS", 0, -1);} $DN_two_countS = sprintf("%7s", $DN_two_count); while(strlen($DN_two_countS)>7) {$DN_two_countS = substr("$DN_two_countS", 0, -1);} $DN_three_countS = sprintf("%7s", $DN_three_count); while(strlen($DN_three_countS)>7) {$DN_three_countS = substr("$DN_three_countS", 0, -1);} - $DN_threeT_countS = sprintf("%7s", $DN_threeT_count); while(strlen($DN_threeT_countS)>7) {$DN_threeT_countS = substr("$DN_threeT_countS", 0, -1);} + $DN_four_countS = sprintf("%7s", $DN_four_count); while(strlen($DN_four_countS)>7) {$DN_four_countS = substr("$DN_four_countS", 0, -1);} + $DN_five_countS = sprintf("%7s", $DN_five_count); while(strlen($DN_five_countS)>7) {$DN_five_countS = substr("$DN_five_countS", 0, -1);} $DN_count_tot = ($DN_count + $DN_count_tot); $DN_one_count_tot = ($DN_one_count + $DN_one_count_tot); $DN_two_count_tot = ($DN_two_count + $DN_two_count_tot); $DN_three_count_tot = ($DN_three_count + $DN_three_count_tot); - $DN_threeT_count_tot = ($DN_threeT_count + $DN_threeT_count_tot); + $DN_four_count_tot = ($DN_four_count + $DN_four_count_tot); + $DN_five_count_tot = ($DN_five_count + $DN_five_count_tot); ########## END DNC (DNC flag) ########## ######################################################## @@ -927,56 +928,40 @@ else ######################################################## ########## BEGIN CONV DNC RATIO (DNC flag out of total leads percentage) ########## - $DR_count=0; $DR_one_count=0; $DR_two_count=0; $DR_three_count=0; - - $stmt="select count(*) from vicidial_list where status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $DR_results = mysqli_num_rows($rslt); - if ($DR_results > 0) - {$row=mysqli_fetch_row($rslt); $DR_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $DR_one_results = mysqli_num_rows($rslt); - if ($DR_one_results > 0) - {$row=mysqli_fetch_row($rslt); $DR_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $DR_two_results = mysqli_num_rows($rslt); - if ($DR_two_results > 0) - {$row=mysqli_fetch_row($rslt); $DR_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($dnc_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $DR_three_results = mysqli_num_rows($rslt); - if ($DR_three_results > 0) - {$row=mysqli_fetch_row($rslt); $DR_three_count = $row[0];} - $DR_threeT_count = ($DR_one_count + $DR_two_count + $DR_three_count); + $DR_count=$DN_count; + $DR_one_count=$DN_one_count; + $DR_two_count=$DN_two_count; + $DR_three_count=$DN_three_count; + $DR_four_count=$DN_four_count; + $DR_five_count=$DN_five_count; + $DR_all_count=$DN_all_count; $DR_count_pct=0; $DR_one_count_pct=0; $DR_two_count_pct=0; $DR_three_count_pct=0; - $DR_threeT_count_pct=0; + $DR_four_count_pct=0; + $DR_five_count_pct=0; if ( ($DR_count > 0) and ($LISTIDcalls[$i] > 0) ) {$DR_count_pct = (($DR_count / $LISTIDcalls[$i]) * 100);} if ( ($DR_one_count > 0) and ($LISTIDcalls[$i] > 0) ) {$DR_one_count_pct = (($DR_one_count / $LISTIDcalls[$i]) * 100);} if ( ($DR_two_count > 0) and ($LISTIDcalls[$i] > 0) ) {$DR_two_count_pct = (($DR_two_count / $LISTIDcalls[$i]) * 100);} if ( ($DR_three_count > 0) and ($LISTIDcalls[$i] > 0) ) {$DR_three_count_pct = (($DR_three_count / $LISTIDcalls[$i]) * 100);} - if ( ($DR_threeT_count > 0) and ($LISTIDcalls[$i] > 0) ) {$DR_threeT_count_pct = (($DR_threeT_count / $LISTIDcalls[$i]) * 100);} + if ( ($DR_four_count > 0) and ($LISTIDcalls[$i] > 0) ) {$DR_four_count_pct = (($DR_four_count / $LISTIDcalls[$i]) * 100);} + if ( ($DR_five_count > 0) and ($LISTIDcalls[$i] > 0) ) {$DR_five_count_pct = (($DR_five_count / $LISTIDcalls[$i]) * 100);} $DR_countS = sprintf("%6.2f", $DR_count_pct); while(strlen($DR_countS)>7) {$DR_countS = substr("$DR_countS", 0, -1);} $DR_one_countS = sprintf("%6.2f", $DR_one_count_pct); while(strlen($DR_one_countS)>7) {$DR_one_countS = substr("$DR_one_countS", 0, -1);} $DR_two_countS = sprintf("%6.2f", $DR_two_count_pct); while(strlen($DR_two_countS)>7) {$DR_two_countS = substr("$DR_two_countS", 0, -1);} $DR_three_countS = sprintf("%6.2f", $DR_three_count_pct); while(strlen($DR_three_countS)>7) {$DR_three_countS = substr("$DR_three_countS", 0, -1);} - $DR_threeT_countS = sprintf("%6.2f", $DR_threeT_count_pct); while(strlen($DR_threeT_countS)>7) {$DR_threeT_countS = substr("$DR_threeT_countS", 0, -1);} + $DR_four_countS = sprintf("%6.2f", $DR_four_count_pct); while(strlen($DR_four_countS)>7) {$DR_four_countS = substr("$DR_four_countS", 0, -1);} + $DR_five_countS = sprintf("%6.2f", $DR_five_count_pct); while(strlen($DR_five_countS)>7) {$DR_five_countS = substr("$DR_five_countS", 0, -1);} $DR_count_tot = ($DR_count + $DR_count_tot); $DR_one_count_tot = ($DR_one_count + $DR_one_count_tot); $DR_two_count_tot = ($DR_two_count + $DR_two_count_tot); $DR_three_count_tot = ($DR_three_count + $DR_three_count_tot); - $DR_threeT_count_tot = ($DR_threeT_count + $DR_threeT_count_tot); + $DR_four_count_tot = ($DR_four_count + $DR_four_count_tot); + $DR_five_count_tot = ($DR_five_count + $DR_five_count_tot); ########## END CONV DNC RATIO (DNC flag out of total leads percentage) ########## ######################################################## @@ -985,7 +970,7 @@ else ######################################################## ########## BEGIN CUSTOMER CONTACT (Customer Contact flag) ########## - $CC_count=0; $CC_one_count=0; $CC_two_count=0; $CC_three_count=0; + $CC_count=0; $CC_one_count=0; $CC_two_count=0; $CC_three_count=0; $CC_four_count=0; $CC_five_count=0; $CC_all_count=0; $stmt="select count(*) from vicidial_list where status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); @@ -1011,19 +996,39 @@ else $CC_three_results = mysqli_num_rows($rslt); if ($CC_three_results > 0) {$row=mysqli_fetch_row($rslt); $CC_three_count = $row[0];} - $CC_threeT_count = ($CC_one_count + $CC_two_count + $CC_three_count); + $stmt="select count(*) from vicidial_log where called_count='4' and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $CC_four_results = mysqli_num_rows($rslt); + if ($CC_four_results > 0) + {$row=mysqli_fetch_row($rslt); $CC_four_count = $row[0];} + $stmt="select count(*) from vicidial_log where called_count='5' and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $CC_five_results = mysqli_num_rows($rslt); + if ($CC_five_results > 0) + {$row=mysqli_fetch_row($rslt); $CC_five_count = $row[0];} + $stmt="select count(distinct lead_id) from vicidial_log where status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $CC_all_results = mysqli_num_rows($rslt); + if ($CC_all_results > 0) + {$row=mysqli_fetch_row($rslt); $CC_all_count = $row[0];} + if ($CC_all_count > $CC_count) {$CC_count = $CC_all_count;} $CC_countS = sprintf("%7s", $CC_count); while(strlen($CC_countS)>7) {$CC_countS = substr("$CC_countS", 0, -1);} $CC_one_countS = sprintf("%7s", $CC_one_count); while(strlen($CC_one_countS)>7) {$CC_one_countS = substr("$CC_one_countS", 0, -1);} $CC_two_countS = sprintf("%7s", $CC_two_count); while(strlen($CC_two_countS)>7) {$CC_two_countS = substr("$CC_two_countS", 0, -1);} $CC_three_countS = sprintf("%7s", $CC_three_count); while(strlen($CC_three_countS)>7) {$CC_three_countS = substr("$CC_three_countS", 0, -1);} - $CC_threeT_countS = sprintf("%7s", $CC_threeT_count); while(strlen($CC_threeT_countS)>7) {$CC_threeT_countS = substr("$CC_threeT_countS", 0, -1);} + $CC_four_countS = sprintf("%7s", $CC_four_count); while(strlen($CC_four_countS)>7) {$CC_four_countS = substr("$CC_four_countS", 0, -1);} + $CC_five_countS = sprintf("%7s", $CC_five_count); while(strlen($CC_five_countS)>7) {$CC_five_countS = substr("$CC_five_countS", 0, -1);} $CC_count_tot = ($CC_count + $CC_count_tot); $CC_one_count_tot = ($CC_one_count + $CC_one_count_tot); $CC_two_count_tot = ($CC_two_count + $CC_two_count_tot); $CC_three_count_tot = ($CC_three_count + $CC_three_count_tot); - $CC_threeT_count_tot = ($CC_threeT_count + $CC_threeT_count_tot); + $CC_four_count_tot = ($CC_four_count + $CC_four_count_tot); + $CC_five_count_tot = ($CC_five_count + $CC_five_count_tot); ########## END CUSTOMER CONTACT (Customer Contact flag) ########## ######################################################## @@ -1032,56 +1037,40 @@ else ######################################################## ########## BEGIN CUSTOMER CONTACT RATIO (Customer Contact flag out of total leads percentage) ########## - $CR_count=0; $CR_one_count=0; $CR_two_count=0; $CR_three_count=0; - - $stmt="select count(*) from vicidial_list where status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $CR_results = mysqli_num_rows($rslt); - if ($CR_results > 0) - {$row=mysqli_fetch_row($rslt); $CR_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $CR_one_results = mysqli_num_rows($rslt); - if ($CR_one_results > 0) - {$row=mysqli_fetch_row($rslt); $CR_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $CR_two_results = mysqli_num_rows($rslt); - if ($CR_two_results > 0) - {$row=mysqli_fetch_row($rslt); $CR_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($customer_contact_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $CR_three_results = mysqli_num_rows($rslt); - if ($CR_three_results > 0) - {$row=mysqli_fetch_row($rslt); $CR_three_count = $row[0];} - $CR_threeT_count = ($CR_one_count + $CR_two_count + $CR_three_count); + $CR_count=$CC_count; + $CR_one_count=$CC_one_count; + $CR_two_count=$CC_two_count; + $CR_three_count=$CC_three_count; + $CR_four_count=$CC_four_count; + $CR_five_count=$CC_five_count; + $CR_all_count=$CC_all_count; $CR_count_pct=0; $CR_one_count_pct=0; $CR_two_count_pct=0; $CR_three_count_pct=0; - $CR_threeT_count_pct=0; + $CR_four_count_pct=0; + $CR_five_count_pct=0; if ( ($CR_count > 0) and ($LISTIDcalls[$i] > 0) ) {$CR_count_pct = (($CR_count / $LISTIDcalls[$i]) * 100);} if ( ($CR_one_count > 0) and ($LISTIDcalls[$i] > 0) ) {$CR_one_count_pct = (($CR_one_count / $LISTIDcalls[$i]) * 100);} if ( ($CR_two_count > 0) and ($LISTIDcalls[$i] > 0) ) {$CR_two_count_pct = (($CR_two_count / $LISTIDcalls[$i]) * 100);} if ( ($CR_three_count > 0) and ($LISTIDcalls[$i] > 0) ) {$CR_three_count_pct = (($CR_three_count / $LISTIDcalls[$i]) * 100);} - if ( ($CR_threeT_count > 0) and ($LISTIDcalls[$i] > 0) ) {$CR_threeT_count_pct = (($CR_threeT_count / $LISTIDcalls[$i]) * 100);} + if ( ($CR_four_count > 0) and ($LISTIDcalls[$i] > 0) ) {$CR_four_count_pct = (($CR_four_count / $LISTIDcalls[$i]) * 100);} + if ( ($CR_five_count > 0) and ($LISTIDcalls[$i] > 0) ) {$CR_five_count_pct = (($CR_five_count / $LISTIDcalls[$i]) * 100);} $CR_countS = sprintf("%6.2f", $CR_count_pct); while(strlen($CR_countS)>7) {$CR_countS = substr("$CR_countS", 0, -1);} $CR_one_countS = sprintf("%6.2f", $CR_one_count_pct); while(strlen($CR_one_countS)>7) {$CR_one_countS = substr("$CR_one_countS", 0, -1);} $CR_two_countS = sprintf("%6.2f", $CR_two_count_pct); while(strlen($CR_two_countS)>7) {$CR_two_countS = substr("$CR_two_countS", 0, -1);} $CR_three_countS = sprintf("%6.2f", $CR_three_count_pct); while(strlen($CR_three_countS)>7) {$CR_three_countS = substr("$CR_three_countS", 0, -1);} - $CR_threeT_countS = sprintf("%6.2f", $CR_threeT_count_pct); while(strlen($CR_threeT_countS)>7) {$CR_threeT_countS = substr("$CR_threeT_countS", 0, -1);} + $CR_four_countS = sprintf("%6.2f", $CR_four_count_pct); while(strlen($CR_four_countS)>7) {$CR_four_countS = substr("$CR_four_countS", 0, -1);} + $CR_five_countS = sprintf("%6.2f", $CR_five_count_pct); while(strlen($CR_five_countS)>7) {$CR_five_countS = substr("$CR_five_countS", 0, -1);} $CR_count_tot = ($CR_count + $CR_count_tot); $CR_one_count_tot = ($CR_one_count + $CR_one_count_tot); $CR_two_count_tot = ($CR_two_count + $CR_two_count_tot); $CR_three_count_tot = ($CR_three_count + $CR_three_count_tot); - $CR_threeT_count_tot = ($CR_threeT_count + $CR_threeT_count_tot); + $CR_four_count_tot = ($CR_four_count + $CR_four_count_tot); + $CR_five_count_tot = ($CR_five_count + $CR_five_count_tot); ########## END CUSTOMER CONTACT RATIO (Customer Contact flag out of total leads percentage) ########## ######################################################## @@ -1090,7 +1079,7 @@ else ######################################################## ########## BEGIN UNWORKABLE (Unworkable flag) ########## - $UW_count=0; $UW_one_count=0; $UW_two_count=0; $UW_three_count=0; + $UW_count=0; $UW_one_count=0; $UW_two_count=0; $UW_three_count=0; $UW_four_count=0; $UW_five_count=0; $UW_all_count=0; $stmt="select count(*) from vicidial_list where status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); @@ -1116,19 +1105,39 @@ else $UW_three_results = mysqli_num_rows($rslt); if ($UW_three_results > 0) {$row=mysqli_fetch_row($rslt); $UW_three_count = $row[0];} - $UW_threeT_count = ($UW_one_count + $UW_two_count + $UW_three_count); + $stmt="select count(*) from vicidial_log where called_count='4' and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $UW_four_results = mysqli_num_rows($rslt); + if ($UW_four_results > 0) + {$row=mysqli_fetch_row($rslt); $UW_four_count = $row[0];} + $stmt="select count(*) from vicidial_log where called_count='5' and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $UW_five_results = mysqli_num_rows($rslt); + if ($UW_five_results > 0) + {$row=mysqli_fetch_row($rslt); $UW_five_count = $row[0];} + $stmt="select count(distinct lead_id) from vicidial_log where status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $UW_all_results = mysqli_num_rows($rslt); + if ($UW_all_results > 0) + {$row=mysqli_fetch_row($rslt); $UW_all_count = $row[0];} + if ($UW_all_count > $UW_count) {$UW_count = $UW_all_count;} $UW_countS = sprintf("%7s", $UW_count); while(strlen($UW_countS)>7) {$UW_countS = substr("$UW_countS", 0, -1);} $UW_one_countS = sprintf("%7s", $UW_one_count); while(strlen($UW_one_countS)>7) {$UW_one_countS = substr("$UW_one_countS", 0, -1);} $UW_two_countS = sprintf("%7s", $UW_two_count); while(strlen($UW_two_countS)>7) {$UW_two_countS = substr("$UW_two_countS", 0, -1);} $UW_three_countS = sprintf("%7s", $UW_three_count); while(strlen($UW_three_countS)>7) {$UW_three_countS = substr("$UW_three_countS", 0, -1);} - $UW_threeT_countS = sprintf("%7s", $UW_threeT_count); while(strlen($UW_threeT_countS)>7) {$UW_threeT_countS = substr("$UW_threeT_countS", 0, -1);} + $UW_four_countS = sprintf("%7s", $UW_four_count); while(strlen($UW_four_countS)>7) {$UW_four_countS = substr("$UW_four_countS", 0, -1);} + $UW_five_countS = sprintf("%7s", $UW_five_count); while(strlen($UW_five_countS)>7) {$UW_five_countS = substr("$UW_five_countS", 0, -1);} $UW_count_tot = ($UW_count + $UW_count_tot); $UW_one_count_tot = ($UW_one_count + $UW_one_count_tot); $UW_two_count_tot = ($UW_two_count + $UW_two_count_tot); $UW_three_count_tot = ($UW_three_count + $UW_three_count_tot); - $UW_threeT_count_tot = ($UW_threeT_count + $UW_threeT_count_tot); + $UW_four_count_tot = ($UW_four_count + $UW_four_count_tot); + $UW_five_count_tot = ($UW_five_count + $UW_five_count_tot); ########## END UNWORKABLE (Unworkable flag) ########## ######################################################## @@ -1137,56 +1146,40 @@ else ######################################################## ########## BEGIN UNWORKABLE RATIO (Unworkable flag out of total leads percentage) ########## - $UR_count=0; $UR_one_count=0; $UR_two_count=0; $UR_three_count=0; - - $stmt="select count(*) from vicidial_list where status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $UR_results = mysqli_num_rows($rslt); - if ($UR_results > 0) - {$row=mysqli_fetch_row($rslt); $UR_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $UR_one_results = mysqli_num_rows($rslt); - if ($UR_one_results > 0) - {$row=mysqli_fetch_row($rslt); $UR_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $UR_two_results = mysqli_num_rows($rslt); - if ($UR_two_results > 0) - {$row=mysqli_fetch_row($rslt); $UR_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($unworkable_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $UR_three_results = mysqli_num_rows($rslt); - if ($UR_three_results > 0) - {$row=mysqli_fetch_row($rslt); $UR_three_count = $row[0];} - $UR_threeT_count = ($UR_one_count + $UR_two_count + $UR_three_count); + $UR_count=$UW_count; + $UR_one_count=$UW_one_count; + $UR_two_count=$UW_two_count; + $UR_three_count=$UW_three_count; + $UR_four_count=$UW_four_count; + $UR_five_count=$UW_five_count; + $UR_all_count=$UW_all_count; $UR_count_pct=0; $UR_one_count_pct=0; $UR_two_count_pct=0; $UR_three_count_pct=0; - $UR_threeT_count_pct=0; + $UR_four_count_pct=0; + $UR_five_count_pct=0; if ( ($UR_count > 0) and ($LISTIDcalls[$i] > 0) ) {$UR_count_pct = (($UR_count / $LISTIDcalls[$i]) * 100);} if ( ($UR_one_count > 0) and ($LISTIDcalls[$i] > 0) ) {$UR_one_count_pct = (($UR_one_count / $LISTIDcalls[$i]) * 100);} if ( ($UR_two_count > 0) and ($LISTIDcalls[$i] > 0) ) {$UR_two_count_pct = (($UR_two_count / $LISTIDcalls[$i]) * 100);} if ( ($UR_three_count > 0) and ($LISTIDcalls[$i] > 0) ) {$UR_three_count_pct = (($UR_three_count / $LISTIDcalls[$i]) * 100);} - if ( ($UR_threeT_count > 0) and ($LISTIDcalls[$i] > 0) ) {$UR_threeT_count_pct = (($UR_threeT_count / $LISTIDcalls[$i]) * 100);} + if ( ($UR_four_count > 0) and ($LISTIDcalls[$i] > 0) ) {$UR_four_count_pct = (($UR_four_count / $LISTIDcalls[$i]) * 100);} + if ( ($UR_five_count > 0) and ($LISTIDcalls[$i] > 0) ) {$UR_five_count_pct = (($UR_five_count / $LISTIDcalls[$i]) * 100);} $UR_countS = sprintf("%6.2f", $UR_count_pct); while(strlen($UR_countS)>7) {$UR_countS = substr("$UR_countS", 0, -1);} $UR_one_countS = sprintf("%6.2f", $UR_one_count_pct); while(strlen($UR_one_countS)>7) {$UR_one_countS = substr("$UR_one_countS", 0, -1);} $UR_two_countS = sprintf("%6.2f", $UR_two_count_pct); while(strlen($UR_two_countS)>7) {$UR_two_countS = substr("$UR_two_countS", 0, -1);} $UR_three_countS = sprintf("%6.2f", $UR_three_count_pct); while(strlen($UR_three_countS)>7) {$UR_three_countS = substr("$UR_three_countS", 0, -1);} - $UR_threeT_countS = sprintf("%6.2f", $UR_threeT_count_pct); while(strlen($UR_threeT_countS)>7) {$UR_threeT_countS = substr("$UR_threeT_countS", 0, -1);} + $UR_four_countS = sprintf("%6.2f", $UR_four_count_pct); while(strlen($UR_four_countS)>7) {$UR_four_countS = substr("$UR_four_countS", 0, -1);} + $UR_five_countS = sprintf("%6.2f", $UR_five_count_pct); while(strlen($UR_five_countS)>7) {$UR_five_countS = substr("$UR_five_countS", 0, -1);} $UR_count_tot = ($UR_count + $UR_count_tot); $UR_one_count_tot = ($UR_one_count + $UR_one_count_tot); $UR_two_count_tot = ($UR_two_count + $UR_two_count_tot); $UR_three_count_tot = ($UR_three_count + $UR_three_count_tot); - $UR_threeT_count_tot = ($UR_threeT_count + $UR_threeT_count_tot); + $UR_four_count_tot = ($UR_four_count + $UR_four_count_tot); + $UR_five_count_tot = ($UR_five_count + $UR_five_count_tot); ########## END UNWORKABLE RATIO (Unworkable flag out of total leads percentage) ########## ######################################################## @@ -1195,7 +1188,7 @@ else ######################################################## ########## BEGIN SCHEDULED CALLBACK (Scheduled Callback flag) ########## - $BA_count=0; $BA_one_count=0; $BA_two_count=0; $BA_three_count=0; + $BA_count=0; $BA_one_count=0; $BA_two_count=0; $BA_three_count=0; $BA_four_count=0; $BA_five_count=0; $BA_all_count=0; $stmt="select count(*) from vicidial_list where status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); @@ -1221,19 +1214,39 @@ else $BA_three_results = mysqli_num_rows($rslt); if ($BA_three_results > 0) {$row=mysqli_fetch_row($rslt); $BA_three_count = $row[0];} - $BA_threeT_count = ($BA_one_count + $BA_two_count + $BA_three_count); + $stmt="select count(*) from vicidial_log where called_count='4' and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $BA_four_results = mysqli_num_rows($rslt); + if ($BA_four_results > 0) + {$row=mysqli_fetch_row($rslt); $BA_four_count = $row[0];} + $stmt="select count(*) from vicidial_log where called_count='5' and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $BA_five_results = mysqli_num_rows($rslt); + if ($BA_five_results > 0) + {$row=mysqli_fetch_row($rslt); $BA_five_count = $row[0];} + $stmt="select count(distinct lead_id) from vicidial_log where status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $BA_all_results = mysqli_num_rows($rslt); + if ($BA_all_results > 0) + {$row=mysqli_fetch_row($rslt); $BA_all_count = $row[0];} + if ($BA_all_count > $BA_count) {$BA_count = $BA_all_count;} $BA_countS = sprintf("%7s", $BA_count); while(strlen($BA_countS)>7) {$BA_countS = substr("$BA_countS", 0, -1);} $BA_one_countS = sprintf("%7s", $BA_one_count); while(strlen($BA_one_countS)>7) {$BA_one_countS = substr("$BA_one_countS", 0, -1);} $BA_two_countS = sprintf("%7s", $BA_two_count); while(strlen($BA_two_countS)>7) {$BA_two_countS = substr("$BA_two_countS", 0, -1);} $BA_three_countS = sprintf("%7s", $BA_three_count); while(strlen($BA_three_countS)>7) {$BA_three_countS = substr("$BA_three_countS", 0, -1);} - $BA_threeT_countS = sprintf("%7s", $BA_threeT_count); while(strlen($BA_threeT_countS)>7) {$BA_threeT_countS = substr("$BA_threeT_countS", 0, -1);} + $BA_four_countS = sprintf("%7s", $BA_four_count); while(strlen($BA_four_countS)>7) {$BA_four_countS = substr("$BA_four_countS", 0, -1);} + $BA_five_countS = sprintf("%7s", $BA_five_count); while(strlen($BA_five_countS)>7) {$BA_five_countS = substr("$BA_five_countS", 0, -1);} $BA_count_tot = ($BA_count + $BA_count_tot); $BA_one_count_tot = ($BA_one_count + $BA_one_count_tot); $BA_two_count_tot = ($BA_two_count + $BA_two_count_tot); $BA_three_count_tot = ($BA_three_count + $BA_three_count_tot); - $BA_threeT_count_tot = ($BA_threeT_count + $BA_threeT_count_tot); + $BA_four_count_tot = ($BA_four_count + $BA_four_count_tot); + $BA_five_count_tot = ($BA_five_count + $BA_five_count_tot); ########## END SCHEDULED CALLBACK (Scheduled Callback flag) ########## ######################################################## @@ -1242,56 +1255,40 @@ else ######################################################## ########## BEGIN SCHEDULED CALLBACK RATIO (Scheduled Callback flag out of total leads percentage) ########## - $BR_count=0; $BR_one_count=0; $BR_two_count=0; $BR_three_count=0; - - $stmt="select count(*) from vicidial_list where status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $BR_results = mysqli_num_rows($rslt); - if ($BR_results > 0) - {$row=mysqli_fetch_row($rslt); $BR_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $BR_one_results = mysqli_num_rows($rslt); - if ($BR_one_results > 0) - {$row=mysqli_fetch_row($rslt); $BR_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $BR_two_results = mysqli_num_rows($rslt); - if ($BR_two_results > 0) - {$row=mysqli_fetch_row($rslt); $BR_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($scheduled_callback_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $BR_three_results = mysqli_num_rows($rslt); - if ($BR_three_results > 0) - {$row=mysqli_fetch_row($rslt); $BR_three_count = $row[0];} - $BR_threeT_count = ($BR_one_count + $BR_two_count + $BR_three_count); + $BR_count=$BA_count; + $BR_one_count=$BA_one_count; + $BR_two_count=$BA_two_count; + $BR_three_count=$BA_three_count; + $BR_four_count=$BA_four_count; + $BR_five_count=$BA_five_count; + $BR_all_count=$BA_all_count; $BR_count_pct=0; $BR_one_count_pct=0; $BR_two_count_pct=0; $BR_three_count_pct=0; - $BR_threeT_count_pct=0; + $BR_four_count_pct=0; + $BR_five_count_pct=0; if ( ($BR_count > 0) and ($LISTIDcalls[$i] > 0) ) {$BR_count_pct = (($BR_count / $LISTIDcalls[$i]) * 100);} if ( ($BR_one_count > 0) and ($LISTIDcalls[$i] > 0) ) {$BR_one_count_pct = (($BR_one_count / $LISTIDcalls[$i]) * 100);} if ( ($BR_two_count > 0) and ($LISTIDcalls[$i] > 0) ) {$BR_two_count_pct = (($BR_two_count / $LISTIDcalls[$i]) * 100);} if ( ($BR_three_count > 0) and ($LISTIDcalls[$i] > 0) ) {$BR_three_count_pct = (($BR_three_count / $LISTIDcalls[$i]) * 100);} - if ( ($BR_threeT_count > 0) and ($LISTIDcalls[$i] > 0) ) {$BR_threeT_count_pct = (($BR_threeT_count / $LISTIDcalls[$i]) * 100);} + if ( ($BR_four_count > 0) and ($LISTIDcalls[$i] > 0) ) {$BR_four_count_pct = (($BR_four_count / $LISTIDcalls[$i]) * 100);} + if ( ($BR_five_count > 0) and ($LISTIDcalls[$i] > 0) ) {$BR_five_count_pct = (($BR_five_count / $LISTIDcalls[$i]) * 100);} $BR_countS = sprintf("%6.2f", $BR_count_pct); while(strlen($BR_countS)>7) {$BR_countS = substr("$BR_countS", 0, -1);} $BR_one_countS = sprintf("%6.2f", $BR_one_count_pct); while(strlen($BR_one_countS)>7) {$BR_one_countS = substr("$BR_one_countS", 0, -1);} $BR_two_countS = sprintf("%6.2f", $BR_two_count_pct); while(strlen($BR_two_countS)>7) {$BR_two_countS = substr("$BR_two_countS", 0, -1);} $BR_three_countS = sprintf("%6.2f", $BR_three_count_pct); while(strlen($BR_three_countS)>7) {$BR_three_countS = substr("$BR_three_countS", 0, -1);} - $BR_threeT_countS = sprintf("%6.2f", $BR_threeT_count_pct); while(strlen($BR_threeT_countS)>7) {$BR_threeT_countS = substr("$BR_threeT_countS", 0, -1);} + $BR_four_countS = sprintf("%6.2f", $BR_four_count_pct); while(strlen($BR_four_countS)>7) {$BR_four_countS = substr("$BR_four_countS", 0, -1);} + $BR_five_countS = sprintf("%6.2f", $BR_five_count_pct); while(strlen($BR_five_countS)>7) {$BR_five_countS = substr("$BR_five_countS", 0, -1);} $BR_count_tot = ($BR_count + $BR_count_tot); $BR_one_count_tot = ($BR_one_count + $BR_one_count_tot); $BR_two_count_tot = ($BR_two_count + $BR_two_count_tot); $BR_three_count_tot = ($BR_three_count + $BR_three_count_tot); - $BR_threeT_count_tot = ($BR_threeT_count + $BR_threeT_count_tot); + $BR_four_count_tot = ($BR_four_count + $BR_four_count_tot); + $BR_five_count_tot = ($BR_five_count + $BR_five_count_tot); ########## END SCHEDULED CALLBACK RATIO (Scheduled Callback flag out of total leads percentage) ########## ######################################################## @@ -1300,7 +1297,7 @@ else ######################################################## ########## BEGIN COMPLETED (Completed flag) ########## - $MP_count=0; $MP_one_count=0; $MP_two_count=0; $MP_three_count=0; + $MP_count=0; $MP_one_count=0; $MP_two_count=0; $MP_three_count=0; $MP_four_count=0; $MP_five_count=0; $MP_all_count=0; $stmt="select count(*) from vicidial_list where status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; $rslt=mysql_to_mysqli($stmt, $link); @@ -1326,19 +1323,39 @@ else $MP_three_results = mysqli_num_rows($rslt); if ($MP_three_results > 0) {$row=mysqli_fetch_row($rslt); $MP_three_count = $row[0];} - $MP_threeT_count = ($MP_one_count + $MP_two_count + $MP_three_count); + $stmt="select count(*) from vicidial_log where called_count='4' and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $MP_four_results = mysqli_num_rows($rslt); + if ($MP_four_results > 0) + {$row=mysqli_fetch_row($rslt); $MP_four_count = $row[0];} + $stmt="select count(*) from vicidial_log where called_count='5' and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $MP_five_results = mysqli_num_rows($rslt); + if ($MP_five_results > 0) + {$row=mysqli_fetch_row($rslt); $MP_five_count = $row[0];} + $stmt="select count(distinct lead_id) from vicidial_log where status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; + $rslt=mysql_to_mysqli($stmt, $link); + if ($DB) {$MAIN.="$stmt\n";} + $MP_all_results = mysqli_num_rows($rslt); + if ($MP_all_results > 0) + {$row=mysqli_fetch_row($rslt); $MP_all_count = $row[0];} + if ($MP_all_count > $MP_count) {$MP_count = $MP_all_count;} $MP_countS = sprintf("%7s", $MP_count); while(strlen($MP_countS)>7) {$MP_countS = substr("$MP_countS", 0, -1);} $MP_one_countS = sprintf("%7s", $MP_one_count); while(strlen($MP_one_countS)>7) {$MP_one_countS = substr("$MP_one_countS", 0, -1);} $MP_two_countS = sprintf("%7s", $MP_two_count); while(strlen($MP_two_countS)>7) {$MP_two_countS = substr("$MP_two_countS", 0, -1);} $MP_three_countS = sprintf("%7s", $MP_three_count); while(strlen($MP_three_countS)>7) {$MP_three_countS = substr("$MP_three_countS", 0, -1);} - $MP_threeT_countS = sprintf("%7s", $MP_threeT_count); while(strlen($MP_threeT_countS)>7) {$MP_threeT_countS = substr("$MP_threeT_countS", 0, -1);} + $MP_four_countS = sprintf("%7s", $MP_four_count); while(strlen($MP_four_countS)>7) {$MP_four_countS = substr("$MP_four_countS", 0, -1);} + $MP_five_countS = sprintf("%7s", $MP_five_count); while(strlen($MP_five_countS)>7) {$MP_five_countS = substr("$MP_five_countS", 0, -1);} $MP_count_tot = ($MP_count + $MP_count_tot); $MP_one_count_tot = ($MP_one_count + $MP_one_count_tot); $MP_two_count_tot = ($MP_two_count + $MP_two_count_tot); $MP_three_count_tot = ($MP_three_count + $MP_three_count_tot); - $MP_threeT_count_tot = ($MP_threeT_count + $MP_threeT_count_tot); + $MP_four_count_tot = ($MP_four_count + $MP_four_count_tot); + $MP_five_count_tot = ($MP_five_count + $MP_five_count_tot); ########## END COMPLETED (Completed Callback flag) ########## ######################################################## @@ -1347,56 +1364,40 @@ else ######################################################## ########## BEGIN COMPLETED RATIO (Completed flag out of total leads percentage) ########## - $MR_count=0; $MR_one_count=0; $MR_two_count=0; $MR_three_count=0; - - $stmt="select count(*) from vicidial_list where status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $MR_results = mysqli_num_rows($rslt); - if ($MR_results > 0) - {$row=mysqli_fetch_row($rslt); $MR_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=1 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $MR_one_results = mysqli_num_rows($rslt); - if ($MR_one_results > 0) - {$row=mysqli_fetch_row($rslt); $MR_one_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=2 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $MR_two_results = mysqli_num_rows($rslt); - if ($MR_two_results > 0) - {$row=mysqli_fetch_row($rslt); $MR_two_count = $row[0];} - $stmt="select count(*) from vicidial_log where called_count=3 and status IN($completed_statuses) and list_id='$LISTIDlists[$i]';"; - $rslt=mysql_to_mysqli($stmt, $link); - if ($DB) {$MAIN.="$stmt\n";} - $MR_three_results = mysqli_num_rows($rslt); - if ($MR_three_results > 0) - {$row=mysqli_fetch_row($rslt); $MR_three_count = $row[0];} - $MR_threeT_count = ($MR_one_count + $MR_two_count + $MR_three_count); + $MR_count=$MP_count; + $MR_one_count=$MP_one_count; + $MR_two_count=$MP_two_count; + $MR_three_count=$MP_three_count; + $MR_four_count=$MP_four_count; + $MR_five_count=$MP_five_count; + $MR_all_count=$MP_all_count; $MR_count_pct=0; $MR_one_count_pct=0; $MR_two_count_pct=0; $MR_three_count_pct=0; - $MR_threeT_count_pct=0; + $MR_four_count_pct=0; + $MR_five_count_pct=0; if ( ($MR_count > 0) and ($LISTIDcalls[$i] > 0) ) {$MR_count_pct = (($MR_count / $LISTIDcalls[$i]) * 100);} if ( ($MR_one_count > 0) and ($LISTIDcalls[$i] > 0) ) {$MR_one_count_pct = (($MR_one_count / $LISTIDcalls[$i]) * 100);} if ( ($MR_two_count > 0) and ($LISTIDcalls[$i] > 0) ) {$MR_two_count_pct = (($MR_two_count / $LISTIDcalls[$i]) * 100);} if ( ($MR_three_count > 0) and ($LISTIDcalls[$i] > 0) ) {$MR_three_count_pct = (($MR_three_count / $LISTIDcalls[$i]) * 100);} - if ( ($MR_threeT_count > 0) and ($LISTIDcalls[$i] > 0) ) {$MR_threeT_count_pct = (($MR_threeT_count / $LISTIDcalls[$i]) * 100);} + if ( ($MR_four_count > 0) and ($LISTIDcalls[$i] > 0) ) {$MR_four_count_pct = (($MR_four_count / $LISTIDcalls[$i]) * 100);} + if ( ($MR_five_count > 0) and ($LISTIDcalls[$i] > 0) ) {$MR_five_count_pct = (($MR_five_count / $LISTIDcalls[$i]) * 100);} $MR_countS = sprintf("%6.2f", $MR_count_pct); while(strlen($MR_countS)>7) {$MR_countS = substr("$MR_countS", 0, -1);} $MR_one_countS = sprintf("%6.2f", $MR_one_count_pct); while(strlen($MR_one_countS)>7) {$MR_one_countS = substr("$MR_one_countS", 0, -1);} $MR_two_countS = sprintf("%6.2f", $MR_two_count_pct); while(strlen($MR_two_countS)>7) {$MR_two_countS = substr("$MR_two_countS", 0, -1);} $MR_three_countS = sprintf("%6.2f", $MR_three_count_pct); while(strlen($MR_three_countS)>7) {$MR_three_countS = substr("$MR_three_countS", 0, -1);} - $MR_threeT_countS = sprintf("%6.2f", $MR_threeT_count_pct); while(strlen($MR_threeT_countS)>7) {$MR_threeT_countS = substr("$MR_threeT_countS", 0, -1);} + $MR_four_countS = sprintf("%6.2f", $MR_four_count_pct); while(strlen($MR_four_countS)>7) {$MR_four_countS = substr("$MR_four_countS", 0, -1);} + $MR_five_countS = sprintf("%6.2f", $MR_five_count_pct); while(strlen($MR_five_countS)>7) {$MR_five_countS = substr("$MR_five_countS", 0, -1);} $MR_count_tot = ($MR_count + $MR_count_tot); $MR_one_count_tot = ($MR_one_count + $MR_one_count_tot); $MR_two_count_tot = ($MR_two_count + $MR_two_count_tot); $MR_three_count_tot = ($MR_three_count + $MR_three_count_tot); - $MR_threeT_count_tot = ($MR_threeT_count + $MR_threeT_count_tot); + $MR_four_count_tot = ($MR_four_count + $MR_four_count_tot); + $MR_five_count_tot = ($MR_five_count + $MR_five_count_tot); ########## END COMPLETED RATIO (Completed flag out of total leads percentage) ########## ######################################################## @@ -1404,37 +1405,37 @@ else $OUToutput .= "| $LISTIDentry_dateS | $LISTIDname | $LISTIDcampaignS | $LISTIDcount | $LISTIDlist_active[$i] "; - $OUToutput .= "| $HA_one_countS | $HA_two_countS | $HA_three_countS | $HA_threeT_countS | $HA_countS "; - $OUToutput .= "| $HR_one_countS% | $HR_two_countS% | $HR_three_countS% | $HR_threeT_countS% | $HR_countS% "; - $OUToutput .= "| $SA_one_countS | $SA_two_countS | $SA_three_countS | $SA_threeT_countS | $SA_countS "; - $OUToutput .= "| $SR_one_countS% | $SR_two_countS% | $SR_three_countS% | $SR_threeT_countS% | $SR_countS% "; - $OUToutput .= "| $DN_one_countS | $DN_two_countS | $DN_three_countS | $DN_threeT_countS | $DN_countS "; - $OUToutput .= "| $DR_one_countS% | $DR_two_countS% | $DR_three_countS% | $DR_threeT_countS% | $DR_countS% "; - $OUToutput .= "| $CC_one_countS | $CC_two_countS | $CC_three_countS | $CC_threeT_countS | $CC_countS "; - $OUToutput .= "| $CR_one_countS% | $CR_two_countS% | $CR_three_countS% | $CR_threeT_countS% | $CR_countS% "; - $OUToutput .= "| $UW_one_countS | $UW_two_countS | $UW_three_countS | $UW_threeT_countS | $UW_countS "; - $OUToutput .= "| $UR_one_countS% | $UR_two_countS% | $UR_three_countS% | $UR_threeT_countS% | $UR_countS% "; - $OUToutput .= "| $BA_one_countS | $BA_two_countS | $BA_three_countS | $BA_threeT_countS | $BA_countS "; - $OUToutput .= "| $BR_one_countS% | $BR_two_countS% | $BR_three_countS% | $BR_threeT_countS% | $BR_countS% "; - $OUToutput .= "| $MP_one_countS | $MP_two_countS | $MP_three_countS | $MP_threeT_countS | $MP_countS "; - $OUToutput .= "| $MR_one_countS% | $MR_two_countS% | $MR_three_countS% | $MR_threeT_countS% | $MR_countS% "; + $OUToutput .= "| $HA_one_countS | $HA_two_countS | $HA_three_countS | $HA_four_countS | $HA_five_countS | $HA_countS "; + $OUToutput .= "| $HR_one_countS% | $HR_two_countS% | $HR_three_countS% | $HR_four_countS% | $HR_five_countS% | $HR_countS% "; + $OUToutput .= "| $SA_one_countS | $SA_two_countS | $SA_three_countS | $SA_four_countS | $SA_five_countS | $SA_countS "; + $OUToutput .= "| $SR_one_countS% | $SR_two_countS% | $SR_three_countS% | $SR_four_countS% | $SR_five_countS% | $SR_countS% "; + $OUToutput .= "| $DN_one_countS | $DN_two_countS | $DN_three_countS | $DN_four_countS | $DN_five_countS | $DN_countS "; + $OUToutput .= "| $DR_one_countS% | $DR_two_countS% | $DR_three_countS% | $DR_four_countS% | $DR_five_countS% | $DR_countS% "; + $OUToutput .= "| $CC_one_countS | $CC_two_countS | $CC_three_countS | $CC_four_countS | $CC_five_countS | $CC_countS "; + $OUToutput .= "| $CR_one_countS% | $CR_two_countS% | $CR_three_countS% | $CR_four_countS% | $CR_five_countS% | $CR_countS% "; + $OUToutput .= "| $UW_one_countS | $UW_two_countS | $UW_three_countS | $UW_four_countS | $UW_five_countS | $UW_countS "; + $OUToutput .= "| $UR_one_countS% | $UR_two_countS% | $UR_three_countS% | $UR_four_countS% | $UR_five_countS% | $UR_countS% "; + $OUToutput .= "| $BA_one_countS | $BA_two_countS | $BA_three_countS | $BA_four_countS | $BA_five_countS | $BA_countS "; + $OUToutput .= "| $BR_one_countS% | $BR_two_countS% | $BR_three_countS% | $BR_four_countS% | $BR_five_countS% | $BR_countS% "; + $OUToutput .= "| $MP_one_countS | $MP_two_countS | $MP_three_countS | $MP_four_countS | $MP_five_countS | $MP_countS "; + $OUToutput .= "| $MR_one_countS% | $MR_two_countS% | $MR_three_countS% | $MR_four_countS% | $MR_five_countS% | $MR_countS% "; $OUToutput .= "|\n"; $CSV_text1.="\"$LISTIDentry_dateS\",\"$LISTIDname\",\"$LISTIDcampaignS\",\"$LISTIDcount\",\"$LISTIDlist_active[$i]\""; - $CSV_text1.=",\"$HA_one_countS\",\"$HA_two_countS\",\"$HA_three_countS\",\"$HA_threeT_countS\",\"$HA_countS\""; - $CSV_text1.=",\"$HR_one_countS%\",\"$HR_two_countS%\",\"$HR_three_countS%\",\"$HR_threeT_countS%\",\"$HR_countS%\""; - $CSV_text1.=",\"$SA_one_countS\",\"$SA_two_countS\",\"$SA_three_countS\",\"$SA_threeT_countS\",\"$SA_countS\""; - $CSV_text1.=",\"$SR_one_countS%\",\"$SR_two_countS%\",\"$SR_three_countS%\",\"$SR_threeT_countS%\",\"$SR_countS%\""; - $CSV_text1.=",\"$DN_one_countS\",\"$DN_two_countS\",\"$DN_three_countS\",\"$DN_threeT_countS\",\"$DN_countS\""; - $CSV_text1.=",\"$DR_one_countS%\",\"$DR_two_countS%\",\"$DR_three_countS%\",\"$DR_threeT_countS%\",\"$DR_countS%\""; - $CSV_text1.=",\"$CC_one_countS\",\"$CC_two_countS\",\"$CC_three_countS\",\"$CC_threeT_countS\",\"$CC_countS\""; - $CSV_text1.=",\"$CR_one_countS%\",\"$CR_two_countS%\",\"$CR_three_countS%\",\"$CR_threeT_countS%\",\"$CR_countS%\""; - $CSV_text1.=",\"$UW_one_countS\",\"$UW_two_countS\",\"$UW_three_countS\",\"$UW_threeT_countS\",\"$UW_countS\""; - $CSV_text1.=",\"$UR_one_countS%\",\"$UR_two_countS%\",\"$UR_three_countS%\",\"$UR_threeT_countS%\",\"$UR_countS%\""; - $CSV_text1.=",\"$BA_one_countS\",\"$BA_two_countS\",\"$BA_three_countS\",\"$BA_threeT_countS\",\"$BA_countS\""; - $CSV_text1.=",\"$BR_one_countS%\",\"$BR_two_countS%\",\"$BR_three_countS%\",\"$BR_threeT_countS%\",\"$BR_countS%\""; - $CSV_text1.=",\"$MP_one_countS\",\"$MP_two_countS\",\"$MP_three_countS\",\"$MP_threeT_countS\",\"$MP_countS\""; - $CSV_text1.=",\"$MR_one_countS%\",\"$MR_two_countS%\",\"$MR_three_countS%\",\"$MR_threeT_countS%\",\"$MR_countS%\""; + $CSV_text1.=",\"$HA_one_countS\",\"$HA_two_countS\",\"$HA_three_countS\",\"$HA_four_countS\",\"$HA_five_countS\",\"$HA_countS\""; + $CSV_text1.=",\"$HR_one_countS%\",\"$HR_two_countS%\",\"$HR_three_countS%\",\"$HR_four_countS%\",\"$HR_five_countS%\",\"$HR_countS%\""; + $CSV_text1.=",\"$SA_one_countS\",\"$SA_two_countS\",\"$SA_three_countS\",\"$SA_four_countS\",\"$SA_five_countS\",\"$SA_countS\""; + $CSV_text1.=",\"$SR_one_countS%\",\"$SR_two_countS%\",\"$SR_three_countS%\",\"$SR_four_countS%\",\"$SR_five_countS%\",\"$SR_countS%\""; + $CSV_text1.=",\"$DN_one_countS\",\"$DN_two_countS\",\"$DN_three_countS\",\"$DN_four_countS\",\"$DN_five_countS\",\"$DN_countS\""; + $CSV_text1.=",\"$DR_one_countS%\",\"$DR_two_countS%\",\"$DR_three_countS%\",\"$DR_four_countS%\",\"$DR_five_countS%\",\"$DR_countS%\""; + $CSV_text1.=",\"$CC_one_countS\",\"$CC_two_countS\",\"$CC_three_countS\",\"$CC_four_countS\",\"$CC_five_countS\",\"$CC_countS\""; + $CSV_text1.=",\"$CR_one_countS%\",\"$CR_two_countS%\",\"$CR_three_countS%\",\"$CR_four_countS%\",\"$CR_five_countS%\",\"$CR_countS%\""; + $CSV_text1.=",\"$UW_one_countS\",\"$UW_two_countS\",\"$UW_three_countS\",\"$UW_four_countS\",\"$UW_five_countS\",\"$UW_countS\""; + $CSV_text1.=",\"$UR_one_countS%\",\"$UR_two_countS%\",\"$UR_three_countS%\",\"$UR_four_countS%\",\"$UR_five_countS%\",\"$UR_countS%\""; + $CSV_text1.=",\"$BA_one_countS\",\"$BA_two_countS\",\"$BA_three_countS\",\"$BA_four_countS\",\"$BA_five_countS\",\"$BA_countS\""; + $CSV_text1.=",\"$BR_one_countS%\",\"$BR_two_countS%\",\"$BR_three_countS%\",\"$BR_four_countS%\",\"$BR_five_countS%\",\"$BR_countS%\""; + $CSV_text1.=",\"$MP_one_countS\",\"$MP_two_countS\",\"$MP_three_countS\",\"$MP_four_countS\",\"$MP_five_countS\",\"$MP_countS\""; + $CSV_text1.=",\"$MR_one_countS%\",\"$MR_two_countS%\",\"$MR_three_countS%\",\"$MR_four_countS%\",\"$MR_five_countS%\",\"$MR_countS%\""; $CSV_text1.="\n"; $i++; @@ -1444,232 +1445,260 @@ else $HA_one_count_totS = sprintf("%7s", $HA_one_count_tot); while(strlen($HA_one_count_totS)>7) {$HA_one_count_totS = substr("$HA_one_count_totS", 0, -1);} $HA_two_count_totS = sprintf("%7s", $HA_two_count_tot); while(strlen($HA_two_count_totS)>7) {$HA_two_count_totS = substr("$HA_two_count_totS", 0, -1);} $HA_three_count_totS = sprintf("%7s", $HA_three_count_tot); while(strlen($HA_three_count_totS)>7) {$HA_three_count_totS = substr("$HA_three_count_totS", 0, -1);} - $HA_threeT_count_totS = sprintf("%7s", $HA_threeT_count_tot); while(strlen($HA_threeT_count_totS)>7) {$HA_threeT_count_totS = substr("$HA_threeT_count_totS", 0, -1);} + $HA_four_count_totS = sprintf("%7s", $HA_four_count_tot); while(strlen($HA_four_count_totS)>7) {$HA_four_count_totS = substr("$HA_four_count_totS", 0, -1);} + $HA_five_count_totS = sprintf("%7s", $HA_five_count_tot); while(strlen($HA_five_count_totS)>7) {$HA_five_count_totS = substr("$HA_five_count_totS", 0, -1);} $SA_count_totS = sprintf("%7s", $SA_count_tot); while(strlen($SA_count_totS)>7) {$SA_count_totS = substr("$SA_count_totS", 0, -1);} $SA_one_count_totS = sprintf("%7s", $SA_one_count_tot); while(strlen($SA_one_count_totS)>7) {$SA_one_count_totS = substr("$SA_one_count_totS", 0, -1);} $SA_two_count_totS = sprintf("%7s", $SA_two_count_tot); while(strlen($SA_two_count_totS)>7) {$SA_two_count_totS = substr("$SA_two_count_totS", 0, -1);} $SA_three_count_totS = sprintf("%7s", $SA_three_count_tot); while(strlen($SA_three_count_totS)>7) {$SA_three_count_totS = substr("$SA_three_count_totS", 0, -1);} - $SA_threeT_count_totS = sprintf("%7s", $SA_threeT_count_tot); while(strlen($SA_threeT_count_totS)>7) {$SA_threeT_count_totS = substr("$SA_threeT_count_totS", 0, -1);} + $SA_four_count_totS = sprintf("%7s", $SA_four_count_tot); while(strlen($SA_four_count_totS)>7) {$SA_four_count_totS = substr("$SA_four_count_totS", 0, -1);} + $SA_five_count_totS = sprintf("%7s", $SA_five_count_tot); while(strlen($SA_five_count_totS)>7) {$SA_five_count_totS = substr("$SA_five_count_totS", 0, -1);} $DN_count_totS = sprintf("%7s", $DN_count_tot); while(strlen($DN_count_totS)>7) {$DN_count_totS = substr("$DN_count_totS", 0, -1);} $DN_one_count_totS = sprintf("%7s", $DN_one_count_tot); while(strlen($DN_one_count_totS)>7) {$DN_one_count_totS = substr("$DN_one_count_totS", 0, -1);} $DN_two_count_totS = sprintf("%7s", $DN_two_count_tot); while(strlen($DN_two_count_totS)>7) {$DN_two_count_totS = substr("$DN_two_count_totS", 0, -1);} $DN_three_count_totS = sprintf("%7s", $DN_three_count_tot); while(strlen($DN_three_count_totS)>7) {$DN_three_count_totS = substr("$DN_three_count_totS", 0, -1);} - $DN_threeT_count_totS = sprintf("%7s", $DN_threeT_count_tot); while(strlen($DN_threeT_count_totS)>7) {$DN_threeT_count_totS = substr("$DN_threeT_count_totS", 0, -1);} + $DN_four_count_totS = sprintf("%7s", $DN_four_count_tot); while(strlen($DN_four_count_totS)>7) {$DN_four_count_totS = substr("$DN_four_count_totS", 0, -1);} + $DN_five_count_totS = sprintf("%7s", $DN_five_count_tot); while(strlen($DN_five_count_totS)>7) {$DN_five_count_totS = substr("$DN_five_count_totS", 0, -1);} $CC_count_totS = sprintf("%7s", $CC_count_tot); while(strlen($CC_count_totS)>7) {$CC_count_totS = substr("$CC_count_totS", 0, -1);} $CC_one_count_totS = sprintf("%7s", $CC_one_count_tot); while(strlen($CC_one_count_totS)>7) {$CC_one_count_totS = substr("$CC_one_count_totS", 0, -1);} $CC_two_count_totS = sprintf("%7s", $CC_two_count_tot); while(strlen($CC_two_count_totS)>7) {$CC_two_count_totS = substr("$CC_two_count_totS", 0, -1);} $CC_three_count_totS = sprintf("%7s", $CC_three_count_tot); while(strlen($CC_three_count_totS)>7) {$CC_three_count_totS = substr("$CC_three_count_totS", 0, -1);} - $CC_threeT_count_totS = sprintf("%7s", $CC_threeT_count_tot); while(strlen($CC_threeT_count_totS)>7) {$CC_threeT_count_totS = substr("$CC_threeT_count_totS", 0, -1);} + $CC_four_count_totS = sprintf("%7s", $CC_four_count_tot); while(strlen($CC_four_count_totS)>7) {$CC_four_count_totS = substr("$CC_four_count_totS", 0, -1);} + $CC_five_count_totS = sprintf("%7s", $CC_five_count_tot); while(strlen($CC_five_count_totS)>7) {$CC_five_count_totS = substr("$CC_five_count_totS", 0, -1);} $UW_count_totS = sprintf("%7s", $UW_count_tot); while(strlen($UW_count_totS)>7) {$UW_count_totS = substr("$UW_count_totS", 0, -1);} $UW_one_count_totS = sprintf("%7s", $UW_one_count_tot); while(strlen($UW_one_count_totS)>7) {$UW_one_count_totS = substr("$UW_one_count_totS", 0, -1);} $UW_two_count_totS = sprintf("%7s", $UW_two_count_tot); while(strlen($UW_two_count_totS)>7) {$UW_two_count_totS = substr("$UW_two_count_totS", 0, -1);} $UW_three_count_totS = sprintf("%7s", $UW_three_count_tot); while(strlen($UW_three_count_totS)>7) {$UW_three_count_totS = substr("$UW_three_count_totS", 0, -1);} - $UW_threeT_count_totS = sprintf("%7s", $UW_threeT_count_tot); while(strlen($UW_threeT_count_totS)>7) {$UW_threeT_count_totS = substr("$UW_threeT_count_totS", 0, -1);} + $UW_four_count_totS = sprintf("%7s", $UW_four_count_tot); while(strlen($UW_four_count_totS)>7) {$UW_four_count_totS = substr("$UW_four_count_totS", 0, -1);} + $UW_five_count_totS = sprintf("%7s", $UW_five_count_tot); while(strlen($UW_five_count_totS)>7) {$UW_five_count_totS = substr("$UW_five_count_totS", 0, -1);} $BA_count_totS = sprintf("%7s", $BA_count_tot); while(strlen($BA_count_totS)>7) {$BA_count_totS = substr("$BA_count_totS", 0, -1);} $BA_one_count_totS = sprintf("%7s", $BA_one_count_tot); while(strlen($BA_one_count_totS)>7) {$BA_one_count_totS = substr("$BA_one_count_totS", 0, -1);} $BA_two_count_totS = sprintf("%7s", $BA_two_count_tot); while(strlen($BA_two_count_totS)>7) {$BA_two_count_totS = substr("$BA_two_count_totS", 0, -1);} $BA_three_count_totS = sprintf("%7s", $BA_three_count_tot); while(strlen($BA_three_count_totS)>7) {$BA_three_count_totS = substr("$BA_three_count_totS", 0, -1);} - $BA_threeT_count_totS = sprintf("%7s", $BA_threeT_count_tot); while(strlen($BA_threeT_count_totS)>7) {$BA_threeT_count_totS = substr("$BA_threeT_count_totS", 0, -1);} + $BA_four_count_totS = sprintf("%7s", $BA_four_count_tot); while(strlen($BA_four_count_totS)>7) {$BA_four_count_totS = substr("$BA_four_count_totS", 0, -1);} + $BA_five_count_totS = sprintf("%7s", $BA_five_count_tot); while(strlen($BA_five_count_totS)>7) {$BA_five_count_totS = substr("$BA_five_count_totS", 0, -1);} $MP_count_totS = sprintf("%7s", $MP_count_tot); while(strlen($MP_count_totS)>7) {$MP_count_totS = substr("$MP_count_totS", 0, -1);} $MP_one_count_totS = sprintf("%7s", $MP_one_count_tot); while(strlen($MP_one_count_totS)>7) {$MP_one_count_totS = substr("$MP_one_count_totS", 0, -1);} $MP_two_count_totS = sprintf("%7s", $MP_two_count_tot); while(strlen($MP_two_count_totS)>7) {$MP_two_count_totS = substr("$MP_two_count_totS", 0, -1);} $MP_three_count_totS = sprintf("%7s", $MP_three_count_tot); while(strlen($MP_three_count_totS)>7) {$MP_three_count_totS = substr("$MP_three_count_totS", 0, -1);} - $MP_threeT_count_totS = sprintf("%7s", $MP_threeT_count_tot); while(strlen($MP_threeT_count_totS)>7) {$MP_threeT_count_totS = substr("$MP_threeT_count_totS", 0, -1);} + $MP_four_count_totS = sprintf("%7s", $MP_four_count_tot); while(strlen($MP_four_count_totS)>7) {$MP_four_count_totS = substr("$MP_four_count_totS", 0, -1);} + $MP_five_count_totS = sprintf("%7s", $MP_five_count_tot); while(strlen($MP_five_count_totS)>7) {$MP_five_count_totS = substr("$MP_five_count_totS", 0, -1);} $HR_count_Tpc=0; $HR_one_count_Tpc=0; $HR_two_count_Tpc=0; $HR_three_count_Tpc=0; - $HR_threeT_count_Tpc=0; + $HR_four_count_Tpc=0; + $HR_five_count_Tpc=0; if ( ($HR_count_tot > 0) and ($TOTALleads > 0) ) {$HR_count_Tpc = (($HR_count_tot / $TOTALleads) * 100);} if ( ($HR_one_count_tot > 0) and ($TOTALleads > 0) ) {$HR_one_count_Tpc = (($HR_one_count_tot / $TOTALleads) * 100);} if ( ($HR_two_count_tot > 0) and ($TOTALleads > 0) ) {$HR_two_count_Tpc = (($HR_two_count_tot / $TOTALleads) * 100);} if ( ($HR_three_count_tot > 0) and ($TOTALleads > 0) ) {$HR_three_count_Tpc = (($HR_three_count_tot / $TOTALleads) * 100);} - if ( ($HR_threeT_count_tot > 0) and ($TOTALleads > 0) ) {$HR_threeT_count_Tpc = (($HR_threeT_count_tot / $TOTALleads) * 100);} + if ( ($HR_four_count_tot > 0) and ($TOTALleads > 0) ) {$HR_four_count_Tpc = (($HR_four_count_tot / $TOTALleads) * 100);} + if ( ($HR_five_count_tot > 0) and ($TOTALleads > 0) ) {$HR_five_count_Tpc = (($HR_five_count_tot / $TOTALleads) * 100);} $HR_count_totS = sprintf("%6.2f", $HR_count_Tpc); while(strlen($HR_count_totS)>7) {$HR_count_totS = substr("$HR_count_totS", 0, -1);} $HR_one_count_totS = sprintf("%6.2f", $HR_one_count_Tpc); while(strlen($HR_one_count_totS)>7) {$HR_one_count_totS = substr("$HR_one_count_totS", 0, -1);} $HR_two_count_totS = sprintf("%6.2f", $HR_two_count_Tpc); while(strlen($HR_two_count_totS)>7) {$HR_two_count_totS = substr("$HR_two_count_totS", 0, -1);} $HR_three_count_totS = sprintf("%6.2f", $HR_three_count_Tpc); while(strlen($HR_three_count_totS)>7) {$HR_three_count_totS = substr("$HR_three_count_totS", 0, -1);} - $HR_threeT_count_totS = sprintf("%6.2f", $HR_threeT_count_Tpc); while(strlen($HR_threeT_count_totS)>7) {$HR_threeT_count_totS = substr("$HR_threeT_count_totS", 0, -1);} + $HR_four_count_totS = sprintf("%6.2f", $HR_four_count_Tpc); while(strlen($HR_four_count_totS)>7) {$HR_four_count_totS = substr("$HR_four_count_totS", 0, -1);} + $HR_five_count_totS = sprintf("%6.2f", $HR_five_count_Tpc); while(strlen($HR_five_count_totS)>7) {$HR_five_count_totS = substr("$HR_five_count_totS", 0, -1);} $SR_count_Tpc=0; $SR_one_count_Tpc=0; $SR_two_count_Tpc=0; $SR_three_count_Tpc=0; - $SR_threeT_count_Tpc=0; + $SR_four_count_Tpc=0; + $SR_five_count_Tpc=0; if ( ($SR_count_tot > 0) and ($TOTALleads > 0) ) {$SR_count_Tpc = (($SR_count_tot / $TOTALleads) * 100);} if ( ($SR_one_count_tot > 0) and ($TOTALleads > 0) ) {$SR_one_count_Tpc = (($SR_one_count_tot / $TOTALleads) * 100);} if ( ($SR_two_count_tot > 0) and ($TOTALleads > 0) ) {$SR_two_count_Tpc = (($SR_two_count_tot / $TOTALleads) * 100);} if ( ($SR_three_count_tot > 0) and ($TOTALleads > 0) ) {$SR_three_count_Tpc = (($SR_three_count_tot / $TOTALleads) * 100);} - if ( ($SR_threeT_count_tot > 0) and ($TOTALleads > 0) ) {$SR_threeT_count_Tpc = (($SR_threeT_count_tot / $TOTALleads) * 100);} + if ( ($SR_four_count_tot > 0) and ($TOTALleads > 0) ) {$SR_four_count_Tpc = (($SR_four_count_tot / $TOTALleads) * 100);} + if ( ($SR_five_count_tot > 0) and ($TOTALleads > 0) ) {$SR_five_count_Tpc = (($SR_five_count_tot / $TOTALleads) * 100);} $SR_count_totS = sprintf("%6.2f", $SR_count_Tpc); while(strlen($SR_count_totS)>7) {$SR_count_totS = substr("$SR_count_totS", 0, -1);} $SR_one_count_totS = sprintf("%6.2f", $SR_one_count_Tpc); while(strlen($SR_one_count_totS)>7) {$SR_one_count_totS = substr("$SR_one_count_totS", 0, -1);} $SR_two_count_totS = sprintf("%6.2f", $SR_two_count_Tpc); while(strlen($SR_two_count_totS)>7) {$SR_two_count_totS = substr("$SR_two_count_totS", 0, -1);} $SR_three_count_totS = sprintf("%6.2f", $SR_three_count_Tpc); while(strlen($SR_three_count_totS)>7) {$SR_three_count_totS = substr("$SR_three_count_totS", 0, -1);} - $SR_threeT_count_totS = sprintf("%6.2f", $SR_threeT_count_Tpc); while(strlen($SR_threeT_count_totS)>7) {$SR_threeT_count_totS = substr("$SR_threeT_count_totS", 0, -1);} + $SR_four_count_totS = sprintf("%6.2f", $SR_four_count_Tpc); while(strlen($SR_four_count_totS)>7) {$SR_four_count_totS = substr("$SR_four_count_totS", 0, -1);} + $SR_five_count_totS = sprintf("%6.2f", $SR_five_count_Tpc); while(strlen($SR_five_count_totS)>7) {$SR_five_count_totS = substr("$SR_five_count_totS", 0, -1);} $DR_count_Tpc=0; $DR_one_count_Tpc=0; $DR_two_count_Tpc=0; $DR_three_count_Tpc=0; - $DR_threeT_count_Tpc=0; + $DR_four_count_Tpc=0; + $DR_five_count_Tpc=0; if ( ($DR_count_tot > 0) and ($TOTALleads > 0) ) {$DR_count_Tpc = (($DR_count_tot / $TOTALleads) * 100);} if ( ($DR_one_count_tot > 0) and ($TOTALleads > 0) ) {$DR_one_count_Tpc = (($DR_one_count_tot / $TOTALleads) * 100);} if ( ($DR_two_count_tot > 0) and ($TOTALleads > 0) ) {$DR_two_count_Tpc = (($DR_two_count_tot / $TOTALleads) * 100);} if ( ($DR_three_count_tot > 0) and ($TOTALleads > 0) ) {$DR_three_count_Tpc = (($DR_three_count_tot / $TOTALleads) * 100);} - if ( ($DR_threeT_count_tot > 0) and ($TOTALleads > 0) ) {$DR_threeT_count_Tpc = (($DR_threeT_count_tot / $TOTALleads) * 100);} + if ( ($DR_four_count_tot > 0) and ($TOTALleads > 0) ) {$DR_four_count_Tpc = (($DR_four_count_tot / $TOTALleads) * 100);} + if ( ($DR_five_count_tot > 0) and ($TOTALleads > 0) ) {$DR_five_count_Tpc = (($DR_five_count_tot / $TOTALleads) * 100);} $DR_count_totS = sprintf("%6.2f", $DR_count_Tpc); while(strlen($DR_count_totS)>7) {$DR_count_totS = substr("$DR_count_totS", 0, -1);} $DR_one_count_totS = sprintf("%6.2f", $DR_one_count_Tpc); while(strlen($DR_one_count_totS)>7) {$DR_one_count_totS = substr("$DR_one_count_totS", 0, -1);} $DR_two_count_totS = sprintf("%6.2f", $DR_two_count_Tpc); while(strlen($DR_two_count_totS)>7) {$DR_two_count_totS = substr("$DR_two_count_totS", 0, -1);} $DR_three_count_totS = sprintf("%6.2f", $DR_three_count_Tpc); while(strlen($DR_three_count_totS)>7) {$DR_three_count_totS = substr("$DR_three_count_totS", 0, -1);} - $DR_threeT_count_totS = sprintf("%6.2f", $DR_threeT_count_Tpc); while(strlen($DR_threeT_count_totS)>7) {$DR_threeT_count_totS = substr("$DR_threeT_count_totS", 0, -1);} + $DR_four_count_totS = sprintf("%6.2f", $DR_four_count_Tpc); while(strlen($DR_four_count_totS)>7) {$DR_four_count_totS = substr("$DR_four_count_totS", 0, -1);} + $DR_five_count_totS = sprintf("%6.2f", $DR_five_count_Tpc); while(strlen($DR_five_count_totS)>7) {$DR_five_count_totS = substr("$DR_five_count_totS", 0, -1);} $CR_count_Tpc=0; $CR_one_count_Tpc=0; $CR_two_count_Tpc=0; $CR_three_count_Tpc=0; - $CR_threeT_count_Tpc=0; + $CR_four_count_Tpc=0; + $CR_five_count_Tpc=0; if ( ($CR_count_tot > 0) and ($TOTALleads > 0) ) {$CR_count_Tpc = (($CR_count_tot / $TOTALleads) * 100);} if ( ($CR_one_count_tot > 0) and ($TOTALleads > 0) ) {$CR_one_count_Tpc = (($CR_one_count_tot / $TOTALleads) * 100);} if ( ($CR_two_count_tot > 0) and ($TOTALleads > 0) ) {$CR_two_count_Tpc = (($CR_two_count_tot / $TOTALleads) * 100);} if ( ($CR_three_count_tot > 0) and ($TOTALleads > 0) ) {$CR_three_count_Tpc = (($CR_three_count_tot / $TOTALleads) * 100);} - if ( ($CR_threeT_count_tot > 0) and ($TOTALleads > 0) ) {$CR_threeT_count_Tpc = (($CR_threeT_count_tot / $TOTALleads) * 100);} + if ( ($CR_four_count_tot > 0) and ($TOTALleads > 0) ) {$CR_four_count_Tpc = (($CR_four_count_tot / $TOTALleads) * 100);} + if ( ($CR_five_count_tot > 0) and ($TOTALleads > 0) ) {$CR_five_count_Tpc = (($CR_five_count_tot / $TOTALleads) * 100);} $CR_count_totS = sprintf("%6.2f", $CR_count_Tpc); while(strlen($CR_count_totS)>7) {$CR_count_totS = substr("$CR_count_totS", 0, -1);} $CR_one_count_totS = sprintf("%6.2f", $CR_one_count_Tpc); while(strlen($CR_one_count_totS)>7) {$CR_one_count_totS = substr("$CR_one_count_totS", 0, -1);} $CR_two_count_totS = sprintf("%6.2f", $CR_two_count_Tpc); while(strlen($CR_two_count_totS)>7) {$CR_two_count_totS = substr("$CR_two_count_totS", 0, -1);} $CR_three_count_totS = sprintf("%6.2f", $CR_three_count_Tpc); while(strlen($CR_three_count_totS)>7) {$CR_three_count_totS = substr("$CR_three_count_totS", 0, -1);} - $CR_threeT_count_totS = sprintf("%6.2f", $CR_threeT_count_Tpc); while(strlen($CR_threeT_count_totS)>7) {$CR_threeT_count_totS = substr("$CR_threeT_count_totS", 0, -1);} + $CR_four_count_totS = sprintf("%6.2f", $CR_four_count_Tpc); while(strlen($CR_four_count_totS)>7) {$CR_four_count_totS = substr("$CR_four_count_totS", 0, -1);} + $CR_five_count_totS = sprintf("%6.2f", $CR_five_count_Tpc); while(strlen($CR_five_count_totS)>7) {$CR_five_count_totS = substr("$CR_five_count_totS", 0, -1);} $UR_count_Tpc=0; $UR_one_count_Tpc=0; $UR_two_count_Tpc=0; $UR_three_count_Tpc=0; - $UR_threeT_count_Tpc=0; + $UR_four_count_Tpc=0; + $UR_five_count_Tpc=0; if ( ($UR_count_tot > 0) and ($TOTALleads > 0) ) {$UR_count_Tpc = (($UR_count_tot / $TOTALleads) * 100);} if ( ($UR_one_count_tot > 0) and ($TOTALleads > 0) ) {$UR_one_count_Tpc = (($UR_one_count_tot / $TOTALleads) * 100);} if ( ($UR_two_count_tot > 0) and ($TOTALleads > 0) ) {$UR_two_count_Tpc = (($UR_two_count_tot / $TOTALleads) * 100);} if ( ($UR_three_count_tot > 0) and ($TOTALleads > 0) ) {$UR_three_count_Tpc = (($UR_three_count_tot / $TOTALleads) * 100);} - if ( ($UR_threeT_count_tot > 0) and ($TOTALleads > 0) ) {$UR_threeT_count_Tpc = (($UR_threeT_count_tot / $TOTALleads) * 100);} + if ( ($UR_four_count_tot > 0) and ($TOTALleads > 0) ) {$UR_four_count_Tpc = (($UR_four_count_tot / $TOTALleads) * 100);} + if ( ($UR_five_count_tot > 0) and ($TOTALleads > 0) ) {$UR_five_count_Tpc = (($UR_five_count_tot / $TOTALleads) * 100);} $UR_count_totS = sprintf("%6.2f", $UR_count_Tpc); while(strlen($UR_count_totS)>7) {$UR_count_totS = substr("$UR_count_totS", 0, -1);} $UR_one_count_totS = sprintf("%6.2f", $UR_one_count_Tpc); while(strlen($UR_one_count_totS)>7) {$UR_one_count_totS = substr("$UR_one_count_totS", 0, -1);} $UR_two_count_totS = sprintf("%6.2f", $UR_two_count_Tpc); while(strlen($UR_two_count_totS)>7) {$UR_two_count_totS = substr("$UR_two_count_totS", 0, -1);} $UR_three_count_totS = sprintf("%6.2f", $UR_three_count_Tpc); while(strlen($UR_three_count_totS)>7) {$UR_three_count_totS = substr("$UR_three_count_totS", 0, -1);} - $UR_threeT_count_totS = sprintf("%6.2f", $UR_threeT_count_Tpc); while(strlen($UR_threeT_count_totS)>7) {$UR_threeT_count_totS = substr("$UR_threeT_count_totS", 0, -1);} + $UR_four_count_totS = sprintf("%6.2f", $UR_four_count_Tpc); while(strlen($UR_four_count_totS)>7) {$UR_four_count_totS = substr("$UR_four_count_totS", 0, -1);} + $UR_five_count_totS = sprintf("%6.2f", $UR_five_count_Tpc); while(strlen($UR_five_count_totS)>7) {$UR_five_count_totS = substr("$UR_five_count_totS", 0, -1);} $BR_count_Tpc=0; $BR_one_count_Tpc=0; $BR_two_count_Tpc=0; $BR_three_count_Tpc=0; - $BR_threeT_count_Tpc=0; + $BR_four_count_Tpc=0; + $BR_five_count_Tpc=0; if ( ($BR_count_tot > 0) and ($TOTALleads > 0) ) {$BR_count_Tpc = (($BR_count_tot / $TOTALleads) * 100);} if ( ($BR_one_count_tot > 0) and ($TOTALleads > 0) ) {$BR_one_count_Tpc = (($BR_one_count_tot / $TOTALleads) * 100);} if ( ($BR_two_count_tot > 0) and ($TOTALleads > 0) ) {$BR_two_count_Tpc = (($BR_two_count_tot / $TOTALleads) * 100);} if ( ($BR_three_count_tot > 0) and ($TOTALleads > 0) ) {$BR_three_count_Tpc = (($BR_three_count_tot / $TOTALleads) * 100);} - if ( ($BR_threeT_count_tot > 0) and ($TOTALleads > 0) ) {$BR_threeT_count_Tpc = (($BR_threeT_count_tot / $TOTALleads) * 100);} + if ( ($BR_four_count_tot > 0) and ($TOTALleads > 0) ) {$BR_four_count_Tpc = (($BR_four_count_tot / $TOTALleads) * 100);} + if ( ($BR_five_count_tot > 0) and ($TOTALleads > 0) ) {$BR_five_count_Tpc = (($BR_five_count_tot / $TOTALleads) * 100);} $BR_count_totS = sprintf("%6.2f", $BR_count_Tpc); while(strlen($BR_count_totS)>7) {$BR_count_totS = substr("$BR_count_totS", 0, -1);} $BR_one_count_totS = sprintf("%6.2f", $BR_one_count_Tpc); while(strlen($BR_one_count_totS)>7) {$BR_one_count_totS = substr("$BR_one_count_totS", 0, -1);} $BR_two_count_totS = sprintf("%6.2f", $BR_two_count_Tpc); while(strlen($BR_two_count_totS)>7) {$BR_two_count_totS = substr("$BR_two_count_totS", 0, -1);} $BR_three_count_totS = sprintf("%6.2f", $BR_three_count_Tpc); while(strlen($BR_three_count_totS)>7) {$BR_three_count_totS = substr("$BR_three_count_totS", 0, -1);} - $BR_threeT_count_totS = sprintf("%6.2f", $BR_threeT_count_Tpc); while(strlen($BR_threeT_count_totS)>7) {$BR_threeT_count_totS = substr("$BR_threeT_count_totS", 0, -1);} + $BR_four_count_totS = sprintf("%6.2f", $BR_four_count_Tpc); while(strlen($BR_four_count_totS)>7) {$BR_four_count_totS = substr("$BR_four_count_totS", 0, -1);} + $BR_five_count_totS = sprintf("%6.2f", $BR_five_count_Tpc); while(strlen($BR_five_count_totS)>7) {$BR_five_count_totS = substr("$BR_five_count_totS", 0, -1);} $MR_count_Tpc=0; $MR_one_count_Tpc=0; $MR_two_count_Tpc=0; $MR_three_count_Tpc=0; - $MR_threeT_count_Tpc=0; + $MR_four_count_Tpc=0; + $MR_five_count_Tpc=0; if ( ($MR_count_tot > 0) and ($TOTALleads > 0) ) {$MR_count_Tpc = (($MR_count_tot / $TOTALleads) * 100);} if ( ($MR_one_count_tot > 0) and ($TOTALleads > 0) ) {$MR_one_count_Tpc = (($MR_one_count_tot / $TOTALleads) * 100);} if ( ($MR_two_count_tot > 0) and ($TOTALleads > 0) ) {$MR_two_count_Tpc = (($MR_two_count_tot / $TOTALleads) * 100);} if ( ($MR_three_count_tot > 0) and ($TOTALleads > 0) ) {$MR_three_count_Tpc = (($MR_three_count_tot / $TOTALleads) * 100);} - if ( ($MR_threeT_count_tot > 0) and ($TOTALleads > 0) ) {$MR_threeT_count_Tpc = (($MR_threeT_count_tot / $TOTALleads) * 100);} + if ( ($MR_four_count_tot > 0) and ($TOTALleads > 0) ) {$MR_four_count_Tpc = (($MR_four_count_tot / $TOTALleads) * 100);} + if ( ($MR_five_count_tot > 0) and ($TOTALleads > 0) ) {$MR_five_count_Tpc = (($MR_five_count_tot / $TOTALleads) * 100);} $MR_count_totS = sprintf("%6.2f", $MR_count_Tpc); while(strlen($MR_count_totS)>7) {$MR_count_totS = substr("$MR_count_totS", 0, -1);} $MR_one_count_totS = sprintf("%6.2f", $MR_one_count_Tpc); while(strlen($MR_one_count_totS)>7) {$MR_one_count_totS = substr("$MR_one_count_totS", 0, -1);} $MR_two_count_totS = sprintf("%6.2f", $MR_two_count_Tpc); while(strlen($MR_two_count_totS)>7) {$MR_two_count_totS = substr("$MR_two_count_totS", 0, -1);} $MR_three_count_totS = sprintf("%6.2f", $MR_three_count_Tpc); while(strlen($MR_three_count_totS)>7) {$MR_three_count_totS = substr("$MR_three_count_totS", 0, -1);} - $MR_threeT_count_totS = sprintf("%6.2f", $MR_threeT_count_Tpc); while(strlen($MR_threeT_count_totS)>7) {$MR_threeT_count_totS = substr("$MR_threeT_count_totS", 0, -1);} + $MR_four_count_totS = sprintf("%6.2f", $MR_four_count_Tpc); while(strlen($MR_four_count_totS)>7) {$MR_four_count_totS = substr("$MR_four_count_totS", 0, -1);} + $MR_five_count_totS = sprintf("%6.2f", $MR_five_count_Tpc); while(strlen($MR_five_count_totS)>7) {$MR_five_count_totS = substr("$MR_five_count_totS", 0, -1);} $TOTALleads = sprintf("%10s", $TOTALleads); $OUToutput .= "+------------+------------------------------------------+----------+------------+----------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; $OUToutput .= "\n"; $OUToutput .= " | TOTALS: | $TOTALleads | |"; - $OUToutput .= " $HA_one_count_totS | $HA_two_count_totS | $HA_three_count_totS | $HA_threeT_count_totS | $HA_count_totS |"; - $OUToutput .= " $HR_one_count_totS% | $HR_two_count_totS% | $HR_three_count_totS% | $HR_threeT_count_totS% | $HR_count_totS% |"; - $OUToutput .= " $SA_one_count_totS | $SA_two_count_totS | $SA_three_count_totS | $SA_threeT_count_totS | $SA_count_totS |"; - $OUToutput .= " $SR_one_count_totS% | $SR_two_count_totS% | $SR_three_count_totS% | $SR_threeT_count_totS% | $SR_count_totS% |"; - $OUToutput .= " $DN_one_count_totS | $DN_two_count_totS | $DN_three_count_totS | $DN_threeT_count_totS | $DN_count_totS |"; - $OUToutput .= " $DR_one_count_totS% | $DR_two_count_totS% | $DR_three_count_totS% | $DR_threeT_count_totS% | $DR_count_totS% |"; - $OUToutput .= " $CC_one_count_totS | $CC_two_count_totS | $CC_three_count_totS | $CC_threeT_count_totS | $CC_count_totS |"; - $OUToutput .= " $CR_one_count_totS% | $CR_two_count_totS% | $CR_three_count_totS% | $CR_threeT_count_totS% | $CR_count_totS% |"; - $OUToutput .= " $UW_one_count_totS | $UW_two_count_totS | $UW_three_count_totS | $UW_threeT_count_totS | $UW_count_totS |"; - $OUToutput .= " $UR_one_count_totS% | $UR_two_count_totS% | $UR_three_count_totS% | $UR_threeT_count_totS% | $UR_count_totS% |"; - $OUToutput .= " $BA_one_count_totS | $BA_two_count_totS | $BA_three_count_totS | $BA_threeT_count_totS | $BA_count_totS |"; - $OUToutput .= " $BR_one_count_totS% | $BR_two_count_totS% | $BR_three_count_totS% | $BR_threeT_count_totS% | $BR_count_totS% |"; - $OUToutput .= " $MP_one_count_totS | $MP_two_count_totS | $MP_three_count_totS | $MP_threeT_count_totS | $MP_count_totS |"; - $OUToutput .= " $MR_one_count_totS% | $MR_two_count_totS% | $MR_three_count_totS% | $MR_threeT_count_totS% | $MR_count_totS% |"; + $OUToutput .= " $HA_one_count_totS | $HA_two_count_totS | $HA_three_count_totS | $HA_four_count_totS | $HA_five_count_totS | $HA_count_totS |"; + $OUToutput .= " $HR_one_count_totS% | $HR_two_count_totS% | $HR_three_count_totS% | $HR_four_count_totS% | $HR_five_count_totS% | $HR_count_totS% |"; + $OUToutput .= " $SA_one_count_totS | $SA_two_count_totS | $SA_three_count_totS | $SA_four_count_totS | $SA_five_count_totS | $SA_count_totS |"; + $OUToutput .= " $SR_one_count_totS% | $SR_two_count_totS% | $SR_three_count_totS% | $SR_four_count_totS% | $SR_five_count_totS% | $SR_count_totS% |"; + $OUToutput .= " $DN_one_count_totS | $DN_two_count_totS | $DN_three_count_totS | $DN_four_count_totS | $DN_five_count_totS | $DN_count_totS |"; + $OUToutput .= " $DR_one_count_totS% | $DR_two_count_totS% | $DR_three_count_totS% | $DR_four_count_totS% | $DR_five_count_totS% | $DR_count_totS% |"; + $OUToutput .= " $CC_one_count_totS | $CC_two_count_totS | $CC_three_count_totS | $CC_four_count_totS | $CC_five_count_totS | $CC_count_totS |"; + $OUToutput .= " $CR_one_count_totS% | $CR_two_count_totS% | $CR_three_count_totS% | $CR_four_count_totS% | $CR_five_count_totS% | $CR_count_totS% |"; + $OUToutput .= " $UW_one_count_totS | $UW_two_count_totS | $UW_three_count_totS | $UW_four_count_totS | $UW_five_count_totS | $UW_count_totS |"; + $OUToutput .= " $UR_one_count_totS% | $UR_two_count_totS% | $UR_three_count_totS% | $UR_four_count_totS% | $UR_five_count_totS% | $UR_count_totS% |"; + $OUToutput .= " $BA_one_count_totS | $BA_two_count_totS | $BA_three_count_totS | $BA_four_count_totS | $BA_five_count_totS | $BA_count_totS |"; + $OUToutput .= " $BR_one_count_totS% | $BR_two_count_totS% | $BR_three_count_totS% | $BR_four_count_totS% | $BR_five_count_totS% | $BR_count_totS% |"; + $OUToutput .= " $MP_one_count_totS | $MP_two_count_totS | $MP_three_count_totS | $MP_four_count_totS | $MP_five_count_totS | $MP_count_totS |"; + $OUToutput .= " $MR_one_count_totS% | $MR_two_count_totS% | $MR_three_count_totS% | $MR_four_count_totS% | $MR_five_count_totS% | $MR_count_totS% |"; $OUToutput .= "\n"; $OUToutput .= " +------------------------------------------+----------+------------+ +"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; - $OUToutput .= "---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; + $OUToutput .= "---------+---------+---------+---------+---------+---------+"; $OUToutput .= "\n"; $CSV_text1.="\"\",\"\",\"TOTAL\",\"$TOTALleads\",\"\""; - $CSV_text1.=",\"$HA_one_count_totS\",\"$HA_two_count_totS\",\"$HA_three_count_totS\",\"$HA_threeT_count_totS\",\"$HA_count_totS\""; - $CSV_text1.=",\"$HR_one_count_totS%\",\"$HR_two_count_totS%\",\"$HR_three_count_totS%\",\"$HR_threeT_count_totS%\",\"$HR_count_totS%\""; - $CSV_text1.=",\"$SA_one_count_totS\",\"$SA_two_count_totS\",\"$SA_three_count_totS\",\"$SA_threeT_count_totS\",\"$SA_count_totS\""; - $CSV_text1.=",\"$SR_one_count_totS%\",\"$SR_two_count_totS%\",\"$SR_three_count_totS%\",\"$SR_threeT_count_totS%\",\"$SR_count_totS%\""; - $CSV_text1.=",\"$DN_one_count_totS\",\"$DN_two_count_totS\",\"$DN_three_count_totS\",\"$DN_threeT_count_totS\",\"$DN_count_totS\""; - $CSV_text1.=",\"$DR_one_count_totS%\",\"$DR_two_count_totS%\",\"$DR_three_count_totS%\",\"$DR_threeT_count_totS%\",\"$DR_count_totS%\""; - $CSV_text1.=",\"$CC_one_count_totS\",\"$CC_two_count_totS\",\"$CC_three_count_totS\",\"$CC_threeT_count_totS\",\"$CC_count_totS\""; - $CSV_text1.=",\"$CR_one_count_totS%\",\"$CR_two_count_totS%\",\"$CR_three_count_totS%\",\"$CR_threeT_count_totS%\",\"$CR_count_totS%\""; - $CSV_text1.=",\"$UW_one_count_totS\",\"$UW_two_count_totS\",\"$UW_three_count_totS\",\"$UW_threeT_count_totS\",\"$UW_count_totS\""; - $CSV_text1.=",\"$UR_one_count_totS%\",\"$UR_two_count_totS%\",\"$UR_three_count_totS%\",\"$UR_threeT_count_totS%\",\"$UR_count_totS%\""; - $CSV_text1.=",\"$BA_one_count_totS\",\"$BA_two_count_totS\",\"$BA_three_count_totS\",\"$BA_threeT_count_totS\",\"$BA_count_totS\""; - $CSV_text1.=",\"$BR_one_count_totS%\",\"$BR_two_count_totS%\",\"$BR_three_count_totS%\",\"$BR_threeT_count_totS%\",\"$BR_count_totS%\""; - $CSV_text1.=",\"$MP_one_count_totS\",\"$MP_two_count_totS\",\"$MP_three_count_totS\",\"$MP_threeT_count_totS\",\"$MP_count_totS\""; - $CSV_text1.=",\"$MR_one_count_totS%\",\"$MR_two_count_totS%\",\"$MR_three_count_totS%\",\"$MR_threeT_count_totS%\",\"$MR_count_totS%\""; + $CSV_text1.=",\"$HA_one_count_totS\",\"$HA_two_count_totS\",\"$HA_three_count_totS\",\"$HA_four_count_totS\",\"$HA_five_count_totS\",\"$HA_count_totS\""; + $CSV_text1.=",\"$HR_one_count_totS%\",\"$HR_two_count_totS%\",\"$HR_three_count_totS%\",\"$HR_four_count_totS%\",\"$HR_five_count_totS%\",\"$HR_count_totS%\""; + $CSV_text1.=",\"$SA_one_count_totS\",\"$SA_two_count_totS\",\"$SA_three_count_totS\",\"$SA_four_count_totS\",\"$SA_five_count_totS\",\"$SA_count_totS\""; + $CSV_text1.=",\"$SR_one_count_totS%\",\"$SR_two_count_totS%\",\"$SR_three_count_totS%\",\"$SR_four_count_totS%\",\"$SR_five_count_totS%\",\"$SR_count_totS%\""; + $CSV_text1.=",\"$DN_one_count_totS\",\"$DN_two_count_totS\",\"$DN_three_count_totS\",\"$DN_four_count_totS\",\"$DN_five_count_totS\",\"$DN_count_totS\""; + $CSV_text1.=",\"$DR_one_count_totS%\",\"$DR_two_count_totS%\",\"$DR_three_count_totS%\",\"$DR_four_count_totS%\",\"$DR_five_count_totS%\",\"$DR_count_totS%\""; + $CSV_text1.=",\"$CC_one_count_totS\",\"$CC_two_count_totS\",\"$CC_three_count_totS\",\"$CC_four_count_totS\",\"$CC_five_count_totS\",\"$CC_count_totS\""; + $CSV_text1.=",\"$CR_one_count_totS%\",\"$CR_two_count_totS%\",\"$CR_three_count_totS%\",\"$CR_four_count_totS%\",\"$CR_five_count_totS%\",\"$CR_count_totS%\""; + $CSV_text1.=",\"$UW_one_count_totS\",\"$UW_two_count_totS\",\"$UW_three_count_totS\",\"$UW_four_count_totS\",\"$UW_five_count_totS\",\"$UW_count_totS\""; + $CSV_text1.=",\"$UR_one_count_totS%\",\"$UR_two_count_totS%\",\"$UR_three_count_totS%\",\"$UR_four_count_totS%\",\"$UR_five_count_totS%\",\"$UR_count_totS%\""; + $CSV_text1.=",\"$BA_one_count_totS\",\"$BA_two_count_totS\",\"$BA_three_count_totS\",\"$BA_four_count_totS\",\"$BA_five_count_totS\",\"$BA_count_totS\""; + $CSV_text1.=",\"$BR_one_count_totS%\",\"$BR_two_count_totS%\",\"$BR_three_count_totS%\",\"$BR_four_count_totS%\",\"$BR_five_count_totS%\",\"$BR_count_totS%\""; + $CSV_text1.=",\"$MP_one_count_totS\",\"$MP_two_count_totS\",\"$MP_three_count_totS\",\"$MP_four_count_totS\",\"$MP_five_count_totS\",\"$MP_count_totS\""; + $CSV_text1.=",\"$MR_one_count_totS%\",\"$MR_two_count_totS%\",\"$MR_three_count_totS%\",\"$MR_four_count_totS%\",\"$MR_five_count_totS%\",\"$MR_count_totS%\""; $CSV_text1.="\n"; @@ -1696,8 +1725,8 @@ else if ($file_download>0) { $FILE_TIME = date("Ymd-His"); - $CSVfilename = "AST_LISTS_campaign_stats_$US$FILE_TIME.csv"; - $CSV_var="CSV_text".$file_download; + $CSVfilename = "AST_LISTS_pass_report_$US$FILE_TIME.csv"; + $CSV_var="CSV_text1"; $CSV_text=preg_replace('/^ +/', '', $$CSV_var); $CSV_text=preg_replace('/\n +,/', ',', $CSV_text); $CSV_text=preg_replace('/ +\"/', '"', $CSV_text);