\n"); } // // Setup defaults for the form // $form_width = '98%'; $source = "On-Line"; if (array_key_exists('source',$_GET) && strlen($_GET['source']) > 0) $source = $_GET['source']; unset($defaultOrder); if (array_key_exists('defaultOrder', $_GET) && strlen($_GET['defaultOrder']) > 0) $defaultOrder = $_GET['defaultOrder']; // Get schedule information $swhere = ""; if ($_SESSION['UserInfo']['type'] == 'Supplier') $swhere = " and supplier_num = " . $_SESSION['UserInfo']['supplier_num']; $query = "select * from hotlunch_schedules " . "where school_num = $school_num " . "and record_num = $schedule_num $swhere"; $results = db_query($query); if (db_num_rows($results) == 0) { echo("
\n"); $error_message = getLanguageText('ERRORMSG-INVALID-SCHEDULE-NUM'); include "form.messages.php"; return; } $schedule_record = db_fetch_array($results); $schedule_name = $schedule_record['schedule_name']; $schedule_type = $schedule_record['schedule_type']; $allow_multiple_orders = $schedule_record['allow_multiple_orders']; $discount_offered = $schedule_record['discount_offered']; $discount_type = $schedule_record['discount_type']; $discount_order_minimum = $schedule_record['discount_order_minimum']; $discount_expiry_date = $schedule_record['discount_expiry_date']; $display_menu_date = $schedule_record['display_menu_date']; $late_charge = $schedule_record['late_charge']; $late_charge_date = $schedule_record['late_charge_date']; $last_link_update = $schedule_record['last_link_update']; $check_for_missed_menus = $schedule_record['check_for_missed_menus']; $implement_order_notes = $schedule_record['implement_order_notes']; $order_notes_message = $schedule_record['order_notes_message']; $implement_order_notes2 = $schedule_record['implement_order_notes2']; $order_notes_message2 = $schedule_record['order_notes_message2']; $hide_unavailable_dates = $schedule_record['hide_unavailable_dates']; $menu_display_mode = $schedule_record['menu_display_mode']; $calendar_month_breaks = $schedule_record['calendar_month_breaks']; $display_title_or_label = $schedule_record['display_title_or_label']; $schedule_prices = $schedule_record['schedule_prices']; if ($schedule_type == 'Date Sensitive') $display_menu_date = 'Y'; // Determine if there are any discounts defined for this schedule $today = date("Y-m-d",time()); $numDiscounts = db_getVal("SELECT count(*) FROM hotlunch_schedules_discounts " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "AND (expiry_date IS NULL OR expiry_date >= '$today') " . "ORDER BY menu_group,order_quantity"); $discountGroups = array(); if ($numDiscounts > 0) { $results = db_query("SELECT distinct menu_group " . "FROM hotlunch_schedules_discounts " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "AND (expiry_date IS NULL OR expiry_date >= '$today') " . "ORDER BY menu_group"); while ($row = db_fetch_array($results)) { $discountGroups[$row['menu_group']] = TRUE; } } // Check if order has already been paid for $form_edit_mode = "edit"; $form_edit_message = ""; if (array_key_exists('ordered_by_num',$_GET)) $ordered_by_num = intval($_GET['ordered_by_num']); if (array_key_exists('order_num',$_GET) && $_GET['order_num'] > 0) $order_num = intval($_GET['order_num']); if (!isset($order_num) && array_key_exists('entered_order_num',$_GET) && $_GET['entered_order_num'] > 0) $order_num = intval($_GET['entered_order_num']); if (array_key_exists('user_num',$_GET)) { $user_num = intval($_GET['user_num']); $userNum = intval($_GET['user_num']); } // Setup for parent/student orders if ($_SESSION['UserInfo']['type'] == 'Parent') { $user_num = intval($_SESSION['UserInfo']['record_num']); $ordered_by_num = intval($_GET['student_num']); $ordered_by_type = "Student"; } // Setup for staff orders if ($_SESSION['UserInfo']['type'] == 'Staff') { $user_num = intval($_SESSION['UserInfo']['record_num']); $ordered_by_type = "Staff"; } // Setup for Guest orders if ($_SESSION['UserInfo']['type'] == 'Guest') { $user_num = intval($_SESSION['UserInfo']['record_num']); $ordered_by_num = intval($_GET['user_num']); $ordered_by_type = "Customer"; } // Get name of person ordering $menu_price_category = 'Regular'; if (isset($ordered_by_num) && $ordered_by_num > 0) { $results = db_query("SELECT * FROM people WHERE record_num = $ordered_by_num"); $person = db_fetch_assoc($results); $name = db_getVal("SELECT concat(first_name,' ',last_name) FROM people WHERE record_num = $ordered_by_num"); $name = $person['first_name'].' '.$person['last_name']; $people_type = $person['people_type']; $menu_price_category = db_getVal("SELECT menu_price_category FROM people WHERE school_num = $base_school_num AND record_num = $ordered_by_num"); if (strlen($menu_price_category) == 0) $menu_price_category = 'Regular'; if ($menu_price_category != 'Regular') $PageTitle = "$menu_price_category " . getLanguageText('TEXT-ORDER'); if ($ordered_by_type != $people_type) $ordered_by_type = $people_type; } // Get current user's class_num $ccnum = 0; if (isset($ordered_by_num) && $ordered_by_num > 0) $ccnum = db_getVal("SELECT class_num FROM people WHERE school_num = $base_school_num AND record_num = $ordered_by_num"); unset($query); $newOrder = 'Y'; $owhere = ""; // If order_num is set then get existing order if (isset($order_num) && $order_num > 0) { $owhere = "and order_num = $order_num "; $query = "select * from hotlunch_order_header " . "where school_num = $school_num " . "and record_num = $order_num"; $item_query = "UPDATE hotlunch_order_items SET order_num = $order_num " . "WHERE school_num = $school_num " . "AND ordered_by_num = $ordered_by_num " . "AND schedule_num = $schedule_num " . "AND order_num = 0"; db_query($item_query); } else { // Otherwise check for an existing order if multiples are not allowed if ($allow_multiple_orders != 'Y' || $naction != 'add') { if (isset($ordered_by_num) && $ordered_by_num > 0) { $order_num = db_getVal("SELECT record_num FROM hotlunch_order_header WHERE school_num = $school_num AND ordered_by_num = $ordered_by_num AND schedule_num = $schedule_num AND status != 'Deleted'"); if (! $order_num) { $query = "select * from hotlunch_order_header " . "where school_num = $school_num " . "and ordered_by_num = $ordered_by_num " . "and schedule_num = $schedule_num " . "and status != 'Deleted'"; } else { $owhere = "and order_num = $order_num "; $query = "select * from hotlunch_order_header " . "where school_num = $school_num " . "and record_num = $order_num"; } } } } if (isset($query)) { $results = db_query($query); if (db_num_rows($results) > 0) { $newOrder = 'N'; $header = db_fetch_array($results); $source = $header['source']; $status = $header['status']; $order_num = $header['record_num']; $ordered_by_num = $header['ordered_by_num']; $ordered_by_type = $header['ordered_by_type']; $order_notes = $header['order_notes']; $order_notes2 = $header['order_notes2']; $discount_amount = $header['discount_amount']; $price_category = $header['price_category']; if ($_SESSION['UserInfo']['type'] == 'System Administrator' || $_SESSION['UserInfo']['type'] == 'SuperUser') echo("

Order Number: $order_num

