Commit 20b51003 authored by hujun's avatar hujun

实收总计

parent b273e63b
...@@ -716,12 +716,8 @@ class Finance extends Basic ...@@ -716,12 +716,8 @@ class Finance extends Basic
$where['d.internal_address'] = [ 'like', '%' . $this->params['internal_address'] . '%' ]; $where['d.internal_address'] = [ 'like', '%' . $this->params['internal_address'] . '%' ];
} }
if (!empty($this->params['phone'])) { if (!empty($this->params['partial_id'])) {
$where['e.phone'] = [ 'like', '%' . $this->params['phone'] . '%' ]; $where['e.id'] = $this->params['partial_id'];
}
if (!empty($this->params['name'])) {
$where['e.name'] = [ 'like', '%' . $this->params['name'] . '%' ];
} }
if (!empty($this->params['house_number'])) { if (!empty($this->params['house_number'])) {
...@@ -732,12 +728,26 @@ class Finance extends Basic ...@@ -732,12 +728,26 @@ class Finance extends Basic
$where[] = [ 'EXP', 'b.id =' . $this->params['bargain_id'] . ' or father_id=' . $this->params['bargain_id'] ]; $where[] = [ 'EXP', 'b.id =' . $this->params['bargain_id'] . ' or father_id=' . $this->params['bargain_id'] ];
} }
if (!empty($this->params['store_id'])) {
$where['e.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['district_id'])) {
$where['e.district_id'] = $this->params['district_id'];
}
$field = 'a.id,b.id as bargain_id,f.income_time,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id,a.real_income_id'; $field = 'a.id,b.id as bargain_id,f.income_time,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,b.house_number,b.father_id,b.order_id,a.real_income_id';
$m_commission = new OPartialCommission(); $m_commission = new OPartialCommission();
try { try {
$data['data']['list'] = $m_commission->getCommissionBargainList($pageNo, $pageSize, 'a.id desc', $field, $where); $data['data']['list'] = $m_commission->getCommissionBargainList($pageNo, $pageSize, 'a.id desc', $field, $where);
$data['data']['total'] = $m_commission->getCommissionBargainListTotal($where); $data['data']['total'] = $m_commission->getCommissionBargainListTotal($where);
if (!empty($where)) {
$data['data']['total_money'] = $m_commission->totalMoney($where); //实收总计
} else {
$data['data']['total_money'] = '';
}
} catch (\Exception $e) { } catch (\Exception $e) {
return $this->response(101, '内部错误,获取分佣提成明细列表失败!请联系运营。'.$e->getMessage()); return $this->response(101, '内部错误,获取分佣提成明细列表失败!请联系运营。'.$e->getMessage());
} }
......
...@@ -84,6 +84,21 @@ class OPartialCommission extends BaseModel ...@@ -84,6 +84,21 @@ class OPartialCommission extends BaseModel
return $result; return $result;
} }
/**
* @param $where
* @return float|int
*/
public function totalMoney($where) {
return $this->alias('a')
->join('o_bargain b', 'a.bargain_id = b.id', 'left')
->join('o_order c', 'b.order_id = c.id', 'left')
->join('g_houses d', 'c.house_id = d.id', 'left')
->join('a_agents e', 'b.agent_id = e.id', 'left')
->join('o_real_income f', 'a.real_income_id = f.id', 'left')
->where($where)
->sum('a.practical_fee');
}
/** /**
* 导出列表 * 导出列表
* *
......
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