$userid";
$user_name = $user_info['first_name'] . ' ' . $user_info['last_name'];
$user_contact = "$userid
\n$user_name - " . $user_info['home_phone'] .
" - $user_email";
$default_payment_method = "Check";
if (strlen($school_record['default_payment_method'])) $default_payment_method = $school_record['default_payment_method'];
// Set form defaults
if ($transaction_amount > 0 && !isset($transaction_type)) $transaction_type = "Payment";
else $transaction_type = "";
if ($transaction_type == "Payment" && !isset($payment_method)) $payment_method = $default_payment_method;
else $payment_method = "";
if (!isset($note)) $note = $user_name;
// Get set of Open transactions
$postingSchedule = 0;
if ($school_record['select_transactions_on_post'] == 'Y') {
$query = "SELECT * FROM user_account " .
"WHERE school_num = $school_num " .
"AND user_num = $user_num " .
"AND transaction_status = 'Open' " .
"AND (deleted != 'Y' OR deleted IS NULL) " .
"ORDER BY entered_time";
$open_transactions = db_query($query);
$postToTRX = db_num_rows($open_transactions);
$openTRX = array();
$postingSchedule = 0;
while ($row = db_fetch_assoc($open_transactions)) {
$openTRX[] = $row;
if ($postingSchedule == 0 && $row['transaction_type'] == 'Order') $postingSchedule = $row['schedule_num'];
}
}
if ($school_record['select_transactions_on_post'] != 'Y' && $school_record['select_orders_on_post'] == 'Y') {
$unpaid_orders = db_query("SELECT hloh.*,p.first_name,p.last_name FROM hotlunch_order_header AS hloh, people AS p " .
"WHERE hloh.school_num = $school_num " .
"AND p.school_num = $base_school_num " .
"AND hloh.status NOT IN ('Paid','Complimentary','Concession','Deleted') " .
"AND hloh.ordered_by_num = p.record_num " .
"AND p.user_num = $user_num " .
"ORDER BY hloh.added_date, hloh.record_num");
$postToTRX = db_num_rows($unpaid_orders);
if ($postToTRX > 0) {
$postingSchedule = db_getVal("SELECT hloh.schedule_num FROM hotlunch_order_header AS hloh, people AS p, hotlunch_schedules AS hls " .
"WHERE hloh.school_num = $school_num " .
"AND hls.school_num = $school_num " .
"AND p.school_num = $base_school_num " .
"AND hloh.status NOT IN ('Paid','Complimentary','Concession','Deleted') " .
"AND hloh.ordered_by_num = p.record_num " .
"AND p.user_num = $user_num " .
"AND hls.record_num = hloh.schedule_num " .
"AND hls.status NOT IN ('Closed','Deleted') " .
"ORDER BY hloh.added_date, hloh.record_num LIMIT 0,1");
}
}
if ($postingSchedule == 0) {
$postingSchedule = db_getVal("SELECT hloh.schedule_num FROM hotlunch_order_header AS hloh, people AS p, hotlunch_schedules AS hls " .
"WHERE hloh.school_num = $school_num " .
"AND hls.school_num = $school_num " .
"AND p.school_num = $base_school_num " .
"AND hloh.status NOT IN ('Paid','Complimentary','Concession','Deleted') " .
"AND hloh.ordered_by_num = p.record_num " .
"AND p.user_num = $user_num " .
"AND hls.record_num = hloh.schedule_num " .
"AND hls.status NOT IN ('Closed','Deleted') " .
"ORDER BY hloh.added_date, hloh.record_num LIMIT 0,1");
}
if (!isset($payment_reference)) $payment_reference = '';
if (!isset($selected_payment_method)) $selected_payment_method = '';
?>
Unpaid Orders