NotesWhat is notes.io?

Notes brand slogan

Notes - notes.io

<?php
/**
* List refunds
*/


function getClientName($clientId = 0){
global $readerDb;
$q = "SELECT id,business_name FROM customers WHERE id ='".mysql_real_escape_string($clientId)."' LIMIT 1";
$result = mysql_query($q, $readerDb) or die(mysql_error());
if(mysql_num_rows($result) > 0 ){
$record = mysql_fetch_object($result);
return $record->business_name;
}

return '';
}

if(isset($_GET['d']) && $_GET['d'] != ""){
$date_condition = "DATE_FORMAT(`time`, '%Y-%m') = '".mysql_real_escape_string($_GET['d'])."'";
$search_date = $_GET['d'];
}else{
$date_condition = "DATE_FORMAT(`time`, '%Y-%m') = '".date("Y-m")."'";
$search_date = date("Y-m");
}
if(isset($_GET['filter'])){
// echo "<script>alert('filtered');</script>";
$filter = $_GET['filter'];
switch ($filter) {
case 'a':
$q = "SELECT * FROM card_payment WHERE refund LIKE '%Refunded%' and $date_condition order by id desc LIMIT 100";
break;
case 'p':
$q = "select cp.* from card_payment cp join refund_status rs on cp.id = rs.cardpayment_id
WHERE cp.refund LIKE '%Refunded%'
and $date_condition
order by cp.id desc LIMIT 100";
break;
case 'np':
$q = "select * from card_payment
WHERE id not in (select distinct(cardpayment_id) from refund_status)
and refund LIKE '%Refunded%'
and $date_condition
order by id desc";
break;
}
}else{
$q = "select * from card_payment
WHERE id not in (select distinct(cardpayment_id) from refund_status)
and refund LIKE '%Refunded%'
and $date_condition
order by id desc";
}


$result = mysql_query($q, $readerDb) or die(mysql_error());

$refundArr = array();
if(mysql_num_rows($result) > 0){
while ($refund = mysql_fetch_object($result)) {
$refundArr[] = $refund;
}
}
?>
<!-- <script src="js/jquery.js" type="text/javascript"></script> -->
<link rel="stylesheet" href="plugins/sortorder/css/theme.blue.css" type="text/css" media="print, projection, screen" />
<div class="col-md-12">
<div class="box">
<h2>
List of Refunds &nbsp;<?="(".date("F, Y", strtotime($search_date)).")"?>
</h2>
<div class="block">
<div class="block_in">
<?php if(empty($refundArr)) : ?>
<!-- We have no refunds to display -->
<h2>Sorry, there are no refunds to display.</h2>
<?php else: ?>
<div class="row">
<div class="col-md-4">
<label>Search by Month</label>
<div class="row">
<div class="col-md-8" style="padding-right:5px;">
<input type="text" id="month" class="form-control input-sm" placeholder = "Search by month" style="margin-right:0px !important;" value="<?=date('Y-m')?>" />
</div>
<div class="col-md-4" style="padding-left:0px;">
<button type="button" class="btn btn-success btn-sm" id="search" data-loading-text="loading...<i class='fa fa-refresh fa-spin'></i>">Search</button>
</div>
</div>
</div>
</div>
<table id="tablesorter" class="tablesorter">
<thead>
<tr>
<th>Business</th>

<th>Payment Reference</th>

<th>Firstname</th>
<th>Lastname</th>
<th>Address</th>
<th>Refund</th>
<th>Date</th>
<th style="text-align:center;" data-filter="false">Refund Status<span><select id="refund_filter">
<option value="np" <?php if($filter == 'np'){ echo "selected";}?>>Not Processed</option>
<option value="p" <?php if($filter == 'p'){ echo "selected";}?>>Processed</option>
<option value="a" <?php if($filter == 'a'){ echo "selected";}?>>Show All</option>
</select><img src="images/loader1.gif" id="refund_filter_loading" style="width:20px;height:20px;"></span>
</th>
<th width="5%" data-filter="false" style="text-align: center;vertical-align: middle;">
View
</th>
</tr>
</thead>
<tbody id="data-tbody">
<?php foreach ($refundArr as $refund): ?>
<?php
$result_check_refund_done = mysql_query("select * from refund_status where cardpayment_id = '".$refund->id."' and status='REFUND-PROCESSED'", $readerDb) or die ("<h3>Error</h3><p><b>".mysql_error()."</b></p>");
if(mysql_num_rows($result_check_refund_done)){
$status = "Refund Processed";
// $refundClass = "refund_processed";
}else{
$status = "<button class='refund_complete' record='$refund->id'>Refund Processed?</button>";
// $refundClass = "refund_not_processed";
}
?>
<tr> <!-- class="<?=$refundClass?>" id="tr-<?=$refund->id?>" -->
<td style="vertical-align:middle;text-align:center;"><?=getClientName($refund->customer_id)?></td>
<td style="vertical-align:middle;text-align:center;">

