177 lines
7.6 KiB
PHP
177 lines
7.6 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
//
|
|
// Process all actions to list and edit records
|
|
//
|
|
$action = "paypal-log";
|
|
$CurrentTable = "user_paypal_transactions";
|
|
$FormFile = "";
|
|
$TitleText = "Pending PayPal Transaction Log";
|
|
$OrderBy = "posting_time";
|
|
|
|
|
|
|
|
// 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
|
|
|
|
//
|
|
// List all requested records
|
|
//
|
|
$query = "SELECT posting_time,payment_date,first_name,last_name,payer_email,mc_currency,mc_gross,mc_fee,payment_type,payment_status,pending_reason," .
|
|
"item_name,business,receiver_email,txn_id,receipt_id,trx_num,user_num,posting_result,posting_message,record_num " .
|
|
"FROM user_paypal_transactions " .
|
|
"WHERE school_num = $school_num " .
|
|
"AND payment_status = 'Pending' " .
|
|
"AND current_year != 'N' " .
|
|
"ORDER BY posting_time,last_name";
|
|
$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='right' class='data-header'><b><?php displayLanguageText('TEXT-FEE'); ?></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='left' class='data-header'><b><?php displayLanguageText('TEXT-EMAIL'); ?></b></td>
|
|
<td align='center' class='data-header'><b><?php displayLanguageText('TEXT-POSTING-RESULT'); ?></b></td>
|
|
</tr>
|
|
<?php
|
|
$count = 1;
|
|
$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 amounts
|
|
if ($mc_gross > 0) $mc_gross = "$" . number_format($mc_gross,2);
|
|
if ($mc_fee > 0) $mc_fee = "$" . number_format($mc_fee,2);
|
|
|
|
// Add info tips
|
|
if ($payment_status == 'Pending') {
|
|
$span_id = "status_$record_num";
|
|
$otipSpans .= "<span id='$span_id' class='hidden'>" . $otipTABLE .
|
|
sprintf($otipROW2,'Pending Reason:',$pending_reason) . "</table></span>\n";
|
|
$otipSpanIDs[] = $span_id;
|
|
$payment_status = "<a href=\"javascript:TagToTip('$span_id')\" onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">Pending</a>";
|
|
}
|
|
|
|
// Unknown posting results
|
|
if ($posting_result == '') {
|
|
$results = db_query("SELECT * FROM user_account WHERE school_num = $school_num AND payment_reference = '$txn_id'");
|
|
if (db_num_rows($results) > 0) {
|
|
$posting_result = 'Posted';
|
|
}
|
|
else {
|
|
$posting_result = 'Error';
|
|
}
|
|
}
|
|
|
|
if ($posting_result == 'Pending') {
|
|
$ppFields = array("payment_date","item_name","business","receiver_email","transaction_subject","txn_type","first_name","last_name","payer_email","payer_status",
|
|
"mc_currency","mc_gross","mc_fee","reference","payment_type","payment_status","pending_reason","trx_num","posting_message");
|
|
$results = db_query("SELECT * FROM user_paypal_transactions WHERE school_num = $school_num AND txn_id = '$txn_id' ORDER BY record_num");
|
|
$span_id = "pending_$record_num";
|
|
$otipSpans .= "<span id='$span_id' class='hidden'>" . $otipTABLE;
|
|
|
|
$num = 0;
|
|
while ($row = db_fetch_array($results)) {
|
|
if ($num > 0) $otipSpans .= "<tr><td align='center' colspan='2'><hr></td></tr>\n";
|
|
for ($i = 0; $i < count($ppFields); $i++) {
|
|
$field = $ppFields[$i];
|
|
$otipSpans .= sprintf($otipROW2,"$field:",$row[$field]);
|
|
}
|
|
$num++;
|
|
}
|
|
$otipSpans .= "</table></span>\n";
|
|
$posting_result = "Pending";
|
|
$posting_result = "<span class='warning'>" .
|
|
"<a href=\"javascript:TagToTip('$span_id')\" onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">Pending</a></span>";
|
|
}
|
|
|
|
|
|
// Format name
|
|
$name = "$first_name $last_name";
|
|
if (is_numeric($user_num) && $user_num > 0) {
|
|
$results = db_query("SELECT * FROM users WHERE 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,"User ID: ",$row['userid']) .
|
|
sprintf($otipROW2,"User Type: ",$row['type']) .
|
|
sprintf($otipROW2,"Name: ",$row['first_name'] . ' ' . $row['last_name']) .
|
|
sprintf($otipROW2,"Email: ",$row['email']) .
|
|
sprintf($otipROW2,"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>";
|
|
|
|
$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>";
|
|
}
|
|
|
|
?>
|
|
<tr>
|
|
<td align='left' class='<?php echo($bgclass) ?>'><?php echo($payment_date); ?></td>
|
|
<td align='left' class='<?php echo($bgclass) ?>'><?php echo($name); ?></td>
|
|
<td align='right' class='<?php echo($bgclass) ?>'><?php echo($mc_gross); ?></td>
|
|
<td align='right' class='<?php echo($bgclass) ?>'><?php echo($mc_fee); ?></td>
|
|
<td align='center' class='<?php echo($bgclass) ?>'><?php echo($payment_type); ?></td>
|
|
<td align='center' class='<?php echo($bgclass) ?>'><?php echo($payment_status); ?></td>
|
|
<td align='left' class='<?php echo($bgclass) ?>'><?php echo($txn_id); ?></td>
|
|
<td align='left' class='<?php echo($bgclass) ?>'><?php echo($payer_email); ?></td>
|
|
<td align='center' class='<?php echo($bgclass) ?>'><?php echo($posting_result); ?></td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
<?php
|
|
}
|
|
|
|
endTemplate();
|
|
?>
|