147 lines
5.1 KiB
PHP
147 lines
5.1 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
//
|
|
// Process all actions to list and edit records
|
|
//
|
|
$action = "user-account-adjustments";
|
|
$CurrentTable = "user_account";
|
|
$FormFile = "";
|
|
$TitleText = getLanguageText('TEXT-ACCOUNT-TRANSACTIONS');
|
|
$OrderBy = "transaction_datetime";
|
|
|
|
if (array_key_exists('type',$_REQUEST) && strlen($_REQUEST['type']) > 0 && $_REQUEST['type'] == 'deleted') {
|
|
$TitleText = getLanguageText('TEXT-DELETED-ACCOUNT-TRANSACTION-REPORT');
|
|
}
|
|
|
|
|
|
// Start the template and output buffering
|
|
startTemplate();
|
|
$templatePageTitle = $TitleText;
|
|
|
|
|
|
|
|
// Ensure that only valid user types have access to this module
|
|
if (!in_array($_SESSION['UserInfo']['type'],array('SuperUser','System Administrator','Application Administrator','Administration Team','Schedule Team','Financial','Financial Team'))) {
|
|
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
|
header("Location: /?error_message=".urlencode($error_message));
|
|
exit();
|
|
}
|
|
|
|
|
|
$school_num = $school_record['record_num'];
|
|
|
|
$print_cmd = "";
|
|
|
|
// Handle selected date ranges
|
|
$start_date = date("Y-m-d 00:00:00",time());
|
|
$end_date = date("Y-m-d 23:59:59",time());
|
|
|
|
if (array_key_exists('start_date',$_REQUEST) && strlen($_REQUEST['start_date']) > 0) $start_date = date("Y-m-d 00:00:00",strtotime($_REQUEST['start_date']));
|
|
if (array_key_exists('end_date',$_REQUEST) && strlen($_REQUEST['end_date']) > 0) {
|
|
$end_date = $_REQUEST['end_date'];
|
|
if ($end_date < substr($start_date,0,10)) {
|
|
$end_date = substr($start_date,0,10);
|
|
$error_message = getLanguageText('ERRORMSG-INVALID-DATE-RANGE');
|
|
}
|
|
|
|
$end_date = date("Y-m-d 23:59:59",strtotime($end_date));
|
|
}
|
|
|
|
$sdate = substr($start_date,0,10);
|
|
$edate = substr($end_date,0,10);
|
|
|
|
$twhere .= "AND transaction_datetime BETWEEN '$start_date' AND '$end_date' ";
|
|
$print_cmd .= "&start_date=$sdate&end_date=$edate";
|
|
|
|
|
|
$selected_transaction_type = "Charge Adjustment";
|
|
$uwhere = "AND ua.transaction_type = '$selected_transaction_type' ";
|
|
$print_cmd .= "&selected_transaction_type=$selected_transaction_type";
|
|
|
|
|
|
// View only selected payment methods
|
|
unset($selected_payment_method);
|
|
if (array_key_exists('selected_payment_method',$_REQUEST) && strlen($_REQUEST['selected_payment_method']) > 0) {
|
|
if (isset($selected_transaction_type) && $selected_transaction_type != 'Payment') unset($selected_payment_method);
|
|
else {
|
|
$selected_payment_method = db_escape_string($_REQUEST['selected_payment_method']);
|
|
$uwhere .= "AND ua.payment_method = '$selected_payment_method' ";
|
|
$print_cmd .= "&selected_payment_method=$selected_payment_method";
|
|
}
|
|
}
|
|
|
|
|
|
// Set query sort order
|
|
$order_by = "ORDER BY transaction_datetime,record_num";
|
|
$sort = "Date";
|
|
$print_cmd .= "&sort=$sort";
|
|
|
|
|
|
|
|
|
|
$message_width = 600;
|
|
include "form.messages.php";
|
|
|
|
?>
|
|
<form method='post' name='transactions'>
|
|
<table width='750' cellpadding='3' class='content-table'>
|
|
<tr>
|
|
<td align='center'>
|
|
<table>
|
|
<tr>
|
|
<td align='left'><?php displayLanguageText('TEXT-START-DATE'); ?>:<br>
|
|
<input type='text' name='start_date' id='start_date' value='<?php echo($sdate) ?>' size='15' class='date-field'></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='left'><?php displayLanguageText('TEXT-END-DATE'); ?>:<br>
|
|
<input type='text' name='end_date' id='end_date' value='<?php echo($edate) ?>' size='15' class='date-field'></td>
|
|
</tr>
|
|
<tr>
|
|
<td align='left' valign='top'><?php displayLanguageText('TEXT-PAYMENT-METHOD'); ?>:<br>
|
|
<select name='selected_payment_method'>
|
|
<option value=''><?php displayLanguageText('TEXT-VIEW-ALL'); ?></option>
|
|
<?php BuildFileList("payment_method.pp.txt",$selected_payment_method) ?>
|
|
</select>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<td align='left' valign='top'><a href='#' class='btn btn--primary btn--xsmall' onClick='document.transactions.submit();'><span><?php displayLanguageText('TEXT-VIEW'); ?></span></a></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<input type='hidden' name='action' value='user-account-adjustments'>
|
|
</form>
|
|
<?php
|
|
|
|
//
|
|
// List all requested records
|
|
//
|
|
$columnHeaders = array("User ID","TRX Date","TRX Type","Note","Amount","Method");
|
|
$query = "SELECT u.userid,substring(transaction_datetime,1,10) as trx_date,transaction_type,note,transaction_amount,schedule_num,order_num," .
|
|
"payment_method,payment_reference,transaction_status,order_payments,ua.user_num,people_num,people_type,additional_note,ua.record_num,deleted," .
|
|
"deleted_datetime,deleted_by_user_num,delete_reason,u.first_name,u.last_name " .
|
|
"FROM user_account as ua LEFT JOIN people as p ON ua.people_num = p.record_num, users AS u " .
|
|
"WHERE u.school_num = $base_school_num " .
|
|
"AND ua.school_num = $school_num " .
|
|
"AND ua.user_num = u.record_num " .
|
|
$uwhere . $twhere . $swhere .
|
|
$order_by;
|
|
$transactions = db_query($query);
|
|
echo("<!-- QUERY: $query -->\n");
|
|
|
|
$mode = 'lookup';
|
|
include "user_account.list.php";
|
|
|
|
|
|
endTemplate();
|
|
?>
|