Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
3701a4b3
Commit
3701a4b3
authored
May 30, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
成交报告查询经纪人
parent
a721d630
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
65 deletions
+97
-65
Finance.php
application/index/controller/Finance.php
+97
-65
No files found.
application/index/controller/Finance.php
View file @
3701a4b3
...
@@ -21,6 +21,7 @@ use app\model\OFinancialAudit;
...
@@ -21,6 +21,7 @@ use app\model\OFinancialAudit;
use
app\model\OPartialCommission
;
use
app\model\OPartialCommission
;
use
app\model\OPayLogModel
;
use
app\model\OPayLogModel
;
use
app\model\ORefundModel
;
use
app\model\ORefundModel
;
use
think\Exception
;
class
Finance
extends
Basic
class
Finance
extends
Basic
{
{
...
@@ -816,23 +817,35 @@ class Finance extends Basic
...
@@ -816,23 +817,35 @@ class Finance extends Basic
}
}
/**
/**
*
成交报告经纪人查询
* 成交报告经纪人查询
* 1盘方,2客方,3反签,4独家,5合作方
* 1盘方,2客方,3反签,4独家,5合作方
*
*
* @return \think\Response
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
*/
public
function
searchBargainAgents
()
public
function
searchBargainAgents
()
{
{
if
(
empty
(
$this
->
params
[
'bargain_id'
]))
{
$params
=
$this
->
params
;
return
$this
->
response
(
101
,
'请求参数错误!'
);
/* $params = array(
"type" => 1,//1盘方,2客方,3反签,4独家,5合作方
"order_id" => 36,
);*/
if
(
!
isset
(
$params
[
"type"
])
||
!
isset
(
$params
[
"order_id"
]))
{
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
}
$bargain
=
new
OBargainModel
();
$data
=
$bargain
->
getAgentTypeByBargainId
(
$this
->
params
[
'bargain_id'
]);
return
$this
->
response
(
200
,
""
,
$data
);
try
{
$order_service
=
new
OrderLogService
();
$list
=
$order_service
->
searchBargainAgents
(
$params
[
"type"
],
$params
[
"order_id"
]);
if
(
count
(
$list
)
>
0
)
{
return
$this
->
response
(
"200"
,
"request success"
,
$list
);
}
else
{
return
$this
->
response
(
"200"
,
"request null"
);
}
}
catch
(
Exception
$e
)
{
return
$this
->
response
(
"101"
,
"request error,msg:"
.
$e
);
}
}
}
/**
/**
...
@@ -942,70 +955,84 @@ class Finance extends Basic
...
@@ -942,70 +955,84 @@ class Finance extends Basic
// $where['b.father_id'] = ['<>', 0]; //去除税费总佣金
// $where['b.father_id'] = ['<>', 0]; //去除税费总佣金
// $where['c.confirm_status'] = 1; //确认分佣
// $where['c.confirm_status'] = 1; //确认分佣
/**收佣日期 start**/
$month_start
=
date
(
'Y-m-01'
);
if
(
!
empty
(
$this
->
params
[
'commission_start_date'
])
&&
empty
(
$this
->
params
[
'commission_end_date'
]))
{
$month_end
=
date
(
'Y-m-t'
);
$where
[
'b.operatiof.income_time'
]
=
[
'> time'
,
$this
->
params
[
'commission_start_time'
]
];
}
if
(
!
empty
(
$this
->
params
[
'commission_end_date'
])
&&
empty
(
$this
->
params
[
'commission_start_date'
]))
{
$where
[
'f.income_time'
]
=
[
'< time'
,
$this
->
params
[
'commission_end_time'
]
];
}
if
(
!
empty
(
$this
->
params
[
'commission_start_date'
])
&&
!
empty
(
$this
->
params
[
'commission_end_date'
]))
{
$where
[
'f.income_time'
]
=
[
'between time'
,
[
$this
->
params
[
'commission_start_date'
],
$this
->
params
[
'commission_end_date'
]
]
];
}
/**收佣日期 end**/
/**提交成交报告日期 start**/
/**收佣日期 start**/
if
(
!
empty
(
$this
->
params
[
'deal_start_date'
])
&&
empty
(
$this
->
params
[
'deal_end_date'
]))
{
if
(
!
empty
(
$this
->
params
[
'income_start_date'
])
&&
empty
(
$this
->
params
[
'income_end_date'
]))
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'deal_start_date'
]
]
.
' 00:00:00'
;
$where
[
'f.income_time'
]
=
[
'> time'
,
$this
->
params
[
'income_start_date'
]
];
}
$month_start
=
$this
->
params
[
'income_start_date'
];
$month_end
=
""
;
if
(
!
empty
(
$this
->
params
[
'deal_end_date'
])
&&
empty
(
$this
->
params
[
'deal_start_date'
]))
{
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'deal_end_date'
]
]
.
'23:59:59'
;
}
if
(
!
empty
(
$this
->
params
[
'deal_start_date'
])
&&
!
empty
(
$this
->
params
[
'deal_end_date'
]))
{
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'deal_start_date'
]
.
' 00:00:00'
,
$this
->
params
[
'deal_end_date'
]
.
'23:59:59'
]
];
}
/**提交成交报告日期 end**/
/**开票日期 start**/
if
(
!
empty
(
$this
->
params
[
'operation_start_date'
])
&&
empty
(
$this
->
params
[
'operation_end_date'
]))
{
$where_fee
[
'b.operation_date'
]
=
[
'> time'
,
$this
->
params
[
'operation_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
[
'operation_start_date'
])
&&
!
empty
(
$this
->
params
[
'operation_end_date'
]))
{
if
(
!
empty
(
$this
->
params
[
'income_end_date'
])
&&
empty
(
$this
->
params
[
'income_start_date'
]))
{
$where_fee
[
'b.operation_date'
]
=
[
'between time'
,
[
$this
->
params
[
'operation_start_date'
],
$this
->
params
[
'operation_end_date'
]
]
];
$where
[
'f.income_time'
]
=
[
'< time'
,
$this
->
params
[
'income_end_date'
]
];
$month_end
=
$this
->
params
[
'income_end_date'
];
$month_start
=
""
;
}
}
/**开票日期 end**/
if
(
empty
(
$this
->
params
[
'income_start_date'
])
&&
empty
(
$this
->
params
[
'income_end_date'
]))
{
$where
[
'f.income_time'
]
=
[
'between time'
,
[
$month_start
,
$month_end
]];
//默认收佣时间
/**经纪人手机号**/
if
(
!
empty
(
$this
->
params
[
'phone'
]))
{
$where
[
'b.phone'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'phone'
]
.
'%'
];
}
}
/**经纪人姓名**/
if
(
!
empty
(
$this
->
params
[
'income_start_date'
])
&&
!
empty
(
$this
->
params
[
'income_end_date'
])){
if
(
!
empty
(
$this
->
params
[
'name'
]))
{
$where
[
'f.income_time'
]
=
[
'between time'
,
[
$this
->
params
[
'income_start_date'
],
$this
->
params
[
'income_end_date'
]]];
$where
[
'd.name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'name'
]
.
'%'
];
$month_start
=
$this
->
params
[
'income_start_date'
];
$month_end
=
$this
->
params
[
'income_end_date'
];
}
}
/**部门id**/
/**收佣日期 end**/
if
(
!
empty
(
$this
->
params
[
'district_id'
]))
{
$where
[
'd.district_id'
]
=
$this
->
params
[
'district_id'
];
}
/**门店名**/
// /**提交成交报告日期 start**/
if
(
!
empty
(
$this
->
params
[
'store_name'
]))
{
// if (!empty($this->params['deal_start_date']) && empty($this->params['deal_end_date'])) {
$m_store
=
new
AStore
();
// $where['a.create_time'] = [ '> time', $this->params['deal_start_date'] ] . ' 00:00:00';
$store_id
=
$m_store
->
findStore
(
'id'
,
[
'store_name'
=>
[
'like'
,
'%'
.
$this
->
params
[
'store_name'
]
.
'%'
]
]);
// }
$where
[
'd.store_id'
]
=
$store_id
[
'id'
];
//
}
// if (!empty($this->params['deal_end_date']) && empty($this->params['deal_start_date'])) {
// $where['a.create_time'] = [ '< time', $this->params['deal_end_date'] ] . '23:59:59';
// }
//
// if (!empty($this->params['deal_start_date']) && !empty($this->params['deal_end_date'])) {
// $where['a.create_time'] = [ 'between time', [ $this->params['deal_start_date'] . ' 00:00:00', $this->params['deal_end_date'] . '23:59:59' ] ];
// }
// /**提交成交报告日期 end**/
//
// /**开票日期 start**/
// if (!empty($this->params['operation_start_date']) && empty($this->params['operation_end_date'])) {
// $where_fee['b.operation_date'] = [ '> time', $this->params['operation_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['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'] ] ];
// }
//
// /**开票日期 end**/
//
// /**经纪人手机号**/
// if (!empty($this->params['phone'])) {
// $where['b.phone'] = [ 'like', '%' . $this->params['phone'] . '%' ];
// }
//
// /**经纪人姓名**/
// if (!empty($this->params['name'])) {
// $where['d.name'] = [ 'like', '%' . $this->params['name'] . '%' ];
// }
//
// /**部门id**/
// if (!empty($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'];
// }
$m_bargain
=
new
OBargainModel
();
$m_bargain
=
new
OBargainModel
();
...
@@ -1014,6 +1041,11 @@ class Finance extends Basic
...
@@ -1014,6 +1041,11 @@ class Finance extends Basic
$fields
.=
'sum(c.service_charge) as service_charge,sum(b.fee) as fee,sum(c.real_fee) as real_fee,'
;
$fields
.=
'sum(c.service_charge) as service_charge,sum(b.fee) as fee,sum(c.real_fee) as real_fee,'
;
$fields
.=
'd.name,d.phone'
;
$fields
.=
'd.name,d.phone'
;
$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
)
{
$data
[
'data'
][
'list'
][
$k
][
'month_income'
]
=
date
(
'Y.m.d'
,
strtotime
(
$month_start
))
.
'-'
.
date
(
'Y.m.d'
,
strtotime
(
$month_end
));
}
$data
[
'data'
][
'total'
]
=
$m_bargain
->
getCommissionTotalListTotal
(
$where
,
$whereOr
);
$data
[
'data'
][
'total'
]
=
$m_bargain
->
getCommissionTotalListTotal
(
$where
,
$whereOr
);
}
else
{
}
else
{
...
@@ -1027,8 +1059,8 @@ class Finance extends Basic
...
@@ -1027,8 +1059,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
][
'income_time'
]
=
$v
[
'income_time'
]
;
//收佣日期
// $excel_data[$k]['month_one'] = date('Y-m-d', ($month_one))
; //收佣日期
$excel_data
[
$k
][
'create_time'
]
=
$v
[
'create_time'
]
;
//成交日期
// $excel_data[$k]['month_end'] = date('Y-m-d', strtotime($month_end))
; //成交日期
$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'
];
//应分佣金
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment