Files
HotLunches/status-update.php
2026-10-19 15:22:52 -07:00

100 lines
2.9 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /?error_message=" . urlencode(getLanguageText('ERRORMSG-SESSION-EXPIRED')));
exit();
}
if ($school_record['data_current_application_contacts'] == 'Y' && $school_record['data_current_school_contacts'] == 'Y') {
header("Location: /");
exit();
}
// Start the template and output buffering
startTemplate();
$templatePageTitle = getLanguageText('TEXT-STATUS-UPDATE');
// Check for application expiration date
if (!isset($base_school_num) || intval($base_school_num) == 0) $base_school_num = $school_num;
$days_left = db_getVal("select datediff(expiry_date,curdate()) from schools where record_num = $base_school_num");
if ($days_left <= 60 && $days_left > 10) {
$expiry_message = "Warning: Access to the Application Will Expire in " . number_format($days_left) . " days";
$class = "success";
}
if ($days_left <= 10 && $days_left >= 0) {
$dtext = ($days_left != 1) ? "Days" : "Day";
if ($days_left > 0) $expiry_message = "Warning: Application Access Will Expire in " . number_format($days_left) . " $dtext";
else $expiry_message = "Warning: Application Access Will Expire Today. Contact Support Immediately if You Wish to Continue.";
$class = "error";
}
if ($days_left < 0) {
$days_left = 15 + $days_left;
$expiry_message = "Warning: Application Access Has Expired. You Will Have Access to the Application for a $days_left Day Grace Period";
$class = "error";
}
// Determine if there is a balance owing
$current_balance_owing = db_getVal("SELECT sum(total - amount_paid) FROM invoice_header WHERE school_num = $base_school_num AND status = 'Open'");
if (strlen($expiry_message) || $current_balance_owing > 0) {
?>
<center>
<table width='80%' cellpadding='2' cellspacing='5'>
<?php
if (strlen($expiry_message)) {
?>
<tr>
<td align='center' class='<?php echo($class) ?>'> <?php echo($expiry_message) ?> </td>
</tr>
<?php
}
if ($current_balance_owing > 0) {
?>
<tr>
<td align='center' class='success'> Your School Has a Current Balance Owing of :: <?php echo('$' . number_format($current_balance_owing,2)) ?> </td>
</tr>
<tr>
<td align='center'><?php include "paypal_form.hotlunches.php"; ?></td>
</tr>
<?php
}
?>
</table>
</center>
<br>
<?php
}
include "form.messages.php";
$TableWidth = 600;
?>
<table width='<?php echo($TableWidth) ?>' cellpadding='5'>
<tr>
<td align='center'>
<p><b><?php displayLanguageText('TEXT-STATUS-UPDATE-MESSAGE'); ?></b></p>
</td>
</tr>
<tr>
<td width='100%' align='center' valign='top'>
<?php
if ($school_record['data_current_application_contacts'] == 'N') include "status-update.contacts.php";
else {
if ($school_record['data_current_school_contacts'] == 'N') include "status-update.school.php";
}
?>
</tr>
</table>
<?php
endTemplate();
?>