|
|
|
|
@ -65,7 +65,6 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
/** 单团财务表 */
|
|
|
|
|
$report_order = array();
|
|
|
|
|
$report_order['OrderYJLR'] = 0; //预计利润
|
|
|
|
|
$report_order['basemoney'] = 0; // 总成本
|
|
|
|
|
$report_order['money'] = 0; // 总收入, 实收金额
|
|
|
|
|
$report_order['profitmoney'] = 0; // 利润
|
|
|
|
|
$report_order['adultnumber'] = 0;
|
|
|
|
|
@ -83,7 +82,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
$report_order['reservedate'] = $order_info->reservedate;
|
|
|
|
|
$report_order['guesttype'] = ($order_info->guesttype===null) ? 1 : $order_info->guesttype;
|
|
|
|
|
$report_order['RO_GRI_SN'] = $report_order['RO_CGI_SN'] = $order_info->GRI_SN;
|
|
|
|
|
// $report_order['basemoney'] = $order_info->basemoney; // 总成本
|
|
|
|
|
$report_order['basemoney'] = $order_info->otherCost; // 总成本=SUM(COLD_TotalCOst)+COLI_OtherCost
|
|
|
|
|
// $report_order['OrderPrice'] = $order_info->OrderPrice; // 总报价
|
|
|
|
|
/** 订单支付信息 */
|
|
|
|
|
$order_payment = $this->OrderFinance_model->get_order_payment($coli_sn);
|
|
|
|
|
@ -118,9 +117,11 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** 保存图兰朵包价线路产品的成本到report_tour */
|
|
|
|
|
$processed_cold_sn = array();
|
|
|
|
|
// pvt
|
|
|
|
|
$report_tour_pvt = array();
|
|
|
|
|
if ( ! empty($ret->pvt)) {
|
|
|
|
|
$processed_cold_sn = array_merge($processed_cold_sn,$ret->pvt->cold_sn);
|
|
|
|
|
$report_tour_pvt['ordernumber'] = $ret->pvt->coli_id;
|
|
|
|
|
$report_tour_pvt['tourCode'] = mb_substr($ret->pvt->PAG_Code, 0, 50);
|
|
|
|
|
$report_tour_pvt['tourname'] = mb_substr($ret->pvt->pag_name, 0, 200);
|
|
|
|
|
@ -167,6 +168,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
if ($coc->PAG_code === $coc->real_code) {
|
|
|
|
|
$cost_c_price = bcadd($cost_c_price, $coc->totalPrice);
|
|
|
|
|
}
|
|
|
|
|
$processed_cold_sn[] = $coc->COLD_SN;
|
|
|
|
|
}
|
|
|
|
|
$cost_c['tourPrice'] = $this->OrderFinance_model->convert_to_RMB($cost_c_price);
|
|
|
|
|
$cost_c['tourProfit'] = ($cost_c['tourPrice']>0) ? bcsub($cost_c['tourPrice'], $cost_c['tourcost']) : 0;
|
|
|
|
|
@ -188,6 +190,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
$report_order['basemoney'] = bcadd($report_order['basemoney'], $cost_c['tourcost']);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$ret->processed_cold_sn = array_unique($processed_cold_sn);
|
|
|
|
|
/** 开始写入数据库 */
|
|
|
|
|
/** 图兰朵供应商 */
|
|
|
|
|
if ( ! empty($ret->report_tour)) {
|
|
|
|
|
@ -195,7 +198,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
}
|
|
|
|
|
/** 非图兰朵供应商的包价线路产品 */
|
|
|
|
|
$other_tour = $this->OrderFinance_model->get_order_detail($coli_sn, 'D', false);
|
|
|
|
|
if ( ! empty($other_tour)) {
|
|
|
|
|
if ( ! empty($other_tour) || empty($ret->processed_cold_sn)) {
|
|
|
|
|
$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);
|
|
|
|
|
@ -366,6 +369,7 @@ class Order_finance extends CI_Controller {
|
|
|
|
|
}
|
|
|
|
|
$ret->coli_sn = $coli_sn;
|
|
|
|
|
$ret->coli_id = $all_orders[0]->coli_ID;
|
|
|
|
|
$ret->cold_sn = array_unique(array_map(function($ele) {return $ele->COLD_SN;}, $all_orders));
|
|
|
|
|
// 总报价
|
|
|
|
|
$ret->totalPrice = 0;
|
|
|
|
|
foreach ($all_orders as $kal => $val) {
|
|
|
|
|
|