\n"); // Get the user_num associated with this person $user_num = db_getVal("SELECT user_num FROM people WHERE record_num = $ordered_by_num"); // Do not allow editing of Paid orders by default if ($status == 'Paid' && $school_record['allow_edit_of_paid_orders'] == 'N' && ($schedule_record['edit_paid_orders'] == 'D' || $schedule_record['edit_paid_orders'] == 'N')) { $form_edit_mode = "review"; $form_edit_message = getLanguageText('MSG-ORDER-PAID'); if (strlen($PageTitle)) $PageTitle .= " - "; $PageTitle .= getLanguageText('TEXT-REVIEW-ORDER'); } // Do not allow editing of compimentary orders if ($status == 'Complimentary' && $school_record['allow_edit_of_complimentary_orders'] != 'Y' && ($schedule_record['edit_complimentary_orders'] == 'D' || $schedule_record['edit_complimentary_orders'] == 'N')) { $form_edit_mode = "review"; $form_edit_message = getLanguageText('MSG-ORDER-NO-EDIT'); if (strlen($PageTitle)) $PageTitle .= " - "; $PageTitle .= getLanguageText('TEXT-REVIEW-ORDER'); } } } // If we are past the last date for ordering $today = date("Y-m-d",time()); $first_menu_date = db_getVal("SELECT min(menu_date) FROM hotlunch_menu_dates WHERE school_num = $school_num AND schedule_num = $schedule_num AND menu_type = 'Regular'"); $days_prior = $schedule_record['days_prior_to_order_date']; if ($days_prior == 0 && date("H",time()) >= $schedule_record['order_until_hour']) $days_prior = 1; $menu_date_cutoff = date("Y-m-d",time() + $days_prior * 60 * 60 * 24 - 60); if ($schedule_record['end_order_datetime'] < $first_menu_date) $menu_date_cutoff = $today; if ($schedule_record['menu_cutoff_date'] > $today) $menu_date_cutoff = $schedule_record['menu_cutoff_date']; $customDateWhere = ""; $dateNow = date("Y-m-d H:i:00",time()); if ($schedule_record['custom_menu_end_dates'] == 'Y') { $customDateWhere = "AND menu_end_order_datetime > '$dateNow' "; } // Ordering ended prior to today if ($form_edit_mode == "edit" && $schedule_record['end_order_datetime'] < $today) { $form_edit_mode = "review"; $form_edit_message = "$schedule_name - " . getLanguageText('MSG-ORDER-CUTOFF-DATE') . ' ' . date("l F jS, Y",strtotime($schedule_record['end_order_datetime'])) . "."; } $now = date("Y-m-d H:i:s",time()); if ($form_edit_mode == "edit" && $schedule_record['end_order_datetime'] < $now) { $form_edit_mode = "review"; $form_edit_message = "$schedule_name - " . getLanguageText('MSG-ORDER-CUTOFF-DATE') . ' ' . date("l F jS, Y",strtotime($schedule_record['end_order_datetime'])) . "."; } // Unless we are logged in as Admin or HotLunchTeam user $AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Application Volunteer','Schedule Volunteer','Administration Team','Schedule Team','Supplier'); if (checkPermission($AllowedUserTypes) == 1) { $form_edit_mode = "edit"; $form_edit_message = ""; } else { if ($form_edit_mode == "edit") { $form_edit_message = "$schedule_name - " . getLanguageText('MSG-ORDER-DATES') . "
\n" . date("l F jS, Y",strtotime($schedule_record['start_order_datetime'])) . " & " . date("l F jS, Y",strtotime($schedule_record['end_order_datetime'])) . "."; } } db_query("UPDATE hotlunch_menu_dates SET current_menu_link = menu_link WHERE school_num = $school_num AND schedule_num = $schedule_num"); // // Determine if there are any linked menu dates for this order source // $menu_link_code = "('None')"; $linked_items = 'N'; if ($source == 'Paper') { $num = db_getVal("select count(*) from hotlunch_menu_dates where school_num = $school_num and schedule_num = $schedule_num and menu_link in ('Paper','All') and active != 'N'"); if ($num > 0) { $linked_items = 'Y'; $menu_link_code = "('Paper','All')"; } } if ($source == 'On-Line') { $num = db_getVal("select count(*) from hotlunch_menu_dates where school_num = $school_num and schedule_num = $schedule_num and menu_link = 'All' and active != 'N'"); if ($num > 0) { $linked_items = 'Y'; $menu_link_code = "('All')"; } } // // Get volunteer message if required // $school_volunteer_signup = $school_record['enable_volunteer_signup']; $schedule_volunteer_signup = $schedule_record['volunteer_signup']; // Setup readonly for text fields based on current user type $readonly_flag = " readonly"; $disabled_flag = " disabled"; if ($linked_items == 'Y') { $AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator'); if (checkPermission($AllowedUserTypes) == 1) { $readonly_flag = ""; $disabled_flag = ""; } // Update the hotlunch_menu_items table if ($today > $last_link_update) { $query = "SELECT menu_date,source_menu,record_num " . "FROM hotlunch_menu_dates " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "ORDER BY sequence,menu_date"; $menu_dates = db_query($query); while ($row = db_fetch_array($menu_dates)) { $mnum = $row['record_num']; db_query("UPDATE hotlunch_menu_items SET current_source_item = source_item WHERE school_num = $school_num AND menu_num = $mnum"); db_query("UPDATE hotlunch_menu_dates SET current_menu_link = menu_link WHERE school_num = $school_num AND record_num = $mnum"); } // Now get the set of source menu dates that are prior to the cut off date $query = "SELECT menu_date,source_menu,record_num " . "FROM hotlunch_menu_dates " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "AND (source_menu = 0 OR source_menu IS NULL) " . "AND menu_date < '$menu_date_cutoff' " . $customDateWhere . "ORDER BY sequence,menu_date"; $menu_dates = db_query($query); if (db_num_rows($menu_dates) > 0) { while ($row = db_fetch_array($menu_dates)) { $mnum = $row['record_num']; $mdate = $row['menu_date']; $results = db_query("SELECT * FROM hotlunch_menu_dates WHERE school_num = $school_num AND source_menu = $mnum AND menu_date >= '$menu_date_cutoff' $customDateWhere ORDER BY sequence,menu_date"); $num_menus = db_num_rows($results); if ($num_menus == 0) continue; $new_source_menu = db_fetch_array($results); $new_mnum = $new_source_menu['record_num']; db_query("UPDATE hotlunch_menu_dates SET current_menu_link = 'No' WHERE school_num = $school_num AND record_num = $new_mnum"); // Get other linked menus if there are any $other_menus = ""; if ($num_menus > 1) { while ($row = db_fetch_array($results)) { if (strlen($other_menus)) $other_menus .= ","; $other_menus .= $row['record_num']; } } // Get all the menu items for this menu date $results = db_query("SELECT * FROM hotlunch_menu_items WHERE school_num = $school_num AND menu_num = $new_mnum ORDER BY sequence"); while ($row = db_fetch_array($results)) { $inum = $row['record_num']; $snum = $row['source_item']; // Update other linked menus if (strlen($other_menus) > 0) { db_query("UPDATE hotlunch_menu_items SET current_source_item = $inum WHERE school_num = $school_num AND source_item = $snum"); } // Update the items to be the new source items db_query("UPDATE hotlunch_menu_items SET current_source_item = 0 WHERE school_num = $school_num AND record_num = $inum"); } } } } } // Create a message about the discount $discount_msg = ""; if (isset($discount_offered) && $discount_offered != 0 && $discount_expiry_date >= $today) { $order_total = $ordertotal; $discount_msg = getLanguageText('MSG-DISCOUNT-AMOUNT') . ' '; if ($discount_type == 'Amount') { $discount_msg .= $currencySymbol . number_format($discount_offered,2); } else { $discount_msg .= number_format($discount_offered,1) . "%"; } $discount_msg .= " " . getLanguageText('MSG-DISCOUNT-DATE') . ' ' . date("F jS, Y",strtotime($discount_expiry_date)); if (isset($discount_order_minimum) && $discount_order_minimum > 0) { $discount_msg .= ' ' . getLanguageText('TEXT-OVER') . " $currencySymbol" . number_format($discount_order_minimum,2); } } // Create message about late charges if (isset($late_charge) && $late_charge > 0) { if (strlen($discount_msg) > 0) $discount_msg .= "
\n"; $discount_msg .= getLanguageText('MSG-LATE-CHARGE') . " $currencySymbol" . number_format($late_charge,2) . " " . getLanguageText('MSG-LATE-CHARGE-DATE') . " " . date("F jS, Y",strtotime($late_charge_date)) . "."; $apply_late_charge = 'N'; if ($late_charge_date <= $today) $apply_late_charge = 'Y'; } // Set flag for concession orders $concessionOrder = 'N'; if ($ordered_by_type == 'Concession') { $concessionOrder = 'Y'; } ?>

