|
|
|
|
@ -71,6 +71,8 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
$report_order['adultnumber'] = 0;
|
|
|
|
|
$report_order['childnumber'] = 0;
|
|
|
|
|
$report_order['babynumber'] = 0;
|
|
|
|
|
$report_order['qtCost'] = 0;
|
|
|
|
|
$report_order['qtMoney'] = 0;
|
|
|
|
|
$report_order['orderstats'] = 1;
|
|
|
|
|
$report_order['ordernumber'] = $order_info->ordernumber;
|
|
|
|
|
$report_order['TuanName'] = mb_substr($order_info->TuanName, 0, 50);
|
|
|
|
|
@ -99,10 +101,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
/** 图兰朵产品: 取拼团实际成本 */
|
|
|
|
|
$ret->combine_cost = $ret->report_tour = array();
|
|
|
|
|
$combineNo_arr = $this->OrderFinance_model->get_order_combineNo($coli_sn);
|
|
|
|
|
// $ret->x = $combineNo_arr;
|
|
|
|
|
$group_type_arr = array_unique(array_map(function($ele){return $ele->GCI_groupType;}, $combineNo_arr));
|
|
|
|
|
// $this->output->set_content_type('application/json')->set_output(json_encode($combineNo_arr));
|
|
|
|
|
// $this->output->set_content_type('application/json')->set_output(json_encode($group_type_arr));
|
|
|
|
|
$processed_code = array(); // 已处理的产品编号
|
|
|
|
|
foreach ($combineNo_arr as $kc => $vc) {
|
|
|
|
|
if (empty($vc->GCI_combineNo)) {
|
|
|
|
|
@ -199,9 +198,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
if ( ! empty($other_tour)) {
|
|
|
|
|
$ret->others = $this->OrderFinance_model->insert_report_tour_others($coli_sn);
|
|
|
|
|
foreach ($ret->others as $kro => $vro) {
|
|
|
|
|
// $report_order['basemoney'] = bcadd($report_order['basemoney'], $vro->tourcost);
|
|
|
|
|
// test
|
|
|
|
|
$report_order['basemoney'] = bcadd($report_order['basemoney'], $vro->COLD_TotalCost);
|
|
|
|
|
$report_order['basemoney'] = bcadd($report_order['basemoney'], $vro->tourcost);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** 火车票预定 */
|
|
|
|
|
@ -209,8 +206,6 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
if( ! empty($train_detail)) {
|
|
|
|
|
$ret->train = $this->OrderFinance_model->insert_report_train($coli_sn);
|
|
|
|
|
foreach ($ret->train as $krt => $vrt) {
|
|
|
|
|
// $report_order['basemoney'] = bcadd($report_order['basemoney'], $vrt->TotalCost);
|
|
|
|
|
// test
|
|
|
|
|
$report_order['basemoney'] = bcadd($report_order['basemoney'], $vrt->TotalCost);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -219,9 +214,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
if ( ! empty($hotel_detail)) {
|
|
|
|
|
$ret->hotel = $this->OrderFinance_model->insert_report_hotel($coli_sn);
|
|
|
|
|
foreach ($ret->hotel as $krh => $vrh) {
|
|
|
|
|
// $report_order['basemoney'] = bcadd($report_order['basemoney'], $vrh->roomcost);
|
|
|
|
|
// test
|
|
|
|
|
$report_order['basemoney'] = bcadd($report_order['basemoney'], $vrh->COLD_TotalCost);
|
|
|
|
|
$report_order['basemoney'] = bcadd($report_order['basemoney'], $vrh->roomcost);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// 订单利润
|
|
|
|
|
@ -279,7 +272,6 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
}
|
|
|
|
|
// 重新计算重复次数
|
|
|
|
|
$all_pags = array_filter(array_map(function($ele){ return $ele->PAG_Code;}, $all_orders));
|
|
|
|
|
// $ret->s = $all_pags;
|
|
|
|
|
// 重复的产品号; 可混拼的产品
|
|
|
|
|
$repeat_code = array();
|
|
|
|
|
$code_count = array_count_values($all_pags);
|
|
|
|
|
@ -368,7 +360,6 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
public function pvt_basic($combineNo="", $coli_sn=0, $processed_code=array())
|
|
|
|
|
{
|
|
|
|
|
$ret = new stdClass();
|
|
|
|
|
// $ret->tour = array();
|
|
|
|
|
$all_orders = $this->OrderFinance_model->get_all_combine_order($combineNo, $processed_code);
|
|
|
|
|
if (empty($all_orders)) {
|
|
|
|
|
return null;
|
|
|
|
|
@ -386,23 +377,19 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
$ret->person_num = $person_num->person_num;
|
|
|
|
|
$ret->adult_num = $person_num->adult_num;
|
|
|
|
|
$ret->child_num = $person_num->child_num;
|
|
|
|
|
// $tour_s = new stdClass();
|
|
|
|
|
$combine_cost = $this->OrderFinance_model->get_combine_sumMoney($combineNo);
|
|
|
|
|
$ret->startdate = $all_orders[0]->COLD_StartDate;
|
|
|
|
|
$ret->person_grade = ($all_orders[0]->COLD_PersonNum + $all_orders[0]->COLD_ChildNum );
|
|
|
|
|
$ret->cost_category = $combine_cost->cost_category;
|
|
|
|
|
$ret->cost_sum = $combine_cost->cost_sum;
|
|
|
|
|
$ret->person_cost = bcdiv($ret->cost_sum, $ret->person_num);
|
|
|
|
|
$ret->comment = "PVT,共" . $ret->person_num . "人次";// 150
|
|
|
|
|
$ret->comment = "PVT,共" . $ret->person_num . "人";
|
|
|
|
|
$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));
|
|
|
|
|
$ret->PAG_Code = implode(",", array_values(array_unique(array_map(function($ele) {return $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)) ;
|
|
|
|
|
// $ret->tour[0] = $tour_s;
|
|
|
|
|
// $ret->order_cost = array_sum(array_map(function($ele) {return $ele->cost_sum;}, $ret->tour));
|
|
|
|
|
return $ret;
|
|
|
|
|
// return $this->output->set_content_type('application/json')->set_output(json_encode($ret, JSON_UNESCAPED_UNICODE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
|