First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
include "db.php";
|
||||
|
||||
$query = "SELECT * FROM hotlunch_order_header WHERE school_num = 277 AND source = 'Paper' ORDER BY record_num";
|
||||
$orders = db_query($query);
|
||||
|
||||
while ($row = db_fetch_assoc($orders)) {
|
||||
extract($row);
|
||||
$order_num = $record_num;
|
||||
$person = $ordered_by_num;
|
||||
|
||||
if ($source == 'On-Line') $priceField = "online_price";
|
||||
if ($source == 'Paper') $priceField = "offline_price";
|
||||
|
||||
$query = "SELECT * FROM hotlunch_order_items WHERE school_num = $school_num AND order_num = $order_num AND schedule_num = $schedule_num";
|
||||
$items = db_query($query);
|
||||
while ($row = db_fetch_assoc($items)) {
|
||||
$rnum = $row['record_num'];
|
||||
$inum = $row['menu_item_num'];
|
||||
$oqty = $row['qty'];
|
||||
$oprice = $row['menu_item_price'];
|
||||
$oextended = $row['extended_price'];
|
||||
$price = db_getVal("SELECT $priceField FROM hotlunch_menu_items WHERE record_num = $inum");
|
||||
$extended = ($price * 100) * $oqty / 100;
|
||||
|
||||
if ($extended == $oextended) continue;
|
||||
if ($price == $oprice) continue;
|
||||
db_query("UPDATE hotlunch_order_items SET menu_item_price = $price, extended_price = $extended WHERE record_num = $rnum");
|
||||
}
|
||||
|
||||
$query = "select sum(extended_price) " .
|
||||
"from hotlunch_order_items " .
|
||||
"where school_num = $school_num " .
|
||||
"and order_num = $order_num " .
|
||||
"and schedule_num = $schedule_num " .
|
||||
"and active != 'N'";
|
||||
$new_total = db_getVal($query);
|
||||
|
||||
if ($new_total == 0.00) continue;
|
||||
if ($order_total == $new_total) continue;
|
||||
|
||||
printf("%4d %6d %8d %12.2f %12.2f \n",$school_num,$schedule_num,$order_num,$order_total,$new_total);
|
||||
|
||||
db_query("UPDATE hotlunch_order_header " .
|
||||
"SET order_total = $new_total, " .
|
||||
"order_subtotal = $new_total " .
|
||||
"WHERE record_num = $order_num");
|
||||
|
||||
$query = "update user_account " .
|
||||
"set transaction_amount = $new_total " .
|
||||
"where school_num = $school_num " .
|
||||
"and schedule_num = $schedule_num " .
|
||||
"and order_num = $order_num " .
|
||||
"and transaction_type = 'Order'";
|
||||
db_query($query);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in new issue
Block a user