0 || $schedule_record['display_instructions'] == 'Y') { ?>
0) { if (strip_tags($schedule_record['description']) == $schedule_record['description']) { echo("

" . htmlspecialchars_decode($schedule_record['description']) . "

\n"); echo(htmlspecialchars_decode($row['content'],ENT_QUOTES)); } else { echo(nl2br($schedule_record['description'])); } } if ($schedule_record['display_instructions'] == 'Y') echo("

" . getLanguageText('TEXT-ORDER-INSTRUCTIONS') . "

\n"); ?>

[Update Linked and Submit]

"); } if ($_SESSION['UserInfo']['type'] == 'SuperUser') { echo("[Submit and Update]

"); } $message_width = $form_width; include "form.messages.php"; ?>

0) echo("

$discount_msg

\n"); $tabindex = 1; $AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Application Volunteer','Schedule Volunteer','Administration Team','Schedule Team','Supplier'); if (checkPermission($AllowedUserTypes) == 1) { ?>
0 || $school_record['orders_for'] != 'Registrant') { ?> 0) { ?>
:
?
:
:
:
:
:
:
:
:

:


" . nl2br(trim($school_record['permission_description'])) . "") ?>
:
:
:
:

:
:

0) echo("

$name

\n"); // Set name title for Concession Order $display_current_totals = 'N'; $concessionOrder = 'N'; if ($ordered_by_type == 'Concession') { echo("

Concession Order

\n"); $display_current_totals = 'Y'; $concessionOrder = 'Y'; } // // Menu Dates Array // $MenuDates = array(); $CurrentDates = array(); // Get menu dates for this schedule $query = "select * from hotlunch_menu_dates " . "where school_num = $school_num " . "and schedule_num = $schedule_num " . "and active != 'N' " . "order by sequence,menu_date"; writeLog($query); $menu_dates = db_query($query); $ordertotal = '0'; $global_code = ""; $menu_items_code = ""; $all_menu_items_code = ""; $menu_options_code = ""; $group_check_code = ""; $group_complete_code = ""; $form_check_code = ""; $discount_code = ""; $groupQtyFields = array(); $groupCodes = array('A','B','C','D','E','F','G','H','I','J','K','L','M'); $otipSpans = ""; $nutrition_spans = ""; $image_spans = ""; writeLog("SELECT min(menu_date) FROM hotlunch_menu_dates WHERE school_num = $school_num AND schedule_num = $schedule_num AND active != 'N' AND menu_type = 'Regular'"); $firstMenuDate = db_getVal("SELECT min(menu_date) FROM hotlunch_menu_dates WHERE school_num = $school_num AND schedule_num = $schedule_num AND active != 'N' AND menu_type = 'Regular' AND menu_date IS NOT NULL"); writeLog("firstMenuDate: $firstMenuDate"); writeLog("SELECT max(menu_date) FROM hotlunch_menu_dates WHERE school_num = $school_num AND schedule_num = $schedule_num AND active != 'N' AND menu_type = 'Regular'"); $lastMenuDate = db_getVal("SELECT max(menu_date) FROM hotlunch_menu_dates WHERE school_num = $school_num AND schedule_num = $schedule_num AND active != 'N' AND menu_type = 'Regular'"); writeLog("lastMenuDate: $lastMenuDate"); while ($mdate = db_fetch_array($menu_dates)) { $menu_num = $mdate['record_num']; $menu_code = $schedule_num . "_" . $menu_num; $menu_title = $mdate['menu_title']; $menu_link = $mdate['menu_link']; $menu_link = $mdate['current_menu_link']; $menu_date = $mdate['menu_date']; $menu_type = $mdate['menu_type']; $menu_instructions = $mdate['menu_instructions']; $volunteer_msg = $mdate['volunteer_msg']; $menu_available = $mdate['available']; writeLog("menu_num: $menu_num\n"); writeLog("menu_date: $menu_date\n"); // Check if this student can order in this menu if ($ccnum > 0 && $ordered_by_type == 'Student' && isset($ordered_by_num) && $ordered_by_num > 0) { $sclasses = db_getVal("SELECT count(*) FROM hotlunch_menu_dates_classes WHERE school_num = $school_num AND schedule_num = $schedule_num AND menu_num = $menu_num"); if ($sclasses > 0) { $access = db_getVal("SELECT count(*) FROM hotlunch_menu_dates_classes WHERE school_num = $school_num AND schedule_num = $schedule_num AND menu_num = $menu_num AND class_num = $ccnum"); if (($_SESSION['UserInfo']['type'] == 'Parent' || $_SESSION['UserInfo']['type'] == 'Staff') && $access == 0) continue; } } // if ($menu_type != 'Footer') { // if ($firstMenuDate == 0) $firstMenuDate = $menu_date; // $lastMenuDate = $menu_date; // } // else { // $menu_date = $lastMenuDate; // } if ($menu_type == 'Footer') $menu_date = $lastMenuDate; $menuDateActive = 'Y'; $rowStyle = ""; $volunteer_signup = 'N'; if ($school_volunteer_signup == 'Y') { $maxVolunteers = $school_record['max_volunteers']; $volunteerMessage = $school_record['default_volunteer_message']; if (strlen($schedule_record['schedule_volunteer_message']) > 0) $volunteerMessage = $schedule_record['schedule_volunteer_message']; $volunteer_signup = 'Y'; } if ($schedule_volunteer_signup == 'Y') { $maxVolunteers = $schedule_record['max_volunteers']; $volunteer_signup = 'Y'; } if (strlen($schedule_record['schedule_volunteer_message']) > 0) $volunteerMessage = $schedule_record['schedule_volunteer_message']; if ($schedule_volunteer_signup == 'N') { $volunteer_signup = 'N'; } if ($mdate['num_volunteer_override'] == 'Y') { $maxVolunteers = $mdate['max_volunteers']; $volunteer_signup = 'Y'; } if (strlen($mdate['volunteer_msg']) > 0) $volunteerMessage = $mdate['volunteer_msg']; if ($mdate['num_volunteer_override'] == 'N') { $volunteer_signup = 'N'; } // Handle linked child items if the field needs to be readonly based on the menu_link $readonly = ""; $disabled = ""; $linkedMenu = false; if (($menu_link == 'Paper' && $source == 'Paper') || $menu_link == 'All') { if ($schedule_record['edit_linked_menus'] == 'N') { $readonly = $readonly_flag; $disabled = $disabled_flag; $linkedMenu = true; } } // Set class for menu header $tclass = 'menudate-header'; // Get menu items for this menu date $active_menu_items = array(); $currentMenuItems = array(); $query = "select * from hotlunch_menu_items " . "where school_num = $school_num " . "and menu_num = $menu_num " . "AND active != 'N' " . "order by sequence"; $menu_items = db_query($query); while ($menu_item = db_fetch_array($menu_items)) { extract($menu_item); // Check if this student can order in this menu item if ($ccnum > 0 && $ordered_by_type == 'Student' && isset($ordered_by_num) && $ordered_by_num > 0) { $sclasses = db_getVal("SELECT count(*) FROM hotlunch_menu_items_classes WHERE school_num = $school_num AND schedule_num = $schedule_num AND menu_num = $menu_num AND menu_item_num = $record_num"); if ($sclasses > 0) { $access = db_getVal("SELECT count(*) FROM hotlunch_menu_items_classes WHERE school_num = $school_num AND schedule_num = $schedule_num AND menu_num = $menu_num AND menu_item_num = $record_num AND class_num = $ccnum"); if (($_SESSION['UserInfo']['type'] == 'Parent' || $_SESSION['UserInfo']['type'] == 'Staff') && $access == 0) continue; } } $active_menu_items[] = $record_num; $currentMenuItems[] = $menu_item; } $iwhere = ""; if (count($active_menu_items)) { $activeMenuItems = implode(",",$active_menu_items); $iwhere = "AND record_num IN ($activeMenuItems) "; } $numItems = count($active_menu_items); if ($numItems == 0) $tclass = 'menudate-noitems'; // Adjust title if date is in the past if ($schedule_type == 'Hot Lunch' || $schedule_type == 'Date Sensitive') { if ($form_edit_mode == 'edit') { if ($menu_date < $menu_date_cutoff) $menuDateActive = 'N'; if ($schedule_record['custom_menu_end_dates'] == 'Y' && $mdate['menu_end_order_datetime'] < $dateNow) $menuDateActive = 'N'; if ($menuDateActive == 'N' || $menu_available == 'N') { $tclass = 'menudate-past'; if ($_SESSION['UserInfo']['type'] == 'Parent' || $_SESSION['UserInfo']['type'] == 'Staff' || $_SESSION['UserInfo']['type'] == 'Guest') { $menu_title .= " - " . getLanguageText('TEXT-NOT-AVAILABLE-AT-THIS-TIME'); if ($hide_unavailable_dates == 'Y') $rowStyle = " style='display: none;'"; } } } } // // Save menu date information // if (in_array($siteType,array('hotlunch','fundraising'))) $menuDate = $mdate['menu_date']; else $menuDate = $mdate['menu_date'] . "." . $menu_num; $MenuDates[$menu_num]['menu_date'] = $mdate['menu_date']; $MenuDates[$menu_num]['menu_type'] = $mdate['menu_type']; $MenuDates[$menu_num]['rowStyle'] = $rowStyle; $MenuDates[$menu_num]['tclass'] = $tclass; $MenuDates[$menu_num]['menu_title'] = $menu_title; $MenuDates[$menu_num]['display_menu_date'] = $display_menu_date; $MenuDates[$menu_num]['menu_instructions'] = $menu_instructions; $MenuDates[$menu_num]['menu_active'] = $menuDateActive; // Get menu items for this menu date $query = "select * from hotlunch_menu_items " . "where school_num = $school_num " . "and menu_num = $menu_num " . "AND active != 'N' " . $iwhere . "order by sequence"; $menu_items = db_query($query); // Determine if groups are in use in this menu $groupCount = db_getVal("SELECT count(*) FROM hotlunch_menu_items " . "WHERE school_num = $school_num " . "AND menu_num = $menu_num " . "AND active != 'N' " . "AND menu_group IN ('A','B','C','D','E','F','G','H','I','J','K','L','M')"); $group_items = array(); $groupLimits = array(); $menu_total = '0'; $menu_count = 0; $item_count = 0; unset($MenuItems); $MenuItems = array(); $MenuItemCount = 0; $LastHeadingClass = ''; while ($menu_item = db_fetch_array($menu_items)) { extract($menu_item); echo("\n"); $readonly = ""; if ($item_type == 'Heading') { $LastHeadingClass = "header-$record_num"; if ($heading_visibility == 'hidden') $LastHeadingClass .= " hidden-item"; $heading_class = ""; } else { $heading_class = $LastHeadingClass; } $curr_item_num = $record_num; $curr_code = $schedule_num . "_" . $menu_num . "_" . $curr_item_num; $qtyfield = "qty_$curr_code"; $cbfield = "cb_$curr_code"; $pricefield = "price_$curr_code"; $linespan = "span_$curr_code"; $linetotal = "ltotal_$curr_code"; $linecount = "lcount_$curr_code"; $minqty = "minqty_$curr_code"; $warnqty = "warnqty_$curr_code"; $maxqty = "maxqty_$curr_code"; $maxqty_by = "maxqty_by_$curr_code"; $family_qty = "family_qty_$curr_code"; // Save qty field to groupQtyFields array for later processing if ($item_type != 'Heading' && array_key_exists('Any',$discountGroups)) $groupQtyFields['Any'] .= " $qtyfield"; for ($i = 0; $i < count($groupCodes); $i++) { $gCode = $groupCodes[$i]; if ($item_type != 'Heading' && array_key_exists($gCode,$discountGroups)) $groupQtyFields[$gCode] .= " $qtyfield"; } if (strlen(trim($label_title)) == 0) $label_title = $item_title; if ($display_title_or_label == 'Title') $label_title = $item_title; $MenuItems[$MenuItemCount]['item_type'] = $item_type; if ($item_type != 'Heading') { // Format tips for "Form" display mode if ($menu_display_mode == 'Form') { // Display nutritional information icon if data exists $nutrition_image = ""; if (strlen(trim($nutritional_info)) > 0) { $span_id = "nut_span$curr_item_num"; $nutrition_icon = "" . getLanguageText("; $otipSpans .= "" . sprintf($otipNUTRITION,nl2br($nutritional_info)) . "\n"; $nutrition_image = "  $nutrition_icon "; } // Process the BC Food Guidelines icons $rating_image = ""; $rating_icon = "Choose $bc_guideline_rating"; if ($school_record['display_bc_food_guidelines'] == 'Y') { if ($bc_guideline_rating == 'Sometimes') $rating_image = " $rating_icon "; if ($bc_guideline_rating == 'Most') $rating_image = " " . $rating_icon . $rating_icon . ""; } // Handle item image $image_link = ""; echo("\n"); if (strlen($image) > 0 && is_file("$imagedir/$image")) { $image_icon = "Item Image"; $ic = explode('.',$image); $iname = ""; $ext = $ic[count($ic) - 1]; for ($i = 0; $i < count($ic) - 1; $i++) { if (strlen($iname)) $iname .= "."; $iname .= $ic[$i]; } $image_size = GetImageSize("$imagedir/$image"); $image_width = $image_size[0]; $image_height = $image_size[1]; $thumbnail = $iname."-tn.".$ext; if ($schedule_record['display_product_thumbnail'] == 'Y') { if (!is_file("$imagedir/$thumbnail")) { $img = createThumbnail($image, $imagedir); } $image_size = GetImageSize("$imagedir/$thumbnail"); $image_width = $image_size[0]; $image_height = $image_size[1]; $image_icon = "Item Image"; } if ($image_width >= $image_height) { if ($image_width > $maxImageDimension) { $image_height = intval($image_height * $maxImageDimension / $image_width); $image_width = $maxImageDimension; } } else { if ($image_height > $maxImageDimension) { $image_width = intval($image_width * $maxImageDimension / $image_height); $image_height = $maxImageDimension; } } $span_id = "img_span$curr_item_num"; $otipSpans .= "" . sprintf($otipIMG,"$imageurl/$image",$image_height,$image_width,$item_title) . "\n"; $image_link = "$image_icon"; } } // Setup prices $item_price = $offline_price; if ($source == 'On-Line') $item_price = $online_price; // Use Special Prices if required if ($school_record['special_item_prices'] == 'Y') { if ($menu_price_category == 'Special 1') $item_price = $special_price1; if ($menu_price_category == 'Special 2') $item_price = $special_price2; if ($menu_price_category == 'Special 3') $item_price = $special_price3; } if (strlen($item_price) == 0) $item_price = "0.00"; // Format tips for "Calendar" display mode if ($menu_display_mode == 'Calendar' || $menu_display_mode == 'Calendar No Weekends') { $iTitle = " - $item_title"; if ($display_price != 'N') $iTitle .= " -   $currencySymbol$item_price  "; $iTitle .= "
\n"; if (strlen($item_description)) $iTitle .= " -- $item_description
\n"; if ($taxable_item == 'Y') $iTitle .= " -- " . getLanguageText('TEXT-TAXABLE') . "
\n"; // Format nutritional info if (strlen(trim($nutritional_info))) $nutritional_info = "
\n" . nl2br(trim($nutritional_info)); // Include image if there is one $iImage = "

"; if (strlen($image) > 0 && is_file("$imagedir/$image")) { $image_size = GetImageSize("$imagedir/$image"); $image_width = $image_size[0]; $image_height = $image_size[1]; if ($image_width >= $image_height) { if ($image_width > $maxImageDimension) { $image_height = intval($image_height * $maxImageDimension / $image_width); $image_width = $maxImageDimension; } } else { if ($image_height > $maxImageDimension) { $image_width = intval($image_width * $maxImageDimension / $image_height); $image_height = $maxImageDimension; } } $image = urlencode($image); $iImage = "
\n
" . sprintf($otipIMG,"$imageurl/$image",$image_height,$image_width,$item_title) . "
"; } $mtitle = ""; if (strlen($menu_title)) $mtitle = "   $menu_title    
\n"; // Process the BC Food Guidelines icons $rating_image = ""; $rating_icon = "Choose $bc_guideline_rating"; if ($school_record['display_bc_food_guidelines'] == 'Y') { if ($bc_guideline_rating == 'Sometimes') $rating_image = " $rating_icon "; if ($bc_guideline_rating == 'Most') $rating_image = " " . $rating_icon . $rating_icon . ""; } $span_id = "info_span$curr_item_num"; if ($menu_available != 'N') { $otipSpans .= "" . sprintf($otipNUTRITION,$mtitle . $iTitle . $nutritional_info) . $iImage . "\n"; } else { $msg = "" . getLanguageText('TEXT-NOT-AVAILABLE') . "
"; $otipSpans .= "" . sprintf($otipNUTRITION,$msg . $mtitle . $iTitle . $nutritional_info) . $iImage . "\n"; } $label_title = "$label_title"; } $qtyvalue = ''; $line_total = '0'; $item_options_ordered = array(); $item_options2_ordered = array(); $item_options3_ordered = array(); // Check if there is an order for this item for this person if (isset($ordered_by_num) && $newOrder != 'Y') { $query = "select * from hotlunch_order_items " . "where school_num = $school_num " . "and ordered_by_num = $ordered_by_num " . "and schedule_num = $schedule_num " . $owhere . "and menu_num = $menu_num " . "and menu_item_num = $curr_item_num " . "and active != 'N'"; $orders = db_query($query); if (db_num_rows($orders) > 0) { $order = db_fetch_array($orders); $qtyvalue = $order['qty']; $options_ordered = $order['options_ordered']; $options2_ordered = $order['options2_ordered']; $options3_ordered = $order['options3_ordered']; if (strlen($options_ordered) > 0) $item_options_ordered = explode("\n",trim($options_ordered)); if (strlen($options2_ordered) > 0) $item_options2_ordered = explode("\n",trim($options2_ordered)); if (strlen($options3_ordered) > 0) $item_options3_ordered = explode("\n",trim($options3_ordered)); $ltotal = $qtyvalue * $item_price; $line_total = number_format($ltotal,2); $menu_total += $ltotal; $menu_count += $qtyvalue; $ordertotal += $ltotal; } } else { if (isset($_POST["qty_$curr_code"])) $qtyvalue = $_POST["qty_$curr_code"]; if ($min_quantity > 0 && $qtyvalue == 0) $qtyvalue = $min_quantity; $ltotal = $qtyvalue * $item_price; $line_total = number_format($ltotal,2); $menu_total += $ltotal; $menu_count += $qtyvalue; $ordertotal += $ltotal; } // Handle dates that have passed for parents if ($_SESSION['UserInfo']['type'] == 'Parent' || $_SESSION['UserInfo']['type'] == 'Staff') { if ($form_edit_mode == 'edit' && $menuDateActive == 'N') { $readonly = $readonly_flag; $disabled = $disabled_flag; } } // Handle item options $options_count_code = ""; $options_code = ""; $optionsArray = array(); for ($set = 0; $set <= 2; $set++) { switch ($set) { case 0: $optionsTitle = $options_title; $itemOptions = $options; $defaultOptions = $default_options; $orderedOptions = $item_options_ordered; $minOptions = $min_options; $maxOptions = $max_options; $ext = ""; break; case 1: $optionsTitle = $options2_title; $itemOptions = $options2; $defaultOptions = $default_options2; $orderedOptions = $item_options2_ordered; $minOptions = $min_options2; $maxOptions = $max_options2; $ext = "2"; break; case 2: $optionsTitle = $options3_title; $itemOptions = $options3; $defaultOptions = $default_options3; $orderedOptions = $item_options3_ordered; $minOptions = $min_options3; $maxOptions = $max_options3; $ext = "3"; break; } $itemOptions = trim($itemOptions); if (strlen($itemOptions) > 0) { $item_options = explode("\n",$itemOptions); $default_options_array = array(); if (strlen(trim($defaultOptions))) $default_options_array = explode("\n",trim($defaultOptions)); for ($o = 0; $o < count($default_options_array); $o++) { $default_options_array[$o] = trim($default_options_array[$o]); } if ($menu_display_mode == 'Form' || $set > 0) $options_code .= "
\n"; if (strlen($optionsTitle)) $options_code .= "$optionsTitle: "; $optionsText = "$optionsTitle: "; if ($form_edit_mode != 'review') { // Build menu options code string $menu_options_code .= " if (code == '$curr_code') {\n"; $menu_options_code .= " var qtyfield = 'qty_'+code+'';\n"; $menu_options_code .= " var cbfield = 'cb_'+code+'';\n"; if ($menuDateActive == 'Y') { $menu_options_code .= " if (document.getElementById(sname).checked && ! document.getElementById(qtyfield).value) {\n"; $menu_options_code .= " document.getElementById(qtyfield).value = 1;\n"; $menu_options_code .= " if (document.getElementById(cbfield)) document.getElementById(cbfield).checked = true;\n"; $menu_options_code .= " }\n\n"; } // Handle limits on the number of options selected if ($maxOptions > 0 || $minOptions > 0) { $numOptions = count($orderedOptions); $global_code .= " var ocount$ext" . "_$curr_code = $numOptions;\n"; $menu_options_code .= " ocount$ext" . "_$curr_code = 0;\n"; $options_count_code .= " ocount$ext" . "_$curr_code = 0;\n"; } $num_options = count($item_options); for ($i = 0; $i < count($item_options); $i++) { $option = trim($item_options[$i]); $optionsArray[] = array($option,$ext); // echo("\n"); if (strlen($option) > 0) $checked = ""; if (in_array($option,$orderedOptions)) $checked = " checked='checked'"; if ($newOrder == 'Y' && in_array($option,$default_options_array)) $checked = " checked='checked'"; $option_f = str_replace(" ","_",substr($option,0,30)); $option_f = str_replace("&","and",$option_f); $option_f = preg_replace("/[^a-zA-Z0-9_]/","",$option_f); $sname = "option{$ext}_$curr_code" . "_$option_f"; if ($disabled != $disabled_flag || strlen($disabled_flag) == 0) { $options_code .= " " . "$option \n"; } else { // $fname = $sname . "_visible"; $options_code .= " " . "$option \n"; if (strlen($checked)) $options_code .= ""; } $optionsText .= "$option "; if ($menu_display_mode == 'Form' && strlen($optionsText) > 70 && $i < ($num_options - 1)) { $optionsText = ""; $options_code .= "
\n"; } if ($maxOptions > 0 || $minOptions > 0) { $menu_options_code .= " if (document.orderform.$sname.checked) ocount$ext" . "_$curr_code" . "++;\n"; $options_count_code .= " if (document.orderform.$sname.checked) ocount$ext" . "_$curr_code" . "++;\n"; } } // Ensure that too many options are not selected if ($menuDateActive == 'Y' && $maxOptions > 0) { $menu_options_code .= " if (ocount$ext" . "_$curr_code > $maxOptions) {\n"; $menu_options_code .= " document.getElementById(sname).checked = false;\n"; $menu_options_code .= " alert(\"" . getLanguageText('TEXT-YOU-MAY-NOT-SELECT-MORE-THAN') . " $maxOptions $optionsTitle\");\n"; $menu_options_code .= " return false;\n"; $menu_options_code .= " }\n"; } $menu_options_code .= " }\n\n"; // Ensure that the minimum number of options have been selected if ($menuDateActive == 'Y' && $minOptions > 0) { $ititle = str_replace("'",""",$item_title); if ($display_menu_date == 'Y') $ititle .= " - " . date("l F jS, Y",strtotime($mdate['menu_date'])); if ($linkedMenu != true) { $form_check_code .= $options_count_code; $form_check_code .= " if (document.getElementById('qty_$curr_code').value > 0 && ocount$ext" . "_$curr_code < $minOptions) {\n"; $form_check_code .= " checkFormMissedOptionsMessage += '" . getLanguageText('TEXT-YOU-MUST-SELECT-AT-LEAST') . " $minOptions $optionsTitle: $ititle\\n';\n"; $form_check_code .= " }\n"; } } } else { $noptions = 0; for ($i = 0; $i < count($item_options); $i++) { $option = trim($item_options[$i]); if (strlen($option) > 0) { if (in_array($option,$orderedOptions)) { if ($noptions == 0) $options_code .= " - "; if ($noptions > 0) $options_code .= ", "; $options_code .= $option; $noptions++; } } } } } } // Complete the span if ($menu_display_mode != 'Form' && strlen($options_code)) { $options_code = "$options_code"; $view_icon_small = "Edit Options"; $label_title .= " " . $view_icon_small; } // Get total items ordered if required $total_ordered = ""; if ($display_current_totals == 'Y') { $query = "select sum(qty) from hotlunch_order_items AS hloi, hotlunch_order_header AS hloh, people AS p " . "where hloi.school_num = $school_num " . "and hloh.school_num = $school_num " . "and p.school_num = $base_school_num " . "and hloh.record_num = hloi.order_num " . "and hloh.status NOT IN ('Inactive','Deleted') " . "and hloi.ordered_by_type != 'Concession' " . "and hloi.ordered_by_num = p.record_num " . "and hloh.schedule_num = $schedule_num " . "and hloi.schedule_num = $schedule_num " . "and hloi.menu_num = $menu_num " . "and hloi.menu_item_num = $curr_item_num " . "and hloi.active != 'N'"; $total_ordered = db_getVal($query); $total_ordered = number_format($total_ordered,0) . "  "; } // Set the border color of the quantity field $borderColor = "808080"; $groupText = ""; $group_available = 0; if (isset($menu_group) && strlen($menu_group) == 1) { $mgcode = strtolower("group_$menu_group" . "_color"); $borderColor = $school_record[$mgcode]; $groupText = "($menu_group) "; $group_available = $mdate['group_' . strtolower($menu_group) . '_available']; $groupLimits[$menu_group] = $group_available; $group_sold = 0; if ($group_available > 0) { $query = "SELECT sum(qty) FROM hotlunch_order_items AS hloi, hotlunch_menu_items AS hlmi " . "WHERE hloi.school_num = $school_num " . "AND hlmi.school_num = $school_num " . "AND hloi.schedule_num = $schedule_num " . "AND hloi.menu_num = $menu_num " . "AND hlmi.menu_num = $menu_num " . "AND hloi.menu_item_num = hlmi.record_num " . "AND hlmi.menu_group = '$menu_group' " . "AND hloi.active != 'N' " . "AND hlmi.active != 'N'"; $group_sold = db_getVal($query); $group_qty_available = $group_available - intval($group_sold); $groupLimits[$menu_group] = $group_qty_available; } } // Clear the group color if the school profile specifies to if ($school_record['display_group_colors'] == 'N' && $display_group_colors != 'Y') $borderColor = "808080"; if (!isset($display_group_colors) || $display_group_colors == 'N') $borderColor = "808080"; // Clear the group text if this is a concession order or if the school profile specifies to if ($concessionOrder == 'Y') $groupText = ""; if ($school_record['display_group_letters'] == 'N' || !isset($display_group_letters) || $display_group_letters == 'N') $groupText = ""; if (!isset($display_group_letters) || $display_group_letters == 'N') $groupText = ""; // If group processing is required save this item number to the correct group if ($groupCount > 0 && $concessionOrder == 'N') $group_items[$menu_group][] = $curr_item_num; $item_count++; $item_price_d = "x $currencySymbol$item_price"; if ($display_price == 'N') $item_price_d = ""; // Handle limited quantity items $item_availability = ""; $qty_remaining = 9999; if ($quantity_available > 0) { $qty_sold = db_getVal("SELECT sum(qty) FROM hotlunch_order_items " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "AND menu_num = $menu_num " . "AND menu_item_num = $curr_item_num " . "AND active != 'N'"); $qty_remaining = $quantity_available - $qty_sold; $availablityText = getLanguageText('TEXT-AVAILABLE'); } if ($group_available > 0) { if ($group_qty_available < $qty_remaining) { $qty_remaining = $group_qty_available; $availablityText = getLanguageText('TEXT-AVAILABLE-IN-GROUP') . " $menu_group"; } } if ($quantity_available > 0 || $group_available > 0) { $item_availability = " "; if ($menu_display_mode != 'Form') $item_availability = "
"; $item_availability .= "($qty_remaining " . $availablityText . ")"; // if ($_SESSION['UserInfo']['type'] == 'SuperUser') $item_availability .= " $group_sold / $group_available"; } // Setup the order form field if ((($mdate['order_format'] != 'Checkbox' || $menu_item_format == 'Q') && $menu_item_format != 'C') || $concessionOrder == 'Y') { $rstyle = ""; $onclick = ""; if ($linkedMenu) { $rstyle = " background: #E0C0C0"; $onclick = " onclick='alert(\"" . getLanguageText('MSG-LINKED-MENU') . "\")'"; $readonly = " readonly"; $AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Application Volunteer','Schedule Volunteer','Administration Team','Schedule Team','Supplier'); if (checkPermission($AllowedUserTypes) == 1) $onclick = ""; } if (!in_array($_SESSION['UserInfo']['type'],array('SuperUser','System Administrator','Application Administrator','Administration Team','Schedule Team'))) { if ($menu_available == 'N' || $menuDateActive == 'N') { $readonly = " readonly onClick='alert(\"" . getLanguageText('TEXT-NOT-AVAILABLE') . "\");'"; $onclick = ""; } } echo("\n"); if (strlen($readonly) == 0) { if ($qty_remaining <= 0) { $readonly = " readonly onClick='alert(\"" . getLanguageText('TEXT-NOT-AVAILABLE') . "\");'"; $onclick = ""; } } $itemTitle = ""; if (strlen(trim($item_message))) $itemTitle = "title=\"$item_message\" "; $today = date("Y-m-d",time()); echo("\n"); if (strlen($active_until_date) && $active_until_date != '' && $active_until_date != '0000-00-00' && $active_until_date < $today) $readonly = " readonly"; $AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator'); if (checkPermission($AllowedUserTypes) == 1) { $readonly = ""; } $rstyle = ""; if (strlen($readonly)) { echo("\n"); $rstyle = " style='color: #ff0000; background-color: #cccccc;'"; } $qfield = "$groupText$total_ordered"; if (strlen($readonly) == 0) { $qfield = "$groupText$total_ordered" . "" . "" . "" . ""; } if (1 == 2 && strlen($readonly) == 0) { $qfield = "$groupText$total_ordered"; } if ($form_edit_mode == "review") { $qfield = $qtyvalue . "     "; } } else { $rstyle = ""; if ($qtyvalue == 0 && $quantity_available > 0 && $qty_remaining <= 0) { $qfield = ""; $item_price_d = ""; } else { $checked = ""; if ($qtyvalue == 1) $checked = " checked='checked'"; if ($min_quantity > 0) { $checked = " checked='checked'"; if ($qtyvalue == 0) $qtyvalue = 1; } if ($form_edit_mode == "review") { $disabled = $disabled_flag; } if (!in_array($_SESSION['UserInfo']['type'],array('SuperUser','System Administrator','Application Administrator','Administration Team','Schedule Team'))) { if ($menu_available == 'N' || $menuDateActive == 'N') { $disabled = " disabled onClick='alert(\"" . getLanguageText('TEXT-NOT-AVAILABLE') . "\");'"; $onclick = ""; $rstyle = " style='background-color: #FF8080'"; } } $itemTitle = ""; if (strlen(trim($item_message))) $itemTitle = "title=\"$item_message\" "; $qfield = "$groupText$total_ordered" . " "; } } $tabindex++; // // Handle item links based on the $menu_link_code value set previously // - $menu_link_code is set when evaluating order source and linking // if ($menuDateActive == 'Y') { $query = "select hlmi.* " . "from hotlunch_menu_items as hlmi, hotlunch_menu_dates as hlmd " . "where hlmi.school_num = $school_num " . "AND hlmi.active != 'N' " . "and hlmi.current_source_item = $curr_item_num " . "and hlmi.menu_num = hlmd.record_num " . "and menu_link in $menu_link_code " . "and hlmd.school_num = $school_num " . "and hlmd.schedule_num = $schedule_num " . "and hlmd.menu_date >= '$menu_date_cutoff'"; $results = db_query($query); $nrows = db_num_rows($results); if (db_num_rows($results) > 0) { $menu_items_code .= " if (code == '$curr_code') {\n"; $all_menu_items_code .= " updateLinkedItems('$curr_code');\n"; while ($row = db_fetch_array($results)) { $linked_menu_code = $schedule_num . "_" . $row['menu_num']; $linked_code = $linked_menu_code . "_" . $row['record_num']; $linked_qty_field = "qty_$linked_code"; $linked_cb_field = "cb_$linked_code"; $menu_items_code .= " document.orderform.$linked_qty_field.value = document.orderform.qty_$curr_code.value;\n"; // Set checkboxes if required if ($mdate['order_format'] == 'Checkbox' || $row['menu_item_format'] == 'C') { $menu_items_code .= " if (document.orderform.$linked_cb_field) document.orderform.$linked_cb_field.checked = document.orderform.cb_$curr_code.checked;\n"; } $menu_items_code .= " updateLine('$linked_code','$linked_menu_code','Y','N');\n"; } $menu_items_code .= " }\n\n"; } } // Handle item description text $item_description = trim($item_description); if (strlen($item_description)) $item_description = "
\n - $item_description"; // Handle supplier product code if ($mdate['display_supplier_code'] == 'Y') { $product_num = db_getVal("SELECT supplier_product_num FROM hotlunch_menu_products WHERE school_num = $school_num AND menu_item_num = $curr_item_num AND product_sequence = 1"); $supplier_code = ""; if ($product_num > 0) { $supplier_code = db_getVal("SELECT supplier_code FROM supplier_products WHERE school_num = $supplier_school_num AND record_num = $product_num"); } if (strlen($supplier_code) > 1) $item_title = "$supplier_code: $item_title"; } // if ($_SESSION['UserInfo']['type'] == 'SuperUser') $item_title = "$curr_item_num: $item_title"; if (strlen($qtyvalue) == 0) $qtyvalue = '0'; $itemStyle = ""; if (strlen($rowStyle)) $itemStyle = $rowStyle; if ($active == 'N') { $itemStyle = " style='display: none;'"; $heading_class = ""; } // Save menu item data $MenuItems[$MenuItemCount]['itemStyle'] = $itemStyle; $MenuItems[$MenuItemCount]['item_title'] = $item_title; $MenuItems[$MenuItemCount]['label_title'] = $label_title; $MenuItems[$MenuItemCount]['item_availability'] = $item_availability; $MenuItems[$MenuItemCount]['rating_image'] = $rating_image; $MenuItems[$MenuItemCount]['nutrition_image'] = $nutrition_image; $MenuItems[$MenuItemCount]['image_link'] = $image_link; $MenuItems[$MenuItemCount]['item_description'] = $item_description; $MenuItems[$MenuItemCount]['options_code'] = $options_code; $MenuItems[$MenuItemCount]['qfield'] = $qfield; $MenuItems[$MenuItemCount]['item_price_d'] = $item_price_d; $MenuItems[$MenuItemCount]['linespan'] = $linespan; $MenuItems[$MenuItemCount]['line_total'] = $line_total; $MenuItems[$MenuItemCount]['pricefield'] = $pricefield; $MenuItems[$MenuItemCount]['item_price'] = $item_price; $MenuItems[$MenuItemCount]['linetotal'] = $linetotal; $MenuItems[$MenuItemCount]['line_total'] = $line_total; $MenuItems[$MenuItemCount]['linecount'] = $linecount; $MenuItems[$MenuItemCount]['qtyvalue'] = $qtyvalue; $MenuItems[$MenuItemCount]['min_quantity'] = $min_quantity; $MenuItems[$MenuItemCount]['warn_quantity'] = $warn_quantity; $MenuItems[$MenuItemCount]['max_quantity'] = $max_quantity; $MenuItems[$MenuItemCount]['max_quantity_by'] = $max_quantity_by; $MenuItems[$MenuItemCount]['minqty'] = $minqty; $MenuItems[$MenuItemCount]['warnqty'] = $warnqty; $MenuItems[$MenuItemCount]['maxqty'] = $maxqty; $MenuItems[$MenuItemCount]['maxqty_by'] = $maxqty_by; $MenuItems[$MenuItemCount]['family_qty'] = $family_qty; $MenuItems[$MenuItemCount]['item_format'] = $menu_item_format; $MenuItems[$MenuItemCount]['item_num'] = $curr_item_num; $MenuItems[$MenuItemCount]['source_item_num'] = $current_source_num; $MenuItems[$MenuItemCount]['heading_class'] = $heading_class; $MenuItems[$MenuItemCount]['curr_code'] = $curr_code; $MenuItems[$MenuItemCount]['menu_code'] = $menu_code; $MenuItems[$MenuItemCount]['readonly'] = $readonly; if (isset($ordered_by_num) && $ordered_by_num > 0) $user_num = db_getVal("SELECT user_num FROM people WHERE record_num = $ordered_by_num"); if (isset($user_num) && $user_num > 0) { $query = "SELECT sum(qty) FROM hotlunch_order_items AS hloi, people AS p " . "WHERE p.school_num = $base_school_num " . "AND hloi.school_num = $school_num " . "AND p.user_num = $user_num " . "AND p.record_num = hloi.ordered_by_num " . "AND hloi.menu_item_num = $curr_item_num"; $fqty = intval(db_getVal($query)); $MenuItems[$MenuItemCount]['family_quantity'] = $fqty - intval($qtyvalue); } else { $MenuItems[$MenuItemCount]['family_quantity'] = 0; } $MenuItems[$MenuItemCount]['display_price'] = $display_price; $MenuItemCount++; } else { $description = $item_description; if (strlen($item_description) > 0) $item_description = "
\n        $item_description"; $MenuItems[$MenuItemCount]['rowStyle'] = $rowStyle; $MenuItems[$MenuItemCount]['item_title'] = $item_title; $MenuItems[$MenuItemCount]['item_description'] = $item_description; $MenuItems[$MenuItemCount]['description'] = $description; $MenuItems[$MenuItemCount]['item_num'] = $curr_item_num; $MenuItems[$MenuItemCount]['heading_visibility'] = $heading_visibility; $MenuItemCount++; } } $MenuDates[$menu_num]['MenuItems'] = $MenuItems; $MenuDates[$menu_num]['item_count'] = $item_count; unset($MenuTotals); $MenuTotals = array(); // Show a totals box if there are menu items if ($item_count > 0) { $menuspan = "span_$menu_code"; $menutotal = "mtotal_$menu_code"; $menucount = "mcount_$menu_code"; $menu_total = number_format($menu_total,2); if ($menuDateActive == 'Y' && ($schedule_type == 'Hot Lunch' || $schedule_type == 'Date Sensitive') && $check_for_missed_menus == 'Y') { $mtitle = str_replace('"',""",$menu_title); if ($display_menu_date == 'Y') $mtitle .= " - " . date("l F jS, Y",strtotime($mdate['menu_date'])); $form_check_code .= " if (document.orderform.$menucount.value == 0) {\n"; $form_check_code .= " missedMenuCount++;\n"; $form_check_code .= " if (missedMenuCount <= maxMenuCount) {\n"; $form_check_code .= " checkFormMissedDatesMessage += \" - $mtitle\\n\";\n"; $form_check_code .= " }\n"; $form_check_code .= " }\n"; } $MenuTotals['rowStyle'] = $rowStyle; $MenuTotals['menuspan'] = $menuspan; $MenuTotals['menu_total'] = $menu_total; $MenuTotals['menutotal'] = $menutotal; $MenuTotals['menucount'] = $menucount; $MenuTotals['menu_count'] = $menu_count; } $MenuDates[$menu_num]['MenuTotals'] = $MenuTotals; unset($MenuVolunteers); $MenuVolunteers = array(); $MenuDates[$menu_num]['MenuVolunteers'] = $MenuVolunteers; if ($concessionOrder == 'N') { if ($volunteer_signup == 'Y') { $vBox = "volunteer_$menu_code"; $vChecked = ""; $vnum = 0; if (isset($user_num) && $user_num > 0) { $vnum = db_getVal("SELECT count(*) FROM hotlunch_volunteers WHERE school_num = $school_num AND schedule_num = $schedule_num AND menu_num = $menu_num AND user_num = $user_num AND deleted != 'Y'"); if ($vnum == 1) $vChecked = " checked='checked'"; } // Determine the number of volunteers currently registered $numRegistered = db_getVal("SELECT count(*) FROM hotlunch_volunteers WHERE school_num = $school_num AND schedule_num = $schedule_num AND menu_num = $menu_num AND deleted != 'Y'"); if ($form_edit_mode == 'review' || $menuDateActive == 'N' || $numRegistered >= $maxVolunteers) { $vField = 'N'; if ($vnum == 1) $vField = 'Y'; $vField .= ""; } else { $vField = ""; $tabindex++; } if (strlen($volunteerMessage) == 0) $volunteerMessage = getLanguageText('TEXT-DEFAULT-VOLUNTEER-MESSAGE'); $MenuVolunteers['rowStyle'] = $rowStyle; $MenuVolunteers['volunteerMessage'] = $volunteerMessage; $MenuVolunteers['volunteer_msg'] = $volunteer_msg; $MenuVolunteers['numRegistered'] = $numRegistered; $MenuVolunteers['maxVolunteers'] = $maxVolunteers; $MenuVolunteers['vnum'] = $vnum; $MenuVolunteers['vField'] = $vField; $MenuDates[$menu_num]['MenuVolunteers'] = $MenuVolunteers; } } // Generate the group processing code if required if ($groupCount > 0 && $concessionOrder == 'N') { $group_check_code .= " if (mcode == '$menu_code') {\n"; $group_check_code .= " var Atotal = Number(0);\n"; $group_menu_code = ""; // Process each group for ($i = 0; $i < count($groupCodes); $i++) { $gCode = $groupCodes[$i]; $groupItems = $group_items[$gCode]; $groupTotal = $gCode . "total"; $groupSum = "var $groupTotal = "; $currGroup = "group_" . strtolower($gCode); $groupLimit = $mdate[$currGroup]; $Lword = "item"; if ($groupLimit > 1) $Lword = "items"; if (isset($groupLimits[$gCode]) && $groupLimits[$gCode] > 0 && $groupLimits[$gCode] < $groupLimit) $groupLimit = $groupLimits[$gCode]; // If this is group B - E check if A required if ($i > 0) { $aRequiredField = $currGroup . "_a_required"; $aCustomMessage = $currGroup . "_message"; } if (count($groupItems) > 0) { for ($j = 0; $j < count($groupItems); $j++) { $item = $groupItems[$j]; $curr_code = $schedule_num . "_" . $menu_num . "_" . $item; // Code to check the quantities of menu groups $group_check_code .= " var $gCode$j = 0;\n"; $group_check_code .= " if (document.orderform.qty_$curr_code) $gCode$j = Number(document.orderform.qty_$curr_code.value);\n"; $group_complete_code .= " var $gCode$j = 0;\n"; $group_complete_code .= " if (document.orderform.qty_$curr_code) $gCode$j = Number(document.orderform.qty_$curr_code.value);\n"; if ($j > 0) $groupSum .= " + "; $groupSum .= "$gCode$j"; $group_menu_code .= " if (code == '$curr_code') {\n"; if ($gCode == 'A') { $group_menu_code .= " if (Atotal == 0) {\n"; for ($m = 1; $m < count($groupCodes); $m++) { $codeTemp = $groupCodes[$m]; $groupTemp = $group_items[$codeTemp]; $requiredTemp = "group_" . strtolower($codeTemp) . "_a_required"; if ($mdate[$requiredTemp] == 'Y' && count($groupTemp) > 0) { for ($n = 0; $n < count($groupTemp); $n++) { $item_temp = $groupTemp[$n]; $temp_code = $schedule_num . "_" . $menu_num . "_" . $item_temp; $group_menu_code .= " document.orderform.qty_$temp_code.value = 0;\n"; // $group_menu_code .= " document.orderform.ltotal_$temp_code.value = 0;\n"; // $group_menu_code .= " document.orderform.lcount_$temp_code.value = 0;\n"; $group_menu_code .= " updateLine('$temp_code','$menu_code','N','Y');\n"; } } } $group_menu_code .= " updateLine('$curr_code','$menu_code','N','Y');\n"; $group_menu_code .= " }\n\n"; } // Code to prevent someone from ordering unless at least one group A has been ordered if ($mdate[$aRequiredField] == 'Y') { $g_message = getLanguageText('TEXT-GROUP-A-FIRST') . " $gCode"; if (strlen($mdate[$aCustomMessage])) $g_message = $mdate[$aCustomMessage]; $group_menu_code .= " if (Atotal == 0 && document.orderform.qty_$curr_code.value > 0) {\n"; $group_menu_code .= " document.orderform.qty_$curr_code.value = '';\n"; if ($mdate['order_format'] == 'Checkbox') { $group_menu_code .= " document.orderform.cb_$curr_code.checked = false;\n"; } $g_message = str_replace('"','\"',$g_message); $group_menu_code .= " alert(\"$g_message\");\n"; $group_menu_code .= " return;\n"; $group_menu_code .= " }\n\n"; } // Ensure that group B,C,D... items are not more than group A items for ($n = 0; $n < count($groupCodes); $n++) { $gCode2 = $groupCodes[$n]; if ($gCode2 == 'A') continue; $groupArrayCode = "group_" . strtolower($gCode2); $aRequiredField2 = $groupArrayCode . "_a_required"; $numGroupItems = db_getVal("SELECT count(*) FROM hotlunch_menu_items WHERE school_num = $school_num AND menu_num = $menu_num AND active != 'N' AND menu_group = '$gCode2'"); if ($numGroupItems > 0 && $mdate[$aRequiredField2] == 'Y' && $mdate[$groupArrayCode] == 0) { $g_quantity = sprintf(getLanguageText('TEXT-GROUP-QTY-ERROR'),$gCode2); $group_menu_code .= " if (Atotal > 0 && " . $gCode2 . "total > Atotal) {\n"; $group_menu_code .= " document.orderform.qty_$curr_code.value = '';\n"; $group_menu_code .= " if (document.orderform.cb_$curr_code.checked) {\n"; $group_menu_code .= " document.orderform.cb_$curr_code.checked = false;\n"; $group_menu_code .= " }\n"; $group_menu_code .= " alert(\"$g_quantity\");\n"; $group_menu_code .= " return;\n"; $group_menu_code .= " }\n\n"; } } // Code to manage group quantity limits if ($groupLimit > 0) { $g_limit = sprintf(getLanguageText('TEXT-GROUP-LIMIT'),$groupLimit) . " $gCode"; $customMsgField = "group_" . strtolower($gCode) . "_max_message"; if (strlen($mdate[$customMsgField])) $g_limit = $mdate[$customMsgField]; $group_menu_code .= " if ($groupTotal > $groupLimit) {\n"; $group_menu_code .= " document.orderform.qty_$curr_code.value = '';\n"; if ($mdate['order_format'] == 'Checkbox') { $group_menu_code .= " document.orderform.cb_$curr_code.checked = false;\n"; } $group_menu_code .= " alert(\"$g_limit\");\n"; $group_menu_code .= " }\n"; } $group_menu_code .= " }\n"; } $group_check_code .= " $groupSum;\n"; $group_complete_code .= " $groupSum;\n"; if ($gCode == 'A') { if ($mdate['group_a_min'] > 0) { $min = $mdate['group_a_min']; $msg = getLanguageText('ERRORMSG-NO-ITEMS-SELECTED') . "\\n-- " . $mdate['menu_title'] . " --"; $group_complete_code .= " if ($groupTotal < $min) {\n"; $group_complete_code .= " alert(\"$msg\");\n"; $group_complete_code .= " return(false);\n"; $group_complete_code .= " }\n"; } } } } $group_check_code .= "\n$group_menu_code"; $group_check_code .= " }\n\n"; // Setup code to check if the mandatory groups have been entered $groupMandatory = false; // Process each group for ($i = 1; $i < count($groupCodes); $i++) { $mandatoryCode = "group_" . strtolower($groupCodes[$i]) . "_mandatory"; if ($mdate[$mandatoryCode] == 'Y') $groupMandatory = true; } // If there is a mandatory group in this menu if ($groupMandatory == true) { $mtitle = str_replace("'","\'",$menu_title); if ($display_menu_date == 'Y') $mtitle .= " - " . date("l F jS, Y",strtotime($mdate['menu_date'])); $group_complete_code .= " if (Atotal > 0) {\n"; for ($i = 1; $i < count($groupCodes); $i++) { $mandatoryCode = "group_" . strtolower($groupCodes[$i]) . "_mandatory"; $groupLimit = $mdate["group_" . strtolower($groupCodes[$i])]; if ($mdate[$mandatoryCode] == 'Y') { // if ($groupLimit == 0) $group_complete_code .= " if (" . $groupCodes[$i] . "total < Atotal) {\n"; // else $group_complete_code .= " if (" . $groupCodes[$i] . "total < $groupLimit) {\n"; if ($groupLimit == 0) { $group_complete_code .= " if (" . $groupCodes[$i] . "total < Atotal) {\n"; $group_complete_code .= " msg = '" . getLanguageText('MESSAGE-INCOMPLETE-ORDER-GROUPS') . "'+'\\n - '+'$mtitle';\n"; $group_complete_code .= " alert(msg);\n"; $group_complete_code .= " return false;\n"; $group_complete_code .= " }\n"; } else { $group_complete_code .= " if (" . $groupCodes[$i] . "total < 1) {\n"; $group_complete_code .= " msg = '" . getLanguageText('MESSAGE-INCOMPLETE-ORDER-GROUPS') . "'+'\\n - '+'$mtitle';\n"; $group_complete_code .= " alert(msg);\n"; $group_complete_code .= " return false;\n"; $group_complete_code .= " }\n"; } } } $group_complete_code .= " }\n"; } } } // // Display calendar form menus // if ($menu_display_mode == 'Calendar' || $menu_display_mode == 'Calendar No Weekends') { $dayNames = array( getLanguageText('TEXT-SUNDAY'), getLanguageText('TEXT-MONDAY'), getLanguageText('TEXT-TUESDAY'), getLanguageText('TEXT-WEDNESDAY'), getLanguageText('TEXT-THURSDAY'), getLanguageText('TEXT-FRIDAY'), getLanguageText('TEXT-SATURDAY') ); writeLog("firstMenuDate: $firstMenuDate"); writeLog("lastMenuDate: $lastMenuDate"); $firstDateTime = strtotime($firstMenuDate); $lastDateTime = strtotime($lastMenuDate); $firstCalendarMonth = date("n",$firstDateTime); $lastCalendarMonth = date("n",$lastDateTime); $currYear = date("Y",$firstMenuDate); $currMonth = $firstCalendarMonth; $currMonthDate = date("Y-m-01",$firstDateTime); $currDateTime = $firstDateTime; $currMonthYear = date("Y-m",$firstDateTime); $lastMonthYear = date("Y-m",$lastDateTime); $monthBreak = true; if ($calendar_month_breaks != 'Y') $monthBreak = false; if ($school_num == 18493 || $school_num == 18494) $monthBreak = false; $monthNum = 1; $monthSpanned = false; $EventCount = 0; $query = "select count(*) " . "from event_calendar " . "where school_num = $school_num " . "and status = 'Approved' " . "and display = 'Active' " . "and start_date <= '$firstMenuDate' and '$lastMenuDate' <= end_date"; $EventCount = db_getVal($query); $RegularMenus = array(); $query = "SELECT menu_date,record_num FROM hotlunch_menu_dates " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "AND menu_type = 'Regular' " . "ORDER BY sequence,menu_date"; while ($row = db_fetch_assoc($results)) { $RegularMenus[$row['menu_date']][] = $row['record_num']; } while ($currMonthYear <= $lastMonthYear) { $currMonthTime = strtotime("$currMonthYear-01"); $currMenuDate = date("Y-m-d",$currMonthTime); $futureMenuDates = db_getVal("SELECT count(*) FROM hotlunch_menu_dates " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "AND menu_date >= '$currMenuDate' " . "AND menu_type = 'Regular'"); if ($futureMenuDates == 0 && $monthBreak == false) break; $monthTitle = date("F Y",$currMonthTime); $cols = 7; $colwidth = '14%'; if ($menu_display_mode == 'Calendar No Weekends') { $cols = 5; $colwidth = '20%'; } if ($monthBreak == false) $monthTitle = $schedule_name; if ($monthBreak || $monthNum == 1) { ?> \n"); for ($dow = 0; $dow < 7; $dow++) { $dayOfWeek = $dayNames[$dow]; if ($menu_display_mode == 'Calendar No Weekends' && ($dow == 0 || $dow == 6)) continue; ?> \n"); } $monthNum++; // Display calendar dates $startDOW = date("w",$currMonthTime); $currCalendarDateTime = $currMonthTime - $startDOW * 60 * 60 * 24 + 60 * 60 * 2; $startWeek = 0; if ($monthSpanned) { $startWeek = 1; $currCalendarDateTime += 60 * 60 * 24 * 7; if (date("d",$currCalendarDateTime) > '07') $currCalendarDateTime = $currMonthTime - 7 * 60 * 60 * 24 + 60 * 60 * 2; } $monthSpanned = false; for ($Week = $startWeek; $Week <= 6; $Week++) { if ($currCalendarDateTime >= $lastDateTime) { $Week = 7; $currMonthYear = $lastMonthYear + 1; $currMonthTime = $lastDateTime; break; } // Check if there are any menus this week if ($menu_display_mode == 'Calendar No Weekends') { $menusThisWeek = false; $wtime = $currCalendarDateTime; for ($dow = 0; $dow < 7; $dow++) { $menu_date = date("Y-m-d",$wtime); if (date("n",$wtime) != date("n",$currMonthTime)) { $wtime = strtotime(date("Y-m-d",$wtime + 60 * 60 * 25)); continue; } $query = "SELECT record_num FROM hotlunch_menu_dates " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "AND menu_date = '$menu_date' " . "AND menu_type = 'Regular' " . "ORDER BY sequence,menu_date LIMIT 0,1"; $menu_num = db_getVal($query); if (isset($menu_num)) { writeLog("menu_num: $menu_num"); writeLog("MenuDates[$menu_num]['menu_date']: " .$MenuDates[$menu_num]['menu_date']); if ($MenuDates[$menu_num]['menu_date'] == $menu_date) $menusThisWeek = true; } $wtime = strtotime(date("Y-m-d",$wtime + 60 * 60 * 25)); } if (!$menusThisWeek) { $currCalendarDateTime = $wtime; if (date("n",$currCalendarDateTime) > date("n",$currMonthTime)) break; if (date("Y",$currCalendarDateTime) > date("Y",$currMonthTime)) break; continue; } } echo(" \n"); for ($dow = 0; $dow < 7; $dow++) { if ($menu_display_mode == 'Calendar No Weekends' && ($dow == 0 || $dow == 6)) { $currCalendarDateTime = strtotime(date("Y-m-d",$currCalendarDateTime + 60 * 60 * 25)); continue; } $currCalendarDate = dateString('shortdate',$currCalendarDateTime); $menu_date = date("Y-m-d",$currCalendarDateTime); $tdclass = "calendar-date"; $dtclass = "caldate"; $currMonthFlag = true; if (date("n",$currCalendarDateTime) != date("n",$currMonthTime)) { if ($monthBreak) { $tdclass = "non-current-date"; $dtclass = "noncaldate"; $currMonthFlag = false; } else { $monthSpanned = true; if ($menu_display_mode == 'Calendar') $Week = 0; } } else { if (date("Y-m-d",$currCalendarDateTime) < date("Y-m-d",time())) { $tdclass .= " calendar-date-past"; } } // Display calendar cell echo(" \n"); $currCalendarDateTime = strtotime(date("Y-m-d",$currCalendarDateTime + 60 * 60 * 25)); } echo(" \n"); if (date("n",$currCalendarDateTime) > date("n",$currMonthTime)) { if ($monthBreak) break; else $monthSpanned = true; } if (date("Y",$currCalendarDateTime) > date("Y",$currMonthTime)) break; } if ($monthBreak) { ?>
$currCalendarDate
\n"); // Check event calendar for events on this date if ($school_record['system_configuration'] == 'Full' && $EventCount > 0) { $query = "select ec.* " . "from event_calendar as ec, event_types as et " . "where ec.school_num = $school_num " . "and et.school_num = $school_num " . "and ec.event_type = et.event_type_title " . "and et.display_on_order_form = 'Y' " . "and ec.status = 'Approved' " . "and ec.display = 'Active' " . "and start_date <= '$menu_date' and '$menu_date' <= end_date " . "order by start_date,end_date,title"; $events = db_query($query); if (db_num_rows($events)) { while ($row = db_fetch_array($events)) { // Handle event type colors $sspan = ""; $espan = ""; $event_type = $row['event_type']; $results = db_query("SELECT * FROM event_types WHERE school_num = $school_num AND event_type_title = '" . db_escape_string($event_type) . "'"); if (db_num_rows($results) > 0) { $erow = db_fetch_array($results); $sspan = ""; $espan = ""; } echo("$sspan" . $row['title'] . "$espan
"); } } } $menuDate = $menu_date; $query = "SELECT record_num,menu_link,current_menu_link FROM hotlunch_menu_dates " . "WHERE school_num = $school_num " . "AND schedule_num = $schedule_num " . "AND menu_date = '$menu_date' " . "AND menu_type = 'Regular' " . "ORDER BY sequence,menu_date"; writeLog($query); $menu_dates = db_query($query); while ($row = db_fetch_assoc($menu_dates)) { $menu_num = $row['record_num']; $mLink = $row['menu_link']; $mLink = $row['current_menu_link']; if ($currMonthFlag && $MenuDates[$menu_num]['menu_date'] == $menu_date) { extract($MenuDates[$menu_num]); // Display menu items for current date if (count($MenuItems)) { $qclass = ""; $tclass = ""; if ($menu_active == 'N') { $qclass = " calitem-past"; $tclass = 'menudate-past'; } $ext = ""; if (($mLink == 'Paper' && $source == 'Paper') || $mLink == 'All') $tclass = 'menudate-linked'; if (strlen($menu_title) && $schedule_record['display_menu_title'] == 'Y') echo("$menu_title $ext\n"); if (strlen($menu_instructions) > 0) { echo("" . nl2br($menu_instructions) . "\n"); } echo(" \n"); for ($i = 0; $i < count($MenuItems); $i++) { extract($MenuItems[$i]); if ($item_type != 'Heading') { $item_price_info = ""; if ($schedule_record['display_item_price'] == 'Y' && $display_price != 'N') $item_price_info = "
-- $currencySymbol".number_format($item_price,2).""; $display_title = $label_title; $ItemTitle = str_replace('"',""",$item_title); ?> class=''> > 0) { extract($MenuVolunteers); if (strlen($volunteerMessage) > 0) { if ($numRegistered < $maxVolunteers || $vnum > 0) { $vfont = $school_record['volunteer_msg_font']; $vcolor = $school_record['volunteer_msg_color']; if (strlen($vfont)) $vfont = " style='font: $vfont;'"; if (strlen($vcolor)) $vcolor = " style='background: #$vcolor;'"; ?> > 0) { extract($MenuTotals); ?> \n"); } else { echo("
:   
\n"); echo(" \n"); echo("
\n"); // echo("$menu_title
\n"); } } } echo("


0) { $displayFooterMenus = true; } // // Display menu form // if ($menu_display_mode == 'Form' || $displayFooterMenus) { ?> $val) { extract($MenuDates[$menu_num]); // If displaying Footer menus do not display regular menus if ($menu_display_mode != 'Form' && $displayFooterMenus && $menu_type == 'Regular') continue; ?> > $item_title"; if ($item_price != 0.00) $priceVal = true; $priceSpan = ""; $qcolSpan = 1; if ($schedule_prices == 'N') { $priceSpan = ""; $qcolSpan = 3; } $readonlyflag = ""; if (strlen($readonly)) $readonlyflag = "readonly"; ?> class=''> [hide]"; if ($heading_visibility == 'hidden') { $control = "[show]"; } ?> class='menu-subheading'> 0) { extract($MenuTotals); $currRowStyle = $rowStyle; if ($priceVal == false) $currRowStyle = " class='invisible'"; ?> > 0) { extract($MenuVolunteers); if (strlen($volunteerMessage) > 0) { if ($numRegistered < $maxVolunteers || $vnum > 0) { $vfont = $school_record['volunteer_msg_font']; $vcolor = $school_record['volunteer_msg_color']; if (strlen($vfont)) $vfont = " style='font: $vfont;'"; if (strlen($vcolor)) $vcolor = " style='background: #$vcolor;'"; ?> > >
0) { ?>
$item_title$item_availability$rating_image") ?> > "); } ?>
  0.00) echo($school_record['currency_symbol'] . $menu_total) ?>
 
