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

95 lines
3.4 KiB
PHP

<?php
require_once("include/globals.php");
if (SessionActive() != 1 || ! UserLoggedIn()) {
header("Location: /");
exit();
}
// Ensure that only valid user types have access to this module
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Application Volunteer','Schedule Volunteer','Administration Team','Schedule Team','Supplier');
if (checkPermission($AllowedUserTypes) != 1) {
echo("<br>\n");
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
include "form.messages.php";
return;
}
// Setup default values on insert
if ($naction == 'add') {
$initTableName = $CurrentTable;
$tarray = initializeTableArray($initTableName);
extract($tarray, EXTR_OVERWRITE);
$menu_group = 'Any';
$order_quantity = 1;
$discount_percentage = 0.0;
$discount_amount = 0;
}
// Check for a current menu group
$currentGroup = db_getVal("SELECT distinct menu_group FROM hotlunch_schedules_discounts WHERE school_num = $school_num AND schedule_num = $schedule_num");
?>
<style type="text/css">
.ui-datepicker { font-size: 80%; }
</style>
<br>
<form method='post' action='/'>
<?php
$message_width = $default_form_width;
include "form.messages.php";
?>
<table width='<?php echo($default_form_width) ?>' class='content-table'>
<tr>
<td colspan='2' align='center' class='heading'><?php echo($PageTitle) ?></td>
</tr>
<tr>
<td colspan='2' align='center'>&nbsp;</td>
</tr>
<tr>
<td width='35%' align='right' valign='top'><?php displayLanguageText('TEXT-MENU-GROUP'); ?>: </td>
<td width='65%' align='left' valign='top'>
<select name='menu_group'>
<?php
if (strlen($currentGroup) == 0) BuildFileList("discount_menu_groups.txt",$menu_group);
else echo("<option value=\"$currentGroup\">$currentGroup</option>\n");
?>
</select>
</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-QUANTITY'); ?>: </td>
<td align='left' valign='top'><input type='text' name='order_quantity' id='order_quantity' value="<?php echo($order_quantity) ?>" size='10'></td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-DISCOUNT'); ?>: </td>
<td align='left' valign='top'><input type='text' name='discount_percentage' id='discount_percentage' value="<?php echo($discount_percentage) ?>" size='5'>%</td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-AMOUNT'); ?>: </td>
<td align='left' valign='top'><?php echo($currencySymbol) ?><input type='text' name='discount_amount' id='discount_amount' value="<?php echo($discount_amount) ?>" size='5'></td>
</tr>
<tr>
<td align='right' valign='top'><?php displayLanguageText('TEXT-EXPIRY-DATE'); ?>: </td>
<td align='left' valign='top'><input type='text' name='expiry_date' id='expiry_date' value="<?php echo($expiry_date) ?>" size='15' class='date-field'></td>
</tr>
<tr>
<td colspan='2' align='center'>
<br>
<input type='submit' class='btn btn--primary' value="<?php echo($ButtonText) ?>">
<input type='hidden' name='action' value='<?php echo($action) ?>'>
<input type='hidden' name='naction' value='<?php echo($next_naction) ?>'>
<input type='hidden' name='schedule_num' value='<?php echo($schedule_num) ?>'>
<input type='hidden' name='record_num' value='<?php echo($record_num) ?>'>
<br>
<br>
</td>
</tr>
</table>
</form>
<br>