function get_msr_report($start_date, $end_date) { $families = get_all_client_transactions($start_date, $end_date); // gets all active families $households = count($families); // get number households // get number of clients which is the sum of the number of family members of every family $total_clients = '0'; $adults = '0'; $seniors = '0'; $children = '0'; foreach ($families as $family) { $family_members = get_all_family_members($family['clientid']); $total_clients += count($family_members) + 1; // sum up the number of members in every family $adults += count(get_all_adults($family['clientid'])); // get the total number of adults $seniors += count(get_all_seniors($family['clientid'])); // get the total number of seniors $children += count(get_all_children($family['clientid'])); // get the total number of adults } $report = array(); $report['Total Number of Househoulds Served'] = $households; $report['Total Number of Adults (18-64) Served'] = $adults; $report['Total Number of Children (under 18) Served'] = $children; $report['Total Number of Seniors (65 and older) Served'] = $seniors; $report['Total Number of Clients Served'] = $total_clients; $report['Total Number of Bags or Boxes Served'] = $households; return $report; }
function get_all_children($id, $family) { $all_child_ip = IP_Database::get_all_ip($id, $family); $ips_to_delete = array(); foreach ($all_child_ip as $a_id => $addr) { $temp_netblock = new IP_Database($a_id); $t_all_child = IP_Database::get_all_ip($temp_netblock->get_netblock_id(), $temp_netblock->get_family()); if (!empty($t_all_child)) { $ips_to_delete = array_merge($ips_to_delete, get_all_children($a_id, $family)); } $ips_to_delete = array_merge($ips_to_delete, array($a_id)); } return $ips_to_delete; }