First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
$student_num = $record_num;
|
||||
|
||||
|
||||
// Determine the number of currently active schedules
|
||||
$today = date("Y-m-d",time());
|
||||
$now = date("Y-m-d H:i:00",time());
|
||||
$school_num = $school_record['record_num'];
|
||||
$num_active = db_getVal("SELECT count(*) FROM hotlunch_schedules " .
|
||||
"WHERE school_num = $school_num " .
|
||||
"AND schedule_type != 'Volunteer Only' " .
|
||||
"AND status = 'Active' " .
|
||||
"AND start_order_datetime <= '$now' " .
|
||||
"AND schedule_end_date >= '$today' " .
|
||||
"AND schedule_for = 'Anyone'");
|
||||
|
||||
// Check if there is a current schedule
|
||||
$max_schedules = $school_record['max_schedules'] + $num_active;
|
||||
|
||||
$query = "select * from hotlunch_schedules " .
|
||||
"where school_num = $school_num " .
|
||||
"AND schedule_type != 'Volunteer Only' " .
|
||||
"and status = 'Active' " .
|
||||
"AND start_order_datetime <= '$now' " .
|
||||
"AND schedule_for = 'Anyone' " .
|
||||
"order by $scheduleSortOrder";
|
||||
$results = db_query($query);
|
||||
$num_schedules = db_num_rows($results);
|
||||
|
||||
$schedules = array();
|
||||
$displayDiscounts = False;
|
||||
|
||||
if (db_num_rows($results) > 0) {
|
||||
$class_num = db_getVal("select class_num from people where school_num = $base_school_num and record_num = $student_num");
|
||||
while ($row = db_fetch_array($results)) {
|
||||
$schedule_num = $row['record_num'];
|
||||
|
||||
// Check that the schedule has menu dates and items defined
|
||||
$numDates = db_getVal("SELECT count(*) FROM hotlunch_menu_dates WHERE school_num = $school_num AND schedule_num = $schedule_num");
|
||||
if ($numDates == 0) continue;
|
||||
|
||||
$numItems = db_getVal("SELECT count(*) FROM hotlunch_menu_dates AS hlmd, hotlunch_menu_items AS hlmi " .
|
||||
"WHERE hlmd.school_num = $school_num " .
|
||||
"AND hlmi.school_num = $school_num " .
|
||||
"AND hlmd.schedule_num = $schedule_num " .
|
||||
"AND hlmi.menu_num = hlmd.record_num " .
|
||||
"AND hlmi.active != 'N'");
|
||||
if ($numItems == 0) continue;
|
||||
|
||||
// Check if this is a limited access schedule by class
|
||||
$class_entries = db_getVal("select count(*) from hotlunch_schedules_classes where school_num = $school_num and schedule_num = $schedule_num");
|
||||
|
||||
if ($class_entries > 0 && $class_num > 0) {
|
||||
$query = "select count(*) from hotlunch_schedules_classes where school_num = $school_num and schedule_num = $schedule_num and class_num = $class_num";
|
||||
$schedule_access = db_getVal($query);
|
||||
if ($schedule_access == 0) continue;
|
||||
}
|
||||
|
||||
|
||||
// Check if this is a limited access schedule by category
|
||||
$category_entries = db_getVal("select count(*) from hotlunch_schedules_categories where school_num = $school_num and schedule_num = $schedule_num");
|
||||
|
||||
if ($category_entries > 0) {
|
||||
$query = "SELECT count(*) FROM hotlunch_schedules_categories AS hlsc, people_categories AS pc " .
|
||||
"WHERE hlsc.school_num = $school_num " .
|
||||
"AND pc.school_num = $school_num " .
|
||||
"AND schedule_num = $schedule_num " .
|
||||
"AND hlsc.category_num = pc.category_num " .
|
||||
"AND pc.people_num = $student_num";
|
||||
$schedule_access = db_getVal($query);
|
||||
if ($schedule_access == 0) continue;
|
||||
}
|
||||
|
||||
|
||||
$schedules[] = $row;
|
||||
$schedule_num = $row['record_num'];
|
||||
$discount = db_getVal("SELECT discount_amount " .
|
||||
"FROM hotlunch_order_header " .
|
||||
"WHERE school_num = $school_num " .
|
||||
"AND schedule_num = $schedule_num " .
|
||||
"AND ordered_by_num = $student_num " .
|
||||
"AND ordered_by_type != 'Concession'");
|
||||
if ($discount > 0) $displayDiscounts = True;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($schedules) > 0) {
|
||||
|
||||
// Initialize the totals
|
||||
$t_balance = 0;
|
||||
$t_subtotal = 0;
|
||||
$t_discount = 0;
|
||||
$t_paid = 0;
|
||||
|
||||
?>
|
||||
<br>
|
||||
<table width='700' cellpadding='2' cellspacing='1' class='content-table' align='center'>
|
||||
<tr class='heading'>
|
||||
<td align='left' width='230'><?php displayLanguageText('TEXT-SCHEDULE'); ?></td>
|
||||
<td align='right'><?php displayLanguageText('TEXT-ORDER-TOTAL'); ?></td>
|
||||
<?php if ($displayDiscounts) { ?>
|
||||
<td align='right'><?php displayLanguageText('TEXT-DISCOUNT'); ?></td>
|
||||
<?php } ?>
|
||||
<td align='right'><?php displayLanguageText('TEXT-ORDER-NET'); ?></td>
|
||||
<td align='center'><?php displayLanguageText('TEXT-STATUS'); ?></td>
|
||||
<td width='150'> </td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
$order_total = 0;
|
||||
$order_net = 0;
|
||||
|
||||
if (!isset($otipSpans)) {
|
||||
$otipSpans = "";
|
||||
$otipSpanIDs = array();
|
||||
}
|
||||
$lcount = 0;
|
||||
for ($sn = 0; $sn < count($schedules); $sn++) {
|
||||
$schedule = $schedules[$sn];
|
||||
extract($schedule);
|
||||
$schedule_num = $record_num;
|
||||
|
||||
$span_id = "schedule_$record_num";
|
||||
if (!in_array($span_id,$otipSpanIDs)) {
|
||||
$otipSpanIDs[] = $span_id;
|
||||
|
||||
$start_order_datet = substr($start_order_datetime,0,16);
|
||||
$end_order_datet = substr($end_order_datetime,0,16);
|
||||
|
||||
$otipSpans .= "<span id='$span_id'>" . $otipTABLE .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-SCHEDULE') . ": ",$schedule_name) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-START-ORDER') . ": ",$start_order_datet) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-END-ORDER') . ": ",$end_order_datet) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-SCHEDULE-START') . ": ",$schedule_start_date) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-SCHEDULE-END') . ": ",$schedule_end_date) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-TYPE') . ": ",$schedule_type) .
|
||||
"</table></span>\n";
|
||||
}
|
||||
|
||||
// Get order information for this student and this schedule
|
||||
$query = "select schedule_num,order_subtotal,discount_amount,order_total," .
|
||||
"amount_paid,status,record_num as order_num " .
|
||||
"from hotlunch_order_header " .
|
||||
"where school_num = $school_num " .
|
||||
"and schedule_num = $schedule_num " .
|
||||
"and ordered_by_num = $student_num " .
|
||||
"and ordered_by_type != 'Concession'";
|
||||
$results = db_query($query);
|
||||
echo("\n\n<!-- $query -->\n\n");
|
||||
|
||||
if (db_num_rows($results) == 0) {
|
||||
$order_subtotal = 0;
|
||||
$discount_amount = 0;
|
||||
$order_total = 0;
|
||||
$amount_paid = 0;
|
||||
$balance = 0;
|
||||
$status = getLanguageText('TEXT-NO-ORDER');
|
||||
unset($order_num);
|
||||
|
||||
$l_bgclass = 'data-odd';
|
||||
if ($lcount % 2) $l_bgclass = 'data-even';
|
||||
$lcount++;
|
||||
|
||||
// Change schedule name to a link
|
||||
$time = date("H",time());
|
||||
$now = date("Y-m-d H:i:s",time());
|
||||
if ($end_order_datetime > $now) {
|
||||
$schedule_name = "<a href='?action=orders&naction=edit&schedule_num=$schedule_num&student_num=$student_num&entered_order_num=' " .
|
||||
"onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">$schedule_name</a>";
|
||||
}
|
||||
else {
|
||||
$schedule_name = "<a href=\"javascript:TagToTip('$span_id')\" onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">$schedule_name</a>";
|
||||
}
|
||||
|
||||
// Display the row of data
|
||||
include "students.display.orders.row.php";
|
||||
}
|
||||
else {
|
||||
while ($row = db_fetch_array($results)) {
|
||||
extract($row);
|
||||
$balance = $order_subtotal - $discount_amount - $amount_paid;
|
||||
|
||||
$t_subtotal += $order_subtotal;
|
||||
$t_total += $order_total;
|
||||
$t_discount += $discount_amount;
|
||||
$t_paid += $amount_paid;
|
||||
$t_balance += $balance;
|
||||
|
||||
$l_bgclass = 'data-odd';
|
||||
if ($lcount % 2) $l_bgclass = 'data-even';
|
||||
$lcount++;
|
||||
|
||||
// Change schedule name to a link
|
||||
$schedule_name = "<a href='?action=orders&naction=edit&schedule_num=$schedule_num&student_num=$student_num&entered_order_num=$order_num' onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">$schedule_name</a>";
|
||||
|
||||
// Display the row of data
|
||||
include "students.display.orders.row.php";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<tr class='heading'>
|
||||
<td align='left'><b><?php displayLanguageText('TEXT-TOTALS'); ?>: </b></td>
|
||||
<td align='right'><b><?php echo($currencySymbol . number_format($t_subtotal,2)) ?></b></td>
|
||||
<?php if ($t_discount != 0) { ?>
|
||||
<td align='right'><b><?php echo($currencySymbol . number_format($t_discount,2)) ?></b></td>
|
||||
<?php } ?>
|
||||
<td align='right'><b><?php echo($currencySymbol . number_format($t_total,2)) ?></b></td>
|
||||
<td align='center'> </td>
|
||||
<td align='center'> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
Reference in new issue
Block a user