Commit dbdd8ed1 authored by hujun's avatar hujun

汇总列表修改

parent 933d8866
...@@ -13,6 +13,7 @@ use app\api_broker\service\OrderLogService; ...@@ -13,6 +13,7 @@ use app\api_broker\service\OrderLogService;
use app\index\extend\Basic; use app\index\extend\Basic;
use app\index\untils\ExportExcelUntil; use app\index\untils\ExportExcelUntil;
use app\model\AAgents; use app\model\AAgents;
use app\model\AStore;
use app\model\OBargainLogModel; use app\model\OBargainLogModel;
use app\model\OBargainModel; use app\model\OBargainModel;
use app\model\ORealIncome; use app\model\ORealIncome;
...@@ -983,42 +984,44 @@ class Finance extends Basic ...@@ -983,42 +984,44 @@ class Finance extends Basic
$data['code'] = 200; $data['code'] = 200;
$data['msg'] = ""; $data['msg'] = "";
$data['data'] = []; $whereOr = $data['data'] = [];
$whereOr = [];
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo']; $pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize']; $pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
$where['c.is_del'] = 0; //订单状态 $where['c.is_del'] = 0; //订单状态
// $where['a.status'] = ['in', '10,11']; //10已提交 11审核成功 // $where['a.status'] = ['in', '10,11']; //10已提交 11审核成功
// $where['b.father_id'] = ['<>', 0]; //去除税费总佣金 $where['b.father_id'] = ['<>', 0]; //去除税费总佣金
// $where['c.confirm_status'] = 1; //确认分佣 // $where['c.confirm_status'] = 1; //确认分佣
$month_start = date('Y-m-01'); $month_start = date('Y-m-01');
$month_end = date('Y-m-t'); $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**/ /**收佣日期 start**/
if (!empty($this->params['income_start_date']) && empty($this->params['income_end_date'])) { if (!empty($this->params['income_start_date']) && empty($this->params['income_end_date'])) {
$where['f.income_time'] = [ '> time', $this->params['income_start_date'] ]; $where['f.income_time'] = [ '> time', $this->params['income_start_date'] ];
$month_start = date('Y.m.d', strtotime($this->params['income_start_date'])); $income_date = date('Y.m.d', strtotime($this->params['income_start_date']));
$month_end = ""; } 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'])) { if (!empty($this->params['income_end_date']) && empty($this->params['income_start_date'])) {
$where['f.income_time'] = [ '< time', $this->params['income_end_date'] ]; $where['f.income_time'] = [ '< time', $this->params['income_end_date'] ];
$month_end = date('Y.m.d', strtotime($this->params['income_end_date'])); $income_date = '-'. date('Y.m.d', strtotime($this->params['income_end_date']));
$month_start = ""; } 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', [ $month_start, $month_end]]; //默认收佣时间
$month_start = date('Y.m.d', strtotime($month_start));
$month_end = date('Y.m.d', strtotime($month_end));
} }
if (!empty($this->params['income_start_date']) && !empty($this->params['income_end_date'])){ 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['f.income_time'] = [ 'between time', [ $this->params['income_start_date'], $this->params['income_end_date']]];
$month_start = date('Y.m.d', strtotime($this->params['income_start_date'])); $income_date = date('Y.m.d', strtotime($this->params['income_start_date'])) .'-'. date('Y.m.d', $this->params['income_end_date']);
$month_end = 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**/ /**收佣日期 end**/
...@@ -1026,7 +1029,6 @@ class Finance extends Basic ...@@ -1026,7 +1029,6 @@ class Finance extends Basic
/**提交成交报告日期 start**/ /**提交成交报告日期 start**/
if (!empty($this->params['bargain_start_date']) && empty($this->params['bargain_end_date'])) { if (!empty($this->params['bargain_start_date']) && empty($this->params['bargain_end_date'])) {
$where['a.create_time'] = [ '> time', $this->params['bargain_start_date'] ] . ' 00:00:00'; $where['a.create_time'] = [ '> time', $this->params['bargain_start_date'] ] . ' 00:00:00';
// $bargain_start_date =
} }
if (!empty($this->params['bargain_end_date']) && empty($this->params['bargain_start_date'])) { if (!empty($this->params['bargain_end_date']) && empty($this->params['bargain_start_date'])) {
...@@ -1041,41 +1043,43 @@ class Finance extends Basic ...@@ -1041,41 +1043,43 @@ class Finance extends Basic
if (!empty($this->params['district_id'])) { if (!empty($this->params['district_id'])) {
$where['d.district_id'] = $this->params['district_id']; $where['d.district_id'] = $this->params['district_id'];
} }
/**门店名**/
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**/ /**提交成交报告日期 end**/
//
// /**开票日期 start**/ /**开票日期 start**/
// if (!empty($this->params['operation_start_date']) && empty($this->params['operation_end_date'])) { if (!empty($this->params['deal_start_date']) && empty($this->params['deal_end_date'])) {
// $where_fee['b.operation_date'] = [ '> time', $this->params['operation_start_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['operation_end_date']) && empty($this->params['operation_start_date'])) {
// $where_fee['b.operation_date'] = [ '> time', $this->params['operation_start_date'] ]; 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['operation_start_date']) && !empty($this->params['operation_end_date'])) { }
// $where_fee['b.operation_date'] = [ 'between time', [ $this->params['operation_start_date'], $this->params['operation_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']]];
// /**开票日期 end**/ $operation_date = date('Y.m.d', strtotime($this->params['deal_start_date'])) .'-'. date('Y.m.d', strtotime($this->params['deal_end_date']));
// }
// /**经纪人手机号**/
// if (!empty($this->params['phone'])) { /**开票日期 end**/
// $where['b.phone'] = [ 'like', '%' . $this->params['phone'] . '%' ];
// } /**经纪人手机号**/
// if (!empty($this->params['phone'])) {
// /**经纪人姓名**/ $where['b.phone'] = [ 'like', '%' . $this->params['phone'] . '%' ];
// if (!empty($this->params['name'])) { }
// $where['d.name'] = [ 'like', '%' . $this->params['name'] . '%' ];
// } /**经纪人姓名**/
// if (!empty($this->params['name'])) {
$where['d.name'] = [ 'like', '%' . $this->params['name'] . '%' ];
// }
// /**门店名**/
// 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'];
// }
$m_bargain = new OBargainModel(); $m_bargain = new OBargainModel();
...@@ -1086,7 +1090,8 @@ class Finance extends Basic ...@@ -1086,7 +1090,8 @@ class Finance extends Basic
$data['data']['list'] = $m_bargain->getCommissionTotalList($pageNo, $pageSize, 'a.id desc', $fields, $where, $whereOr); $data['data']['list'] = $m_bargain->getCommissionTotalList($pageNo, $pageSize, 'a.id desc', $fields, $where, $whereOr);
foreach ($data['data']['list'] as $k=>$v) { foreach ($data['data']['list'] as $k=>$v) {
$data['data']['list'][$k]['month_income'] = $month_start . '-' . $month_end; $data['data']['list'][$k]['income_date'] = $income_date;
$data['data']['list'][$k]['operation_date'] = $operation_date;
} }
$data['data']['total'] = $m_bargain->getCommissionTotalListTotal($where, $whereOr); $data['data']['total'] = $m_bargain->getCommissionTotalListTotal($where, $whereOr);
...@@ -1102,8 +1107,8 @@ class Finance extends Basic ...@@ -1102,8 +1107,8 @@ class Finance extends Basic
$data = $m_bargain->getCommissionTotalList($pageNo, $pageSize, 'a.id desc', $fields, $where, $whereOr); $data = $m_bargain->getCommissionTotalList($pageNo, $pageSize, 'a.id desc', $fields, $where, $whereOr);
foreach ($data as $k => $v) { foreach ($data as $k => $v) {
// $excel_data[$k]['month_one'] = date('Y-m-d', ($month_one)); //收佣日期 $excel_data[$k]['income_date'] = $income_date; //收佣日期
// $excel_data[$k]['month_end'] = date('Y-m-d', strtotime($month_end)); //成交日期 $excel_data[$k]['operation_date'] = $operation_date; //成交日期
$excel_data[$k]['district_store'] = $v['district_store']; //所属部门/门店 $excel_data[$k]['district_store'] = $v['district_store']; //所属部门/门店
$excel_data[$k]['name'] = $v['name'] . '-' . $v['phone']; //业务员 $excel_data[$k]['name'] = $v['name'] . '-' . $v['phone']; //业务员
$excel_data[$k]['should_commission'] = $v['should_commission']; //应分佣金 $excel_data[$k]['should_commission'] = $v['should_commission']; //应分佣金
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
[% if(it) { %] [% if(it) { %]
[% for(var item in it){ %] [% for(var item in it){ %]
<tr class="text-center"> <tr class="text-center">
<td>[%= it[item]['create_time'] %]</td> <td>[%= it[item]['income_date'] %]</td>
<td>[%= it[item]['income_time'] %]</td> <td>[%= it[item]['operation_date'] %]</td>
<td>[%= it[item]['district_store'] %]</td> <td>[%= it[item]['district_store'] %]</td>
<td>[%= it[item]['name'] %]</td> <td>[%= it[item]['name'] %]</td>
<td>[%= it[item]['practical_fee'] %]</td> <td>[%= it[item]['practical_fee'] %]</td>
......
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