paypal 查看收款是否已录入订单;+收款转移到订单

feature/trippest
lyt 7 years ago
parent 2a78c413bc
commit 5ab9632f89

@ -1,4 +1,4 @@
<form action="http://www.mycht.cn/webht.php/apps/pay/iPayLinksService/gai_modal_save" method="post" id="form_modal_orderid" name="form_modal_gai">
<form action="http://www.mycht.cn/webht.php/apps/pay/iPayLinksService/gai_modal_save" method="post" id="form_modal_gai" name="form_modal_gai">
<?php if ( ! empty($gai_info)) { ?>
<p>已录入订单 <?php echo!empty($old_order) ? $old_order : ""; ?></p>
<table class="table table-hover table-bordered">

@ -1031,4 +1031,79 @@ class Index extends CI_Controller {
$objWriter->save('php://output');
}
/** 查看收款记录的是否已录入到订单 */
public function gai_modal($pn_txn_id=null, $pn_id = null, $neworder=null)
{
$data = array();
$data['note'] = $this->Note_model->note($pn_txn_id, $pn_id);
$orderid_info = $this->analysis_orderid($data['note']->pn_invoice);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
if ($orderid_info->ordertype === 'T') {
$data['gai_info'] = $this->Paypal_model->get_money_t($pn_txn_id);
} elseif ($orderid_info->ordertype === 'B') {
$data['gai_info'] = $this->Paypal_model->get_money_b($pn_txn_id);
}
}
$data['old_order'] = $data['note']->pn_invoice;
$data['new_order'] = $neworder;
$data['order_info'] = null;
if ($neworder !== null) {
$neworder_id = $this->analysis_orderid($neworder);
$neworder_id = json_decode($neworder_id);
if ( ! empty($neworder_id)) {
$data['order_info'] = $this->Paypal_model->get_order($neworder_id->orderid, true, $neworder_id->ordertype);
}
}
echo json_encode($this->load->view('gai_setting', $data, true));
}
public function gai_modal_save()
{
$data = array();
$pn_txn_id = $this->input->post('pn_txn_id');
$pn_id = $this->input->post('pn_id');
$neworder = $this->input->post('pn_invoice');
$data['note'] = $this->Note_model->note($pn_txn_id, $pn_id);
$orderid_info = $this->analysis_orderid($data['note']->pn_invoice);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
if ($orderid_info->ordertype === 'T') {
$data['gai_info'] = $this->Paypal_model->get_money_t($pn_txn_id);
$this->Paypal_model->delete_money_t($pn_txn_id);
} elseif ($orderid_info->ordertype === 'B') {
$data['gai_info'] = $this->Paypal_model->get_money_b($pn_txn_id);
$this->Paypal_model->delete_money_b($pn_txn_id);
}
}
if (!empty($pn_txn_id) && !empty($neworder)) {
$orderid_info = $this->analysis_orderid($neworder);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
$advisor_info = $this->Paypal_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
if (!empty($advisor_info)) {
$this->Note_model->set_invoice($pn_txn_id, $neworder);
$this->send_note($pn_txn_id);
echo json_encode('修改成功!');
return true;
}
}
}
echo json_encode('没找到数据!');
return;
}
public function closeGai($pn_txn_id)
{
$data = array();
$data['note'] = $this->Note_model->note($pn_txn_id);
if (!empty($data['note'])) {
$this->Note_model->update_send($pn_txn_id, 'closeRecord');
echo json_encode('该收款记录已经忽略!');
return true;
}
echo json_encode('没找到数据!');
return;
}
}

