Commit 28258664 authored by hujun's avatar hujun

分佣汇总修改

parent a9ed4450
......@@ -1016,27 +1016,26 @@ class Finance extends Basic
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$where['c.is_del'] = 0; //订单状态
$where['a.status'] = ['in', '10,11,13']; //10已提交 11审核成功
$where['b.father_id'] = ['<>', 0]; //去除税费总佣金
$where['c.confirm_status'] = 1; //确认分佣
$where['b.status'] = ['in', '10,11,13']; //10已提交 11审核成功
$where[] = ['EXP', '(c.father_id > 0 or c.father_id is NULL)']; //去除税费总佣金
$where['a.confirm_status'] = 1; //确认分佣
$income_date = $operation_date = '';
/**收佣日期 start**/
if (!empty($this->params['income_start_date']) && empty($this->params['income_end_date'])) {
$where[] = [ 'EXP', " f.income_time > {$this->params['income_start_date']} or b.operation_date > {$this->params['income_start_date']}"];
$where[] = [ 'EXP', " f.income_time > {$this->params['income_start_date']} or c.operation_date > {$this->params['income_start_date']}"];
$income_date = date('Y.m.d', strtotime($this->params['income_start_date']));
}
if (!empty($this->params['income_end_date']) && empty($this->params['income_start_date'])) {
$where[] = [ 'EXP', " f.income_time < {$this->params['income_end_date']} or b.operation_date < {$this->params['income_start_date']}"];
$where[] = [ 'EXP', " f.income_time < {$this->params['income_end_date']} or c.operation_date < {$this->params['income_start_date']}"];
$income_date = '-'. date('Y.m.d', strtotime($this->params['income_end_date']));
}
if (!empty($this->params['income_start_date']) && !empty($this->params['income_end_date'])){
$where[] = [ 'EXP', "(f.income_time > {$this->params['income_start_date']} and f.income_time < {$this->params['income_end_date']}) or
(b.operation_date > {$this->params['income_start_date']} or b.operation_date < {$this->params['income_end_date']})"];
(c.operation_date > {$this->params['income_start_date']} or c.operation_date < {$this->params['income_end_date']})"];
$income_date = date('Y.m.d', strtotime($this->params['income_start_date'])) .'-'. date('Y.m.d', strtotime($this->params['income_end_date']));
}
......@@ -1044,18 +1043,18 @@ class Finance extends Basic
/**提交成交报告日期 start**/
if (!empty($this->params['bargain_start_date']) && empty($this->params['bargain_end_date'])) {
$where[] = [ 'EXP', "a.create_time > {$this->params['bargain_start_date']} . ' 00:00:00' or b.operation_date > {$this->params['bargain_start_date']}"];
$where[] = [ 'EXP', "a.create_time > {$this->params['bargain_start_date']} . ' 00:00:00' or c.operation_date > {$this->params['bargain_start_date']}"];
$operation_date = date('Y.m.d', strtotime($this->params['bargain_start_date']));
}
if (!empty($this->params['bargain_end_date']) && empty($this->params['bargain_start_date'])) {
$where[] = [ 'EXP', "a.create_time < {$this->params['bargain_end_date']} . ' 23:59:59' or b.operation_date < {$this->params['bargain_end_date']}"];
$where[] = [ 'EXP', "a.create_time < {$this->params['bargain_end_date']} . ' 23:59:59' or c.operation_date < {$this->params['bargain_end_date']}"];
$operation_date = date('Y.m.d', strtotime($this->params['bargain_end_date']));
}
if (!empty($this->params['bargain_start_date']) && !empty($this->params['bargain_end_date'])) {
$where[] = [ 'EXP', "(a.create_time > '{$this->params['bargain_start_date']} 00:00:00' and a.create_time < '{$this->params['bargain_end_date']} 23:59:59') or
(b.operation_date > {$this->params['bargain_start_date']} and b.operation_date < {$this->params['bargain_end_date']})"];
(c.operation_date > {$this->params['bargain_start_date']} and c.operation_date < {$this->params['bargain_end_date']})"];
$operation_date = date('Y.m.d', strtotime($this->params['bargain_start_date'])) .'-'. date('Y.m.d', strtotime($this->params['bargain_end_date']));
}
......@@ -1079,13 +1078,11 @@ class Finance extends Basic
$where['d.name'] = [ 'like', '%' . $this->params['name'] . '%' ];
}
$m_bargain = new OBargainModel();
$m_bargain = new OPartialCommission();
if (empty($this->params['excel']) && $this->params['excel'] != 1) {
$fields = 'f.income_time,a.create_time,a.id,a.agent_id,sum(b.fee) as fee,sum(c.practical_fee) as practical_fee,sum(c.cash) as cash,';
$fields .= 'sum(b.fee) as fee,sum(c.real_fee) as real_fee,';
$fields .= 'd.name,d.phone';
$fields = 'f.income_time,b.create_time,b.id,b.agent_id,sum(c.fee) as fee,sum(a.practical_fee) as practical_fee,sum(a.cash) as cash,';
$fields .= 'sum(a.real_fee) as real_fee,d.name,d.phone';
$data['data']['list'] = $m_bargain->getCommissionTotalList($pageNo, $pageSize, 'a.id desc', $fields, $where, $whereOr);
foreach ($data['data']['list'] as $k=>$v) {
......@@ -1099,9 +1096,9 @@ class Finance extends Basic
//导出Excel
$fields = 'f.income_time,a.create_time,sum(b.fee) as fee,sum(f.money) as money,sum(c.cash) as cash,';
$fields .= 'sum(c.service_charge) as service_charge,a.agent_id,sum(c.practical_fee) as practical_fee,';
$fields .= 'd.name,d.phone,sum(c.charity_fund) as charity_fund, sum(should_commission) as should_commission';
$fields = 'f.income_time,b.create_time,sum(c.fee) as fee,sum(f.money) as money,sum(a.cash) as cash,';
$fields .= 'sum(a.service_charge) as service_charge,a.agent_id,sum(a.practical_fee) as practical_fee,';
$fields .= 'd.name,d.phone,sum(a.charity_fund) as charity_fund, sum(a.should_commission) as should_commission';
$pageSize = 25000;
$data = $m_bargain->getCommissionTotalList($pageNo, $pageSize, 'a.id desc', $fields, $where, $whereOr);
......
This diff is collapsed.
......@@ -9,7 +9,11 @@
<td>[%= it[item]['practical_fee'] %]</td>
<td>[%= it[item]['cash'] %]</td>
<td>[%= it[item]['practical_fee'] %]</td>
<td>[%= it[item]['fee'] %]</td>
<td>
[% if (it[item]['fee']){ %]
[%= it[item]['fee'] %]
[% } %]
</td>
<td>[%= it[item]['over_fee'] %]</td>
</tr>
[% } %]
......
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