#Add this to get variables /*This will be passed in the url for an entire annual report */ $grpBy = 'Building'; if(isset($_GET['sortBy'])){ $grpBy = $_GET['sortBy']; } #Add this to just after the report variables $empty_report = 'n'; #Move this to inside the if num_rows $output_type = 'FI'; /************** BEGIN CODE TO INSERT RECORD INTO DB FOR A COMPLETED REPORT**************/ /* Insert record of report into the annual_report_pages_completed table */ $report_name = insertReportRecord($dbLink, $report_type_id, $recordId, $schYear); /************** END CODE TO INSERT RECORD INTO DB FOR A COMPLETED REPORT**************/ /****************** BEGIN SAVE REPORT TO REPORTS_PDF ********************/ /*Create the path where the completed report will be saved. */ $reportsPath = REPORTS_SAVE_PATH; $subFolder = 'year' . $schYear . '/'; $rptName = $report_name . '_' . $recordId . '.pdf'; $saveTo = $reportsPath . $subFolder . $rptName; /****************** END SAVE REPORT TO REPORTS_PDF ********************/ #Put this inside the else $empty_report = 'y'; #Add this to just below the else #Clean any content of the output buffer. ob_end_clean(); mysqli_close($dbc); #if this is for the entire annual report and this indiv report is not empty, save it to the yearx folder if($entire === 'y' && $empty_report === 'n'){ $output_type = 'F'; $pdf->Output($saveTo, $output_type); } #if this is for an individual report, output it, but do not save a copy else if($entire != 'y'){ # Send the pdf $pdf->Output($output_type); } #Put this in the last else $redUrl = "annual_report_create.php?id=" . $recordId . "&schYear=" . $schYear . "&sortBy=" . $grpBy; #Move this to the last line in the last if echo ""; ###################### DONE REPORTS ################### aging_equip_sum equip_health_status warranty_replaced_machines usage_profile_svc_supplies spc_srv_supply_cost_sav proj_equip_costs_bldg proj_equip_costs_bldg_color srv_supply_use_vnd_blk srv_supply_use_vnd_col repro_equip_assmt leased_equip owned_equip stardoc_user_name annual_blk_vol_grouped annual_blk_vol_overall annual_col_vol_grouped annual_col_vol_overall warranty_progress_report avg_student_to_copy_usage service_supply_contract_client service_supply_contract_vendor spc_staff