Files
HotLunches/renewal.form.php
2026-10-19 15:22:52 -07:00

122 lines
4.5 KiB
PHP

<?php
if ($school_record['status'] != 'Active' && $school_num != 3) return;
if ($school_record['status'] != 'Active') return;
if (!in_array($school_record['reseller'],array('hotlunch'))) return;
// Only display form between February 15 and July 31
$today = date("Y-m-d",time());
$start = date("Y-02-15",time());
// $start = date("Y-02-01",time());
$end = date("Y-06-30",time());
$pYr = date("Y",time()) - 1;
$cYr = date("Y",time());
$nYr = $cYr + 1;
$fYr = $cYr + 2;
$cMo = date("m",time());
$expiry_date = $school_record['expiry_date'];
$etime = strtotime($expiry_date);
$time = $etime - time();
if ($expiry_date == $end && date("m-d",time()) >= "02-15") $time = 0;
if ($cMo == '07' || $cMo == '08') $time = 0;
// if ($_SESSION['UserInfo']['type'] != 'SuperUser' && $expiry_date != $end && $time > (60 * 60 * 24 * 40)) return;
// if ($_SESSION['UserInfo']['type'] != 'SuperUser' && $time > (60 * 60 * 24 * 40)) return;
$num_invoices = db_getVal("SELECT count(*) FROM invoice_header WHERE school_num = $school_num AND status IN ('Open','Paid')");
if ($num_invoices == 0 && $time > (60 * 60 * 24 * 30) && $_SESSION['UserInfo']['type'] != 'SuperUser') return;
if (strlen($expiry_date) > 0 && $num_invoices > 0) {
$invoice_renewal = db_getVal("SELECT max(renewal_date) FROM invoice_header WHERE school_num = $school_num AND status IN ('Open','Paid')");
switch($cMo) {
case '01':
if ($school_num == 3 && $_SESSION['UserInfo']['type'] == 'SuperUser') break;
$renewal = $cYr . "-07-31";
if ($expiry_date >= $renewal) return;
if ($invoice_renewal >= $renewal) return;
if ($time > (60 * 60 * 24 * 30)) return;
break;
case '02':
case '03':
case '04':
case '05':
case '06':
case '07':
if ($school_num == 3 && $_SESSION['UserInfo']['type'] == 'SuperUser') break;
$renewal = $nYr . "-07-31";
if ($expiry_date >= $renewal) return;
if ($invoice_renewal >= $renewal) return;
break;
case '08':
case '09':
case '10':
case '11':
case '12':
$renewal = $nYr . "-07-31";
if ($expiry_date >= $renewal) return;
if ($invoice_renewal >= $renewal) return;
if ($time > (60 * 60 * 24 * 30)) return;
break;
}
}
$configuration = $school_record['system_configuration'];
?>
<br>
<div id='renewal-form'></div>
<table width='500' class='content-table'>
<tr>
<td align='left'>
<center>
<h2><?php displayLanguageText('TEXT-ANNUAL-UPDATE'); ?></h2>
</center>
<p><b><?php displayLanguageText('TEXT-APPLICATION-CONTACTS'); ?></b><br>
<?php displayLanguageText('TEXT-STATUS-UPDATE-MESSAGE-CONTACTS'); ?></p>
<?php
$query = "SELECT * FROM school_contact_list WHERE school_num = $school_num ORDER BY sequence";
$results = db_query($query);
if (db_num_rows($results) > 0) {
echo(" <ul>\n");
while ($row = db_fetch_assoc($results)) {
echo("<li>");
echo($row['contact_name']." - ".$row['contact_email']);
echo("</li>");
}
echo(" </ul>\n");
}
?>
<p> --> <b><a href='?action=application-contacts'><?php displayLanguageText('TEXT-UPDATE-APPLICATION-CONTACTS'); ?></a></b></p>
<p> --> <b><a href='mailto:training@easyschoolsoftware.net?subject=Hot Lunch Training Request'><?php displayLanguageText('TEXT-SCHEDULE-TRAINING-SESSION'); ?></a></b></p>
<p> --> <b><a href='mailto:support@easyschoolsoftware.net?subject=Hot Lunch Suggestions'><?php displayLanguageText('TEXT-SUGGESTIONS-FOR-APPLICATION'); ?></a></b></p>
<br>
<center>
<h2><?php displayLanguageText('TEXT-ON-LINE-RENEWALS'); ?></h2>
</center>
<p><b><?php displayLanguageText('TEXT-ON-LINE-RENEWALS'); ?></b></p>
<?php if ($today <= $start || $today >= $end) { ?>
<p><?php displayLanguageText('TEXT-CLICK-TO-CREATE-INVOICE'); ?></p>
<?php } else { ?>
<p><?php displayLanguageText('TEXT-EARLYBIRD-MSG-1'); ?></p>
<p><?php displayLanguageText('TEXT-EARLYBIRD-MSG-2'); ?></p>
<?php } ?>
<p><b><?php displayLanguageText('TEXT-SITE-TYPE'); ?>: <?php echo($configuration) ?></b><br>
<?php displayLanguageText('TEXT-CONFIGURATION-CHANGE-MSG'); ?> <a href='mailto:support@hotlunches.net?subject=Configuration Change Request'>support@easyschoolsoftware.net</a></p>
</td>
</tr>
<tr>
<td align='center'>
<form method='post' action='renewal.invoice.php'>
<input type='submit' class='btn btn--primary>' value="<?php displayLanguageText('TEXT-GENERATE-INVOICE'); ?>" <?php if ($school_num == 3) echo("disabled"); ?>>
</form>
<br>
</td>
</tr>
</table>