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
670b94e6
Commit
670b94e6
authored
Jul 04, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分佣汇总修改
parent
bc8aa634
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
56 deletions
+66
-56
Finance.php
application/index/controller/Finance.php
+50
-53
OPartialCommission.php
application/model/OPartialCommission.php
+16
-3
No files found.
application/index/controller/Finance.php
View file @
670b94e6
...
...
@@ -289,14 +289,14 @@ class Finance extends Basic
$update_real_arr
[
$i
][
'operation_id'
]
=
$this
->
userId
;
$update_real_arr
[
$i
][
'money'
]
=
$item
[
'fee'
];
$update_real_arr
[
$i
][
'income_time'
]
=
$item
[
'operation_date'
];
$log_data
[
$i
]
=
'[编辑实收佣金:'
.
$item
[
'fee'
]
.
',收佣日期'
.
$item
[
'operation_date'
]
.
']'
;
//
$log_data
[
$i
]
=
'[编辑实收佣金:'
.
$item
[
'fee'
]
.
',收佣日期'
.
$item
[
'operation_date'
]
.
']'
;
//
$i
++
;
}
else
{
$add_real_arr
[
$j
][
'bargain_id'
]
=
$bargain_id
;
$add_real_arr
[
$j
][
'operation_id'
]
=
$this
->
userId
;
$add_real_arr
[
$j
][
'money'
]
=
$item
[
'fee'
];
$add_real_arr
[
$j
][
'income_time'
]
=
$item
[
'operation_date'
];
$log_data
[
$j
]
=
'[新增实收佣金:'
.
$item
[
'fee'
]
.
',收佣日期'
.
$item
[
'operation_date'
]
.
']'
;
$log_data
[
$j
]
=
'[新增实收佣金:'
.
$item
[
'fee'
]
.
',收佣日期'
.
$item
[
'operation_date'
]
.
']'
;
$j
++
;
}
}
...
...
@@ -309,7 +309,7 @@ class Finance extends Basic
$m_real
->
addRealIncome
(
$add_real_arr
);
}
$content
=
'[应收总佣金:'
.
$update_data
[
'commission'
]
.
']'
.
implode
(
' '
,
$log_data
);
$content
=
'[应收总佣金:'
.
$update_data
[
'commission'
]
.
']'
.
implode
(
' '
,
$log_data
);
$this
->
editRecordLog
((
int
)
$this
->
params
[
"id"
],
$content
,
1
,
''
,
$update_data
[
'is_open'
]);
}
catch
(
\Exception
$e
)
{
return
$this
->
response
(
101
,
'内部错误,修改成交报告失败!请联系运营。'
);
...
...
@@ -720,13 +720,13 @@ class Finance extends Basic
$update_arr
[
$i
][
'operation_id'
]
=
$this
->
userId
;
//确认分佣加时间 否则 只是保存分佣数据
if
(
$this
->
params
[
'is_account_commission'
]
==
1
)
{
$update_arr
[
$i
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$update_arr
[
$i
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$update_arr
[
$i
][
'confirm_status'
]
=
1
;
}
$i
++
;
$log_data
[]
=
"[分佣比例(%):
{
$item
[
'scale'
]
}
][应分佣金(元):
{
$item
[
'should_commission'
]
}
][实分佣金(元):
{
$item
[
'real_fee'
]
}
]"
.
"[手续费(元):
{
$item
[
'service_charge'
]
}
][慈善基金(元):
{
$item
[
'charity_fund'
]
}
]"
.
$log_data
[]
=
"[分佣比例(%):
{
$item
[
'scale'
]
}
][应分佣金(元):
{
$item
[
'should_commission'
]
}
][实分佣金(元):
{
$item
[
'real_fee'
]
}
]"
.
"[手续费(元):
{
$item
[
'service_charge'
]
}
][慈善基金(元):
{
$item
[
'charity_fund'
]
}
]"
.
"[现金奖(元):
{
$item
[
'cash'
]
}
][实收佣金(元):
{
$item
[
'practical_fee'
]
}
]"
;
}
else
{
$add_arr
[
$j
][
'bargain_id'
]
=
$this
->
params
[
'bargain_id'
];
...
...
@@ -742,7 +742,7 @@ class Finance extends Basic
$add_arr
[
$j
][
'agent_id'
]
=
$item
[
'agent_id'
];
//确认分佣加时间 否则 只是保存分佣数据
if
(
$this
->
params
[
'is_account_commission'
]
==
1
)
{
$add_arr
[
$j
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$add_arr
[
$j
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$add_arr
[
$j
][
'confirm_status'
]
=
1
;
}
$j
++
;
...
...
@@ -759,7 +759,7 @@ class Finance extends Basic
$this
->
editRecordLog
(
$this
->
params
[
'bargain_id'
],
implode
(
','
,
$log_data
));
//log记录
}
if
(
$j
==
0
&&
$this
->
params
[
'is_account_commission'
]
>
0
)
{
//没有新增数据,则把最后一条数据的分佣比例和应分佣金改掉
if
(
$j
==
0
&&
$this
->
params
[
'is_account_commission'
]
>
0
)
{
//没有新增数据,则把最后一条数据的分佣比例和应分佣金改掉
$params
[
'id'
]
=
$this
->
params
[
'is_account_commission'
];
$params
[
'should_commission'
]
=
$data
[
0
][
'should_commission'
];
$params
[
'scale'
]
=
$data
[
0
][
'scale'
];
...
...
@@ -848,7 +848,7 @@ class Finance extends Basic
$log_data
=
[];
foreach
(
$tax
as
$k
=>
$v
)
{
$tax
[
$k
][
'agent_name'
]
=
$m_agent
->
getAgentsById
(
$v
[
'agent_id'
],
'name'
);
$log_data
[]
=
'[经纪人:id:'
.
$v
[
'agent_id'
]
.
',名字:'
.
$tax
[
$k
][
'agent_name'
]
.
',税费:'
.
$v
[
'fee'
]
.
'][开票比例:'
.
$v
[
'scale'
]
.
']'
;
$log_data
[]
=
'[经纪人:id:'
.
$v
[
'agent_id'
]
.
',名字:'
.
$tax
[
$k
][
'agent_name'
]
.
',税费:'
.
$v
[
'fee'
]
.
'][开票比例:'
.
$v
[
'scale'
]
.
']'
;
}
if
(
$this
->
params
[
'id'
]
&&
$this
->
params
[
'id'
]
>
0
)
{
//编辑
...
...
@@ -859,7 +859,7 @@ class Finance extends Basic
$data
=
$m_fee
->
addTaxes
(
$tax
,
$bargain_id
,
$this
->
userId
,
$father_id
,
$this
->
params
[
'total_fee'
],
$operation_date
);
$log_data_string
=
implode
(
','
,
$log_data
);
$log_data_string
=
implode
(
','
,
$log_data
);
$content
=
"[开票金额:
{
$this
->
params
[
'total_fee'
]
}
][开票日期:
{
$operation_date
}
][
{
$log_data_string
}
]"
;
$this
->
editRecordLog
(
$this
->
params
[
'bargain_id'
],
$content
);
return
$this
->
response
(
"200"
,
"request success"
,
$data
);
...
...
@@ -892,7 +892,8 @@ class Finance extends Basic
*
* @return \think\Response
*/
public
function
searchOrderAgents
()
{
public
function
searchOrderAgents
()
{
$params
=
$this
->
params
;
/* $params = array(
"type" => 1,//1盘方,2客方,3反签,4独家,5合作方
...
...
@@ -958,8 +959,8 @@ class Finance extends Basic
$fields
=
'a.id,a.operation_date,e.name,e.phone,a.fee,b.house_number,d.internal_address,a.agent_id,b.father_id,b.id as bargain_id,b.order_id'
;
$where
[
'c.is_del'
]
=
0
;
$where
[
'b.status'
]
=
[
'in'
,
[
10
,
11
,
13
]
];
//10已提交 11审核成功
$where
[
'a.father_id'
]
=
[
'neq'
,
0
];
$where
[
'b.status'
]
=
[
'in'
,
[
10
,
11
,
13
]
];
//10已提交 11审核成功
$where
[
'a.father_id'
]
=
[
'neq'
,
0
];
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.operation_date'
]
=
[
'> time'
,
$this
->
params
[
'create_time'
]
.
' 00:00:00'
];
}
...
...
@@ -1016,57 +1017,57 @@ class Finance extends Basic
$pageNo
=
empty
(
$this
->
params
[
'pageNo'
])
?
1
:
$this
->
params
[
'pageNo'
];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
15
:
$this
->
params
[
'pageSize'
];
$where
[
'b.status'
]
=
[
'in'
,
'10,11,13'
];
//10已提交 11审核成功
$where
[
'b.status'
]
=
[
'in'
,
'10,11,13'
];
//10已提交 11审核成功
$where
[
'a.confirm_status'
]
=
1
;
//确认分佣
$operation_start_data
=
$operation_end_data
=
$income_date
=
$operation_date
=
''
;
/**收佣日期 start**/
if
(
!
empty
(
$this
->
params
[
'income_start_date'
])
&&
empty
(
$this
->
params
[
'income_end_date'
]))
{
$where
[]
=
[
'EXP'
,
" f.income_time >
{
$this
->
params
[
'income_start_date'
]
}
or c.operation_date >
{
$this
->
params
[
'income_start_date'
]
}
"
];
$where
[]
=
[
'EXP'
,
" f.income_time >
{
$this
->
params
[
'income_start_date'
]
}
or c.operation_date >
{
$this
->
params
[
'income_start_date'
]
}
"
];
$income_date
=
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'income_start_date'
]));
$operation_start_data
=
$this
->
params
[
'income_start_date'
];
$operation_start_data
=
$this
->
params
[
'income_start_date'
]
.
' 00:00:00'
;
}
if
(
!
empty
(
$this
->
params
[
'income_end_date'
])
&&
empty
(
$this
->
params
[
'income_start_date'
]))
{
$where
[]
=
[
'EXP'
,
" f.income_time <
{
$this
->
params
[
'income_end_date'
]
}
or c.operation_date <
{
$this
->
params
[
'income_start_date'
]
}
"
];
$income_date
=
'-'
.
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'income_end_date'
]));
$where
[]
=
[
'EXP'
,
" f.income_time <
{
$this
->
params
[
'income_end_date'
]
}
or c.operation_date <
{
$this
->
params
[
'income_start_date'
]
}
"
];
$income_date
=
'-'
.
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'income_end_date'
]));
$operation_end_data
=
$this
->
params
[
'income_end_date'
];
$operation_end_data
=
$this
->
params
[
'income_end_date'
]
.
' 23:59:59'
;
}
if
(
!
empty
(
$this
->
params
[
'income_start_date'
])
&&
!
empty
(
$this
->
params
[
'income_end_date'
])){
$where
[]
=
[
'EXP'
,
"(f.income_time BETWEEN '
{
$this
->
params
[
'income_start_date'
]
}
' and '
{
$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'
]));
if
(
!
empty
(
$this
->
params
[
'income_start_date'
])
&&
!
empty
(
$this
->
params
[
'income_end_date'
]))
{
$where
[]
=
[
'EXP'
,
"(f.income_time BETWEEN '
{
$this
->
params
[
'income_start_date'
]
}
' and '
{
$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'
]));
$operation_start_data
=
$this
->
params
[
'income_start_date'
];
$operation_end_data
=
$this
->
params
[
'income_end_date'
];
$operation_start_data
=
$this
->
params
[
'income_start_date'
]
.
' 00:00:00'
;
$operation_end_data
=
$this
->
params
[
'income_end_date'
]
.
' 23:59:59'
;
}
/**收佣日期 end**/
/**提交成交报告日期 start**/
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 c.operation_date >
{
$this
->
params
[
'bargain_start_date'
]
}
"
];
$where
[]
=
[
'EXP'
,
"a.create_time >
{
$this
->
params
[
'bargain_start_date'
]
}
. ' 00:00:00' OR c.operation_date >
{
$this
->
params
[
'bargain_start_date'
]
}
"
];
$operation_date
=
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'bargain_start_date'
]));
$operation_start_data
=
$this
->
params
[
'bargain_start_date'
];
$operation_start_data
=
$this
->
params
[
'bargain_start_date'
]
.
' 00:00:00'
;
}
if
(
!
empty
(
$this
->
params
[
'bargain_end_date'
])
&&
empty
(
$this
->
params
[
'bargain_start_date'
]))
{
$where
[]
=
[
'EXP'
,
"a.create_time <
{
$this
->
params
[
'bargain_end_date'
]
}
. ' 23:59:59' OR c.operation_date <
{
$this
->
params
[
'bargain_end_date'
]
}
"
];
$where
[]
=
[
'EXP'
,
"a.create_time <
{
$this
->
params
[
'bargain_end_date'
]
}
. ' 23:59:59' OR c.operation_date <
{
$this
->
params
[
'bargain_end_date'
]
}
"
];
$operation_date
=
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'bargain_end_date'
]));
$operation_end_data
=
$this
->
params
[
'bargain_end_date'
];
$operation_end_data
=
$this
->
params
[
'bargain_end_date'
]
.
' 23:59:59'
;
}
if
(
!
empty
(
$this
->
params
[
'bargain_start_date'
])
&&
!
empty
(
$this
->
params
[
'bargain_end_date'
]))
{
$where
[]
=
[
'EXP'
,
"(a.create_time BETWEEN '
{
$this
->
params
[
'bargain_start_date'
]
}
00:00:00' and '
{
$this
->
params
[
'bargain_end_date'
]
}
23:59:59')"
];
$operation_date
=
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'bargain_start_date'
]))
.
'-'
.
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'bargain_end_date'
]));
$where
[]
=
[
'EXP'
,
"(a.create_time BETWEEN '
{
$this
->
params
[
'bargain_start_date'
]
}
00:00:00' and '
{
$this
->
params
[
'bargain_end_date'
]
}
23:59:59')"
];
$operation_date
=
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'bargain_start_date'
]))
.
'-'
.
date
(
'Y.m.d'
,
strtotime
(
$this
->
params
[
'bargain_end_date'
]));
$operation_start_data
=
$this
->
params
[
'bargain_start_date'
];
$operation_end_data
=
$this
->
params
[
'bargain_end_date'
];
$operation_start_data
=
$this
->
params
[
'bargain_start_date'
]
.
' 00:00:00'
;
$operation_end_data
=
$this
->
params
[
'bargain_end_date'
]
.
' 23:59:59'
;
}
/**部门id**/
...
...
@@ -1090,13 +1091,12 @@ class Finance extends Basic
}
$m_bargain
=
new
OPartialCommission
();
$fields
=
'f.income_time,b.create_time,b.id,b.agent_id,d.name,d.phone'
;
if
(
empty
(
$this
->
params
[
'excel'
])
&&
$this
->
params
[
'excel'
]
!=
1
)
{
$fields
=
'f.income_time,b.create_time,b.id,b.agent_id,sum(a.practical_fee) as practical_fee,sum(a.cash) as cash,'
;
$fields
.=
'sum(a.real_fee) as real_fee,d.name,d.phone'
;
$data
[
'data'
][
'list'
]
=
$m_bargain
->
getCommissionTotalList
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$fields
,
$where
,
$operation_start_data
,
$operation_end_data
);
foreach
(
$data
[
'data'
][
'list'
]
as
$k
=>
$v
)
{
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'
];
...
...
@@ -1106,11 +1106,6 @@ class Finance extends Basic
}
else
{
//导出Excel
$fields
=
'f.income_time,b.create_time,sum(f.money) as money,sum(a.cash) as cash,'
;
$fields
.=
'sum(a.service_charge) as service_charge,a.agent_id,sum(a.practical_fee) as practical_fee,'
;
$fields
.=
'd.name,d.phone,sum(a.charity_fund) as charity_fund, sum(a.should_commission) as should_commission'
;
$pageSize
=
25000
;
$data
=
$m_bargain
->
getCommissionTotalList
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$fields
,
$where
,
$operation_start_data
,
$operation_end_data
);
...
...
@@ -1123,7 +1118,7 @@ class Finance extends Basic
$excel_data
[
$k
][
'service_charge'
]
=
$v
[
'service_charge'
];
//手续费
$excel_data
[
$k
][
'cash'
]
=
$v
[
'cash'
];
//现金奖
$excel_data
[
$k
][
'charity_fund'
]
=
$v
[
'charity_fund'
];
//慈善基金
$excel_data
[
$k
][
'
money'
]
=
$v
[
'money
'
];
//实收佣金
$excel_data
[
$k
][
'
practical_fee'
]
=
$v
[
'practical_fee
'
];
//实收佣金
$excel_data
[
$k
][
'fee'
]
=
$v
[
'fee'
];
//税费
$excel_data
[
$k
][
'over_fee'
]
=
$v
[
'practical_fee'
]
-
$v
[
'fee'
];
}
...
...
@@ -1170,7 +1165,7 @@ class Finance extends Basic
$data
=
$m_financial
->
editData
(
$data
,
$this
->
params
[
'bargain_id'
],
'bargain_id'
);
$m_bargain
=
new
OBargainModel
();
$m_bargain
->
updateBargainById
(
$this
->
params
[
'bargain_id'
],
[
'status'
=>
10
]);
$m_bargain
->
updateBargainById
(
$this
->
params
[
'bargain_id'
],
[
'status'
=>
10
]);
$msg
=
''
;
if
(
$data
>
0
)
{
$code
=
200
;
...
...
@@ -1225,7 +1220,8 @@ class Finance extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
financeUpdateLog
(){
public
function
financeUpdateLog
()
{
if
(
!
$this
->
request
->
isAjax
())
{
return
view
(
'finance/finance_update_log'
);
}
...
...
@@ -1236,35 +1232,35 @@ class Finance extends Basic
$where
=
[];
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'create_time'
]
];
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'create_time'
]
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'create_time'
]))
{
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'create_time'
]
];
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'create_time'
]
];
}
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
!
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
],
$this
->
params
[
'end_time'
]]
];
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
],
$this
->
params
[
'end_time'
]
]
];
}
//商铺号
if
(
!
empty
(
$this
->
params
[
'house_number'
]))
{
$where
[
'a.house_number'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'house_number'
]
.
'%'
];
$where
[
'a.house_number'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'house_number'
]
.
'%'
];
}
//商铺地址
if
(
!
empty
(
$this
->
params
[
'internal_address'
]))
{
$where
[
'a.step_content'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'internal_address'
]
.
'%'
];
$where
[
'a.step_content'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'internal_address'
]
.
'%'
];
}
//经纪人名字
if
(
!
empty
(
$this
->
params
[
'name'
]))
{
$where
[
'b.name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'name'
]
.
'%'
];
$where
[
'b.name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'name'
]
.
'%'
];
}
//经纪人手机号
if
(
!
empty
(
$this
->
params
[
'phone'
]))
{
$where
[
'b.name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'phone'
]
.
'%'
];
$where
[
'b.name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'phone'
]
.
'%'
];
}
$fields
=
'a.create_time,step_content,b.name,b.phone'
;
...
...
@@ -1287,7 +1283,8 @@ class Finance extends Basic
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
editRecordLog
(
int
$bargain_id
,
string
$step_content
=
''
,
int
$type
=
1
,
string
$house_number
=
''
,
int
$is_open
=
0
)
{
public
function
editRecordLog
(
int
$bargain_id
,
string
$step_content
=
''
,
int
$type
=
1
,
string
$house_number
=
''
,
int
$is_open
=
0
)
{
$m_bargain
=
new
OBargainModel
();
$house_number_table
=
$m_bargain
->
getCheckBargain
(
'a.house_number,c.internal_address'
,
(
int
)
$bargain_id
);
...
...
@@ -1299,7 +1296,7 @@ class Finance extends Basic
$insert_data
=
[];
if
(
is_array
(
$step_content
))
{
foreach
(
$step_content
as
$k
=>
$v
)
{
foreach
(
$step_content
as
$k
=>
$v
)
{
$insert_data
[
$k
][
'bargain_id'
]
=
$bargain_id
;
$insert_data
[
$k
][
'step_content'
]
=
$step_content
;
$insert_data
[
$k
][
'type'
]
=
$type
;
...
...
application/model/OPartialCommission.php
View file @
670b94e6
...
...
@@ -236,7 +236,8 @@ class OPartialCommission extends BaseModel
$data
=
$this
->
alias
(
'a'
)
->
field
(
$field
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o_real_income f'
,
'b.id = f.bargain_id'
,
'left'
)
->
join
(
'o_bargain e'
,
'b.father_id = e.id or b.id=e.id and e.father_id=0'
,
'left'
)
->
join
(
'o_real_income f'
,
'e.id = f.bargain_id'
,
'left'
)
->
join
(
'a_agents d'
,
'a.agent_id = d.id'
,
'left'
)
->
where
(
$params
)
->
order
(
$order_
)
...
...
@@ -254,17 +255,29 @@ class OPartialCommission extends BaseModel
$data
[
$k
][
'district_store'
]
=
$district_store
[
'district_name'
]
.
'-'
.
$district_store
[
'store_name'
];
//税费
$data
[
$k
][
'fee'
]
=
$m_tax
->
where
(
'operation_date'
,
'between time'
,
[
$operation_start_data
,
$operation_end_data
])
$data
[
$k
][
'fee'
]
=
$m_tax
->
where
(
'operation_date'
,
'between time'
,
[
$operation_start_data
,
$operation_end_data
])
->
where
(
'agent_id'
,
$v
[
'agent_id'
])
->
sum
(
'fee'
);
//去除多次应分佣金
$should_commission
=
$this
->
where
(
'confirm_date'
,
'between time'
,
[
$operation_start_data
,
$operation_end_data
])
$should_commission
=
$this
->
where
(
'confirm_date'
,
'between time'
,
[
$operation_start_data
,
$operation_end_data
])
->
where
(
'agent_id'
,
$v
[
'agent_id'
])
->
group
(
'bargain_id'
)
->
column
(
'should_commission'
);
$data
[
$k
][
'should_commission'
]
=
0
;
foreach
(
$should_commission
as
$kk
=>
$vv
)
{
$data
[
$k
][
'should_commission'
]
+=
$vv
;
}
$field_sum
=
'sum(practical_fee) as practical_fee,sum(cash) as cash,sum(real_fee) as real_fee,sum(service_charge) as service_charge,
sum(charity_fund) as charity_fund'
;
//应分佣金
$partial_commission
=
$this
->
field
(
$field_sum
)
->
where
(
'confirm_date'
,
'between time'
,
[
$operation_start_data
,
$operation_end_data
])
->
where
(
'agent_id'
,
$v
[
'agent_id'
])
->
find
();
$data
[
$k
][
'practical_fee'
]
=
$partial_commission
[
'practical_fee'
];
$data
[
$k
][
'cash'
]
=
$partial_commission
[
'cash'
];
$data
[
$k
][
'real_fee'
]
=
$partial_commission
[
'real_fee'
];
$data
[
$k
][
'service_charge'
]
=
$partial_commission
[
'service_charge'
];
$data
[
$k
][
'charity_fund'
]
=
$partial_commission
[
'charity_fund'
];
}
}
...
...
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