517 lines
21 KiB
PHP
517 lines
21 KiB
PHP
<?php
|
|
$ValidAccess = 2010;
|
|
require_once("include/globals.php");
|
|
|
|
|
|
// if ($_SESSION['UserInfo']['type'] == 'SuperUser') startLog("hotlunch.order_details.csv.php");
|
|
|
|
//
|
|
// Ensure that the user is logged in
|
|
//
|
|
if (SessionActive() != 1 || !UserLoggedIn()) {
|
|
header("Location: /?action=order-details&schedule_num=$schedule_num&menu_num=$menu_num&error_code=NOACCESS");
|
|
exit();
|
|
}
|
|
|
|
|
|
// Check permissions
|
|
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Application Volunteer','Schedule Volunteer','Administration Team','Schedule Team','Supplier');
|
|
if (checkPermission($AllowedUserTypes) != 1) {
|
|
header("Location: /?action=order-details&schedule_num=$schedule_num&menu_num=$menu_num&error_code=NOACCESS");
|
|
exit();
|
|
}
|
|
|
|
|
|
if (array_key_exists('reseller_school',$_GET)) $reseller_school = intval($_GET['reseller_school']);
|
|
if (array_key_exists('reseller_menu_num',$_GET)) $reseller_menu_num = intval($_GET['reseller_menu_num']);
|
|
|
|
if (isset($reseller_school)) writeLog("reseller_school: $reseller_school");
|
|
if (isset($reseller_menu_num)) writeLog("reseller_menu_num: $reseller_menu_num");
|
|
|
|
if (isset($reseller_school) && isset($reseller_menu_num)) {
|
|
$school_num = $reseller_school;
|
|
$base_school_num = $reseller_school;
|
|
$menu_num = $reseller_menu_num;
|
|
|
|
$query = "SELECT * FROM schools WHERE record_num = $school_num";
|
|
writeLog($query);
|
|
$results = db_query($query);
|
|
$school_record = db_fetch_assoc($results);
|
|
|
|
$schedule_num = db_getVal("SELECT schedule_num FROM hotlunch_menu_dates WHERE school_num = $reseller_school AND record_num = $menu_num");
|
|
|
|
writeLog("school_num: $school_num");
|
|
writeLog("menu_num: $menu_num");
|
|
writeLog("schedule_num: $schedule_num");
|
|
writeLog("school: ".$school_record['school_name']);
|
|
writeLog("logo: ".$school_record['logo_image']);
|
|
|
|
$query = "SELECT schedule_num FROM hotlunch_menu_dates WHERE school_num = $reseller_school AND record_num = $reseller_menu_num";
|
|
writeLog($query);
|
|
$schedule_num = db_getVal($query);
|
|
|
|
$query = "SELECT * FROM form_defaults WHERE school_num = $school_num AND action = 'order-details'";
|
|
writeLog($query);
|
|
$results = db_query($query);
|
|
while ($row = db_fetch_array($results)) {
|
|
$fname = $row['field'];
|
|
$$fname = $row['default_value'];
|
|
writeLog("$fname: ".$$fname);
|
|
}
|
|
if (isset($report_sort)) writeLog("report_sort: $report_sort");
|
|
}
|
|
|
|
|
|
|
|
//
|
|
// Get and validate the parameters
|
|
//
|
|
if (array_key_exists('schedule_num',$_POST)) $schedule_num = intval($_POST['schedule_num']);
|
|
if (array_key_exists('menu_num',$_POST)) $menu_num = intval($_POST['menu_num']);
|
|
if (array_key_exists('document_format',$_POST)) $document_format = $_POST['document_format'];
|
|
if (array_key_exists('report_sort',$_POST)) $report_sort = $_POST['report_sort'];
|
|
if (array_key_exists('display_payment_status',$_POST)) $display_payment_status = $_POST['display_payment_status'];
|
|
if (array_key_exists('display_contact_details',$_POST)) $display_contact_details = $_POST['display_contact_details'];
|
|
if (array_key_exists('include_people',$_POST)) $include_people = db_escape_string($_POST['include_people']);
|
|
if (array_key_exists('contactInfo', $_POST)) $contactInfo = $_POST['contactInfo'];
|
|
if (array_key_exists('studentInfo', $_POST)) $studentInfo = $_POST['studentInfo'];
|
|
if (array_key_exists('studentName', $_POST)) $studentName = $_POST['studentName'];
|
|
if (array_key_exists('printTotals', $_POST)) $printTotals = $_POST['printTotals'];
|
|
if (array_key_exists('selectedClasses', $_POST) && is_array($_POST['selectedClasses']) && count($_POST['selectedClasses'])) $selectedClasses = $_POST['selectedClasses'];
|
|
|
|
|
|
$orderStatus = 'Active';
|
|
if (isset($_POST['orderStatus'])) $orderStatus = $_POST['orderStatus'];
|
|
|
|
|
|
if (!isset($schedule_num)) {
|
|
header("Location: /?action=order-details&schedule_num=$schedule_num&menu_num=$menu_num&error_code=NOSCHED");
|
|
exit();
|
|
}
|
|
|
|
if (!isset($menu_num)) {
|
|
header("Location: /?action=order-details&schedule_num=$schedule_num&menu_num=$menu_num&error_code=NOMENU");
|
|
exit();
|
|
}
|
|
|
|
writeLog("school_num: $school_num");
|
|
if (isset($reseller_school)) writeLog("reseller_school: $reseller_school");
|
|
writeLog("schedule_num: $schedule_num");
|
|
writeLog("menu_num: $menu_num");
|
|
|
|
|
|
// Update form defaults
|
|
$formFields = array('document_format',
|
|
'report_sort',
|
|
'display_payment_status',
|
|
'display_contact_details',
|
|
'contactInfo',
|
|
'studentInfo',
|
|
'studentName',
|
|
'display_user_data',
|
|
'orderStatus',
|
|
'display_details',
|
|
'printTotals',
|
|
'include_people',
|
|
'fontSize',
|
|
'titleHighlights',
|
|
'include_allergy_info');
|
|
if (!isset($reseller_school) && !isset($reseller_menu_num)) {
|
|
for ($i = 0; $i < count($formFields); $i++) {
|
|
$fname = $formFields[$i];
|
|
$value = isset($_POST[$fname]) ? $_POST[$fname] : '';
|
|
$value = db_escape_string($value);
|
|
db_query("INSERT INTO form_defaults VALUES ($school_num,'order-details','$fname','$value') ON DUPLICATE KEY UPDATE default_value = '$value'");
|
|
writeLog("$fname: $value");
|
|
}
|
|
}
|
|
|
|
|
|
// Check if this is a valid schedule
|
|
$query = "select * from hotlunch_schedules " .
|
|
"where school_num = $school_num " .
|
|
"and record_num = $schedule_num";
|
|
writeLog($query);
|
|
$results = db_query($query);
|
|
|
|
if (db_num_rows($results) == 0) {
|
|
header("Location: /?action=order-details&schedule_num=$schedule_num&menu_num=$menu_num&error_code=INVALIDSCHED");
|
|
exit();
|
|
}
|
|
|
|
$hotlunch_schedule = db_fetch_array($results);
|
|
$schedule_name = $hotlunch_schedule['schedule_name'];
|
|
writeLog($schedule_name);
|
|
|
|
|
|
// If this is a ScheduleTeam user check if they have permission to access this schedule
|
|
if (in_array($_SESSION['UserInfo']['type'],array('Schedule Team','Schedule Volunteer'))) {
|
|
$userNum = intval($_SESSION['UserInfo']['record_num']);
|
|
$access = db_getVal("SELECT count(*) FROM hotlunch_schedules_people WHERE school_num = $school_num AND schedule_num = $schedule_num AND user_num = $userNum");
|
|
|
|
if (!$access || $access == 0) {
|
|
header("Location: /?action=order-details&schedule_num=$schedule_num&menu_num=$menu_num&error_code=NOACCESS");
|
|
exit();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Check if this is a valid menu
|
|
$query = "select * from hotlunch_menu_dates " .
|
|
"where school_num = $school_num " .
|
|
"and schedule_num = $schedule_num " .
|
|
"and record_num = $menu_num";
|
|
writeLog($query);
|
|
$results = db_query($query);
|
|
|
|
if (db_num_rows($results) == 0) {
|
|
header("Location: /?action=order-details&schedule_num=$schedule_num&menu_num=$menu_num&error_code=INVALIDMENU");
|
|
exit();
|
|
}
|
|
|
|
$hotlunch_menu_date = db_fetch_array($results);
|
|
$menu_title = $hotlunch_menu_date['menu_title'];
|
|
$menu_date = date("D M j Y",strtotime($hotlunch_menu_date['menu_date']));
|
|
writeLog("menu_title: $menu_title");
|
|
writeLog("menu_date: $menu_date");
|
|
|
|
|
|
// Determine which items have been selected
|
|
$selected_items = array();
|
|
$query = "select * from hotlunch_menu_items " .
|
|
"where school_num = $school_num " .
|
|
"and menu_num = $menu_num " .
|
|
"order by sequence";
|
|
writeLog($query);
|
|
$results = db_query($query);
|
|
|
|
while ($row = db_fetch_array($results)) {
|
|
$record_num = $row['record_num'];
|
|
if (array_key_exists("item_$record_num", $_POST) && $_POST["item_$record_num"] == 'Y') $selected_items[] = $record_num;
|
|
else {
|
|
if (isset($reseller_school)) $selected_items[] = $record_num;
|
|
}
|
|
}
|
|
|
|
if (count($selected_items) == 0) {
|
|
header("Location: /?action=order-details&schedule_num=$schedule_num&menu_num=$menu_num&error_code=NOITEMS");
|
|
exit();
|
|
}
|
|
|
|
|
|
$school_name = $school_record['school_name'];
|
|
|
|
|
|
$numClasses = db_getVal("SELECT count(*) FROM classes WHERE school_num = $base_school_num");
|
|
if ($numClasses == 0) {
|
|
db_query("UPDATE people SET class_num = 3, meal_location = 1 WHERE school_num = $base_school_num AND people_type = 'Student'");
|
|
}
|
|
|
|
|
|
//
|
|
// Orders to print
|
|
//
|
|
$items = implode(',',$selected_items);
|
|
writeLog("items: $items");
|
|
|
|
$groupByClass = true;
|
|
$order_by = "sequence,ordered_by_type desc,last_name,first_name";
|
|
|
|
if (isset($report_sort)) {
|
|
switch ($report_sort) {
|
|
case 'byClass':
|
|
$order_by = "sequence,ordered_by_type desc,last_name,first_name";
|
|
break;
|
|
|
|
case 'byGrade':
|
|
$order_by = "grade,ordered_by_type desc,last_name,first_name";
|
|
$groupByClass = false;
|
|
break;
|
|
|
|
case 'byStudent':
|
|
$order_by = "last_name,first_name";
|
|
$groupByClass = false;
|
|
break;
|
|
|
|
case 'byEnteredDate':
|
|
$order_by = "added_date,record_num";
|
|
$groupByClass = false;
|
|
break;
|
|
|
|
case 'byPaidDate':
|
|
$order_by = "paid_date,record_num";
|
|
$groupByClass = false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
// Setup order status where clause
|
|
$owhere = "and hloh.status not in ('Inactive','Deleted') ";
|
|
if ($orderStatus == 'Any') $owhere = "and hloh.status != 'Deleted' ";
|
|
|
|
// Check for meal locations
|
|
$ClassNumField = "class_num";
|
|
if ($school_record['implement_meal_locations'] == 'Y' && $hotlunch_schedule['class_sort_field'] == 'D' || $hotlunch_schedule['class_sort_field'] == 'L') {
|
|
$ClassNumField = "meal_location";
|
|
$query = "UPDATE people SET meal_location = class_num WHERE school_num = $school_num AND meal_location IS NULL";
|
|
db_query($query);
|
|
}
|
|
|
|
|
|
// Get all orders for this menu date
|
|
if ($include_people == 'All Orders') {
|
|
if ($school_record['staff_meals_to_classroom'] != 'N') {
|
|
$query = "select distinct hloi.ordered_by_num,hloi.ordered_by_type,hloh.added_date,hloh.paid_date,p.first_name,p.last_name,p.$ClassNumField AS class_num," .
|
|
"c.division,c.sequence,c.grade,hloi.order_num,p.user_num,delivered,hloh.order_notes,hloh.order_notes2,hloh.record_num " .
|
|
"from hotlunch_order_header as hloh, hotlunch_order_items as hloi, hotlunch_menu_items as hlmi, " .
|
|
"people as p left join classes as c on c.school_num = $base_school_num and p.$ClassNumField = c.record_num left join people as p1 on c.teacher1 = p1.record_num " .
|
|
"where hloh.record_num = hloi.order_num " .
|
|
$owhere .
|
|
"and hloi.ordered_by_num = p.record_num " .
|
|
"and hloi.school_num = $school_num " .
|
|
"and hlmi.school_num = $school_num " .
|
|
"and p.school_num = $base_school_num " .
|
|
"and hloi.menu_item_num in ($items) " .
|
|
"and hloi.menu_item_num = hlmi.record_num " .
|
|
"and hloi.active != 'N' " .
|
|
"order by $order_by";
|
|
}
|
|
else {
|
|
$query = "select distinct hloi.ordered_by_num,hloi.ordered_by_type,hloh.added_date,hloh.paid_date,p.first_name,p.last_name,0 as class_num," .
|
|
"0 as division,0 as sequence,0 as grade,hloi.order_num,p.user_num,delivered,hloh.order_notes,hloh.order_notes2,hloh.record_num " .
|
|
"from hotlunch_order_header as hloh, hotlunch_order_items as hloi, hotlunch_menu_items as hlmi, " .
|
|
"people as p left join classes as c on c.school_num = $base_school_num and p.$ClassNumField = c.record_num left join people as p1 on c.teacher1 = p1.record_num " .
|
|
"where hloh.record_num = hloi.order_num " .
|
|
$owhere .
|
|
"and hloi.ordered_by_num = p.record_num " .
|
|
"and hloi.school_num = $school_num " .
|
|
"and hlmi.school_num = $school_num " .
|
|
"and p.school_num = $base_school_num " .
|
|
"and hloi.menu_item_num in ($items) " .
|
|
"and hloi.menu_item_num = hlmi.record_num " .
|
|
"and hloi.ordered_by_type = 'Staff' " .
|
|
"and hloi.active != 'N' " .
|
|
"UNION " .
|
|
"select distinct hloi.ordered_by_num,hloi.ordered_by_type,hloh.added_date,hloh.paid_date,p.first_name,p.last_name,p.$ClassNumField as class_num," .
|
|
"c.division,c.sequence,c.grade,hloi.order_num,p.user_num,delivered,hloh.order_notes,hloh.order_notes2,hloh.record_num " .
|
|
"from hotlunch_order_header as hloh, hotlunch_order_items as hloi, hotlunch_menu_items as hlmi, " .
|
|
"people as p left join classes as c on c.school_num = $base_school_num and p.$ClassNumField = c.record_num left join people as p1 on c.teacher1 = p1.record_num " .
|
|
"where hloh.record_num = hloi.order_num " .
|
|
$owhere .
|
|
"and hloi.ordered_by_num = p.record_num " .
|
|
"and hloi.school_num = $school_num " .
|
|
"and hlmi.school_num = $school_num " .
|
|
"and p.school_num = $base_school_num " .
|
|
"and hloi.menu_item_num in ($items) " .
|
|
"and hloi.menu_item_num = hlmi.record_num " .
|
|
"and hloi.ordered_by_type IN ('Student','Customer') " .
|
|
"and hloi.active != 'N' " .
|
|
"order by $order_by";
|
|
}
|
|
}
|
|
else {
|
|
$query = "SELECT distinct p.record_num AS ordered_by_num,p.people_type AS ordered_by_type,hloh.added_date,hloh.paid_date,p.first_name,p.last_name,p.$ClassNumField AS class_num,c.division,c.sequence," .
|
|
"c.grade,hloi.order_num,p.user_num,delivered,hloh.order_notes,hloh.order_notes2,hloh.record_num " .
|
|
"FROM people AS p " .
|
|
"left join (hotlunch_order_header AS hloh, hotlunch_order_items AS hloi, hotlunch_menu_items AS hlmi) " .
|
|
"ON (p.record_num = hloh.ordered_by_num " .
|
|
"AND hloh.school_num = $school_num " .
|
|
"AND hloh.record_num = hloi.order_num " .
|
|
"AND hloi.school_num = $school_num " .
|
|
"AND hlmi.school_num = $school_num " .
|
|
$owhere .
|
|
"AND hloi.ordered_by_num = p.record_num " .
|
|
"AND hloi.menu_item_num in ($items) " .
|
|
"AND hloi.menu_item_num = hlmi.record_num " .
|
|
"AND hloi.active != 'N'), " .
|
|
"classes AS c " .
|
|
"WHERE p.school_num = $base_school_num " .
|
|
"AND c.school_num = $base_school_num " .
|
|
"AND p.$ClassNumField = c.record_num " .
|
|
"ORDER BY $order_by";
|
|
}
|
|
|
|
$orders = db_query($query);
|
|
|
|
|
|
// Initialize the spreadsheet document type
|
|
header('Pragma: public');
|
|
header('Expires: 0');
|
|
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
|
header('Cache-Control: private',false);
|
|
header("Content-type: application/octet-stream; charset=utf-8");
|
|
header("Content-Disposition: attachment; filename=order-details.csv");
|
|
header('Content-Transfer-Encoding: text');
|
|
|
|
echo("\xEF\xBB\xBF");
|
|
|
|
|
|
// Titles
|
|
echo("\"$school_name\"\n");
|
|
writeLog("school_name: $school_name");
|
|
// echo("\"");
|
|
|
|
if (count($selected_items) == 1) {
|
|
$item_title = db_getVal("SELECT item_title FROM hotlunch_menu_items WHERE school_num = $school_num AND record_num = $items");
|
|
$menu_title .= " - $item_title";
|
|
}
|
|
|
|
if ($siteType == 'hotlunch' || $siteType == 'fundraising') echo(str_replace('"','""',"$menu_date - $menu_title")."\n");
|
|
else echo(str_replace('"','""',$menu_title)."\n");
|
|
|
|
|
|
echo(getLanguageText('TEXT-NAME') . ',');
|
|
if ($school_record['participant_grouping'] != 'None') echo("\"" . $GlobalText['Class'] . "\",");
|
|
|
|
if ($school_record['collect_student_number'] == 'Y') echo("\"" . getLanguageText('TEXT-STUDENT-NUMBER') . "\",");
|
|
if ($school_record['collect_student_birthdate'] == 'Y') echo("\"" . getLanguageText('TEXT-BIRTH-DATE') . "\",");
|
|
if ($school_record['collect_student_sex'] == 'Y') echo("\"" . getLanguageText('TEXT-SEX') . "\",");
|
|
if ($school_record['collect_student_age'] == 'Y') echo("\"" . getLanguageText('TEXT-AGE') . "\",");
|
|
if ($school_record['collect_student_grade'] == 'Y') echo("\"" . getLanguageText('TEXT-GRADE') . "\",");
|
|
if ($school_record['collect_permission'] == 'Y' || $school_record['collect_permission'] == 'W') echo("\"" . $school_record['permission_prompt'] . "\",,");
|
|
if ($school_record['user_defined_values'] == 'Y' && strlen($school_record['user_defined_title']) > 0) echo("\"" . $school_record['user_defined_title'] . "\",");
|
|
|
|
echo("\"" . getLanguageText('TEXT-PARENT') . "\",");
|
|
echo("\"" . getLanguageText('TEXT-PHONE') . "\",");
|
|
echo("\"" . getLanguageText('TEXT-EMAIL') . "\",");
|
|
echo("\n");
|
|
|
|
$prev_class_num = -1;
|
|
|
|
// Process each record
|
|
$page = 0;
|
|
while ($entry = db_fetch_array($orders)) {
|
|
extract($entry);
|
|
$person_info = "";
|
|
|
|
// Format name
|
|
$name = trim($first_name . ' ' . $last_name);
|
|
if (isset($studentName) && $studentName == 'First') $name = $first_name;
|
|
|
|
if ($school_record['participant_grouping'] != 'None') {
|
|
if ($class_num != $prev_class_num) {
|
|
$class_info = "Staff";
|
|
if (isset($class_num) && is_numeric($class_num) && $class_num > 0) $class_info = getClassInfo($class_num);
|
|
$prev_class_num = $class_num;
|
|
}
|
|
|
|
if ($ordered_by_type == 'Staff') $name .= " (Staff)";
|
|
$person_info .= "\"$name\",\"$class_info\"";
|
|
}
|
|
else {
|
|
$person_info .= "\"$name\"";
|
|
}
|
|
|
|
// Include additional info if required
|
|
$results = db_query("SELECT * FROM people WHERE school_num = $base_school_num AND record_num = $ordered_by_num");
|
|
$ainfo = db_fetch_array($results);
|
|
|
|
// Student number
|
|
if ($school_record['collect_student_number'] == 'Y') {
|
|
$person_info .= ",\"" . $ainfo['student_number'] . "\"";
|
|
}
|
|
|
|
// Student birthdate
|
|
if ($school_record['collect_student_birthdate'] == 'Y') {
|
|
$person_info .= ",\"" . date($school_record['date_format'],strtotime($ainfo['birthdate'])) . "\"";
|
|
}
|
|
|
|
// Student sex
|
|
if ($school_record['collect_student_sex'] == 'Y') {
|
|
$person_info .= ",\"" . $ainfo['sex'] . "\"";
|
|
}
|
|
|
|
// Student age
|
|
if ($school_record['collect_student_age'] == 'Y') {
|
|
$person_info .= ",\"" . $ainfo['age'] . "\"";
|
|
}
|
|
|
|
// Student grade
|
|
if ($school_record['collect_student_grade'] == 'Y') {
|
|
$person_info .= ",\"" . $ainfo['school_grade'] . "\"";
|
|
}
|
|
|
|
// Additional permission
|
|
if ($school_record['collect_permission'] == 'Y' || $school_record['collect_permission'] == 'W') {
|
|
$person_info .= ",\"" . $ainfo['additional_permission'] . "\",\"" . $ainfo['additional_permission_note'] . "\"";
|
|
}
|
|
|
|
// User Defined Data
|
|
if ($school_record['user_defined_values'] == 'Y' && strlen($school_record['user_defined_title']) > 0) {
|
|
$person_info .= ",\"" . $ainfo['user_defined_value'] . "\"";
|
|
}
|
|
|
|
// Include parent contact info
|
|
$info = getContactInfo($user_num);
|
|
$person_info .= ",\"" . $info[0] . "\"";
|
|
$person_info .= ",\"" . $info[1] . "\"";
|
|
$person_info .= ",\"" . $info[2] . "\"";
|
|
|
|
if (in_array($school_record['registration_address'],array('Optional','Required'))) {
|
|
$user_record = $info[3];
|
|
$person_info .= ",\"" . $user_record['address'] . "\"";
|
|
$person_info .= ",\"" . $user_record['city'] . "\"";
|
|
$person_info .= ",\"" . $user_record['province'] . "\"";
|
|
$person_info .= ",\"" . $user_record['postal'] . "\"";
|
|
}
|
|
|
|
// Get order status
|
|
if ($display_payment_status == 'Y') {
|
|
if ($order_num > 0) $order_status = db_getVal("SELECT status FROM hotlunch_order_header WHERE record_num = $order_num");
|
|
else $order_status = getLanguageText('TEXT-NO-ORDER');
|
|
$person_info .= ",$order_status";
|
|
}
|
|
|
|
$person_info .= "," . $hotlunch_schedule['schedule_type'] . "," . $siteType;
|
|
if ($hotlunch_schedule['schedule_type'] != 'Hot Lunch' && in_array($siteType,array('hotlunch','yearbook','tickets','fundraising'))) $person_info .= ",$delivered";
|
|
|
|
$person_info .= ",$added_date";
|
|
|
|
|
|
// Get order items for this order
|
|
if ($order_num > 0) {
|
|
$query = "select hloi.*,hlmi.item_title,hlmi.sequence 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.menu_num = $menu_num " .
|
|
"and hloi.order_num = $order_num " .
|
|
"and hloi.menu_item_num in ($items) " .
|
|
"and hloi.menu_item_num = hlmi.record_num " .
|
|
"and hloi.active != 'N' " .
|
|
"order by sequence";
|
|
$ordered_items = db_query($query);
|
|
|
|
// Display the items
|
|
while ($row = db_fetch_array($ordered_items)) {
|
|
extract($row);
|
|
|
|
// Check for item options
|
|
$options = "";
|
|
$options_ordered = trim($options_ordered);
|
|
$options2_ordered = trim($options2_ordered);
|
|
$options3_ordered = trim($options3_ordered);
|
|
|
|
if (strlen($options2_ordered)) $options_ordered .= "\n$options2_ordered";
|
|
if (strlen($options3_ordered)) $options_ordered .= "\n$options3_ordered";
|
|
|
|
if (strlen($options_ordered) > 0) {
|
|
$options = trim(str_replace("\n",", ",trim($options_ordered)));
|
|
}
|
|
|
|
$extended_price = $currencySymbol.str_replace(',','',number_format($extended_price,2));
|
|
echo("$person_info,$qty,$extended_price,$item_title,\"$options\"");
|
|
|
|
if ($hotlunch_schedule['implement_order_notes'] != 'N') echo(",$order_notes");
|
|
if ($hotlunch_schedule['implement_order_notes2'] != 'N') echo(",$order_notes2");
|
|
echo("\n");
|
|
|
|
}
|
|
}
|
|
else echo("$person_info\n");
|
|
}
|
|
|
|
|
|
?>
|