cost nedd_price include price_loan
This commit is contained in:
@@ -287,7 +287,7 @@ class Cost extends HD_Controller{
|
||||
];
|
||||
$sum = $this->app_liche_orders_model->sum('total_price', ['o_id'=>$row['o_id'],'status'=>1,'pay_price <>'=>0]);
|
||||
$info['pay_price'] = $sum['total_price'] ? $sum['total_price'] : 0;
|
||||
$info['need_price'] = $this->orders_v2_entity->recevable_price($row['o_id']);
|
||||
$info['need_price'] = $this->orders_v2_entity->recevable_price($row['o_id'],$srv_price=true,$price_loan=false);
|
||||
//获取车信息
|
||||
$brand = $this->auto_brand_model->get(['id' => $item_row['brand_id']], 'name');
|
||||
$serie = $this->auto_series_model->get(['id' => $item_row['s_id']], 'name');
|
||||
@@ -550,7 +550,7 @@ class Cost extends HD_Controller{
|
||||
|
||||
$sum = $this->app_liche_orders_model->sum('total_price', ['o_id'=>$val['o_id'],'status'=>1,'pay_price <>'=>0]);
|
||||
$pay_price = $sum['total_price'] ? $sum['total_price'] : 0;
|
||||
$need_price = $this->orders_v2_entity->recevable_price($val['o_id']);
|
||||
$need_price = $this->orders_v2_entity->recevable_price($val['o_id'],$srv_price=true,$price_loan=false);
|
||||
|
||||
$data[] = [
|
||||
'id' => $val['id'],
|
||||
|
||||
@@ -557,7 +557,7 @@ class Order extends CI_Controller{
|
||||
}
|
||||
$sum = $this->app_liche_orders_model->sum('total_price', ['o_id'=>$item['id'],'status'=>1,'pay_price <>'=>0]);
|
||||
$pay_price = $sum['total_price'] ? $sum['total_price'] : 0;
|
||||
$need_price = $this->orders_v2_entity->recevable_price($item['id']);
|
||||
$need_price = $this->orders_v2_entity->recevable_price($item['id'],$srv_price=true,$price_loan=false);
|
||||
$srv_json['if_pay'] = $pay_price>=$need_price ? 1 : 0;
|
||||
$add_data['srv_json'] = json_encode($srv_json,JSON_UNESCAPED_UNICODE);
|
||||
$id = $this->items_cost_model->add($add_data);
|
||||
|
||||
@@ -414,9 +414,10 @@ class Orders_v2_entity{
|
||||
* 计算订单应收金额
|
||||
* @param $oid int 订单id
|
||||
* @param $srv_price boolean 是否包含服务费
|
||||
* @param $price_loan boolean 是否包含分期(230220 成本-应收款不要扣掉按揭部分)
|
||||
* @return float
|
||||
*/
|
||||
public function recevable_price($oid,$srv_price=true){
|
||||
public function recevable_price($oid,$srv_price=true,$price_loan=true){
|
||||
$this->order_row = $this->ci->receiver_orders_v2_model->get(['id'=>$oid]);
|
||||
if(!$this->order_row){
|
||||
return false;
|
||||
@@ -429,7 +430,7 @@ class Orders_v2_entity{
|
||||
}else{
|
||||
$recevable_price = $total_price;
|
||||
}
|
||||
if(!$this->order_row['payway']){ //分期
|
||||
if($price_loan && !$this->order_row['payway']){ //分期
|
||||
$recevable_price -= $money_json['price_loan'];
|
||||
}
|
||||
return $recevable_price;
|
||||
|
||||
Reference in New Issue
Block a user