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
80113065
Commit
80113065
authored
Dec 12, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应收佣金
parent
2e1ade74
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
13 deletions
+46
-13
Finance.php
application/index/controller/Finance.php
+11
-1
OPartialCommission.php
application/model/OPartialCommission.php
+35
-12
No files found.
application/index/controller/Finance.php
View file @
80113065
...
...
@@ -1689,6 +1689,8 @@ class Finance extends Basic
if
(
$result_data
[
'status'
]
==
'successful'
)
{
$data
=
$result_data
[
'data'
];
$should_where
[
'confirm_date'
]
=
[
'between time'
,
[
$operation_start_data
,
$operation_end_data
]];
$should_where
[
'confirm_status'
]
=
1
;
foreach
(
$data
as
$k
=>
$v
)
{
$commission_where
[
'agent_id'
]
=
$v
[
'agent_id'
];
$commission_data
=
$m_partial
->
sumCommission
(
$commission_fields
,
$commission_where
);
...
...
@@ -1696,7 +1698,15 @@ class Finance extends Basic
$excel_data
[
$k
][
'operation_date'
]
=
$operation_date
;
//成交日期
$excel_data
[
$k
][
'district_store'
]
=
$v
[
'district_store'
];
//所属部门/门店
$excel_data
[
$k
][
'name'
]
=
$v
[
'name'
]
.
'-'
.
$v
[
'phone'
];
//业务员
$excel_data
[
$k
][
'should_commission'
]
=
$v
[
'should_commission'
];
//应分佣金
$should_where
[
'agent_id'
]
=
$v
[
'agent_id'
];
if
(
empty
(
$this
->
params
[
'confirm_date'
]))
{
$should_where
[
'confirm_date'
]
=
[
'between time'
,
[
$operation_start_data
,
$operation_end_data
]];
}
else
{
$should_where
[
'confirm_date'
]
=
[
'between time'
,
[
$operation_start_data
,
$this
->
params
[
'confirm_date'
]
.
' 23:59:59'
]];
}
$should_commission
=
$m_partial
->
sumFieldsGroup
(
'should_commission'
,
$should_where
);
$excel_data
[
$k
][
'should_commission'
]
=
$should_commission
;
//应分佣金
$excel_data
[
$k
][
'service_charge'
]
=
$commission_data
[
'service_charge'
];
//手续费
$excel_data
[
$k
][
'cash'
]
=
$commission_data
[
'cash'
];
//现金奖
$excel_data
[
$k
][
'charity_fund'
]
=
$commission_data
[
'charity_fund'
];
//慈善基金
...
...
application/model/OPartialCommission.php
View file @
80113065
...
...
@@ -308,18 +308,18 @@ class OPartialCommission extends BaseModel
$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
;
}
//
//去除多次应分佣金
//
$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;
//
}
}
}
...
...
@@ -465,4 +465,26 @@ class OPartialCommission extends BaseModel
->
where
(
$where
)
->
find
();
}
/**
* @param $fields
* @param $where
* @param string $group
* @return int
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
sumFieldsGroup
(
$fields
,
$where
,
$group
=
'bargain_id'
)
{
$where
[
'is_del'
]
=
$num
=
0
;
$data
=
$this
->
field
(
$fields
)
->
where
(
$where
)
->
group
(
$group
)
->
find
();
foreach
(
$data
as
$k
=>
$v
)
{
$num
+=
$v
[
$fields
];
}
return
$num
;
}
}
\ No newline at end of file
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