$rp_period = $rp_info['rp_period'];
    if ($_POST['rp_period']) {
        $rp_period = $_POST['rp_period'];
    }
    // Overall Report
    $report = genReport($rp_source_query . $bank_sql_t, $rp_destination_query, $rp_period);
    $report['title'] = "General Report - All companys";
    $report['header'] = "Overall Report";
    $report['priority'] = 99999;
    $report_list['z'] = $report;
    $company_list_sql = "Select userId, companyname from `cs_companydetails` as cd WHERE cd.activeuser=1 {$bank_sql_cd}";
    $result = mysql_query($company_list_sql) or dieLog(mysql_error() . " ~ {$company_list_sql}");
    while ($companyId = mysql_fetch_assoc($result)) {
        $s_sql = $rp_source_query . $bank_sql_t . " AND t.userId = '" . $companyId['userId'] . "'";
        $d_sql = $rp_destination_query . $bank_sql_cd . " AND cd.userId = '" . $companyId['userId'] . "'";
        $report = genReport($s_sql, $d_sql, $rp_period);
        if ($report['priority'] == 0) {
            $report['header'] = "Company Reports (No Alerts)";
        } else {
            $report['header'] = "Company Reports (Contain Alerts)";
        }
        $report['title'] = ucfirst($rp_type) . " Report - " . $companyId['companyname'];
        $report_list[$report['priority'] . "_" . $companyId['companyname']] = $report;
    }
    // Sorting List
    krsort($report_list);
}
// End Generate Report
ob_start();
?>
<script language="javascript">
Example #2
0
 $report['priority'] = 99999;
 $report['period'] = $report_periods[round($rp_period)];
 if (!$report['period']) {
     $report['period'] = round($rp_period) . " Day";
 }
 $report_list['z'] = $report;
 if (!$_POST['rp_inactive']) {
     $company_sql = " AND cd.activeuser=1";
 }
 $company_list_sql = "Select cd.userId, companyname from `cs_companydetails` as cd left join `cs_transactiondetails` as t on t.userId = cd.userId WHERE 1 {$company_sql} {$bank_sql_t} group by companyname ";
 $result = mysql_query($company_list_sql) or dieLog(mysql_error() . " ~ {$company_list_sql}");
 while ($companyId = mysql_fetch_assoc($result)) {
     $s_sql = $rp_source_query . $bank_sql_t . " AND cd.userId = '" . $companyId['userId'] . "'";
     $d_sql = $rp_destination_query . $bank_sql_cd . " AND cd.userId = '" . $companyId['userId'] . "'";
     $rp_cmp_period = getHalfProcessingTime($companyId['userId'], $rp_period);
     $report = genReport($s_sql, $d_sql, $rp_cmp_period, false, $companyId['userId']);
     if ($report != -1) {
         $duration = "";
         if ($rp_cmp_period >= 1) {
             $duration = " (" . round($rp_cmp_period * 2) . " Day Duration)";
         }
         if ($rp_cmp_period < 1) {
             $duration = " (Less Than One Day)";
         }
         if (intval($report['priority']) == 0) {
             $report['header'] = "Company Reports (No Alerts)";
         } else {
             $report['header'] = "Company Reports (Contain Alerts)";
         }
         $report['period'] = $report_periods[round($rp_cmp_period)];
         if (!$report['period']) {