function run_html_report() { $parameters = $_GET['ses']; $form_ses = $_GET['form_ses']; $report = $_GET['r']; $dir = $_GET['dir']; $emailer = $_GET['emailer']; include_once "../{$dir}/database.php"; include_once 'common.php'; if ($emailer != '1') { if (activityPasswordNeeded($report)) { $session = nuSession($parameters, false); if ($session->foundOK == '') { print 'you have been logged out..'; return; } } } $setup = nuSetup(); $T = nuRunQuery("SELECT * FROM zzsys_activity WHERE sat_all_code = '{$report}'"); $A = db_fetch_object($T); //----------allow for custom code---------------------------------------------- //--already done now.. eval($A->sat_report_display_code); $id = uniqid('1'); $thedate = date('Y-m-d H:i:s'); $dq = '"'; if ($A->zzsys_activity_id != '') { //$viewer = $_SESSION['zzsys_user_id']; $viewer = $session->sss_zzsys_user_id; $s = "INSERT INTO zzsys_report_log (zzsys_report_log_id, "; $s = $s . "srl_zzsys_activity_id, srl_date ,srl_viewer) "; $s = $s . "VALUES ('{$id}', '{$report}', '{$thedate}', '{$viewer}')"; nuRunQuery($s); } else { print 'No Such Report...'; return; } $s = "SELECT count(*), MAX(sva_expiry_date) FROM zzsys_variable "; $s = $s . "WHERE sva_id = '{$form_ses}' "; $s = $s . "GROUP BY sva_expiry_date"; $t1 = nuRunQuery($s); $r1 = db_fetch_row($t1); $numberOfVariables = $r1[0]; $expiryDate = $r1[1]; //---must have at least 1 variable if ($numberOfVariables > 0) { $s = "DELETE FROM zzsys_variable "; $s = $s . "WHERE sva_id = '{$form_ses}' "; $s = $s . "AND sva_name = 'ReportTitle'"; nuRunQuery($s); setnuVariable($form_ses, $expiryDate, 'ReportTitle', $A->sat_all_description); MakeReport($form_ses, $A); } else { print 'Report has Expired...'; } }
} $s = "SELECT count(*), MAX(sva_expiry_date) FROM zzsys_variable "; $s = $s . "WHERE sva_id = '{$form_ses}' "; $s = $s . "GROUP BY sva_expiry_date"; $t1 = nuRunQuery($s); $r1 = db_fetch_row($t1); $numberOfVariables = $r1[0]; $expiryDate = $r1[1]; //---must have at least 1 variable if ($numberOfVariables > 0) { $s = "DELETE FROM zzsys_variable "; $s = $s . "WHERE sva_id = '{$form_ses}' "; $s = $s . "AND sva_name = 'ReportTitle'"; nuRunQuery($s); setnuVariable($form_ses, $expiryDate, 'ReportTitle', $A->sat_all_description); MakeReport($form_ses, $A); } else { print 'Report has Expired...'; } function MakeReport($parameters, $ACTIVITY) { $theReport = new reportDisplay($parameters, $ACTIVITY); $theReport->pageLength = $ACTIVITY->sat_report_page_length; $theReport->setPageLength($ACTIVITY->sat_report_page_length); $theReport->buildReport(); print $theReport->styleSheet; $pageNo = 1; //-first page start div $theReport->section[0]->html = "\n<!-- start of page -->\n<div style='height:{$theReport->pageLength}'>\n" . $theReport->section[0]->html; //-last page end div $theReport->section[count($theReport->section) - 1]->html = $theReport->section[count($theReport->section) - 1]->html . "</div>\n<!-- end of page -->\n\n";