From 7f690b7dfeb13b2a9337b82c88aeb02fa176a626 Mon Sep 17 00:00:00 2001 From: lyt Date: Thu, 5 Dec 2019 15:27:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4report=5Ftour=E7=9B=B8?= =?UTF-8?q?=E5=90=8C=E7=9A=84cold=5Fsn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/order_finance.php | 2 ++ .../models/orderFinance_model.php | 20 +++++++++---------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/webht/third_party/trippestOrderSync/controllers/order_finance.php b/webht/third_party/trippestOrderSync/controllers/order_finance.php index 0a3b92f6..25207e9f 100644 --- a/webht/third_party/trippestOrderSync/controllers/order_finance.php +++ b/webht/third_party/trippestOrderSync/controllers/order_finance.php @@ -179,6 +179,7 @@ class Order_finance extends CI_Controller { $report_tour_pvt['RPT_Other'] = $cpvt->cost_category['otherCosts']; $report_tour_pvt['RPT_Total'] = $cpvt->cost_sum; $report_tour_pvt['RPT_PersonGrade'] = $cpvt->person_grade; + $report_tour_pvt['this_coldsn'] = implode(',', $cpvt->cold_sn); $ret->report_tour[] = $report_tour_pvt; // 计算订单总成本 $report_order['basemoney'] = bcadd($report_order['basemoney'], $report_tour_pvt['tourcost']); @@ -220,6 +221,7 @@ class Order_finance extends CI_Controller { $cost_c['RPT_Other'] = $cost->cost_category['otherCosts']; $cost_c['RPT_Total'] = $cost->cost_sum; $cost_c['RPT_PersonGrade'] = $cost->person_num; + $cost_c['this_coldsn'] = implode(',', array_map(function ($ele){return $ele->COLD_SN;}, $cost->order_cost)); $ret->report_tour[] = $cost_c; // 计算订单总成本 $report_order['basemoney'] = bcadd($report_order['basemoney'], $cost_c['tourcost']); diff --git a/webht/third_party/trippestOrderSync/models/orderFinance_model.php b/webht/third_party/trippestOrderSync/models/orderFinance_model.php index c52beaa9..3def163e 100644 --- a/webht/third_party/trippestOrderSync/models/orderFinance_model.php +++ b/webht/third_party/trippestOrderSync/models/orderFinance_model.php @@ -270,19 +270,19 @@ class OrderFinance_model extends CI_Model { { foreach ($report_tour_arr as $krt => $vrt) { $tourBz_tmp = ""; - if ($this->report_tour_exists($vrt['ordernumber'], $vrt['RPT_COLD_SN']) === TRUE) { - $where = " ordernumber='" . $vrt['ordernumber'] . "' and RPT_COLD_SN=".$vrt['RPT_COLD_SN'] ; //AND tourCode='" . $vrt['tourCode'] . "' "; - $tourBz_tmp = mb_ereg_replace('[^a-zA-Z0-9\-\[\]]$', '', strstr($vrt['tourBZ'], ",", true)); - if (stripos($tourBz_tmp, "pvt") === false) { - $tourBz_tmp = str_replace("]", "", $tourBz_tmp); - } - $tourBz_tmp = str_replace("[", "[[]", $tourBz_tmp); + $tourBz_tmp = mb_ereg_replace('[^a-zA-Z0-9\-\[\]]$', '', strstr($vrt['tourBZ'], ",", true)); + if (stripos($tourBz_tmp, "pvt") === false) { + $tourBz_tmp = str_replace("]", "", $tourBz_tmp); + } + $tourBz_tmp = str_replace("[", "[[]", $tourBz_tmp); + $where = " ordernumber='" . $vrt['ordernumber'] . "' and RPT_COLD_SN IN (" . $vrt['this_coldsn'] . ") " ; $where .= " AND (tourBZ like '%" . $this->HT->escape_like_str($tourBz_tmp) . "%' - OR tourBZ='') "; + OR tourBZ='' + OR orderstats=0 + ) "; $delete_sql = "DELETE FROM tourmanager.dbo.Report_Tour where " . $where; - // $update_sql = $this->HT->update_string('tourmanager.dbo.Report_Tour', $vrt, $where); $this->HT->query($delete_sql); - } + unset($vrt['this_coldsn']); $this->HT->insert('tourmanager.dbo.Report_Tour', $vrt); } return TRUE;