\n");
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
return;
}
if (array_key_exists('schedule_num',$_GET)) $schedule_num = intval($_GET['schedule_num']);
if (array_key_exists('order_num',$_GET)) $order_num = intval($_GET['order_num']);
if (!isset($order_num)) {
echo("
\n");
$error_message = "Missing Order Number";
include "form.messages.php";
return;
}
// Calculate the order cost
$query = "select sum(hloi.qty * hlmp.supplier_product_qty * (sp.package_cost / sp.package_qty)) as cost " .
"from hotlunch_order_items as hloi, hotlunch_menu_products as hlmp, supplier_products as sp " .
"where hloi.school_num = $school_num " .
"and hlmp.school_num = $school_num " .
"and sp.school_num = $supplier_school_num " .
"and hloi.order_num = $order_num " .
"and hloi.schedule_num = $schedule_num " .
"and hloi.menu_item_num = hlmp.menu_item_num " .
"and hlmp.supplier_product_num = sp.record_num";
$order_cost = doubleval(db_getVal($query));
db_query("UPDATE hotlunch_order_header SET order_cost = $order_cost WHERE record_num = $order_num");
// Get the order header record
$query = "select * from hotlunch_order_header " .
"where school_num = $school_num " .
"and schedule_num = $schedule_num " .
"and record_num = $order_num";
$results = db_query($query);
if (db_num_rows($results) == 0) {
echo("
\n");
$error_message = "Order Not Found";
include "form.messages.php";
return;
}
$header = db_fetch_array($results);
extract($header);
// Get person's name
if ($ordered_by_type == 'Student') {
$query = "select concat_ws(' ',first_name,last_name) from people " .
"where school_num = $base_school_num " .
"and people_type = 'Student' " .
"and record_num = $ordered_by_num";
}
else {
$query = "select concat_ws(' ',first_name,last_name) from people " .
"where school_num = $base_school_num " .
"and people_type = 'Staff' " .
"and record_num = $ordered_by_num";
}
$name = db_getVal($query);
// Get the userid of the person who entered this order
$entered_by_id = db_getVal("SELECT userid FROM users WHERE school_num = $base_school_num AND record_num = $entered_by");
?>