39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
include "db.php";
|
|
|
|
$query = "SELECT * FROM schools WHERE status = 'Active'";
|
|
$schools = db_query($query);
|
|
|
|
while ($row = db_fetch_assoc($schools)) {
|
|
$school_num = $row['record_num'];
|
|
$school_name = $row['school_name'];
|
|
|
|
$newSchool = true;
|
|
|
|
$query = "SELECT * FROM hotlunch_order_header WHERE school_num = $school_num";
|
|
$orders = db_query($query);
|
|
|
|
while ($row = db_fetch_assoc($orders)) {
|
|
extract($row);
|
|
$order_num = $record_num;
|
|
|
|
$results = db_query("SELECT * FROM user_account WHERE school_num = $school_num AND order_num = $order_num");
|
|
if (db_num_rows($results) == 0) {
|
|
$results = db_query("SELECT * FROM people WHERE school_num = $school_num AND record_num = $ordered_by_num");
|
|
if (db_num_rows($results)) {
|
|
if ($newSchool) echo("\n-------- $school_name --------\n");
|
|
$newSchool = false;
|
|
|
|
$person = db_fetch_assoc($results);
|
|
$pname = $person['first_name'].' '.$person['last_name'];
|
|
|
|
$sname = db_getVal("SELECT schedule_name FROM hotlunch_schedules WHERE school_num = $school_num AND record_num = $schedule_num");
|
|
|
|
printf("%7d %-50s %-30s %12.2f\n",$ordered_by_num,$pname,$sname,$order_total);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|