|
|
|
|
@ -100,6 +100,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
$report_order['adultnumber'] = $person_num->adult_num;
|
|
|
|
|
$report_order['childnumber'] = $person_num->child_num;
|
|
|
|
|
$ret = new stdClass();
|
|
|
|
|
$ret->pvt = array();
|
|
|
|
|
/** 图兰朵产品: 取拼团实际成本 */
|
|
|
|
|
$ret->combine_cost = array();
|
|
|
|
|
$ret->report_tour = array();
|
|
|
|
|
@ -113,12 +114,19 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
if ($vc->GCI_groupType == 1) {
|
|
|
|
|
// 除去只能PVT的. 避免预定接送*1+tour*1, tour拼团只有一个订单, 被视为整团pvt,漏算接送成本
|
|
|
|
|
$processed_code = array_diff($processed_code, $this->forbidden_combine());
|
|
|
|
|
$ret->pvt[] = $pvt_cost = $this->pvt_basic($vc->GCI_combineNo, $coli_sn, $processed_code);
|
|
|
|
|
$processed_code = array_merge($processed_code, $pvt_cost->processed_code); // 多地pvt时需要区分
|
|
|
|
|
$pvt_cost = $this->pvt_basic($vc->GCI_combineNo, $coli_sn, $processed_code);
|
|
|
|
|
if ($pvt_cost !== null) {
|
|
|
|
|
$ret->pvt[] = $pvt_cost;
|
|
|
|
|
}
|
|
|
|
|
if (isset($pvt_cost->processed_code) && $order_info->pag_cnt > 1) { // 单个产品可能重复,既拼又PVT
|
|
|
|
|
$processed_code = array_merge($processed_code, $pvt_cost->processed_code); // 多地pvt时需要区分
|
|
|
|
|
}
|
|
|
|
|
} else if ($vc->GCI_groupType == 2) {
|
|
|
|
|
// 这里不排除产品编号是否已处理, 因为重复的情况比较多
|
|
|
|
|
// 这里不排除产品编号是否已处理, 因为重复的情况比较多. 如T180917-BHJ180716001M
|
|
|
|
|
$tmp_cost = $this->combine_basic($vc->GCI_combineNo, $coli_sn);
|
|
|
|
|
$processed_code = array_merge($processed_code, $tmp_cost->combine_pags);
|
|
|
|
|
if ($order_info->pag_cnt > 1) { // 单个产品可能重复,既拼又PVT
|
|
|
|
|
$processed_code = array_merge($processed_code, $tmp_cost->combine_pags);
|
|
|
|
|
}
|
|
|
|
|
$ret->combine_cost[] = $tmp_cost;
|
|
|
|
|
$tmp_cost = null;
|
|
|
|
|
}
|
|
|
|
|
@ -246,7 +254,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
* @date 2018-07-18
|
|
|
|
|
* @param string $combineNo
|
|
|
|
|
*/
|
|
|
|
|
public function combine_basic($combineNo="", $coli_sn=0)
|
|
|
|
|
public function combine_basic($combineNo="", $coli_sn=0, $debug=false)
|
|
|
|
|
{
|
|
|
|
|
$ret = new stdClass();
|
|
|
|
|
$all_orders = $this->OrderFinance_model->get_all_combine_order($combineNo);
|
|
|
|
|
@ -370,7 +378,9 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
foreach ($ret->order_cost as $kc => $voc) {
|
|
|
|
|
$ret->order_cost[$kc]->order_cost_sum = bcmul($voc->person_num, $ret->person_cost);
|
|
|
|
|
}
|
|
|
|
|
// return $this->output->set_content_type('application/json')->set_output(json_encode($ret, JSON_UNESCAPED_UNICODE));
|
|
|
|
|
if ($debug!=false) {
|
|
|
|
|
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
|
|
|
|
|
}
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -379,9 +389,10 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
* @example 180515061M
|
|
|
|
|
* @date 2018-07-18
|
|
|
|
|
*/
|
|
|
|
|
public function pvt_basic($combineNo="", $coli_sn=0, $processed_code=array())
|
|
|
|
|
public function pvt_basic($combineNo="", $coli_sn=0, $processed_code=array(), $debug=false)
|
|
|
|
|
{
|
|
|
|
|
$ret = new stdClass();
|
|
|
|
|
$ret->processed_code = array();
|
|
|
|
|
$all_orders_raw = $this->OrderFinance_model->get_all_combine_order($combineNo, $processed_code);
|
|
|
|
|
if (empty($all_orders_raw)) {
|
|
|
|
|
return null;
|
|
|
|
|
@ -390,7 +401,6 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
// 取出供应商id, 有多个供应商时, 说明拆分为多个pvt
|
|
|
|
|
// 多地PVT
|
|
|
|
|
$all_vei_cnt = count(array_unique(array_map(function($ele) {return mb_strtoupper($ele->COLD_PlanVEI_SN);}, $all_orders_raw)));
|
|
|
|
|
$ret->processed_code = array();
|
|
|
|
|
if ($all_vei_cnt > 1) {
|
|
|
|
|
$all_vei = array_unique(array_map(function($ele) {return mb_strtoupper($ele->COLD_PlanVEI_SN);}, $all_orders_raw));
|
|
|
|
|
$all_orders = array();
|
|
|
|
|
@ -427,6 +437,9 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
$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->pag_name = implode(";\r\n", array_map(function($ele) {return $ele->PAG_Title;}, $pags_info)) ;
|
|
|
|
|
if ($debug!=false) {
|
|
|
|
|
return $this->output->set_content_type('application/json')->set_output(json_encode($ret));
|
|
|
|
|
}
|
|
|
|
|
return $ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|