First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Process all actions to list and edit records
|
||||
//
|
||||
$action = "user-account-report";
|
||||
$CurrentTable = "user_account";
|
||||
$FormFile = "";
|
||||
$TitleText = getLanguageText('TEXT-TRX-SUMMARY-REPORT');
|
||||
$OrderBy = "transaction_datetime";
|
||||
|
||||
|
||||
// Start the template and output buffering
|
||||
startTemplate();
|
||||
$templatePageTitle = getLanguageText('TEXT-TRX-SUMMARY-REPORT');
|
||||
|
||||
|
||||
// Ensure that only valid user types have access to this module
|
||||
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Administration Team','Schedule Team','Financial','Financial Team');
|
||||
if (checkPermission($AllowedUserTypes) != 1) {
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
include "form.messages.php";
|
||||
endTemplate();
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
$school_num = $school_record['record_num'];
|
||||
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
|
||||
$print_cmd = "";
|
||||
$report_title = $TitleText . "<br>\n";
|
||||
|
||||
// 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',$_POST) && strlen($_POST['start_date']) > 0) $start_date = date("Y-m-d 00:00:00",strtotime($_POST['start_date']));
|
||||
|
||||
if (array_key_exists('end_date',$_POST) && strlen($_POST['end_date']) > 0) {
|
||||
$end_date = $_POST['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";
|
||||
|
||||
|
||||
|
||||
$message_width = 400;
|
||||
include "form.messages.php";
|
||||
|
||||
?>
|
||||
<form method='post' name='transactions'>
|
||||
<table width='400' cellpadding='3' class='content-table'>
|
||||
<tr>
|
||||
<td align='right'><?php displayLanguageText('TEXT-START-DATE'); ?>: </td>
|
||||
<td align='left'><input type='text' name='start_date' value='<?php echo($sdate) ?>' size='15' class='date-field'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='right'><?php displayLanguageText('TEXT-END-DATE'); ?>: </td>
|
||||
<td align='left'><input type='text' name='end_date' value='<?php echo($edate) ?>' size='15' class='date-field'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='right' valign='top'></td>
|
||||
<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>
|
||||
<input type='hidden' name='action' value='user-account-transaction-summary'>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
|
||||
//
|
||||
// List all requested records
|
||||
//
|
||||
$query = "SELECT transaction_type,sum(transaction_amount) as amount " .
|
||||
"FROM user_account " .
|
||||
"WHERE school_num = $school_num " .
|
||||
$twhere .
|
||||
"AND (deleted != 'Y' OR deleted IS NULL) " .
|
||||
"GROUP BY 1 " .
|
||||
"ORDER BY transaction_type";
|
||||
$transactions = db_query($query);
|
||||
$ColumnTitle = getLanguageText('TEXT-TRANSACTION-TYPE');
|
||||
$report_title .= "$sdate - $edate<br>\n- " . $ColumnTitle . " -";
|
||||
|
||||
$RowClasses = array("data-odd","data-even");
|
||||
|
||||
if (db_num_rows($transactions) > 0) {
|
||||
?>
|
||||
<p><b><?php echo($report_title) ?></b></p>
|
||||
<table width='550' id='data-table' class='content-table'>
|
||||
<tr>
|
||||
<td align='left' valign='top' class='data-header'><b><?php echo($ColumnTitle) ?></b></td>
|
||||
<td align='right' valign='top' class='data-header'><b><?php displayLanguageText('TEXT-CHARGES'); ?></b></td>
|
||||
<td align='right' valign='top' class='data-header'><b><?php displayLanguageText('TEXT-CREDITS'); ?></b></td>
|
||||
</tr>
|
||||
<?php
|
||||
$count = 0;
|
||||
$total = 0;
|
||||
$total_credits = 0;
|
||||
$total_charges = 0;
|
||||
|
||||
while ($row = db_fetch_array($transactions)) {
|
||||
extract($row);
|
||||
|
||||
$bgclass = $RowClasses[$count % 2];
|
||||
$count++;
|
||||
|
||||
if ($amount < 0) $amount_str = "- $currencySymbol" . number_format(-1 * $amount,2);
|
||||
else $amount_str = $currencySymbol . number_format($amount,2);
|
||||
|
||||
// Determine which column this amount belongs in
|
||||
$charge_str = "";
|
||||
$credit_str = "";
|
||||
|
||||
switch ($transaction_type) {
|
||||
case 'Donation':
|
||||
case 'NSF':
|
||||
case 'Refund':
|
||||
case 'Late Charge':
|
||||
case 'Tax Charge':
|
||||
case 'Paper Order Charge':
|
||||
case 'Remittance Form Fee':
|
||||
case 'Additional Order Fee':
|
||||
case 'Other Charge':
|
||||
case 'Charge Adjustment':
|
||||
case 'Order':
|
||||
case 'Bambora Transaction Fee':
|
||||
case 'PayPal Transaction Fee':
|
||||
case 'Credit Card Transaction Fee':
|
||||
case 'Reversed Payment':
|
||||
$charge_str = $amount_str;
|
||||
$total_charges += $amount;
|
||||
break;
|
||||
|
||||
case 'Complimentary Credit':
|
||||
case 'Payment':
|
||||
case 'Credit':
|
||||
case 'Credit Adjustment':
|
||||
case 'Multiple Order Discount':
|
||||
default:
|
||||
$credit_str = $amount_str;
|
||||
$total_credits += $amount;
|
||||
break;
|
||||
}
|
||||
|
||||
$total += $amount;
|
||||
?>
|
||||
<tr>
|
||||
<td align='left' valign='top' class='<?php echo($bgclass) ?>'><?php echo($transaction_type) ?></td>
|
||||
<td align='right' valign='top' class='<?php echo($bgclass) ?>'><?php echo($charge_str) ?></td>
|
||||
<td align='right' valign='top' class='<?php echo($bgclass) ?>'><?php echo($credit_str) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
if ($total < 0) $amount_str = "- $currencySymbol" . number_format(-1 * $total,2);
|
||||
else $amount_str = $currencySymbol . number_format($total,2);
|
||||
|
||||
// Format totals
|
||||
if ($total_charges < 0) $charge_str = "- $currencySymbol" . number_format(-1 * $total_charges,2);
|
||||
else $charge_str = $currencySymbol . number_format($total_charges,2);
|
||||
|
||||
if ($total_credits < 0) $credit_str = "- $currencySymbol" . number_format(-1 * $total_credits,2);
|
||||
else $credit_str = $currencySymbol . number_format($total_credits,2);
|
||||
|
||||
$print_cmd = "&query=" . urlencode($query) . "&sdate=$sdate&edate=$edate";
|
||||
?>
|
||||
<tr>
|
||||
<td align='left' valign='top' class='data-header'> </td>
|
||||
<td align='right' valign='top' class='data-header'><b><?php echo($charge_str) ?></b></td>
|
||||
<td align='right' valign='top' class='data-header'><b><?php echo($credit_str) ?></b></td>
|
||||
</tr>
|
||||
</table>
|
||||
<table width='400'>
|
||||
<tr>
|
||||
<td align='right'>
|
||||
<table align='right'>
|
||||
<tr>
|
||||
<td align='center'><a href='?action=user-account-transaction-summary-print<?php echo($print_cmd) ?>' class='btn btn--primary btn--xsmall'><span><?php displayLanguageText('TEXT-PRINT'); ?></span></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
endTemplate();
|
||||
?>
|
||||
Reference in new issue
Block a user