<?php if ($refund->VendorTxCode!='') {
echo $refund->VendorTxCode;
}else{
echo $refund->CrossReference;
}
?>
</td>
<td style="vertical-align:middle;text-align:center;"><?=$refund->firstname?></td>
<td style="vertical-align:middle;text-align:center;"><?=$refund->lastname?></td>
<td style="vertical-align:middle;text-align:center;"><?=$refund->address?></td>
<td><?=$refund->refund?></td>
<td style="vertical-align:middle;text-align:center;"><?=$refund->time?></td>

<td style="vertical-align:middle;text-align:center;" id="td-<?=$refund->id?>"><?=$status?></td>
<td style="vertical-align:middle;text-align:center;">
<?php if ($refund->VendorTxCode!='') {
$search = array('{', '}');
$link = str_replace($search, '', $refund->CrossReference);

?>

<a target="_blank" href="https://live.sagepay.com/mysagepay/transactiondetail.msp?transactionID=<?=urlencode($link);?>">View</a>

<?php }else{ ?>
<a target="_blank" href="https://ca-live.barclaycardsmartpay.com/ca/ca/accounts/showTx.shtml?pspReference=<?=urlencode($refund->CrossReference)?>&txType=Payment">View</a>
<?php }?>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script src="plugins/sortorder/js/jquery.tablesorter.js"></script>
<script src="plugins/sortorder/js/jquery.tablesorter.widgets.js"></script>
<script>
$(document).ready(function($) {
$(window).load(function() {
$('#refund_filter_loading').hide();
});

$('.refund_complete').click(function() {
if(confirm('Are you sure this refund has been processed?')){
var id = $(this).attr('record');
$('#td-'+id).html('');
$.ajax({
url: "ajaxCalls/refund_complete.php",
type: 'POST',
dataType:"json",
data: 'action=refund_done'+'&id='+id,
success: function(response) {
if(response.status === "success") {
$('#td-'+id).html('<label>Refund Processed</label>');
/*$('#tr-'+id).removeClass('refund_not_processed');
$('#tr-'+id).addClass('refund_processed');*/
}
}
});

}else{
return false;
}
});
$('#refund_filter').change(function(event) {
$('#refund_filter_loading').show();
var filter = $(this).val();
window.location = "index.php?content=list_refunds&filter="+filter;
/*switch(filter){
case 'a':
$('.refund_processed').show();
$('.refund_not_processed').show();
break;
case 'p':
$('.refund_processed').show();
$('.refund_not_processed').hide();
break;
case 'np':
$('.refund_processed').hide();
$('.refund_not_processed').show();
break;
}*/
});
$("table").tablesorter({
theme: 'blue',
sortList: [[4,1]],
widgets: ["zebra", "filter","stickyHeaders"],
widgetOptions: {
cssStickyHeaders_offset : 0,
cssStickyHeaders_addCaption : true,
// jQuery selector or object to attach sticky header to
cssStickyHeaders_attachTo : null,
cssStickyHeaders_filteredToTop : true,
cssStickyHeaders_zIndex : 10
}
});

$('#month').datepicker({
dateFormat: 'yy-mm',
changeMonth: true,
changeYear: true,
showButtonPanel: true,
onClose: function(dateText, inst) {
$(this).datepicker('setDate', new Date(inst.selectedYear, inst.selectedMonth, 1));
},
onChangeMonthYear: function(year, month, widget) {
setTimeout(function() {
$('.ui-datepicker-calendar').hide();
});
}
}).click(function(){
$('.ui-datepicker-calendar').hide();
});

$('#search').click(function(e){
$(this).button('loading');
var year_month = $('#month').val();
window.open('index.php?content=list_refunds&d='+year_month,"_self");
});
});
</script>


     
 
what is notes.io
 

Notes.io is a web-based application for taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000 notes created and continuing...

With notes.io;

  • * You can take a note from anywhere and any device with internet connection.
  • * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
  • * You can quickly share your contents without website, blog and e-mail.
  • * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
  • * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.

Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.

Easy: Notes.io doesn’t require installation. Just write and share note!

Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )

Free: Notes.io works for 12 years and has been free since the day it was started.


You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;


Email: [email protected]

Twitter: http://twitter.com/notesio

Instagram: http://instagram.com/notes.io

Facebook: http://facebook.com/notesio



Regards;
Notes.io Team

     
 
Shortened Note Link
 
 
Looding Image
 
     
 
Long File
 
 

For written notes was greater than 18KB Unable to shorten.

To be smaller than 18KB, please organize your notes, or sign in.