case 'family': if (isset($client_command) && $client_command == 'hide') { $comments_hide = true; } else { $comments_hide = false; } render_all_families(get_all_families(), $comments_hide); break; case 'pickups': if (post('did_submit') == 'yes') { new_bag_transaction_date($client_command, post('date')); } if (isset($client_command)) { render_pickups_go($client_command); } else { render_pickups(get_pickup_families()); } break; case 'deliveries': if (post('did_submit') == 'yes') { new_bag_transaction($client_command); } if (isset($client_command)) { render_deliveries_go($client_command); } else { render_deliveries(get_delivery_families()); } break; case 'dropoffs': if (post('did_submit') == 'yes') { $food_sources = get_all_food_sources();
function render_active_clients() { global $reporting_framework_render; global $parameters; foreach ($parameters as $parameter) { global ${$parameter}; } $content = ""; // Get all pickups/deliverys $pickups = get_pickup_families(); $deliveries = get_delivery_families(); // Tally up # of pickups on 2nd/4th and deliveries on 2nd/4th of active members $pickups_2nd = '0'; $pickups_4th = '0'; foreach ($pickups as $pickup) { if ($pickup['pickup_second'] == '1') { $pickups_2nd++; } if ($pickup['pickup_fourth'] == '1') { $pickups_4th++; } } $deliveries_2nd = '0'; $deliveries_4th = '0'; foreach ($deliveries as $delivery) { if ($delivery['pickup_second'] == '1') { $deliveries_2nd++; } if ($delivery['pickup_fourth'] == '1') { $deliveries_4th++; } } $total_2nd = $pickups_2nd + $deliveries_2nd; $total_4th = $pickups_4th + $deliveries_4th; // Get client transactions of last month $start_date = date('Y-m-d', mktime(0, 0, 0, date('m') - 1, date('d'), date('Y'))); $end_date = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y'))); $client_transactions = get_all_client_transactions($start_date, $end_date); // Tally up # of pickups on 2nd/4th and deliveries on 2nd/4th of past transactions within date window (last month) $last_month = array('pickups_second' => '0', 'pickups_fourth' => '0', 'deliveries_second' => '0', 'deliveries_fourth' => '0'); foreach ($client_transactions as $ct) { if ($ct['delivery'] == '0') { $day = date('d', strtotime($ct['date'])); if ($day < '15') { $last_month['pickups_second'] += 1; } else { $last_month['pickups_fourth'] += 1; } } else { $day = date('d', strtotime($ct['date'])); if ($day < '15') { $last_month['pickups_second'] += 1; } else { $last_month['pickups_fourth'] += 1; } } } $reporting_list = new Template(); $reporting_list->load('report_projection_list'); $reporting_list_render['title'] = "Active Clients"; $reporting_list_render['pickups_2nd'] = $pickups_2nd; $reporting_list_render['pickups_4th'] = $pickups_4th; $reporting_list_render['deliveries_2nd'] = $deliveries_2nd; $reporting_list_render['deliveries_4th'] = $deliveries_4th; $reporting_list_render['total_2nd'] = $total_2nd; $reporting_list_render['total_4th'] = $total_4th; $reporting_list_render['pickups_2nd_last_month'] = $last_month['pickups_second']; $reporting_list_render['pickups_4th_last_month'] = $last_month['pickups_fourth']; $reporting_list_render['deliveries_2nd_last_month'] = $last_month['deliveries_second']; $reporting_list_render['deliveries_4th_last_month'] = $last_month['deliveries_fourth']; $reporting_list_render['total_2nd_last_month'] = $last_month['pickups_second'] + $last_month['deliveries_second']; $reporting_list_render['total_4th_last_month'] = $last_month['pickups_fourth'] + $last_month['deliveries_fourth']; $reporting_list_render['report_rows'] = $content; $reporting_list->set_vars($reporting_list_render); $reporting_list->parse(); $content = $reporting_list->final; $reporting_framework_render['content'] = $reporting_list->final; render_all(); }