152 lines
5.4 KiB
PHP
152 lines
5.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');
|
|
if (checkPermission($AllowedUserTypes) != 1) {
|
|
echo("<br>\n");
|
|
$error_message = "You are not permitted access to this module";
|
|
include "form.messages.php";
|
|
return;
|
|
}
|
|
|
|
|
|
// Setup default values on insert
|
|
if ($naction == 'add') {
|
|
$initTableName = "payments";
|
|
$tarray = initializeTableArray($initTableName);
|
|
extract($tarray, EXTR_OVERWRITE);
|
|
|
|
$payment_date = date("Y-m-d",time());
|
|
$batch_num = 0;
|
|
$currency = "CAD";
|
|
$school_num = 0;
|
|
}
|
|
|
|
?>
|
|
<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'> </td>
|
|
</tr>
|
|
<tr>
|
|
<td width='30%' align='right' valign='top'><?php displayLanguageText('TEXT-SCHOOL'); ?>: </td>
|
|
<td width='70%' align='left' valign='top'>
|
|
<select name='school_num'>
|
|
<?php BuildDBList("schools","record_num","school_name","school_name",$school_num,"ASC","and status != 'Deleted' ") ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'><?php displayLanguageText('TEXT-PAYMENT-DATE'); ?>: </td>
|
|
<td align='left' valign='top'><input type='text' name='payment_date' value='<?php echo($payment_date) ?>' size='15' class='date-field'></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'><?php displayLanguageText('TEXT-AMOUNT'); ?>: </td>
|
|
<td align='left' valign='top'><input type='text' name='amount' value='<?php echo($amount) ?>' size='10'></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'><?php displayLanguageText('TEXT-CURRENCY'); ?>: </td>
|
|
<td align='left' valign='top'>
|
|
<select name='currency'>
|
|
<?php BuildFileList("paypal-currencies.txt",$currency) ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='right' valign='top'><?php displayLanguageText('TEXT-DEPOSIT-GROUP'); ?>: </td>
|
|
<td align='left' valign='top'><input type='text' name='batch_num' value='<?php echo($batch_num) ?>' size='5'></td>
|
|
</tr>
|
|
<?php if ($naction != 'add') { ?>
|
|
<tr>
|
|
<td align='right' valign='top'><?php displayLanguageText('TEXT-INVOICES'); ?>: </td>
|
|
<td align='left' valign='top'><input type='text' name='invoice_num' value='<?php echo($invoice_num) ?>' size='20'></td>
|
|
</tr>
|
|
<?php } ?>
|
|
<?php
|
|
if ($naction == 'add') {
|
|
?>
|
|
<tr>
|
|
<td align='right' valign='top'><?php displayLanguageText('TEXT-EMAIL'); ?>: </td>
|
|
<td align='left' valign='top'>
|
|
<input type='radio' name='notification' value='Single' checked='checked'> Single
|
|
<input type='radio' name='notification' value='Multiple'> Multiple
|
|
<input type='radio' name='notification' value='None'> None
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
$query = "SELECT * FROM invoice_header WHERE status = 'Open' ORDER BY record_num";
|
|
$results = db_query($query);
|
|
if (db_num_rows($results)) {
|
|
?>
|
|
<tr>
|
|
<td colspan='2' align='center'>
|
|
<br>
|
|
<table width='100%' class='content-table'>
|
|
<tr>
|
|
<td align='left' valign='top' class='data-header'><b><?php displayLanguageText('TEXT-SCHOOL'); ?></b></td>
|
|
<td align='center' valign='top' class='data-header'><b><?php displayLanguageText('TEXT-INVOICE'); ?></b></td>
|
|
<td align='center' valign='top' class='data-header'><b><?php displayLanguageText('TEXT-DATE'); ?></b></td>
|
|
<td align='center' valign='top' class='data-header'><b><?php displayLanguageText('TEXT-STATUS'); ?></b></td>
|
|
<td align='right' valign='top' class='data-header'><b><?php displayLanguageText('TEXT-AMOUNT'); ?></b></td>
|
|
<td class='data-header'> </td>
|
|
</tr>
|
|
<?php
|
|
$count = 0;
|
|
while ($row = db_fetch_array($results)) {
|
|
$class = 'data-even';
|
|
if ($count % 2) $class = 'data-odd';
|
|
$count++;
|
|
|
|
$school_name = db_getVal("SELECT school_name FROM schools WHERE record_num = ".$row['school_num']);
|
|
$fvalue = $row['record_num'];
|
|
|
|
echo(" <tr>\n");
|
|
echo(" <td align='left' class='$class'>" . $school_name . "</td>\n");
|
|
echo(" <td align='center' class='$class'>" . $row['record_num'] . "</td>\n");
|
|
echo(" <td align='center' class='$class'>" . $row['invoice_date'] . "</td>\n");
|
|
echo(" <td align='center' class='$class'>" . $row['status'] . "</td>\n");
|
|
echo(" <td align='right' class='$class'>$" . $row['total'] . "</td>\n");
|
|
echo(" <td align='center' class='$class'><input type='checkbox' name='selected_invoices[]' value='$fvalue'></td>\n");
|
|
echo(" </tr>\n");
|
|
}
|
|
?>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
$ButtonText = getLanguageText('TEXT-INSERT-PAYMENT');
|
|
?>
|
|
<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='record_num' value='<?php echo($record_num) ?>'>
|
|
<br>
|
|
<br>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</form>
|
|
<br>
|
|
|