From a93d4308d1b68b1167d568ad5be6c549705f75c8 Mon Sep 17 00:00:00 2001 From: lyt Date: Tue, 30 Apr 2019 17:57:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?Trippest=E6=88=90=E6=9C=AC=E8=A1=A5?= =?UTF-8?q?=E5=85=85:=E5=A2=9E=E5=8A=A0report=5Ftour:RPT=5FCOLD=5FSN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../third_party/trippestOrderSync/controllers/order_finance.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/webht/third_party/trippestOrderSync/controllers/order_finance.php b/webht/third_party/trippestOrderSync/controllers/order_finance.php index ee9bac2f..e4c06133 100644 --- a/webht/third_party/trippestOrderSync/controllers/order_finance.php +++ b/webht/third_party/trippestOrderSync/controllers/order_finance.php @@ -168,6 +168,7 @@ class Order_finance extends CI_Controller { $report_tour_pvt['tourProvide'] = mb_substr($cpvt->vendor_name, 0, 50); $report_tour_pvt['tourBZ'] = mb_substr($cpvt->comment, 0, 150); $report_tour_pvt['orderstats'] = 0; + $report_tour_pvt['RPT_COLD_SN'] = $cpvt->cold_sn[0]; // 成本详情 $report_tour_pvt['RPT_Car'] = $cpvt->cost_category['touristCarOperations']; $report_tour_pvt['RPT_Meal'] = $cpvt->cost_category['restraurantOperations']; @@ -196,6 +197,7 @@ class Order_finance extends CI_Controller { $cost_c['tourCostRsd'] = $cost->person_cost; $cost_c['tourCostRSx'] = $cost->person_cost; $cost_c['tourcost'] = $cost->order_cost[0]->order_cost_sum; + $cost_c['RPT_COLD_SN'] = $cost->order_cost[0]->COLD_SN; $cost_c_price = 0; foreach ($cost->order_cost as $koc => $coc) { if ($coc->PAG_code === $coc->real_code) { From fafede57fc923436da4e536a86d9a5cd9834fde5 Mon Sep 17 00:00:00 2001 From: lyt Date: Sun, 5 May 2019 14:44:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=90=8C=E6=AD=A5:=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=BB=84=E5=9B=A2=E7=A4=BE=E9=94=99=E8=AF=AF=E7=9A=84=E5=A4=87?= =?UTF-8?q?=E6=B3=A8=E6=8F=90=E7=A4=BA;=20=E4=BF=AE=E6=AD=A3=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=94=B6=E6=AC=BE=E8=AE=B0=E5=BD=95=E7=9A=84=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B[=E5=9C=B0=E6=8E=A5=E4=BB=A3=E6=94=B6,=E5=9C=B0?= =?UTF-8?q?=E6=8E=A5=E7=A4=BE=E4=BB=A3=E6=94=B6]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trippestOrderSync/controllers/TulanduoApi.php | 8 +++++++- .../third_party/trippestOrderSync/models/order_update.php | 2 +- .../third_party/trippestOrderSync/models/orders_model.php | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php index 4dd918a5..4c4384e0 100644 --- a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php +++ b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php @@ -369,7 +369,7 @@ class TulanduoApi extends CI_Controller ,"GCI_leaveDate" => $detail_jsonResp->orderDetail->leaveDate ,"GCI_createTime" => date('Y-m-d H:i:s') ); - $this->Order_update->biz_groupcombineinfo_update($gci_update_column); + $gci_info = $this->Order_update->biz_groupcombineinfo_update($gci_update_column); /** GRoupInfo */ $coli_groupcode_ht = analysis_groupCode($getInfo_byGroupCode->COLI_GroupCode); $groupcode_ht = $coli_groupcode_ht['cut']; @@ -395,6 +395,12 @@ class TulanduoApi extends CI_Controller $new_memo = trim($detail_jsonResp->orderDetail->orderRemark)=="" ? $old_memo : $old_memo . " orderRemark\r\n" . $detail_jsonResp->orderDetail->orderRemark . "\r\n"; $old_detail = mb_strstr($coli_orderdetailtext, " operations", true)!==false ? mb_strstr($coli_orderdetailtext, " operations", true) : $coli_orderdetailtext; $new_detail = trim($allDetails_to_HT)=="" ? $old_detail : $old_detail . " operations\r\n" . $allDetails_to_HT . "\r\n"; + // 判断收款方并提示 + $finance_memo = ""; + if (intval($coli_opi_id) === 435 && in_array($gci_info->GCI_FromAgc, array("D目的地桂林组", "Trippest"))) { + $finance_memo .= "备注: 本订单组团社是渠道, 账单收款方应为地接社代收, 同步回来却是Trippest自营, 请注意核对.\r\n"; + $new_memo .= mb_strstr($new_memo, "orderRemark", true)!==false ? $finance_memo : ("orderRemark " . $finance_memo); + } // 团款总金额 // 渠道实收 $travel_fee = 0; diff --git a/webht/third_party/trippestOrderSync/models/order_update.php b/webht/third_party/trippestOrderSync/models/order_update.php index bff88fd2..8b0bd495 100644 --- a/webht/third_party/trippestOrderSync/models/order_update.php +++ b/webht/third_party/trippestOrderSync/models/order_update.php @@ -53,7 +53,7 @@ class Order_update extends CI_Model { } $update_str = $this->HT->update_string('GroupCombineInfo', $column_data, $this->gci_where_update); $update_exc = $this->HT->query($update_str); - return $update_exc; + return $this->HT->query("SELECT top 1 * from GroupCombineInfo WHERE " . $this->gci_where_update)->row(); } /*! diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php index a25828f3..e241900c 100644 --- a/webht/third_party/trippestOrderSync/models/orders_model.php +++ b/webht/third_party/trippestOrderSync/models/orders_model.php @@ -1280,8 +1280,8 @@ class Orders_model extends CI_Model { public function biz_groupaccountinfo_cut($coli_sn, $paytype) { $sql = "DELETE from BIZ_GroupAccountInfo - WHERE GAI_COLI_SN=? AND GAI_Type=? AND GAI_Operator = 435"; - $query = $this->HT->query($sql, array($coli_sn, $paytype)); + WHERE GAI_COLI_SN=? AND GAI_Operator = 435"; // AND GAI_Type=?, $paytype + $query = $this->HT->query($sql, array($coli_sn)); return $query; } From 0f1deb1ef0a280cb1ed52f57a5b09f20d91b5899 Mon Sep 17 00:00:00 2001 From: lyt Date: Fri, 17 May 2019 13:38:21 +0800 Subject: [PATCH 3/3] =?UTF-8?q?Trippest=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E8=B4=A6=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../trippestOrderSync/controllers/TulanduoApi.php | 5 +++++ .../trippestOrderSync/models/orders_model.php | 13 +++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php index 4c4384e0..ba83d1d4 100644 --- a/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php +++ b/webht/third_party/trippestOrderSync/controllers/TulanduoApi.php @@ -697,6 +697,11 @@ class TulanduoApi extends CI_Controller $output_text = "Got order operations from TuLanDuo:" . $detail_jsonResp->orderDetail->orderId . ". " . $coli_id; log_message('error', $output_text); echo $output_text; + if (strval($order->isHistory) === '1') { + require_once('order_finance.php'); + $vendor_class = new Order_finance(); + $vendor_class->single_order_report($coli_sn); + } return; } diff --git a/webht/third_party/trippestOrderSync/models/orders_model.php b/webht/third_party/trippestOrderSync/models/orders_model.php index e241900c..e32fbaf3 100644 --- a/webht/third_party/trippestOrderSync/models/orders_model.php +++ b/webht/third_party/trippestOrderSync/models/orders_model.php @@ -176,7 +176,12 @@ class Orders_model extends CI_Model { public function get_groupCombineInfo_finance() { // return array(); // 历史数据已获取完毕 - $to_update_cost_date = date("Y-m-d", strtotime("-45 days")); + // $to_update_cost_date = date("Y-m-d", strtotime("-45 days")); + $to_update_month_begin = date('Y-m-01', strtotime("-4 months", strtotime(date("Y-m-d")))); + $to_update_month_end = date('Y-m-01', strtotime("-3 months", strtotime(date("Y-m-d")))); + $end_d = strtotime($to_update_month_end)-1; + $to_update_month_end = date("Y-m-d 23:59:59", $end_d); + $set_time = date("Y-m-d 00:00:00", strtotime("+50 days",$end_d)); $last_update_time = date("Y-m-d 00:00:00"); $sql = " SELECT top 1 coli.COLI_ID, coli.COLI_SN, coli.COLI_GRI_SN, cold.COLD_SN, coli.COLI_OrderDetailText, coli.COLI_Memo,coli.COLI_State,coli.COLI_OPI_ID, cold.COLD_PlanVEI_SN, cold.COLD_MemoText, gci.*,'1' as 'isHistory' @@ -189,15 +194,15 @@ class Orders_model extends CI_Model { where GCI_combineNo is not null and GCI_combineNo not in ('cancel','forbidden') -- 45天前的订单 - and gci.gci_leaveDate = '$to_update_cost_date' + --and gci.gci_leaveDate = '$to_update_cost_date' -- 今天更新一次 and gci.GCI_createTime < '$last_update_time' -- 已生成账单的不再自动同步 and NOT exists ( select 1 from report_order where ordernumber=COLI_ID and orderstats=1 ) --- and GCI_travelDate between '2018-08-01' and '2018-08-31 23:59:59' --- and gci.GCI_createTime < '2018-12-06 14:00:00' + and GCI_travelDate between '$to_update_month_begin' and '$to_update_month_end' + and gci.GCI_createTime < '$set_time' and GCI_combineNo not like '%取消%' "; $sql .= " ORDER BY isHistory ASC,GCI_createTime ASC ";