|
|
@ -245,7 +245,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$ret->coli_sn = $coli_sn;
|
|
|
|
$ret->coli_sn = $coli_sn;
|
|
|
|
$all_pags = array_map(function($ele){ return $ele->PAG_Code;}, $all_orders);
|
|
|
|
$all_pags = array_map(function($ele){ return mb_strtoupper($ele->PAG_Code);}, $all_orders);
|
|
|
|
$all_pag = array_unique($all_pags);
|
|
|
|
$all_pag = array_unique($all_pags);
|
|
|
|
$combine_pag_arr = array();
|
|
|
|
$combine_pag_arr = array();
|
|
|
|
$pvt_code = $this->forbidden_combine();
|
|
|
|
$pvt_code = $this->forbidden_combine();
|
|
|
@ -275,7 +275,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
$all_orders[] = $ve;
|
|
|
|
$all_orders[] = $ve;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 重新计算重复次数
|
|
|
|
// 重新计算重复次数
|
|
|
|
$all_pags = array_filter(array_map(function($ele){ return $ele->PAG_Code;}, $all_orders));
|
|
|
|
$all_pags = array_filter(array_map(function($ele){ return mb_strtoupper($ele->PAG_Code);}, $all_orders));
|
|
|
|
// 重复的产品号; 可混拼的产品
|
|
|
|
// 重复的产品号; 可混拼的产品
|
|
|
|
$repeat_code = array();
|
|
|
|
$repeat_code = array();
|
|
|
|
$code_count = array_count_values($all_pags);
|
|
|
|
$code_count = array_count_values($all_pags);
|
|
|
@ -284,7 +284,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$tmp = null;
|
|
|
|
$tmp = null;
|
|
|
|
$tmp = $this->get_allowed_combine($vp);
|
|
|
|
$tmp = $this->get_allowed_combine(mb_strtoupper($vp));
|
|
|
|
$this_allowed = ($tmp === null) ? null : array_diff($tmp, $all_pag); // diff((31,41), (31,41,47)) ==> ()
|
|
|
|
$this_allowed = ($tmp === null) ? null : array_diff($tmp, $all_pag); // diff((31,41), (31,41,47)) ==> ()
|
|
|
|
// $this_allowed = ($tmp === null) ? null : array_diff($all_pag, $tmp); // diff((31,41), (31,41,47)) ==> ()
|
|
|
|
// $this_allowed = ($tmp === null) ? null : array_diff($all_pag, $tmp); // diff((31,41), (31,41,47)) ==> ()
|
|
|
|
if (empty($this_allowed) && $tmp !== null) {
|
|
|
|
if (empty($this_allowed) && $tmp !== null) {
|
|
|
@ -310,10 +310,10 @@ class Order_finance extends CI_Controller {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$ret->combine_pags = my_array_unique($combine_pag_arr);
|
|
|
|
$ret->combine_pags = my_array_unique($combine_pag_arr);
|
|
|
|
$ret->combine_pags = $ret->combine_pags[0]; // 这里用0是因为一个拼团应该只有一组或一个产品
|
|
|
|
$ret->combine_pags = $ret->combine_pags[0]; // 这里用0是因为一个拼团应该只有一组或一个产品
|
|
|
|
// 一些不再常规混拼的团, 仅有一个拼团号的订单则加上该团
|
|
|
|
// 一些不在常规混拼的团, 仅有一个拼团号的订单则加上该团
|
|
|
|
foreach ($all_orders as $key => $value) {
|
|
|
|
foreach ($all_orders as $key => $value) {
|
|
|
|
if ($value->combine_cnt === 1) {
|
|
|
|
if ($value->combine_cnt === 1) {
|
|
|
|
$ret->combine_pags[] = $value->PAG_Code;
|
|
|
|
$ret->combine_pags[] = mb_strtoupper($value->PAG_Code);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$ret->combine_pags = array_values(array_unique($ret->combine_pags));
|
|
|
|
$ret->combine_pags = array_values(array_unique($ret->combine_pags));
|
|
|
@ -323,11 +323,11 @@ class Order_finance extends CI_Controller {
|
|
|
|
$pag_sns = array();
|
|
|
|
$pag_sns = array();
|
|
|
|
$unique_coli = array();
|
|
|
|
$unique_coli = array();
|
|
|
|
foreach ($all_orders as $ko => $vo) {
|
|
|
|
foreach ($all_orders as $ko => $vo) {
|
|
|
|
if (in_array($vo->PAG_Code, $ret->combine_pags)) {
|
|
|
|
if (in_array(mb_strtoupper($vo->PAG_Code), $ret->combine_pags)) {
|
|
|
|
$pag_sns[] = $vo->COLD_ServiceSN;
|
|
|
|
$pag_sns[] = $vo->COLD_ServiceSN;
|
|
|
|
// 整团单拼时, 避免重复计算人数
|
|
|
|
// 整团单拼时, 避免重复计算人数
|
|
|
|
// 订单人数不重复计
|
|
|
|
// 订单人数不重复计
|
|
|
|
if ( ! in_array($vo->PAG_Code, $pvt_code) && ! in_array($vo->COLI_SN, $unique_coli)) {
|
|
|
|
if ( ! in_array(mb_strtoupper($vo->PAG_Code), $pvt_code) && ! in_array($vo->COLI_SN, $unique_coli)) {
|
|
|
|
$unique_coli[] = $vo->COLI_SN;
|
|
|
|
$unique_coli[] = $vo->COLI_SN;
|
|
|
|
$ret->person_num += $vo->COLD_PersonNum + $vo->COLD_ChildNum;
|
|
|
|
$ret->person_num += $vo->COLD_PersonNum + $vo->COLD_ChildNum;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -338,9 +338,9 @@ class Order_finance extends CI_Controller {
|
|
|
|
$tour_s->person_num = $vo->COLD_PersonNum + $vo->COLD_ChildNum;
|
|
|
|
$tour_s->person_num = $vo->COLD_PersonNum + $vo->COLD_ChildNum;
|
|
|
|
$tour_s->adult_num = $vo->COLD_PersonNum;
|
|
|
|
$tour_s->adult_num = $vo->COLD_PersonNum;
|
|
|
|
$tour_s->child_num = $vo->COLD_ChildNum;
|
|
|
|
$tour_s->child_num = $vo->COLD_ChildNum;
|
|
|
|
$tour_s->PAG_code = $vo->PAG_Code;
|
|
|
|
$tour_s->PAG_code = mb_strtoupper($vo->PAG_Code);
|
|
|
|
// $tour_s->real_code = isset($vo->real_code) ? $vo->real_code : $vo->PAG_Code;
|
|
|
|
// $tour_s->real_code = isset($vo->real_code) ? $vo->real_code : $vo->PAG_Code;
|
|
|
|
$tour_s->real_code = isset($vo->real_code)&&in_array($vo->real_code, $ret->combine_pags) ? $vo->real_code : $vo->PAG_Code;
|
|
|
|
$tour_s->real_code = isset($vo->real_code)&&in_array($vo->real_code, $ret->combine_pags) ? $vo->real_code : mb_strtoupper($vo->PAG_Code);
|
|
|
|
$tour_s->real_pag_sn = isset($vo->real_pag_sn) ? $vo->real_pag_sn : $vo->COLD_ServiceSN;
|
|
|
|
$tour_s->real_pag_sn = isset($vo->real_pag_sn) ? $vo->real_pag_sn : $vo->COLD_ServiceSN;
|
|
|
|
$tour_s->totalPrice = $vo->COLD_TotalPrice;
|
|
|
|
$tour_s->totalPrice = $vo->COLD_TotalPrice;
|
|
|
|
$ret->order_cost[] = $tour_s;
|
|
|
|
$ret->order_cost[] = $tour_s;
|
|
|
@ -386,7 +386,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
$ret->totalPrice = bcadd($ret->totalPrice, $val->COLD_TotalPrice);
|
|
|
|
$ret->totalPrice = bcadd($ret->totalPrice, $val->COLD_TotalPrice);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// 预定的产品数
|
|
|
|
// 预定的产品数
|
|
|
|
$ret->tour_count = count(array_unique(array_map(function($ele) {return $ele->PAG_Code;}, $all_orders)));
|
|
|
|
$ret->tour_count = count(array_unique(array_map(function($ele) {return mb_strtoupper($ele->PAG_Code);}, $all_orders)));
|
|
|
|
$person_num = $this->OrderFinance_model->get_order_person_num($coli_sn);
|
|
|
|
$person_num = $this->OrderFinance_model->get_order_person_num($coli_sn);
|
|
|
|
$ret->person_num = $person_num->person_num;
|
|
|
|
$ret->person_num = $person_num->person_num;
|
|
|
|
$ret->adult_num = $person_num->adult_num;
|
|
|
|
$ret->adult_num = $person_num->adult_num;
|
|
|
@ -400,7 +400,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
$ret->comment = "PVT,共" . $ret->person_num . "人";
|
|
|
|
$ret->comment = "PVT,共" . $ret->person_num . "人";
|
|
|
|
$pag_sns = array_values(array_unique(array_map(function($ele) {return $ele->COLD_ServiceSN;}, $all_orders)));
|
|
|
|
$pag_sns = array_values(array_unique(array_map(function($ele) {return $ele->COLD_ServiceSN;}, $all_orders)));
|
|
|
|
$pags_info = $this->OrderFinance_model->get_pag_info(implode(',', $pag_sns));
|
|
|
|
$pags_info = $this->OrderFinance_model->get_pag_info(implode(',', $pag_sns));
|
|
|
|
$ret->PAG_Code = implode(",", array_values(array_unique(array_map(function($ele) {return $ele->PAG_Code;}, $pags_info))));
|
|
|
|
$ret->PAG_Code = implode(",", array_values(array_unique(array_map(function($ele) {return mb_strtoupper($ele->PAG_Code);}, $pags_info))));
|
|
|
|
$ret->vendor_name = implode(",", array_values(array_unique(array_map(function($ele) {return $ele->VEI2_CompanyBN;}, $pags_info)))) ;
|
|
|
|
$ret->vendor_name = implode(",", array_values(array_unique(array_map(function($ele) {return $ele->VEI2_CompanyBN;}, $pags_info)))) ;
|
|
|
|
$ret->pag_name = implode(";\r\n", array_map(function($ele) {return $ele->PAG_Title;}, $pags_info)) ;
|
|
|
|
$ret->pag_name = implode(";\r\n", array_map(function($ele) {return $ele->PAG_Title;}, $pags_info)) ;
|
|
|
|
return $ret;
|
|
|
|
return $ret;
|
|
|
|