function show_report() { error_log("******START: show_report******"); $shifthistories = get_all_peoples_histories_in_shifts(); // This returns a key sorted list of everyone's names that are or were in shifts; - GIOVI //The key being the the person's id and the associated value being the id of every shift s/he is in separated by commas. - GIOVI $projecthistories = get_all_peoples_histories_in_proj(); //This returns a key sorted list of everyone's names that are or were in projects - GIOVI $name = $_POST['volunteer-names']; $from = ""; $to = ""; if (isset($_POST['date']) && $_POST['date'] != "") { if ($_POST['date'] == "last-week") { $from = date("m/d/y", strtotime("6 weeks ago")); $to = date("m/d/y", strtotime("last week")); } else { if ($_POST['date'] == "last-month") { $from = date("m/d/y", strtotime("2 months ago")); $to = date("m/d/y", strtotime("last month")); } else { $from = $_POST["from"]; $to = $_POST["to"]; } } } //Affects Individual Hours, Total Hours, and Shift/Vacancies respectivly - GIOVI //Added two more if statements to take in total projects and project vacancies - GIOVI if (isset($_POST['report-types'])) { if (in_array('volunteer-names', $_POST['report-types'])) { report_by_individual_volunteer($name, $shifthistories, $projecthistories, $from, $to); //Check if this needs to have a connection to projects - GIOVI } if (in_array('volunteer-hours', $_POST['report-types'])) { report_shifts_totalhours($from, $to); } if (in_array('shifts-staffed-vacant', $_POST['report-types'])) { report_shift_vacancies($from, $to); } if (in_array('project-hours', $_POST['report-types'])) { report_projects_totalhours($from, $to); } if (in_array('project-staffed-vacant', $_POST['report-types'])) { report_project_vacancies($from, $to); } } error_log("******END: show_report******"); }
function getReport() { $allshifthistories = get_all_peoples_histories_in_shifts(); // This returns a key sorted list of everyone's names that are or were in shifts; //The key being the the person's id and the associated value being the id of every shift s/he is in separated by commas. - GIOVI $allprojecthistories = get_all_peoples_histories_in_proj(); //Same as above but for projects - GIOVI $namearr = array(NameFirst, NameLast); $name = implode(' ', $namearr); $nameinarr = array($name); //Remember that the name(s) must be an array in order for it to be able to be passed through the foreach in the following method error_log("The name is " . $name); //You can add a from/to date in the two blanks('') to have a specified range; Format mm/dd/yyyy - GIOVI report_by_individual_volunteer($nameinarr, $allshifthistories, '', ''); //This method takes an array of name(s) and the histories and should display the days for each individual and the number of hours they work for each day with a total - GIOVI report_shifts_totalhours($allshifthistories, '', ''); //This method takes all the histories from everyone and displays the total hours everyone works for each day and timeshift as well as the total - GIOVI report_shift_vacancies('', ''); //This method will take in a time range or will use the default (01/01/2000 to 12/31/2020) and will display all the shifts and vacancies for each day and timeshift as well as the total - GIOVI report_projects_totalhours($allprojecthistories, '', ''); report_project_vacancies('', ''); }