0) $ordertotal = $ordertotal - $discount_amount; // Table for footer fields and buttons ?> 0) { ?>
::
 
::
 
$::
: 0) echo($school_record['currency_symbol'] . number_format($discount_amount,2)) ?>
: 0.00) echo($school_record['currency_symbol'] . number_format($ordertotal,2)) ?>

"; $startTable = " \n"; $numDocs = 0; while ($row = db_fetch_array($schedule_docs)) { $doc_num = $row['record_num']; $query = "select * from documents " . "where school_num = $school_num " . "and record_num = $doc_num"; $results = db_query($query); if (db_num_rows($results)) { $r = db_fetch_array($results); $fname = $r['file_name']; $doc_title = "" . $row['title'] . ""; if (strlen($row['description'])) $doc_title .= "
\n" . $row['description']; $link = "$view_icon"; echo($startTable); echo(" \n"); echo(" \n"); echo(" \n"); echo(" \n"); $startTable = ""; $numDocs++; } } if ($numDocs > 0) { echo("
$doc_title$link
\n"); echo("
\n"); } } if ($form_edit_mode == "edit") { if (isset($defaultOrder)) { $classes = db_query("SELECT * FROM classes WHERE school_num = $base_school_num ORDER BY sequence"); $numRows = db_num_rows($classes); if ($numRows > 10) $numRows = 10; ?>

value="">