@ -45,16 +45,17 @@ class Note_model extends CI_Model {
public function search_date($date) {
$this->init();
$search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR pn_send<>'send') ";
$search_sql = " AND (pn.pn_datetime BETWEEN '$date 00:00:00' AND '$date 23:59:59' OR pn_send not in ('send','closeRecord')) ";
$this->search = $search_sql;
$this->orderby=" ORDER BY CASE pn.pn_send WHEN 'sendfail' THEN 1 ELSE 2 END ,pn.pn_sn DESC ";
return $this->get_list();
}
public function note($pn_txn_id){
public function note($pn_txn_id, $pn_sn=NULL){
$this->init();
$this->topnum=1;
$this->pn_txn_id=" AND pn.pn_txn_id=".$this->HT->escape($pn_txn_id);
$this->pn_txn_id .= ($pn_sn===NULL) ? "" : " AND pn.pn_sn=".$this->HT->escape($pn_sn);
return $this->get_list();
}
@ -118,6 +119,7 @@ class Note_model extends CI_Model {
$this->search ? $sql.=$this->search : false;
$this->pn_txn_id ? $sql.=$this->pn_txn_id : false;
$this->orderby ? $sql.=$this->orderby : false;
// log_message('error',$sql);
$query = $this->HT->query($sql);
//print_r($this->HT->queries);
if ($this->topnum === 1) {

@ -521,4 +521,37 @@ class Paypal_model extends CI_Model {
$query = $this->HT->query($sql, array($paymanner, $COLI_SN));
return $query;
}
//根据交易号获取收款记录(传统订单)
public function get_money_t($pn_invoice) {
$sql = "SELECT GroupAccountInfo.*
from GroupAccountInfo
where DeleteFlag=0 and GAI_AccreditNo=?
";
$query = $this->HT->query($sql, array($pn_invoice));
$result = $query->result();
return $result;
}
//根据交易号获取收款记录(商务订单)
public function get_money_b($pn_invoice) {
$sql = "SELECT BIZ_GroupAccountInfo.*
from BIZ_GroupAccountInfo
where DeleteFlag=0 and GAI_AccreditNo=?
";
$query = $this->HT->query($sql, array($pn_invoice));
$result = $query->result();
return $result;
}
/** 删除收款记录 */
public function delete_money_t($deadId)
{
$sql = "UPDATE GroupAccountInfo SET DeleteFlag=1 WHERE GAI_AccreditNo=?";
$query = $this->HT->query($sql, array($deadId));
return $query;
}
public function delete_money_b($deadId)
{
$sql = "UPDATE BIZ_GroupAccountInfo SET DeleteFlag=1 WHERE GAI_AccreditNo=?";
$query = $this->HT->query($sql, array($deadId));
return $query;
}
}

@ -0,0 +1,41 @@
<form action="/webht.php/apps/paypal/index/gai_modal_save" method="post" id="form_modal_gai" name="form_modal_gai">
<?php if ( ! empty($gai_info)) { ?>
<p>已录入订单 <?php echo!empty($old_order) ? $old_order : ""; ?></p>
<table class="table table-hover table-bordered">
<thead>
<th>申请金额/币种</th>
<th>实收金额</th>
</thead>
<tr>
<td><?php echo $gai_info[0]->GAI_SQJE; ?>&nbsp;<?php echo $gai_info[0]->GAI_SQJECurrency; ?></td>
<td><?php echo $gai_info[0]->GAI_SSJE; ?>&nbsp;CNY</td>
</tr>
</table>
<p>撤回以上订单收款记录, 并转移到订单: </p>
<?php } else { ?>
<p>未自动录入到订单 </p>
<?php } ?>
<div class="input-group">
<input type="text" class="form-control" id="pn_invoice" name="pn_invoice" value="<?php echo $new_order; ?>" placeholder="输入订单号" >
<span class="input-group-addon search-btn" style="cursor: pointer; background: url(//data.chinahighlights.com/css/images/global/site-search-button.png) no-repeat center center;width: auto;height: auto;"
onclick="show_gai_modal('<?php echo $note->pn_txn_id; ?>','<?php echo $note->pn_sn; ?>', $('#pn_invoice').val())" ></span>
</div>
<label class="text-danger">订单号形如: 160414408_B , B商务订单JJ160321052_T,T传统订单请务必加上后缀</label>
<div>订单详细内容: </div>
<p>
<?php //
if (!empty($order_info)) {
echo "COLI_SN => $order_info->COLI_SN<br/>";
echo "COLI_ID => $order_info->COLI_ID<br/>";
echo "OPI_Email => $order_info->OPI_Email<br/>";
echo "OPI_Name => $order_info->OPI_Name<br/>";
echo!empty($order_info->COLI_GroupCode) ? "COLI_GroupCode => $order_info->COLI_GroupCode<br/>" : false;
echo!empty($order_info->COLI_OrderDetailText) ? "COLI_OrderDetailText => $order_info->COLI_OrderDetailText\n" : false;
} else {
echo '找不到目标订单内容';
}
?>
</p>
<input type="hidden" name="pn_txn_id" id="pn_txn_id" value="<?php echo $note->pn_txn_id; ?>" />
<input type="hidden" name="pn_id" id="pn_id" value="<?php echo $note->pn_sn; ?>" />
</form>

@ -41,6 +41,7 @@
return date;
}
});
</script>
<style type="text/css">
.export_form_area{display: inline-block;padding: 6px;border: 1px solid #ccc;background-color: #ccc;position: absolute;top: 0;left: 17%;}
@ -123,8 +124,8 @@
<li class="col-sm-4"><strong>客人邮箱</strong></li>
<li class="col-sm-4 "><strong>交易号</strong></li>
<li class="col-sm-3 "><strong>收款(北京)时间</strong></li>
<li class="col-sm-3 "><strong>通知时间</strong></li>
<li class="col-sm-2 "><strong>通知状态</strong></li>
<li class="col-sm-2 "><strong>通知时间</strong></li>
<li class="col-sm-3 "><strong>通知状态</strong></li>
</a>
</ul>
<?php
@ -142,13 +143,16 @@
<li class="col-sm-4 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"><?php echo $item->pn_txn_id; ?></li>
<li class="col-sm-3 nopadding-L" style="overflow:hidden;word-break: break-all;height: 25px;"><?php echo date('Y-m-d H:i:s', strtotime($item->pn_payment_date) + 3600 * 8); ?></li>
<li class="col-sm-3 nopadding-L" ><?php echo $item->pn_datetime; ?></li>
<li class="col-sm-2" >
<li class="col-sm-2 nopadding-L" ><?php echo $item->pn_datetime; ?></li>
<li class="col-sm-3" >
<?php
$show_send = '';
$class_css = '';
$show_record = '查看录入状态';
if ($item->pn_send == 'send') {
$show_send = $item->pn_send;
} elseif ($item->pn_send == 'closeRecord') {
$show_send = $show_record = '已忽略';
} else if ($item->pn_payment_status == 'Completed') {
$class_css = 'btn-danger';
$show_send = $item->pn_send;
@ -157,6 +161,12 @@
$show_send = $item->pn_payment_status;
}
?><a href="javascript:void(0);" onclick="show_order_modal('<?php echo $item->pn_txn_id; ?>', '')" class="btn btn-sm <?php echo $class_css; ?>"><?php echo $show_send; ?></a>
<br>
<a href="javascript:void(0);" class="text_padding text-primary" style="padding: 10px;"
onclick="show_gai_modal('<?php echo $item->pn_txn_id; ?>','<?php echo $item->pn_sn; ?>')"
>
<?php echo $show_record; ?>
</a>
</li>
</ul>
@ -186,6 +196,27 @@
</div>
</div>
<!-- 收款记录详情 -->
<div class="modal" id="modal_set_gai" tabindex="-1" role="dialog" aria-labelledby="gaiModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="gaiModalLabel">收款记录修正操作</h4>
</div>
<div class="modal-body" id="modal_set_gai_body">
...
</div>
<div class="modal-footer" style="color: #333;font-weight: 700;">
<button type="button" class="btn btn-warning pull-left" onclick="close_gai()" >忽略此条收款</button>
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-warning" onclick="submit_gai_modal()">保存</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
function show_order_modal(pn_txn_id, pn_invoice) {
@ -234,6 +265,52 @@
return false;
}
function show_gai_modal(pn_txn_id, pn_id, new_order) {
$('#modal_set_gai').modal('show');
var url = '/webht.php/apps/paypal/index/gai_modal/' + pn_txn_id + '/' + pn_id;
if (new_order) url += '/' + new_order;
$.ajax({
type: "get",
dataType: "json",
url: url,
success: function(data, textStatus) {
$('#modal_set_gai_body').html(data);
$('#modal_set_gai').modal('show');
},
error: function(msg) {
alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYOYO...');
}
});
}
function close_gai() {
var pn_txn_id = $('#pn_txn_id').val();
if (confirm('是否忽略此记录: ' + pn_txn_id)) {
$.ajax({
type: "get",
dataType: "json",
url: '/webht.php/apps/paypal/index/closeGai/' + pn_txn_id,
success: function(data, textStatus) {
alert(data);
},
error: function(msg) {
alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYOYO...');
}
});
}
}
function submit_gai_modal() {debugger
$('#form_modal_gai').ajaxSubmit({
success: function(data, textStatus) {
alert(data);
},
error: function(msg) {
alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYOYO...');
},
dataType: 'json',
timeout: 30000
});
return false;
}

Loading…
Cancel
Save