ipaylinks 增加显示是否已录入订单,收款记录移交功能

feature/trippest
lyt 7 years ago
parent 6281487374
commit 70333b9905

@ -60,7 +60,7 @@ class IPayLinksService extends CI_Controller
$this->note_list();
}
public function note_list()
public function note_list2()
{
$data = array();
$data["paytext"] = $this->payment_status();
@ -76,7 +76,7 @@ class IPayLinksService extends CI_Controller
return;
}
public function note_list2()
public function note_list()
{
$data = array();
$data["paytext"] = $this->payment_status();
@ -507,23 +507,25 @@ class IPayLinksService extends CI_Controller
$M_State = 0;
$this->IPayLinks_model->save_automail($fromName, $fromEmail, $toName, $toEmail, $subject, $body, $M_RelatedInfo, $M_State, $M_AddTime, 'iPayLinks note');
// 2.给客人发邮件,通知账单
$toName2 = !empty($item->IPL_payerName) ? $item->IPL_payerName : '';
$toEmail2 = !empty($item->IPL_payerEmail) ? $item->IPL_payerEmail : '';
// Zac170919039_T订单号 / 996.00USD / iPayLinks
$subject2 = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_orderAmount . $item->IPL_currencyCode . ' / China Highlights';
// lang
$remark_info = json_decode($item->IPL_memo);
(isset($remark_info->remark)) ? $remark_info = json_decode($remark_info->remark) : NULL;
$ln = (isset($remark_info->ln)) ? $remark_info->ln : "en";
$this->lang->load('ipl_common',$ln);
$this->lang->load('ipl_buyer_email',$ln);
$item->text = $this->lang->language;
// # lang end
$body2 = $this->load->view('receipt_buyer', $item, true);
$M_RelatedInfo2 = $item->IPL_sn;
$M_AddTime2 = $item->IPL_completeTime;
$M_State2 = 0;
$this->IPayLinks_model->save_automail($fromName, $fromEmail, $toName2, $toEmail2, $subject2, $body2, $M_RelatedInfo2, $M_State2, $M_AddTime2, 'China Highlights Has Received Your Payment');
if (empty($pn_txn_id)) {
$toName2 = !empty($item->IPL_payerName) ? $item->IPL_payerName : '';
$toEmail2 = !empty($item->IPL_payerEmail) ? $item->IPL_payerEmail : '';
// Zac170919039_T订单号 / 996.00USD / iPayLinks
$subject2 = $orderid_info->orderid . '_' . $orderid_info->ordertype . ' / ' . $item->IPL_orderAmount . $item->IPL_currencyCode . ' / China Highlights';
// lang
$remark_info = json_decode($item->IPL_memo);
(isset($remark_info->remark)) ? $remark_info = json_decode($remark_info->remark) : NULL;
$ln = (isset($remark_info->ln)) ? $remark_info->ln : "en";
$this->lang->load('ipl_common',$ln);
$this->lang->load('ipl_buyer_email',$ln);
$item->text = $this->lang->language;
// # lang end
$body2 = $this->load->view('receipt_buyer', $item, true);
$M_RelatedInfo2 = $item->IPL_sn;
$M_AddTime2 = $item->IPL_completeTime;
$M_State2 = 0;
$this->IPayLinks_model->save_automail($fromName, $fromEmail, $toName2, $toEmail2, $subject2, $body2, $M_RelatedInfo2, $M_State2, $M_AddTime2, 'China Highlights Has Received Your Payment');
}
// ---- 添加邮件发送记录 end
$this->Note_model->update_send($item->IPL_dealId, 'send');
@ -915,6 +917,82 @@ class IPayLinksService extends CI_Controller
);
}
public function gai_modal($pn_txn_id=null, $pn_invoice=null, $pn_id = null, $neworder=null)
{
$data = array();
$data['note'] = $this->Note_model->note($pn_txn_id, $pn_id);
$orderid_info = $this->analysis_orderid($pn_invoice);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
if ($orderid_info->ordertype === 'T') {
$data['gai_info'] = $this->IPayLinks_model->get_money_t($pn_txn_id);
} elseif ($orderid_info->ordertype === 'B') {
$data['gai_info'] = $this->IPayLinks_model->get_money_b($pn_txn_id);
}
}
$data['old_order'] = $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->IPayLinks_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'][0]->IPL_orderId);
if (!empty($orderid_info)) {
$orderid_info = json_decode($orderid_info);
if ($orderid_info->ordertype === 'T') {
$data['gai_info'] = $this->IPayLinks_model->get_money_t($pn_txn_id);
$this->IPayLinks_model->delete_money_t($pn_txn_id);
} elseif ($orderid_info->ordertype === 'B') {
$data['gai_info'] = $this->IPayLinks_model->get_money_b($pn_txn_id);
$this->IPayLinks_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->IPayLinks_model->get_order($orderid_info->orderid, false, $orderid_info->ordertype);
if (!empty($advisor_info)) {
$this->Note_model->set_invoice($pn_txn_id, $neworder);
$this->batch_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;
}
//获取note详情以便后续修改各项数据
public function note_modal($pn_txn_id = false, $pn_invoice = false, $pn_id = null) {
$data = array();

@ -311,7 +311,7 @@ class IPayLinks_model extends CI_Model {
public function get_money_t($pn_invoice) {
$sql = "SELECT GroupAccountInfo.*
from GroupAccountInfo
where GAI_Type='15018' and GAI_AccreditNo=?
where GAI_Type='15018' and DeleteFlag=0 and GAI_AccreditNo=?
";
$query = $this->HT->query($sql, array($pn_invoice));
$result = $query->result();
@ -321,7 +321,7 @@ class IPayLinks_model extends CI_Model {
public function get_money_b($pn_invoice) {
$sql = "SELECT BIZ_GroupAccountInfo.*
from BIZ_GroupAccountInfo
where GAI_Type='15018' and GAI_AccreditNo=?
where GAI_Type='15018' and DeleteFlag=0 and GAI_AccreditNo=?
";
$query = $this->HT->query($sql, array($pn_invoice));
$result = $query->result();
@ -340,4 +340,17 @@ class IPayLinks_model extends CI_Model {
$query = $this->HT->query($sql, array($entry_sum_RMB, $pn_invoice));
return $query;
}
/** 删除收款记录 */
public function delete_money_t($deadId)
{
$sql = "UPDATE GroupAccountInfo SET DeleteFlag=1 WHERE GAI_Type='15018' and 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_Type='15018' and GAI_AccreditNo=?";
$query = $this->HT->query($sql, array($deadId));
return $query;
}
}

@ -9,6 +9,7 @@ class Note_model extends CI_Model {
var $orderby = null;
var $send = null;
var $search = null;
var $date = null;
var $dealId = null;
var $payment_status = null;
@ -21,6 +22,7 @@ class Note_model extends CI_Model {
$this->topnum = null;
$this->send = null;
$this->search = null;
$this->date = null;
$this->payment_status = null;
$this->dealId = null;
$this->orderby = ' ORDER BY IPL_sent DESC ,IPL_sn DESC ';
@ -42,15 +44,16 @@ class Note_model extends CI_Model {
public function search_date($date) {
$this->init();
$search_sql = " AND (IPL_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' or IPL_sent<>'send') ";
$search_sql = " AND (IPL_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' ) ";
$this->search = $search_sql;
$this->send = " AND (IPL_sent<>'closeRecord') ";
$this->orderby=" ORDER BY IPL_sent DESC ,IPL_sn DESC ";
return $this->get_list();
}
public function search_date2($date) {
$this->init();
$search_sql = " AND (IPL_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' or IPL_sent<>'send') ";
$this->search = $search_sql;
$search_sql = " AND (IPL_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' ) ";
$this->date = $search_sql;
$this->orderby=" ORDER BY IPL_sent DESC ,IPL_sn DESC ";
return $this->get_list_with_order();
}
@ -198,7 +201,7 @@ class Note_model extends CI_Model {
when IPL_payType='pay' and (ISNULL(gaib.GAI_SN, 0)+ISNULL(gai.GAI_SN, 0))>0 then 9999
when IPL_payType='pay' and coli.COLI_ID is not null then 99999
when IPL_payType<>'pay' then 10000
when IPL_sent=' closeRecord' then 10000
when IPL_sent='closeRecord' then 10000
else 1
end isRecord,
ipl.*
@ -208,13 +211,14 @@ class Note_model extends CI_Model {
left join Tourmanager.dbo.GroupAccountInfo gai on gai.GAI_AccreditNo=ipl.IPL_dealId and gai.DeleteFlag=0 and ipl.IPL_payType='pay'
where 1=1
and ( (ipl.IPL_stateCode=2 and ipl.IPL_payType<>'pay') or (ipl.IPL_resultCode='0000' and ipl.IPL_payType='pay') )
$this->send
$this->search
$this->dealId
and (
1=1
$this->send
$this->search
$this->dealId
$this->date
-- AND (IPL_noticeTime BETWEEN '2018-07-27 00:00:00' AND '2018-07-27 23:59:59' or IPL_sent<>'send')
or ((ISNULL(gaib.GAI_SN, 0)+ISNULL(gai.GAI_SN, 0))=0 and IPL_payType='pay' and COLI.COLI_ID is null)
or ((ISNULL(gaib.GAI_SN, 0)+ISNULL(gai.GAI_SN, 0))=0 and IPL_payType='pay' AND (IPL_sent<>'closeRecord') and COLI.COLI_ID is null)
)
order by isRecord asc,ipl.IPL_sent desc,IPL_sn desc";
$query = $this->INFO->query($sql);

@ -0,0 +1,38 @@
<form action="http://www.mycht.cn/webht.php/apps/pay/iPayLinksService/gai_modal_save" method="post" id="form_modal_orderid" 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 } ?>
<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" onclick="show_gai_modal('<?php echo $note->IPL_dealId; ?>','<?php echo $note->IPL_orderId; ?>','<?php echo $note->IPL_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->IPL_dealId; ?>" />
<input type="hidden" name="pn_id" id="pn_id" value="<?php echo $note->IPL_sn; ?>" />
</form>

@ -159,6 +159,8 @@
$class_css = '';
if ($item->IPL_sent == 'send') {
$show_send = $item->IPL_sent;
} else if ($item->IPL_sent == 'closeRecord') {
$show_send = "已忽略";
} else if (strcmp(trim($item->IPL_stateCode), "2") && $item->IPL_stateCode != NULL) {
$class_css = 'btn-danger';
$show_send = $paytext[intval(trim($item->IPL_stateCode))];

@ -42,6 +42,7 @@
.input-group-btn{border: 1px solid #ccc;padding: 5px;}
.search-btn{cursor: pointer; background: url(//data.chinahighlights.com/css/images/global/site-search-button.png) no-repeat center center;}
.export_form_area{display: inline-block;padding: 6px;border: 1px solid #ccc;background-color: #ccc;}
#modal_set_gai .btn{color: #333;font-weight: 700;}
</style>
</head>
<body>
@ -161,6 +162,8 @@
$class_css = '';
if ($item->IPL_sent == 'send') {
$show_send = $item->IPL_sent;
} else if ($item->IPL_sent == 'closeRecord') {
$show_send = "已忽略";
} else if (strcmp(trim($item->IPL_stateCode), "2") && $item->IPL_stateCode != NULL) {
$class_css = 'btn-danger';
$show_send = $paytext[intval(trim($item->IPL_stateCode))];
@ -185,7 +188,11 @@
$record_class = ' btn btn-sm btn_margin btn-warning ';
}
?>
<a href="javascript:void(0);" onclick="" class="<?php echo $record_class; ?>"><?php echo $isRecord; ?></a>
<a href="javascript:void(0);" class="<?php echo $record_class; ?>"
onclick="show_gai_modal('<?php echo $item->IPL_dealId; ?>', '<?php echo $item->IPL_orderId; ?>','<?php echo $item->IPL_sn; ?>')"
>
<?php echo $isRecord; ?>
</a>
</li>
</ul>
@ -223,6 +230,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">
<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>
</body>
<script src="//data.chinahighlights.com/js/min.php?f=/js/jquery-1.8.2.min.js&v=20170811" type="text/javascript"></script>
<script type="text/javascript">
@ -272,6 +300,51 @@
return date;
}
});
function show_gai_modal(pn_txn_id, pn_invoice, pn_id, new_order) {
var url = '/webht.php/apps/pay/ipaylinksservice/gai_modal/' + pn_txn_id + '/' + pn_invoice + '/' + 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: 'http://www.mycht.cn/webht.php/apps/pay/ipaylinksservice/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() {
$('#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;
}
function show_order_modal(pn_txn_id, pn_invoice,noticeTime,old_order, pn_id) {
if (pn_txn_id) {
$.ajax({

@ -13,13 +13,12 @@
<dd><?php echo $note->IPL_acquiringTime; ?></dd>
</dl>
<dl class="dl-horizontal">
<dt>订单号</dt>
<dd>
<div class="input-group">
<input type="text" class="form-control" id="pn_invoice" name="pn_invoice" value="<?php echo!empty($IPL_orderId) ? $IPL_orderId : $note->IPL_orderId; ?>">
<span class="input-group-addon search-btn" onclick="show_order_modal('<?php echo $note->IPL_dealId; ?>', $('#pn_invoice').val(),'<?php echo $note->IPL_noticeTime; ?>','<?php echo $note->IPL_orderId; ?>')"></span>
<span class="input-group-addon search-btn" onclick="show_order_modal('<?php echo $note->IPL_dealId; ?>', $('#pn_invoice').val(),'<?php echo $note->IPL_noticeTime; ?>','<?php echo $note->IPL_orderId; ?>','<?php echo $note->IPL_sn; ?>')"></span>
</div>
<label class="text-danger">订单号形如: 160414408_B , B商务订单JJ160321052_T,T传统订单请务必加上后缀</label>
</dd>
@ -28,7 +27,6 @@
<dl class="dl-horizontal">
<dt>订单详细内容</dt>
<dd>
<?php
if (!empty($order_info)) {
echo "COLI_SN => $order_info->COLI_SN<br/>";

Loading…
Cancel
Save