First Commit
This commit is contained in:
1 parent
5eb9dd037d
commit
2e62c0e60b
11877 files changed
+2035312
No files matched your search
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
require_once("include/globals.php");
|
||||
|
||||
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
||||
header("Location: /");
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Process all actions to list and edit records
|
||||
//
|
||||
$action = "paypal-log-master";
|
||||
$CurrentTable = "user_paypal_transactions";
|
||||
$FormFile = "";
|
||||
$TitleText = getLanguageText('TEXT-PAYPAL-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'))) {
|
||||
echo("<br>\n");
|
||||
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
||||
include "form.messages.php";
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
<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' ";
|
||||
|
||||
|
||||
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' ";
|
||||
|
||||
|
||||
// Build argument string for GET
|
||||
$args = "&start_date=" . urlencode($start_date);
|
||||
$args .= "&end_date=" . urlencode($end_date);
|
||||
$args .= "&selected_user=$selected_user";
|
||||
$args .= "&error_message=" . urlencode($error_message);
|
||||
header("Location: /?action=$action$args");
|
||||
exit();
|
||||
}
|
||||
|
||||
if (array_key_exists('action',$_GET) && array_key_exists('start_date', $_GET)) {
|
||||
$start_date = $_GET['start_date'];
|
||||
$end_date = $_GET['end_date'];
|
||||
$selected_user = $_GET['selected_user'];
|
||||
|
||||
$sdate = substr($start_date,0,10);
|
||||
$edate = substr($end_date,0,10);
|
||||
|
||||
$twhere = "AND posting_time BETWEEN '$start_date' AND '$end_date' ";
|
||||
}
|
||||
|
||||
|
||||
$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'></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='paypal-log-master'>
|
||||
</form>
|
||||
<?php
|
||||
|
||||
|
||||
//
|
||||
// List all requested records
|
||||
//
|
||||
$query = "SELECT school_num,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 1 = 1 " .
|
||||
"AND current_year != 'N' " .
|
||||
$twhere .
|
||||
"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='center' class='data-header'><b><?php displayLanguageText('TEXT-SCHOOL'); ?></b></td>
|
||||
<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;
|
||||
$school_name = db_getVal("SELECT school_name FROM schools WHERE record_num = $school_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';
|
||||
}
|
||||
}
|
||||
|
||||
// Error postings
|
||||
if ($posting_result == 'Error') {
|
||||
$span_id = "result_$record_num";
|
||||
if (strlen($posting_message) == 0) $posting_message = "Unknown Posting Error";
|
||||
$otipSpans .= "<span id='$span_id' class='hidden'>" . $otipTABLE .
|
||||
sprintf($otipROW2,'Posting Error:',$posting_message) . "</table></span>\n";
|
||||
$otipSpanIDs[] = $span_id;
|
||||
$posting_result = "<span class='error'><a href='?action=pp-post&trx_num=$record_num' onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">Error</a></span>";
|
||||
}
|
||||
|
||||
// Successful postings
|
||||
if ($posting_result == 'Posted') {
|
||||
$span_id = "result_$record_num";
|
||||
|
||||
$results = db_query("SELECT * FROM user_account WHERE school_num = $school_num AND payment_reference = '$txn_id'");
|
||||
if (db_num_rows($results) > 0) {
|
||||
$otipSpanIDs[] = $span_id;
|
||||
$otipSpans .= "<span id='$span_id' class='hidden'>" . $otipTABLE;
|
||||
$otipSpans .= sprintf($otipROW2,"Transaction Num:",$trx_num);
|
||||
$otipSpans .= sprintf($otipROW2,"Item:",$item_name);
|
||||
$otipSpans .= sprintf($otipROW2,"Business:",$business);
|
||||
$otipSpans .= sprintf($otipROW2,"Receiver:",$receiver_email);
|
||||
|
||||
$row = db_fetch_array($results);
|
||||
$otipSpans .= sprintf($otipROW2,"User Acct TRX:",$record_num);
|
||||
$order_payments = $row['order_payments'];
|
||||
$orders = explode("|",$order_payments);
|
||||
|
||||
for ($i = 0; $i < count($orders); $i++) {
|
||||
$order_num = preg_replace('/\{(\d+):\d+.\d+\}/','{$1}',$orders[$i]);
|
||||
|
||||
if (!is_numeric($order_num)) continue;
|
||||
|
||||
// Get order info
|
||||
$results = db_query("SELECT * FROM hotlunch_order_header WHERE school_num = $school_num AND record_num = $order_num");
|
||||
$row = db_fetch_array($results);
|
||||
|
||||
// Get schedule info
|
||||
$schedule_num = $row['schedule_num'];
|
||||
$schedule_name = "Unknown";
|
||||
if (is_numeric($schedule_num) && $schedule_num > 0) {
|
||||
$schedule_name = db_getVal("SELECT schedule_name FROM hotlunch_schedules WHERE school_num = $school_num AND record_num = $schedule_num");
|
||||
}
|
||||
|
||||
// Get person info
|
||||
$person_num = $row['ordered_by_num'];
|
||||
$oname = "Unknown";
|
||||
if (is_numeric($person_num) && $person_num > 0) {
|
||||
$oname = db_getVal("SELECT concat(first_name,' ',last_name) FROM people WHERE school_num = $base_school_num AND record_num = $person_num");
|
||||
}
|
||||
|
||||
$otipSpans .= "<tr><td align='center' colspan='2'><hr></td></tr>\n";
|
||||
|
||||
$otipSpans .= sprintf($otipROW2,"Order Number: ",$order_num);
|
||||
$otipSpans .= sprintf($otipROW2,"Ordered By: ",$oname);
|
||||
$otipSpans .= sprintf($otipROW2,"Order Schedule: ",$schedule_name);
|
||||
// $otipSpans .= sprintf($otipROW2,"Order Status: ",$row['status']);
|
||||
$otipSpans .= sprintf($otipROW2,"Order Date: ",$row['added_date']);
|
||||
// $otipSpans .= sprintf($otipROW2,"Last Updated: ",$row['updated_date']);
|
||||
}
|
||||
|
||||
$otipSpans .= "</table></span>\n";
|
||||
$posting_result = "<a href=\"javascript:TagToTip('$span_id')\" onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">Posted</a>";
|
||||
}
|
||||
else {
|
||||
if ($row['payment_status'] != 'Pending') {
|
||||
$otipSpanIDs[] = $span_id;
|
||||
$otipSpans .= "<span id='$span_id' class='hidden'>" . $otipTABLE;
|
||||
$otipSpans .= sprintf($otipROW2,"Transaction Num:",$trx_num);
|
||||
$otipSpans .= "<tr><td align='center' colspan='2'><hr></td></tr>\n";
|
||||
$otipSpans .= "<tr><td align='left' colspan='2'><b>Unable to locate the<br>user account transaction<br>for this PayPal payment</b></td></tr>\n";
|
||||
$otipSpans .= "</table></span>\n";
|
||||
$posting_result = "<span class='warning'>" .
|
||||
"<a href='?action=pp-post&trx_num=$record_num' onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">Warning</a></span>";
|
||||
}
|
||||
else {
|
||||
$posting_result = "Pending";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 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,"School: ",$school_name) .
|
||||
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>";
|
||||
|
||||
$payer_email = "<a href=\"javascript:TagToTip('$span_id')\" onmouseover=\"TagToTip('$span_id')\" onmouseout=\"UnTip()\">$payer_email</a>";
|
||||
}
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td align='left' class='<?php echo($bgclass) ?>'><?php echo($school_num); ?></td>
|
||||
<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();
|
||||
?>
|
||||
Reference in new issue
Block a user