Commit 0093830d authored by clone's avatar clone

Merge branch 'wx0604' of https://gitee.com/zwyjjc/tl_estate into wx0604

parents 0393c19f acff90d9
......@@ -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']} and 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'] . '%' ];
......@@ -1099,13 +1069,14 @@ class Finance extends Basic
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(c.service_charge) as service_charge,sum(b.fee) as fee,sum(c.real_fee) as real_fee,';
$fields .= 'sum(b.fee) as fee,sum(c.real_fee) as real_fee,';
$fields .= '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) {
$data['data']['list'][$k]['income_date'] = $income_date;
$data['data']['list'][$k]['operation_date'] = $operation_date;
$data['data']['list'][$k]['over_fee'] = $v['practical_fee'] - $v['fee'];
}
$data['data']['total'] = $m_bargain->getCommissionTotalListTotal($where, $whereOr);
......@@ -1114,7 +1085,7 @@ 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,';
$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';
$pageSize = 25000;
......@@ -1131,10 +1102,10 @@ class Finance extends Basic
$excel_data[$k]['charity_fund'] = $v['charity_fund']; //慈善基金
$excel_data[$k]['money'] = $v['money']; //实收佣金
$excel_data[$k]['fee'] = $v['fee']; //税费
$excel_data[$k]['over_fee'] = $v['real_fee'] - $v['charity_fund'];
$excel_data[$k]['over_fee'] = $v['practical_fee'] - $v['fee'];
}
$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({
......@@ -457,22 +457,61 @@ define(['doT', 'text!temp/commissionTotal_template_tpl.html', 'css!style/home.cs
});
},
exportList: function(pageNo) {
console.log(2);
business.pageNo = pageNo;
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);
},
var store_id = $('#store_name').val();
var str = '/index/getCommissionTotalList?excel=1';
if (name) {
str += '&name=' + name;
}
if (phone) {
str += '&phone=' + phone;
}
if (income_start_date) {
str += '&income_start_date=' + income_start_date;
}
if (income_end_date) {
str += '&income_end_date=' + income_end_date;
}
if (bargain_start_date) {
str += '&bargain_start_date=' + bargain_start_date;
}
if (bargain_end_date) {
str += '&bargain_end_date=' + bargain_end_date;
}
if (operation_start_date) {
str += '&operation_start_date=' + operation_start_date;
}
if (operation_end_date) {
str += '&operation_end_date=' + operation_end_date;
}
if (district_id) {
str += '&district_id=' + district_id;
}
if (store_id) {
str += '&store_name=' + store_name;
}
window.open(str)
}
};
return business;
});
\ No newline at end of file
......@@ -8,14 +8,9 @@
<td>[%= it[item]['name'] %]</td>
<td>[%= it[item]['practical_fee'] %]</td>
<td>[%= it[item]['cash'] %]</td>
<td>[%= it[item]['service_charge'] %]</td>
<td>[%= it[item]['practical_fee'] %]</td>
<td>[%= it[item]['fee'] %]</td>
<!--<td>[%= it[item]['service_charge'] %]</td>-->
<!--<td>
<a class="btn1 btn-info edit" href="#modal-details" data-toggle="modal" data-id='[%= it[item]["id"] %]'>详情</a>
<a class="btn1 btn-info timeline" href="#modal-linetime" data-toggle="modal" data-id='[%= it[item]["id"] %]'>时间轴</a>
</td>-->
<td>[%= it[item]['over_fee'] %]</td>
</tr>
[% } %]
[% }else{ %]
......@@ -23,5 +18,5 @@
<td colspan="9" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
</script>
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