Commit cbc318cf authored by hujun's avatar hujun

财务统计

parent f3731895
...@@ -4223,7 +4223,6 @@ class Finance extends Basic ...@@ -4223,7 +4223,6 @@ class Finance extends Basic
$open_agent_refund = $this->sumPayLogRefundByType(4, 1, 1,$income_start, $income_end);//开业中介费退款 $open_agent_refund = $this->sumPayLogRefundByType(4, 1, 1,$income_start, $income_end);//开业中介费退款
$open_case_refund = $this->sumPayLogRefundByType(5, 1, 1,$income_start, $income_end);//开业案场费退款 $open_case_refund = $this->sumPayLogRefundByType(5, 1, 1,$income_start, $income_end);//开业案场费退款
$data['open_commission'] = $open_agent_fee + $open_case_fee - $open_agent_refund - $open_case_refund; //已开业佣金 $data['open_commission'] = $open_agent_fee + $open_case_fee - $open_agent_refund - $open_case_refund; //已开业佣金
//佣金总计:中介费入账+案场费入账-中介费退款-案场费退款 //佣金总计:中介费入账+案场费入账-中介费退款-案场费退款
$data['total_commission'] = $data['not_open_commission'] + $data['open_commission']; $data['total_commission'] = $data['not_open_commission'] + $data['open_commission'];
...@@ -4293,11 +4292,11 @@ class Finance extends Basic ...@@ -4293,11 +4292,11 @@ class Finance extends Basic
$m_pay = new ORefundModel(); $m_pay = new ORefundModel();
if ($is_bargain) { if ($is_bargain) {
$where['b.is_open'] = $is_open; $where['c.is_open'] = $is_open;
$where['a.type'] = $type; $where['a.type'] = $type;
$where['b.status'] = ['in', '10,11,13']; $where['c.status'] = ['in', '10,11,13'];
$where['b.father_id'] = $where['a.is_del'] = 0; $where['c.father_id'] = $where['a.is_del'] = 0;
$where['c.income_time'] = ['between', [$income_start, $income_end]]; $where['b.income_time'] = ['between', [$income_start, $income_end]];
$price = $m_pay->sumBargainPrice('a.refund_money', $where); //未开业中介费 $price = $m_pay->sumBargainPrice('a.refund_money', $where); //未开业中介费
} else { } else {
$where['a.type'] = $type; $where['a.type'] = $type;
......
...@@ -332,8 +332,8 @@ class ORefundModel extends Model{ ...@@ -332,8 +332,8 @@ class ORefundModel extends Model{
*/ */
public function sumBargainPrice($field, $where) { public function sumBargainPrice($field, $where) {
return $this->db_->alias('a') return $this->db_->alias('a')
->join('o_bargain b','a.order_id=b.order_id') ->join('o_paylog b','a.pay_log_id=b.id', 'left')
->join('o_paylog c','a.pay_log_id=c.id') ->join('o_bargain c','b.bargain_id=c.id', 'left')
->where($where) ->where($where)
->sum($field); ->sum($field);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment