Commit 49f2b9e6 authored by hujun's avatar hujun

实收汇总5

parent 1bec173a
This diff is collapsed.
...@@ -205,26 +205,20 @@ class OPartialCommission extends BaseModel ...@@ -205,26 +205,20 @@ class OPartialCommission extends BaseModel
} }
/** /**
* 分佣提成汇总表
*
* @param int $pageNo * @param int $pageNo
* @param int $pageSize * @param int $pageSize
* @param string $field * @param string $field
* @param string $params * @param string $params
* @param $operation_start_data * @return false|\PDOStatement|string|\think\Collection
* @param $operation_end_data
* @param $is_bargain
* @return array
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException * @throws \think\exception\DbException
*/ */
public function getCommissionTotalList($pageNo = 1, $pageSize = 15, $field = '', $params = '', $operation_start_data, $operation_end_data, $is_bargain) public function getCommissionTotalList($pageNo = 1, $pageSize = 15, $field = '', $params = '')
{ {
$agent_id = $this->alias('a') return $this->alias('a')
->field('a.agent_id,d.name,d.store_id,d.district_id,e.status') ->field($field)
->join('o_real_income b', 'a.real_income_id = b.id', 'left') ->join('o_real_income b', 'a.real_income_id = b.id', 'left')
// ->join('o_taxes c', 'a.agent_id = c.agent_id', 'left')
->join('a_agents d', 'a.agent_id = d.id', 'left') ->join('a_agents d', 'a.agent_id = d.id', 'left')
->join('o_bargain e', 'a.bargain_id = e.id', 'left') ->join('o_bargain e', 'a.bargain_id = e.id', 'left')
->where($params) ->where($params)
...@@ -232,41 +226,6 @@ class OPartialCommission extends BaseModel ...@@ -232,41 +226,6 @@ class OPartialCommission extends BaseModel
->page($pageNo) ->page($pageNo)
->group('a.agent_id') ->group('a.agent_id')
->select(); ->select();
$partial_where['a.confirm_status'] = 1;
$partial_where['b.status'] = ['IN', '10,11,13'];
$partial_where['a.is_del'] = $taxes_where['is_del'] = 0;
$taxes_where['a.father_id'] = ['>', 0];
$m_tax = new OTaxes();
$result = [];
foreach ($agent_id as $k=>$v) {
if (in_array($v['status'], [10,11,13])) {
$partial_where['a.agent_id'] =$v['agent_id'];
if ($is_bargain != 1) {
$partial_where['c.income_time'] = ['between', [$operation_start_data, $operation_end_data]];
} else {
$partial_where['b.create_time'] = ['between', [$operation_start_data, $operation_end_data]];
}
$result[$k] = $this->getSumMoney($field, $partial_where);
} else {
$result[$k]['practical_fee'] = 0;
$result[$k]['real_fee'] = 0;
$result[$k]['service_charge'] = 0;
$result[$k]['charity_fund'] = 0;
}
$taxes_where['a.operation_date'] = ['between', [$operation_start_data, $operation_end_data]];
$taxes_where['b.agent_id'] = $v['agent_id'];
$result[$k]['fee'] = $m_tax->sumBargainFee('a.fee', $taxes_where);
$result[$k]['agent_id'] = $v['agent_id'];
$result[$k]['name'] = $v['name'];
$result[$k]['store_id'] = $v['store_id'];
$result[$k]['district_id'] = $v['district_id'];
}
return $result;
} }
public function getSumMoney($field, $where) { public function getSumMoney($field, $where) {
......
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