165 lines
7.8 KiB
PHP
165 lines
7.8 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
// Get parameters
|
|
if (array_key_exists('form_message', $_GET)) $form_message = db_escape_string($_GET['form_message']);
|
|
if (array_key_exists('schedule_num', $_GET)) $schedule_num = intval($_GET['schedule_num']);
|
|
if (array_key_exists('user_num', $_GET)) $user_num = intval($_GET['user_num']);
|
|
if (array_key_exists('current_name', $_GET)) $current_name = db_escape_string($_GET['current_name']);
|
|
if (array_key_exists('ordertotal', $_GET)) $ordertotal = $_GET['ordertotal'];
|
|
if (array_key_exists('discount_amount', $_GET)) $discount_amount = $_GET['discount_amount'];
|
|
if (array_key_exists('order_num', $_GET)) $order_num = intval($_GET['order_num']);
|
|
if (array_key_exists('order_total', $_GET)) $order_total = floatval($_GET['order_total']);
|
|
if (array_key_exists('late_charge_amount', $_GET)) $late_charge_amount = $_GET['late_charge_amount'];
|
|
if (array_key_exists('tax_charge_amount', $_GET)) $tax_charge_amount = $_GET['tax_charge_amount'];
|
|
if (array_key_exists('paper_order_charge', $_GET)) $paper_order_charge = $_GET['paper_order_charge'];
|
|
if (array_key_exists('edit_link', $_GET)) $edit_link = $_GET['edit_link'];
|
|
if (array_key_exists('account_link', $_GET)) $account_link = $_GET['account_link'];
|
|
if (array_key_exists('order_link', $_GET)) $order_link = $_GET['order_link'];
|
|
|
|
if (!isset($schedule_num) || $schedule_num == 0) {
|
|
$error_message = getLanguageText('TEXT-INVALID-ACCESS');
|
|
header("Location: /?error_message=".urlencode($error_message));
|
|
exit();
|
|
}
|
|
|
|
if (!isset($order_num) || $order_num == 0) {
|
|
$error_message = getLanguageText('TEXT-INVALID-ACCESS');
|
|
header("Location: /?error_message=".urlencode($error_message));
|
|
exit();
|
|
}
|
|
|
|
|
|
$order_status = db_getVal("SELECT status FROM hotlunch_order_header WHERE school_num = $school_num AND record_num = $order_num");
|
|
|
|
if (strlen($ordertotal) == 0) $ordertotal = 0;
|
|
|
|
|
|
$r = db_query("SELECT * FROM hotlunch_schedules WHERE school_num = $school_num AND record_num = $schedule_num");
|
|
$schedule = db_fetch_assoc($r);
|
|
$schedule_prices = $schedule['schedule_prices'];
|
|
|
|
echo("<br>\n");
|
|
include "form.messages.php";
|
|
|
|
// Get account balance
|
|
if (isset($user_num) && $user_num > 0) {
|
|
updateUserBalance($user_num);
|
|
$balance = db_getVal("select sum(transaction_amount) as balance from user_account where school_num = $school_num and user_num = $user_num AND (deleted != 'Y' OR deleted IS NULL)");
|
|
}
|
|
|
|
$sign = "";
|
|
if (!isset($balance)) $balance = 0;
|
|
if ($balance < 0) $sign = "-";
|
|
|
|
$order_entered_message = "";
|
|
if (strlen($school_record['order_entered_message'])) $order_entered_message = $school_record['order_entered_message'];
|
|
if (strlen($hotlunch_schedule['order_entered_message'])) $order_entered_message = $hotlunch_schedule['order_entered_message'];
|
|
if (!isset($current_name)) $current_name = '';
|
|
if (isset($ordered_by_type) && $ordered_by_type == 'Concession') $current_name = getLanguageText('TEXT-CONCESSION');
|
|
|
|
?>
|
|
<br>
|
|
<table width='700' cellpadding='1' cellspacing='1' border='0' class='content-table'>
|
|
<tr>
|
|
<td align='center' colspan='2'><b><?php displayLanguageText('TEXT-ORDERED-BY'); ?> <?php echo($current_name); ?></b></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right'><b><?php echo($source) ?> <?php displayLanguageText('TEXT-ORDER-NUMBER'); ?> :: </b></td>
|
|
<td width='45%' align='left'> <b><?php echo($order_num); ?></b></td>
|
|
</tr>
|
|
<?php if (isset($schedule_prices) && $schedule_prices != 'N') { ?>
|
|
<tr>
|
|
<td align='right'><b><?php echo($source) ?> <?php displayLanguageText('TEXT-ORDER-STATUS'); ?> :: </b></td>
|
|
<td width='45%' align='left'> <b><?php echo($order_status); ?></b></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right'><b><?php echo($source) ?> <?php displayLanguageText('TEXT-ORDER-TOTAL'); ?> :: </b></td>
|
|
<td width='45%' align='left'> <b><?php echo($currencySymbol . number_format($ordertotal,2)); ?></b></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (isset($discount_amount) && $discount_amount > 0) { ?>
|
|
<tr>
|
|
<td align='right'><b><?php displayLanguageText('TEXT-DISCOUNT'); ?> :: </b></td>
|
|
<td align='left'> <b><?php echo($currencySymbol . number_format($discount_amount,2)); ?></b></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right'><b><?php displayLanguageText('TEXT-ORDER-NET'); ?> :: </b></td>
|
|
<td align='left'> <b><?php echo($currencySymbol . number_format($order_total,2)); ?></b></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (isset($late_charge_amount) && $late_charge_amount > 0) { ?>
|
|
<tr>
|
|
<td align='right'><b><?php displayLanguageText('TEXT-LATE-CHARGE'); ?> :: </b></td>
|
|
<td align='left'> <b><?php echo($currencySymbol . number_format($late_charge_amount,2)); ?></b></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (isset($tax_charge_amount) && $tax_charge_amount > 0) { ?>
|
|
<tr>
|
|
<td align='right'><b><?php echo($tax_description) ?> :: </b></td>
|
|
<td align='left'> <b><?php echo($currencySymbol . number_format($tax_charge_amount,2)); ?></b></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (isset($paper_order_charge) && $paper_order_charge > 0 && $source == 'Paper') { ?>
|
|
<tr>
|
|
<td align='right'><b><?php echo($paper_order_message) ?> :: </b></td>
|
|
<td align='left'> <b><?php echo($currencySymbol . number_format($paper_order_charge,2)); ?></b></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (in_array($_SESSION['UserInfo']['type'],array('SuperUser','System Administrator','Application Administrator','Application Volunteer','Schedule Volunteer','Administration Team'))) { ?>
|
|
<tr>
|
|
<td colspan='2' align='center'><?php echo($account_link) ?> <?php echo($order_link) ?> <?php echo($edit_link) ?></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php
|
|
if (isset($multi_order_discount) && floatval($multi_order_discount) < 0.00) {
|
|
$multi_order_discount = floatval($multi_order_discount);
|
|
?>
|
|
<tr>
|
|
<td align='right'><b><?php displayLanguageText('TEXT-MULTI-ORDER-DISCOUNTS'); ?> :: </b></td>
|
|
<td width='45%' align='left'> <b><?php echo("- $currencySymbol" . number_format(abs($multi_order_discount),2)); ?></b></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php
|
|
if (isset($user_num) && $user_num > 0) {
|
|
$balance = floatval($balance);
|
|
?>
|
|
<tr>
|
|
<td align='right'><b><?php displayLanguageText('TEXT-ACCOUNT-BALANCE'); ?> :: </b></td>
|
|
<td width='45%' align='left'> <b><?php echo("$sign$currencySymbol" . number_format(abs($balance),2)); ?></b></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (isset($order_status) && ($order_status == 'Unpaid' || $order_status == 'Inactive') && $order_total > 0 && $balance < 0) { ?>
|
|
<tr>
|
|
<td colspan='2' align='center'>
|
|
<hr>
|
|
<p class='warning'><b><?php displayLanguageText('TEXT-APPLY-CREDIT-BALANCE-TO-ORDER'); ?></b><br>
|
|
<br>
|
|
<a href='#' class='btn-apply-credit btn btn--primary btn--xsmall' onum='<?php echo($order_num) ?>' ototal='<?php echo($order_total) ?>'><?php displayLanguageText('TEXT-APPLY-CREDIT-TO-ORDER'); ?></a></p>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php if (isset($order_status) && ($order_status == 'Unpaid' || $order_status == 'Inactive') && strlen($order_entered_message)) { ?>
|
|
<tr>
|
|
<td colspan='2' align='center'>
|
|
<hr>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td colspan='2' align='center'>
|
|
<p><b><?php echo(nl2br($order_entered_message)) ?></b></p>
|
|
</td>
|
|
</tr>
|
|
<?php } ?>
|
|
</table>
|
|
<br>
|
|
<?php if (in_array($_SESSION['UserInfo']['type'], array('Parent','Guest','Staff'))) { ?>
|
|
<p><a href='?action=user-account' class='btn btn--primary>'><?php displayLanguageText('TEXT-VIEW-ACCOUNT-TRANSACTIONS'); ?></a></p>
|
|
<?php } ?>
|