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
7eb908b9
Commit
7eb908b9
authored
Aug 07, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
office
parent
1e2c7d90
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
125 deletions
+20
-125
OfficeFinance.php
application/index/controller/OfficeFinance.php
+2
-2
OfficeOPartialCommission.php
application/model/OfficeOPartialCommission.php
+17
-122
OfficeOTaxes.php
application/model/OfficeOTaxes.php
+1
-1
No files found.
application/index/controller/OfficeFinance.php
View file @
7eb908b9
...
...
@@ -267,8 +267,8 @@ class OfficeFinance extends Basic
$where
[
'e.id'
]
=
$this
->
params
[
'partial_id'
];
}
$field
=
'a.id,a.confirm_date,a.practical_fee,b.scale_fee,b.scale,b.role,d.internal_address,b.agent_id,cash,'
;
$field
.=
'service_charge,charity_fund,real_fee,a.real_income_id,a.should_commission,
d.internal_address,
b.father_id,b.id as bargain_id'
;
$field
=
'a.id,a.confirm_date,a.practical_fee,b.scale_fee,b.scale,b.role,d.
s.address as
internal_address,b.agent_id,cash,'
;
$field
.=
'service_charge,charity_fund,real_fee,a.real_income_id,a.should_commission,b.father_id,b.id as bargain_id'
;
$m_commission
=
new
OfficeOPartialCommission
();
try
{
...
...
application/model/OfficeOPartialCommission.php
View file @
7eb908b9
...
...
@@ -101,11 +101,12 @@ class OfficeOPartialCommission extends BaseModel
public
function
getCommissionBargainColumn
(
$pageNo
,
$pageSize
,
$order_
=
'id desc'
,
$fields
,
$where
)
{
$data
=
$this
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o_order c'
,
'b.order_id = c.id'
,
'left'
)
->
join
(
'g_houses d'
,
'c.house_id = d.id'
,
'left'
)
->
join
(
'office_o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'office_o_order c'
,
'b.order_id = c.id'
,
'left'
)
->
join
(
"office_g_room r"
,
"c.house_id = r.id"
,
"left"
)
->
join
(
"office_g_building s"
,
"r.building_id = s.id"
,
"left"
)
->
join
(
'a_agents e'
,
'b.agent_id = e.id'
,
'left'
)
->
join
(
'o_real_income f'
,
'a.real_income_id = f.id'
,
'left'
)
->
join
(
'o
ffice_o
_real_income f'
,
'a.real_income_id = f.id'
,
'left'
)
->
where
(
$where
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
...
...
@@ -182,7 +183,7 @@ class OfficeOPartialCommission extends BaseModel
$result
=
$this
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"a_agents b"
,
"a.agent_id=b.id"
,
"left"
)
->
join
(
"o_bargain c"
,
"a.bargain_id=c.id or a.bargain_id = c.father_id"
,
"left"
)
->
join
(
"o
ffice_o
_bargain c"
,
"a.bargain_id=c.id or a.bargain_id = c.father_id"
,
"left"
)
->
where
(
$params
)
->
order
(
"a.create_time desc"
)
->
select
();
...
...
@@ -221,9 +222,9 @@ class OfficeOPartialCommission extends BaseModel
{
return
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'o_real_income b'
,
'a.real_income_id = b.id'
,
'left'
)
->
join
(
'o
ffice_o
_real_income b'
,
'a.real_income_id = b.id'
,
'left'
)
->
join
(
'a_agents d'
,
'a.agent_id = d.id'
,
'left'
)
->
join
(
'o_bargain e'
,
'a.bargain_id = e.id'
,
'left'
)
->
join
(
'o
ffice_o
_bargain e'
,
'a.bargain_id = e.id'
,
'left'
)
->
where
(
$params
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
...
...
@@ -234,8 +235,8 @@ class OfficeOPartialCommission extends BaseModel
public
function
getSumMoney
(
$field
,
$where
)
{
return
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o_real_income c'
,
' a.real_income_id = c.id'
,
'left'
)
->
join
(
'o
ffice_o
_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o
ffice_o
_real_income c'
,
' a.real_income_id = c.id'
,
'left'
)
->
where
(
$where
)
->
find
();
}
...
...
@@ -248,84 +249,13 @@ class OfficeOPartialCommission extends BaseModel
public
function
getCommissionTotalInfo
(
$field
,
$where
)
{
return
$this
->
alias
(
'a'
)
->
field
(
'distinct a.id'
)
->
join
(
'o_real_income b'
,
'a.real_income_id = b.id'
,
'left'
)
->
join
(
'o
ffice_o
_real_income b'
,
'a.real_income_id = b.id'
,
'left'
)
->
join
(
'a_agents d'
,
'a.agent_id = d.id'
,
'left'
)
->
join
(
'o_bargain e'
,
'a.bargain_id = e.id'
,
'left'
)
->
join
(
'o
ffice_o
_bargain e'
,
'a.bargain_id = e.id'
,
'left'
)
->
where
(
$where
)
->
sum
(
$field
);
}
/**
* 分佣提成汇总表
*
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @param $operation_start_data
* @param $operation_end_data
* @return mixed
*/
public
function
getCommissionTotalListV2
(
$pageNo
=
1
,
$pageSize
=
15
,
$order_
=
'a.id desc'
,
$field
=
''
,
$params
=
''
,
$operation_start_data
,
$operation_end_data
)
{
try
{
$data
=
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'o_bargain c'
,
'a.bargain_id = c.id'
,
'left'
)
->
join
(
'o_real_income d'
,
'a.real_income_id = d.id'
,
'left'
)
->
join
(
'o_taxes f'
,
'a.bargain_id = f.bargain_id'
,
'left'
)
->
where
(
$params
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
group
(
'b.id'
)
->
select
();
$m_agent
=
new
AAgents
();
$m_tax
=
new
OTaxes
();
foreach
(
$data
as
$k
=>
$v
)
{
if
(
isset
(
$v
[
'agent_id'
]))
{
$district_store
=
$m_agent
->
getStoreDistrict
(
'store_name,district_name'
,
[
'a.id'
=>
$v
[
'agent_id'
]
]);
$data
[
$k
][
'district_store'
]
=
$district_store
[
'district_name'
]
.
'-'
.
$district_store
[
'store_name'
];
// //去除多次应分佣金
// $should_commission = $this->where('confirm_date', 'between time', [ $operation_start_data, $operation_end_data ])
// ->where('agent_id', $v['agent_id'])
// ->where('confirm_status', 1)
// ->where('is_del', 0)
// ->group('bargain_id')
// ->column('should_commission');
//
// $data[$k]['should_commission'] = 0;
// foreach ($should_commission as $kk => $vv) {
// $data[$k]['should_commission'] += $vv;
// }
}
}
$result
[
'status'
]
=
'successful'
;
$result
[
'data'
]
=
$data
;
}
catch
(
\Exception
$e
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
$e
->
getMessage
();
}
return
$result
;
}
public
function
getCommissionTotalField
(
$filed
,
$params
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'o_bargain c'
,
'a.bargain_id = c.id'
,
'left'
)
->
join
(
'o_real_income d'
,
'a.real_income_id = d.id'
,
'left'
)
->
join
(
'o_taxes f'
,
'a.bargain_id = f.bargain_id'
,
'left'
)
->
where
(
$params
)
->
group
(
'b.id'
)
->
sum
(
$filed
);
}
/**
* @param $params
* @return int|string
...
...
@@ -339,26 +269,10 @@ class OfficeOPartialCommission extends BaseModel
public
function
getCommissionTotalListTotal
(
$params
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'o_real_income b'
,
'a.real_income_id = b.id'
,
'left'
)
->
join
(
'o_taxes c'
,
'a.agent_id = c.agent_id'
,
'left'
)
->
join
(
'o
ffice_o
_real_income b'
,
'a.real_income_id = b.id'
,
'left'
)
->
join
(
'o
ffice_o
_taxes c'
,
'a.agent_id = c.agent_id'
,
'left'
)
->
join
(
'a_agents d'
,
'a.agent_id = d.id'
,
'left'
)
->
join
(
'o_bargain e'
,
'a.bargain_id = e.id'
,
'left'
)
->
where
(
$params
)
->
group
(
'a.agent_id'
)
->
count
();
}
/**
* @param $params
* @return int|string
*/
public
function
getCommissionTotalListTotalV2
(
$params
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'a_agents b'
,
'a.agent_id = b.id'
,
'left'
)
->
join
(
'o_bargain c'
,
'a.bargain_id = c.id'
,
'left'
)
->
join
(
'o_real_income d'
,
'a.real_income_id = d.id'
,
'left'
)
->
join
(
'o_taxes f'
,
'a.bargain_id = f.bargain_id'
,
'left'
)
->
join
(
'office_o_bargain e'
,
'a.bargain_id = e.id'
,
'left'
)
->
where
(
$params
)
->
group
(
'a.agent_id'
)
->
count
();
...
...
@@ -376,7 +290,7 @@ class OfficeOPartialCommission extends BaseModel
try
{
$data
=
$this
->
field
(
'confirm_status'
)
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o
ffice_o
_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
where
(
'EXP'
,
'a.id ='
.
$bargain_id
.
' or b.father_id = '
.
$bargain_id
)
->
where
(
'b.status'
,
'<>'
,
30
)
->
where
(
'a.is_del'
,
0
)
...
...
@@ -448,25 +362,6 @@ class OfficeOPartialCommission extends BaseModel
return
$this
->
where
(
$where
)
->
value
(
$field
);
}
/**
* @param $field
* @param $where
* @return array|false|\PDOStatement|string|\think\Model
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
sumCommission
(
$field
,
$where
)
{
$where
[
'a.is_del'
]
=
0
;
$where
[
'b.is_del'
]
=
0
;
return
$partial_commission
=
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'o_real_income b'
,
'a.real_income_id = b.id'
,
'left'
)
->
where
(
$where
)
->
find
();
}
/**
* @param $fields
* @param $where
...
...
@@ -530,7 +425,7 @@ class OfficeOPartialCommission extends BaseModel
$date
=
$this
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
"o_real_income b"
,
"a.real_income_id = b.id"
,
"left"
)
->
join
(
"o
ffice_o
_real_income b"
,
"a.real_income_id = b.id"
,
"left"
)
->
where
(
$where_
)
->
select
();
return
$date
;
...
...
application/model/OfficeOTaxes.php
View file @
7eb908b9
...
...
@@ -335,7 +335,7 @@ class OfficeOTaxes extends BaseModel
public
function
sumBargainFee
(
$field
=
'a.fee'
,
$where
)
{
return
$this
->
field
(
$field
)
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o
ffice_o
_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'a_agents c'
,
'b.agent_id = c.id'
,
'left'
)
->
where
(
$where
)
->
sum
(
$field
);
...
...
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