First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
include "db.php";
|
||||
|
||||
$query = "select school_num,schedule_num,count(*) as num_orders from hotlunch_order_header where ordered_by_type = 'Concession' and school_num != 19702 group by 1,2 having count(*) > 1";
|
||||
$orders = db_query($query);
|
||||
|
||||
while ($row = db_fetch_assoc($orders)) {
|
||||
extract($row);
|
||||
|
||||
$query = "SELECT * FROM schools WHERE record_num = $school_num";
|
||||
$school_record = db_getVal($query);
|
||||
$school_name = $school_record['school_name'];
|
||||
$status = $school_record['status'];
|
||||
|
||||
$schedule = db_getVal("SELECT * FROM hotlunch_schedules WHERE school_num = $school_num AND record_num = $schedule_num");
|
||||
$schedule_name = $schedule['title'];
|
||||
$start_date = $schedule['schedule_start_date'];
|
||||
|
||||
echo("$school_num - $school_name ($status): $schedule_name ($start_date) $num_orders\n");
|
||||
|
||||
$results = db_query("SELECT record_num FROM hotlunch_order_header WHERE school_num = $school_num AND schedule_num = $schedule_num AND ordered_by_type = 'Concession'");
|
||||
while ($row = db_fetch_assoc($results)) {
|
||||
extract($row);
|
||||
$onum = $record_num;
|
||||
|
||||
$numItems = db_getVal("SELECT count(*) FROM hotlunch_order_items WHERE school_num = $school_num AND order_num = $onum");
|
||||
echo("$onum: $numItems\n");
|
||||
if ($numItems == 0) {
|
||||
db_query("DELETE from hotlunch_order_header WHERE school_num = $school_num AND schedule_num = $schedule_num AND record_num = $onum");
|
||||
}
|
||||
}
|
||||
echo("\n");
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user