First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
+280
@@ -0,0 +1,280 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Process all actions to list and edit records
|
||||
//
|
||||
$action = "bambora-log";
|
||||
$CurrentTable = "user_bambora_transactions";
|
||||
$FormFile = "";
|
||||
$TitleText = getLanguageText('TEXT-BAMBORA-LOG');
|
||||
$OrderBy = "posting_time";
|
||||
|
||||
if (array_key_exists('type',$_REQUEST) && strlen($_REQUEST['type']) > 0 && $_REQUEST['type'] == 'deleted') {
|
||||
$TitleText .= " (" . getLanguageText('TEXT-DELETED') . ")";
|
||||
}
|
||||
|
||||
|
||||
// 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'))) {
|
||||
echo("<br>\n");
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
include "form.messages.php";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$school_num = $school_record['record_num'];
|
||||
|
||||
?>
|
||||
<br>
|
||||
<?php
|
||||
|
||||
// Handle selected date ranges
|
||||
$start_date = date("Y-m-d 00:00:00",time());
|
||||
$end_date = date("Y-m-d 23:59:59",time());
|
||||
|
||||
$sdate = substr($start_date,0,10);
|
||||
$edate = substr($end_date,0,10);
|
||||
|
||||
$twhere = "AND posting_time BETWEEN '$start_date' AND '$end_date' ";
|
||||
|
||||
$view_approved = 'N';
|
||||
|
||||
|
||||
if (array_key_exists('action',$_POST) && strlen($_POST['action']) > 0) {
|
||||
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 posting_time BETWEEN '$start_date' AND '$end_date' ";
|
||||
|
||||
$swhere = "";
|
||||
if (array_key_exists('view_approved',$_POST)) $view_approved = db_escape_string($_POST['view_approved']);
|
||||
if (isset($view_approved) && $view_approved == 'Y') $swhere = "AND payment_status = 'Completed' ";
|
||||
|
||||
|
||||
// View only a selected userid
|
||||
$uwhere = "";
|
||||
unset($selected_user);
|
||||
if (array_key_exists('selected_user',$_POST) && strlen($_POST['selected_user']) > 0) {
|
||||
$selected_user = $_POST['selected_user'];
|
||||
$uwhere = "AND payer_email = '$selected_user' ";
|
||||
}
|
||||
|
||||
|
||||
// Build argument string for GET
|
||||
$args = "&start_date=" . urlencode($start_date);
|
||||
$args .= "&end_date=" . urlencode($end_date);
|
||||
if (isset($selected_user)) $args .= "&selected_user=$selected_user";
|
||||
$args .= "&view_approved=$view_approved";
|
||||
$args .= "&error_message=" . urlencode($error_message);
|
||||
header("Location: /?action=$action$args");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (array_key_exists('action',$_GET) && array_key_exists('start_date', $_GET)) {
|
||||
if (array_key_exists('start_date', $_GET)) $start_date = $_GET['start_date'];
|
||||
if (array_key_exists('end_date', $_GET)) $end_date = $_GET['end_date'];
|
||||
|
||||
$sdate = substr($start_date,0,10);
|
||||
$edate = substr($end_date,0,10);
|
||||
|
||||
$twhere = "AND posting_time BETWEEN '$start_date' AND '$end_date' ";
|
||||
|
||||
$swhere = "";
|
||||
if (array_key_exists('view_approved',$_GET)) $view_approved = db_escape_string($_GET['view_approved']);
|
||||
if (isset($view_approved) && $view_approved == 'Y') $swhere = "AND payment_status = 'Completed' ";
|
||||
|
||||
// View only a selected userid
|
||||
$uwhere = "";
|
||||
unset($selected_user);
|
||||
if (array_key_exists('selected_user',$_GET) && strlen($_GET['selected_user']) > 0) {
|
||||
$selected_user = $_GET['selected_user'];
|
||||
$uwhere = "AND user_num = '$selected_user' ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$message_width = 600;
|
||||
include "form.messages.php";
|
||||
|
||||
?>
|
||||
<form method='post' name='transactions'>
|
||||
<table width='600' cellpadding='3' class='content-table'>
|
||||
<tr>
|
||||
<td align='right'><?php displayLanguageText('TEXT-START-DATE'); ?>: </td>
|
||||
<td align='left'><input type='text' name='start_date' id='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' id='end_date' value='<?php echo($edate) ?>' size='15' class='date-field'></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='right' valign='top'><?php displayLanguageText('TEXT-USER'); ?>: </td>
|
||||
<td align='left'>
|
||||
<select name='selected_user'>
|
||||
<option value=''><?php displayLanguageText('TEXT-VIEW-ALL'); ?></option>
|
||||
<?php
|
||||
// List userid's from user_bambora_transactions table
|
||||
$results = db_query("SELECT distinct user_num,first_name,last_name,email " .
|
||||
"FROM user_bambora_transactions AS trx,users " .
|
||||
"WHERE trx.school_num = $school_num " .
|
||||
"AND users.school_num = $base_school_num " .
|
||||
"AND users.record_num = trx.user_num " .
|
||||
"ORDER BY last_name,first_name");
|
||||
while ($row = db_fetch_array($results)) {
|
||||
$user_num = $row['user_num'];
|
||||
$fname = $row['first_name'];
|
||||
$lname = $row['last_name'];
|
||||
$email = $row['email'];
|
||||
|
||||
$selected = "";
|
||||
if (isset($selected_user) && $selected_user == $user_num) $selected = " selected='selected'";
|
||||
echo(" <option value='$user_num'$selected>$fname $lname ($email)</option>\n");
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align='right'><?php displayLanguageText('TEXT-VIEW-APPROVED'); ?>: </td>
|
||||
<td align='left'>
|
||||
<?php BuildFileRadio("yn.txt","view_approved",$view_approved) ?>
|
||||
</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='bambora-log'>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
|
||||
//
|
||||
// List all requested records
|
||||
//
|
||||
if (!isset($swhere)) $swhere = '';
|
||||
if (!isset($twhere)) $twhere = '';
|
||||
if (!isset($uwhere)) $uwhere = '';
|
||||
$query = "SELECT trx.*,first_name,last_name,email " .
|
||||
"FROM user_bambora_transactions AS trx,users " .
|
||||
"WHERE trx.school_num = $school_num " .
|
||||
"AND users.school_num = $base_school_num " .
|
||||
"AND users.record_num = trx.user_num " .
|
||||
$uwhere . $twhere . $swhere .
|
||||
"ORDER BY posting_time,posting_time";
|
||||
$transactions = db_query($query);
|
||||
|
||||
$num_transactions = db_num_rows($transactions);
|
||||
if ($num_transactions > 0) {
|
||||
?>
|
||||
<p><b><?php displayLanguageText('TEXT-ACCOUNT-TRANSACTIONS'); ?> - <?php echo($num_transactions) ?></b></p>
|
||||
<table width='900' class='content-table'>
|
||||
<tr>
|
||||
<td align='left' class='data-header'><b><?php displayLanguageText('TEXT-PAYMENT-DATE'); ?></b></td>
|
||||
<td align='left' class='data-header'><b><?php displayLanguageText('TEXT-NAME'); ?></b></td>
|
||||
<td align='right' class='data-header'><b><?php displayLanguageText('TEXT-AMOUNT'); ?></b></td>
|
||||
<td align='center' class='data-header'><b><?php displayLanguageText('TEXT-TYPE'); ?></b></td>
|
||||
<td align='center' class='data-header'><b><?php displayLanguageText('TEXT-STATUS'); ?></b></td>
|
||||
<td align='left' class='data-header'><b><?php displayLanguageText('TEXT-TRX-ID'); ?></b></td>
|
||||
<td align='center' class='data-header'><b><?php displayLanguageText('TEXT-POSTING-RESULT'); ?></b></td>
|
||||
</tr>
|
||||
<?php
|
||||
$count = 1;
|
||||
$total = 0;
|
||||
$otipSpans = "";
|
||||
$otipSpanIDs = array();
|
||||
|
||||
while ($row = db_fetch_array($transactions)) {
|
||||
extract($row);
|
||||
$trxID = $record_num;
|
||||
|
||||
$bgclass = "data-even";
|
||||
if ($count % 2) $bgclass = "data-odd";
|
||||
$count++;
|
||||
|
||||
// Format name
|
||||
$name = "$first_name $last_name";
|
||||
if (is_numeric($user_num) && $user_num > 0) {
|
||||
$results = db_query("SELECT * FROM users WHERE school_num = $base_school_num AND record_num = $user_num");
|
||||
$row = db_fetch_array($results);
|
||||
$span_id = "user_$user_num";
|
||||
if (!in_array($span_id,$otipSpanIDs)) {
|
||||
$user_balance = db_getVal("select sum(transaction_amount) as balance from user_account where school_num = $school_num and user_num = $user_num AND (deleted != 'Y' OR deleted IS NULL)");
|
||||
$user_balance = floatval($user_balance);
|
||||
$otipSpans .= "<span id='$span_id' class='hidden'>" . $otipTABLE .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-USER-NUM').": ",$user_num) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-USER-ID').": ",$row['userid']) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-USER-TYPE').": ",$row['type']) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-NAME').": ",$row['first_name'] . ' ' . $row['last_name']) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-EMAIL').": ",$row['email']) .
|
||||
sprintf($otipROW2,getLanguageText('TEXT-PHONE').": ",$row['home_phone']) .
|
||||
sprintf($otipROW2,'<nobr>' . getLanguageText('TEXT-CURRENT-BALANCE') . ': </nobr>',$currencySymbol . number_format($user_balance,2)) .
|
||||
"</table></span>\n";
|
||||
$otipSpanIDs[] = $span_id;
|
||||
}
|
||||
$name = "<a href='?action=user-account&naction=list&user_num=$user_num' onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">$name</a>";
|
||||
|
||||
if (!isset($payer_email)) $payer_email = '';
|
||||
$pemail = $payer_email;
|
||||
if (strlen($pemail) > 20) $pemail = substr($pemail,0,20) . "...";
|
||||
$payer_email = "<a href=\"javascript:TagToTip('$span_id')\" onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">$pemail</a>";
|
||||
}
|
||||
|
||||
$total += $payment_amount;
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td align='left' class='<?php echo($bgclass) ?>'><?php echo($posting_time); ?></td>
|
||||
<td align='left' class='<?php echo($bgclass) ?>'><?php echo($name); ?></td>
|
||||
<td align='right' class='<?php echo($bgclass) ?>'>$<?php echo(number_format($payment_amount,2)); ?></td>
|
||||
<td align='center' class='<?php echo($bgclass) ?>'><?php echo($payment_status); ?></td>
|
||||
<td align='center' class='<?php echo($bgclass) ?>'><?php echo($merchant_response); ?></td>
|
||||
<td align='left' class='<?php echo($bgclass) ?>'><?php echo($txn_id); ?></td>
|
||||
<td align='center' class='<?php echo($bgclass) ?>'><?php echo($posting_result); ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
|
||||
$bgclass = 'data-header';
|
||||
?>
|
||||
<tr>
|
||||
<td align='left' class='<?php echo($bgclass) ?>'> </td>
|
||||
<td align='left' class='<?php echo($bgclass) ?>'><?php displayLanguageText('TEXT-TOTAL'); ?></td>
|
||||
<td align='right' class='<?php echo($bgclass) ?>'>$<?php echo(number_format($total,2)); ?></td>
|
||||
<td align='center' class='<?php echo($bgclass) ?>'> </td>
|
||||
<td align='center' class='<?php echo($bgclass) ?>'> </td>
|
||||
<td align='left' class='<?php echo($bgclass) ?>'> </td>
|
||||
<td align='center' class='<?php echo($bgclass) ?>'> </td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
|
||||
endTemplate();
|
||||
?>
|
||||
Reference in new issue
Block a user