First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
include "db.php";
|
||||
include "include/queuemail.php";
|
||||
|
||||
$query = "SELECT * FROM hotlunch_order_header WHERE added_date > '2026-04-07' AND order_total = 0.00 AND ordered_by_type != 'Concession' ORDER BY school_num";
|
||||
$orders = db_query($query);
|
||||
echo("Orders: ".db_num_rows($orders)."\n\n");
|
||||
|
||||
$Parents = array();
|
||||
$count = 0;
|
||||
|
||||
while ($row = db_fetch_assoc($orders)) {
|
||||
extract($row);
|
||||
$order_num = $record_num;
|
||||
|
||||
$num_items = db_getVal("SELECT count(*) FROM hotlunch_order_items WHERE school_num = $school_num AND order_num = $order_num");
|
||||
|
||||
if ($num_items == 0) {
|
||||
$results = db_query("SELECT * FROM people WHERE record_num = $ordered_by_num");
|
||||
$precord = db_fetch_assoc($results);
|
||||
$first_name = $precord['first_name'];
|
||||
$last_name = $precord['last_name'];
|
||||
$user_num = $precord['user_num'];
|
||||
|
||||
$results = db_query("SELECT * FROM users WHERE record_num = $user_num");
|
||||
$urecord = db_fetch_assoc($results);
|
||||
$parent = $urecord['first_name'].' '.$urecord['last_name'];
|
||||
$email = $urecord['email'];
|
||||
|
||||
$results = db_query("SELECT * FROM hotlunch_schedules WHERE record_num = $schedule_num");
|
||||
$schedule = db_fetch_assoc($results);
|
||||
$schedule_name = $schedule['schedule_name'];
|
||||
|
||||
$results = db_query("SELECT * FROM schools WHERE record_num = $school_num");
|
||||
$srecord = db_fetch_assoc($results);
|
||||
$school_name = $srecord['school_name'];
|
||||
$dstatus = $school_record['default_order_status'];
|
||||
db_query("DELETE FROM hotlunch_order_header WHERE record_num = $order_num");
|
||||
// db_query("UPDATE hotlunch_order_header SET status = '$dstatus' WHERE record_num = $order_num");
|
||||
|
||||
printf("%10d %10d %10d %4d %s - %d %s %s --> %s\n",$school_num,$schedule_num,$order_num,$num_items,"$first_name $last_name",$user_num,$parent,$email,$school_name);
|
||||
|
||||
$emailMessage = "Hello $parent,\n".
|
||||
"\n" .
|
||||
"We experienced a small problem with our application today and approximately 15 orders were not saved correctly. This problem has been corrected.\n" .
|
||||
"\n" .
|
||||
"We ask that you please check the order for:\n" .
|
||||
" - $first_name $last_name\n" .
|
||||
" - $schedule_name\n" .
|
||||
"\n" .
|
||||
"We apologize for this inconvenience.\n" .
|
||||
"\n" .
|
||||
"Hot Lunches Online\n\n";
|
||||
|
||||
$emailTo = $email;
|
||||
// $emailTo = "mark@fester.ca";
|
||||
$emailFrom = "support@hotlunches.net";
|
||||
$emailSubject = "Hot Lunches Online ordering problem today at $school_name";
|
||||
$fromName = "HotLunches Online";
|
||||
|
||||
// QueueEmail($emailTo, $emailFrom, $emailSubject, $emailMessage, $fromName);
|
||||
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
echo("$count\n\n");
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user