if ($_POST['FilterForm']) { // return to the filter form $Title = RPT_CRITERIA; $IncludePage = 'forms/ReportsFilter.html'; } else { // return to the page setup form $Title = RPT_PAGESETUP; $IncludePage = 'forms/ReportsPageUpdate.html'; } } else { // send the report (Both of these function exit the script (the point of no return) if ($_POST['todo'] == RPT_BTN_EXPCSV) { GenerateCSVFile($ReportData, $Prefs); } if ($_POST['todo'] == RPT_BTN_EXPPDF) { GeneratePDFFile($ReportData, $Prefs); } } break; case RPT_BTN_CONT: default: $Title = RPT_CRITERIA; $IncludePage = 'forms/ReportsFilter.html'; } // end switch 'todo' } // end if (!isset($_POST['todo'])) include $PathPrefix . 'includes/header.inc'; if ($usrMsg) { foreach ($usrMsg as $temp) { prnmsg($temp['message'], $temp['level']);
// Houston, we have a problem, sql build failed $messageStack->add($success['message'], $success['level']); $failed = true; } if (!$failed) { // send the report if ($todo == 'exp_csv') { GenerateCSVFile($ReportData, $Prefs); } // No return from this function if ($todo == 'exp_html') { GenerateHTMLFile($ReportData, $Prefs); } // No return from this function if ($todo == 'exp_pdf') { $output = GeneratePDFFile($ReportData, $Prefs, $delivery_method); } // if we are here, delivery method was email if ($output) { // open a temp file $temp_file = DIR_FS_MY_FILES . $_SESSION['company'] . '/temp/' . microtime() . '.pdf'; $handle = fopen($temp_file, 'w'); // put the string into the file fwrite($handle, $output); fclose($handle); // generate the email $block = array(); if ($cc_address) { $block['EMAIL_CC_NAME'] = $cc_name; $block['EMAIL_CC_ADDRESS'] = $cc_address; }