diff --git a/webht/third_party/pay/controllers/iPayLinksService.php b/webht/third_party/pay/controllers/iPayLinksService.php index d787b765..6db9d8b6 100644 --- a/webht/third_party/pay/controllers/iPayLinksService.php +++ b/webht/third_party/pay/controllers/iPayLinksService.php @@ -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(); diff --git a/webht/third_party/pay/models/IPayLinks_model.php b/webht/third_party/pay/models/IPayLinks_model.php index 56096204..ff8af136 100644 --- a/webht/third_party/pay/models/IPayLinks_model.php +++ b/webht/third_party/pay/models/IPayLinks_model.php @@ -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; + } } diff --git a/webht/third_party/pay/models/note_model.php b/webht/third_party/pay/models/note_model.php index ce206ad6..ba7942ca 100644 --- a/webht/third_party/pay/models/note_model.php +++ b/webht/third_party/pay/models/note_model.php @@ -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); diff --git a/webht/third_party/pay/views/gai_setting.php b/webht/third_party/pay/views/gai_setting.php new file mode 100644 index 00000000..355d3b2e --- /dev/null +++ b/webht/third_party/pay/views/gai_setting.php @@ -0,0 +1,38 @@ +
+ +

已录入订单

+ + + + + + + + + +
申请金额/币种实收金额
GAI_SQJE; ?> GAI_SQJECurrency; ?>GAI_SSJE; ?> CNY
+

撤回以上订单收款记录, 并转移到订单:

+ +
+ + +
+ +
订单详细内容:
+

+ $order_info->COLI_SN
"; + echo "COLI_ID => $order_info->COLI_ID
"; + echo "OPI_Email => $order_info->OPI_Email
"; + echo "OPI_Name => $order_info->OPI_Name
"; + echo!empty($order_info->COLI_GroupCode) ? "COLI_GroupCode => $order_info->COLI_GroupCode
" : false; + echo!empty($order_info->COLI_OrderDetailText) ? "COLI_OrderDetailText => $order_info->COLI_OrderDetailText\n" : false; + } else { + echo '找不到目标订单内容'; + } + ?> +

+ + +
diff --git a/webht/third_party/pay/views/iPayLinks_list.php b/webht/third_party/pay/views/iPayLinks_list.php index 8b3b3a45..b97c0a80 100644 --- a/webht/third_party/pay/views/iPayLinks_list.php +++ b/webht/third_party/pay/views/iPayLinks_list.php @@ -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))]; diff --git a/webht/third_party/pay/views/iPayLinks_list2.php b/webht/third_party/pay/views/iPayLinks_list2.php index 2b5dac34..9e7dddf3 100644 --- a/webht/third_party/pay/views/iPayLinks_list2.php +++ b/webht/third_party/pay/views/iPayLinks_list2.php @@ -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;} @@ -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 '; } ?> - + + + @@ -223,6 +230,27 @@ + + +