Commit 6f138dd2 authored by hujun's avatar hujun

汇总

parent ec7a6d5e
......@@ -1007,50 +1007,42 @@ class Finance extends Basic
$where['b.father_id'] = ['<>', 0]; //去除税费总佣金
$where['c.confirm_status'] = 1; //确认分佣
$month_start = date('Y-m-01');
$month_end = date('Y-m-t');
$income_date = $operation_date = '';
$month_start_dot = date('Y.m.01');
$month_end_dot = date('Y.m.t');
/**收佣日期 start**/
if (!empty($this->params['income_start_date']) && empty($this->params['income_end_date'])) {
$where['f.income_time'] = [ '> time', $this->params['income_start_date'] ];
$where[] = [ 'EXP', " f.income_time > {$this->params['income_start_date']} or b.operation_date > {$this->params['income_start_date']}"];
$income_date = date('Y.m.d', strtotime($this->params['income_start_date']));
} else {
// $where['f.income_time'] = [ '> time', strtotime($month_start)];
// $income_date = $month_start_dot;
}
if (!empty($this->params['income_end_date']) && empty($this->params['income_start_date'])) {
$where['f.income_time'] = [ '< time', $this->params['income_end_date'] ];
$where[] = [ 'EXP', " f.income_time < {$this->params['income_end_date']} or b.operation_date < {$this->params['income_start_date']}"];
$income_date = '-'. date('Y.m.d', strtotime($this->params['income_end_date']));
} else {
// $where['f.income_time'] = [ '< time', strtotime($month_end)];
// $income_date = '-'. $month_end_dot;
}
if (!empty($this->params['income_start_date']) && !empty($this->params['income_end_date'])){
$where['f.income_time'] = [ 'between time', [ $this->params['income_start_date'], $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']})"];
$income_date = date('Y.m.d', strtotime($this->params['income_start_date'])) .'-'. date('Y.m.d', strtotime($this->params['income_end_date']));
} else {
// $where['f.income_time'] = [ 'between time', [ date('Y-m-d',strtotime($month_start)), date('Y-m-d',strtotime($month_end))]];
// $income_date = $month_start_dot .'-'. $month_end_dot;
}
/**收佣日期 end**/
/**提交成交报告日期 start**/
if (!empty($this->params['bargain_end_date']) && empty($this->params['income_end_date'])) {
$where['a.create_time'] = [ '> time', $this->params['bargain_start_date'] ] . ' 00:00:00';
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']}"];
$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['a.create_time'] = [ '< time', $this->params['bargain_end_date'] ] . '23:59:59';
$where[] = [ 'EXP', "a.create_time < {$this->params['bargain_end_date']} . ' 23:59:59' or b.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['a.create_time'] = [ 'between time', [ $this->params['bargain_start_date'] . ' 00:00:00', $this->params['bargain_end_date'] . '23:59:59' ] ];
$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']} or b.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']));
}
/**部门id**/
......@@ -1059,32 +1051,10 @@ class Finance extends Basic
}
/**门店名**/
if (!empty($this->params['store_name'])) {
$m_store = new AStore();
$store_id = $m_store->findStore('id', [ 'store_name' => [ 'like', '%' . $this->params['store_name'] . '%' ] ]);
$where['d.store_id'] = $store_id['id'];
}
/**提交成交报告日期 end**/
/**开票日期 start**/
if (!empty($this->params['deal_start_date']) && empty($this->params['deal_end_date'])) {
$where['b.operation_date'] = [ '> time', $this->params['deal_start_date']];
$operation_date = date('Y.m.d', strtotime($this->params['deal_start_date']));
if (!empty($this->params['store_id'])) {
$where['d.store_id'] = $this->params['store_id'];
}
if (!empty($this->params['deal_end_date']) && empty($this->params['deal_start_date'])) {
$where['b.operation_date'] = [ '> time', $this->params['deal_end_date']];
$operation_date = '-'.date('Y.m.d', strtotime($this->params['deal_end_date']));
}
if (!empty($this->params['deal_start_date']) && !empty($this->params['deal_end_date'])) {
$where['b.operation_date'] = [ 'between time', [ $this->params['deal_start_date'], $this->params['deal_end_date']]];
$operation_date = date('Y.m.d', strtotime($this->params['deal_start_date'])) .'-'. date('Y.m.d', strtotime($this->params['deal_end_date']));
}
/**开票日期 end**/
/**经纪人手机号**/
if (!empty($this->params['phone'])) {
$where['b.phone'] = [ 'like', '%' . $this->params['phone'] . '%' ];
......@@ -1134,7 +1104,7 @@ class Finance extends Basic
$excel_data[$k]['over_fee'] = $v['real_fee'] - $v['charity_fund'];
}
$num = count($excel_data) + 1;
$num = count($excel_data) + 2;
$excel_data[$num]['income_time'] = '合计'; //收佣日期
$excel_data[$num]['create_time'] = ''; //成交日期
$excel_data[$num]['district_store'] = ''; //所属部门/门店
......
......@@ -826,7 +826,7 @@ class OBargainModel extends Model
->order($order_)
->limit($pageSize)
->page($pageNo)
->group('d.id')
->group('a.agent_id')
->select();
$m_agent = new AAgents();
......@@ -856,7 +856,7 @@ class OBargainModel extends Model
->join('o_real_income f', 'a.id = f.bargain_id', 'left')
->where($params)
->whereOr($whereOr)
->group('d.id')
->group('a.agent_id')
->count();
}
......
......@@ -394,10 +394,10 @@ define(['doT', 'text!temp/commissionTotal_template_tpl.html', 'css!style/home.cs
params.pageSize = business.pageSize;
params.name = $('#user_name').val();
params.phone = $('#user_phone').val();
params.commission_start_date = $('#create_time').val();
params.commission_end_date = $('#end_time').val();
params.deal_start_date = $('#create_dealtime').val();
params.deal_end_date = $('#end_dealtime').val();
params.income_start_date = $('#create_time').val();
params.income_end_date = $('#end_time').val();
params.bargain_start_date = $('#create_dealtime').val();
params.bargain_end_date = $('#end_dealtime').val();
params.district_id = $("#district_id").val(); //部门id 添加字段
params.store_id = $('#guest_stores').val();
$.ajax({
......@@ -462,16 +462,16 @@ define(['doT', 'text!temp/commissionTotal_template_tpl.html', 'css!style/home.cs
var excel_two = 1;
var name = $('#user_name').val();
var phone = $('#user_phone').val();
var commission_start_date = $('#create_time').val();
var commission_end_date = $('#end_time').val();
var deal_start_date = $('#create_dealtime').val();
var deal_end_date = $('#end_dealtime').val();
var income_start_date = $('#create_time').val();
var income_end_date = $('#end_time').val();
var bargain_start_date = $('#create_dealtime').val();
var bargain_end_date = $('#end_dealtime').val();
var operation_start_date = $('#create_ticketTime').val();
var operation_end_date = $('#end_ticketTime').val();
var district_id = $("#qx-store option:selected").val(); //部门id 添加字段
var store_name = $('#store_name').val();
window.open('/index/getCommissionTotalList?' +
'excel=' + excel_two + '&name=' + name + '&phone=' + phone + '&commission_start_date=' + commission_start_date + '&commission_end_date=' + commission_end_date + '&deal_start_date=' + deal_start_date + '&deal_end_date=' + deal_end_date + '&operation_start_date=' + operation_start_date + '&operation_end_date=' + operation_end_date + '&district_id=' + district_id + '&store_name=' + store_name);
'excel=' + excel_two + '&name=' + name + '&phone=' + phone + '&income_start_date=' + income_start_date + '&income_end_date=' + income_end_date + '&bargain_start_date=' + bargain_start_date + '&bargain_end_date=' + bargain_end_date + '&operation_start_date=' + operation_start_date + '&operation_end_date=' + operation_end_date + '&district_id=' + district_id + '&store_name=' + store_name);
},
};
return business;
......
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