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
f4b58679
Commit
f4b58679
authored
Dec 21, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
实收汇总
parent
15b8d43c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
32 deletions
+119
-32
Finance.php
application/index/controller/Finance.php
+25
-14
commission_total.html
application/index/view/finance/commission_total.html
+6
-0
OPartialCommission.php
application/model/OPartialCommission.php
+82
-14
route.php
application/route.php
+1
-2
commissionTotal.js
public/resource/js/commissionTotal.js
+4
-1
commissionTotal_template_tpl.html
public/resource/template/commissionTotal_template_tpl.html
+1
-1
No files found.
application/index/controller/Finance.php
View file @
f4b58679
...
...
@@ -1417,7 +1417,7 @@ class Finance extends Basic
public
function
getCommissionTotalList
()
{
if
(
!
$this
->
request
->
isAjax
()
&&
$this
->
params
[
'excel'
]
!=
1
)
{
//
return view('commission_total');
return
view
(
'commission_total'
);
}
$data
[
'code'
]
=
200
;
...
...
@@ -1425,27 +1425,30 @@ class Finance extends Basic
$data
[
'data'
]
=
$excel_data
=
[];
$pageSize
=
empty
(
$this
->
params
[
'pageSize'
])
?
10
:
$this
->
params
[
'pageSize'
];
$pageNo
=
$this
->
params
[
'pageNo'
]
==
1
?
0
:
(
$this
->
params
[
'pageNo'
]
-
1
)
*
$pageSize
;
$where
=
' AND e.status in (10,11,13) AND a.confirm_status = 1 '
;
if
(
empty
(
$this
->
params
[
'pageNo'
])
||
$this
->
params
[
'pageNo'
]
==
1
)
{
$pageNo
=
0
;
}
else
{
$pageNo
=
(
$this
->
params
[
'pageNo'
]
-
1
)
*
$pageSize
;
}
$where
=
' e.status in (10,11,13) AND 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
.=
" AND
a.income_time >
{
$this
->
params
[
'income_start_date'
]
}
AND c.operation_date >
{
$this
->
params
[
'income_start_date'
]
}
"
;
$where
.=
" AND
b.income_time > '
{
$this
->
params
[
'income_start_date'
]
}
' AND 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'
]
.
' 00:00:00'
;
}
if
(
!
empty
(
$this
->
params
[
'income_end_date'
])
&&
empty
(
$this
->
params
[
'income_start_date'
]))
{
$where
.=
" AND
a.income_time <
{
$this
->
params
[
'income_end_date'
]
}
AND c.operation_date <
{
$this
->
params
[
'income_end_date'
]
}
"
;
$where
.=
" AND
b.income_time < '
{
$this
->
params
[
'income_end_date'
]
}
' AND c.operation_date < '
{
$this
->
params
[
'income_end_date'
]
}
'
"
;
$income_date
=
'-'
.
date
(
'Y.m.d'
,
strtotime
(
$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
.=
" AND
a.income_time BETWEEN
{
$this
->
params
[
'income_start_date'
]
}
AND
{
$this
->
params
[
'income_end_date'
]
}
"
;
$where
.=
" AND c.operation_date BETWEEN
{
$this
->
params
[
'income_start_date'
]
}
AND
{
$this
->
params
[
'income_end_date'
]
}
"
;
$where
.=
" AND
b.income_time BETWEEN '
{
$this
->
params
[
'income_start_date'
]
}
' AND '
{
$this
->
params
[
'income_end_date'
]
}
'
"
;
$where
.=
" AND c.operation_date 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'
]
.
' 00:00:00'
;
...
...
@@ -1468,19 +1471,27 @@ class Finance extends Basic
$where
.=
" AND a.agent_id=
{
$this
->
params
[
'agent_id'
]
}
"
;
}
$fields
=
' d.store_id,d.district_id,a.agent_id,sum( a.practical_fee ),sum( c.fee ),sum( a.real_fee ),sum( a.service_charge ),sum( a.charity_fund ) '
;
$m_bargain
=
new
OPartialCommission
();
$fields
=
' d.store_id,d.district_id,a.agent_id,sum( a.practical_fee ) as practical_fee,sum( c.fee ) as fee,'
;
$fields
.=
'sum( a.real_fee ) as real_fee,sum( a.service_charge ) as service_charge,sum( a.charity_fund ) as charity_fund'
;
$m_partial
=
new
OPartialCommission
();
if
(
empty
(
$this
->
params
[
'excel'
])
&&
$this
->
params
[
'excel'
]
!=
1
)
{
$list
=
$m_
bargain
->
getCommissionTotalList
(
$pageNo
,
$pageSize
,
$fields
,
$where
,
$operation_start_data
,
$operation_end_data
);
$list
=
$m_
partial
->
getCommissionTotalList
(
$pageNo
,
$pageSize
,
$fields
,
$where
,
$operation_start_data
,
$operation_end_data
);
foreach
(
$data
[
'data'
][
'list'
]
as
$k
=>
$v
)
{
$m_store
=
new
AStore
();
$m_agent
=
new
AAgents
();
foreach
(
$list
as
$k
=>
$v
)
{
$list
[
$k
][
'income_date'
]
=
$income_date
;
$list
[
$k
][
'operation_date'
]
=
$operation_date
;
$list
[
$k
][
'over_fee'
]
=
$v
[
'practical_fee'
]
-
$v
[
'fee'
];
$list
[
$k
][
'district_store'
]
=
$m_store
->
getStoreDistrictName
(
$v
[
'store_id'
]);
$list
[
$k
][
'fee'
]
=
empty
(
$v
[
'fee'
])
?
0
:
$v
[
'fee'
];
$list
[
$k
][
'name'
]
=
$m_agent
->
getAgentsById
(
$v
[
'agent_id'
],
'name'
);
}
$data
[
'data'
][
'list'
]
=
$list
;
// $data['data']['total'] = $m_bargain->getCommissionTotalListTotal($where);
$data
[
'data'
][
'total'
]
=
$m_partial
->
getCommissionTotalListTotal
(
$where
);
$data
[
'data'
][
'total_money'
]
=
$m_partial
->
getCommissionTotalInfo
(
'a.practical_fee'
,
$where
);
$data
[
'data'
][
'total_taxes'
]
=
$m_partial
->
getCommissionTotalInfo
(
'c.fee'
,
$where
);
}
return
$this
->
response
(
$data
[
'code'
],
$data
[
'msg'
],
$data
[
'data'
]);
}
...
...
application/index/view/finance/commission_total.html
View file @
f4b58679
...
...
@@ -149,6 +149,12 @@
<span
style=
"margin-left: 5px;font-size: 16px;font-weight: 600;"
>
最终实收总计:
<span
class=
"total-money"
></span>
元
</span>
<span
style=
"margin-left: 5px;font-size: 16px;font-weight: 600;"
>
税费总计:
<span
class=
"total-taxes"
></span>
元
</span>
<span
style=
"margin-left: 5px;font-size: 16px;font-weight: 600;"
>
最终实收总计:
<span
class=
"total-all"
></span>
元
</span>
</form>
</td>
</tr>
...
...
application/model/OPartialCommission.php
View file @
f4b58679
...
...
@@ -226,9 +226,9 @@ class OPartialCommission extends BaseModel
LEFT JOIN a_agents d ON a.agent_id = d.id
LEFT JOIN o_bargain e ON a.bargain_id = e.id
WHERE
a.practical_fee IS NOT NULL
AND
c.fee IS NOT NULL
{
$params
}
{
$params
}
AND
a.practical_fee > 0
AND c.fee > 0
GROUP BY
a.agent_id
) UNION ALL
...
...
@@ -242,9 +242,9 @@ class OPartialCommission extends BaseModel
LEFT JOIN a_agents d ON a.agent_id = d.id
LEFT JOIN o_bargain e ON a.bargain_id = e.id
WHERE
a.practical_fee IS NULL
AND c.fee IS NOT NULL
{
$params
}
AND a.practical_fee IS NULL
AND c.fee > 0
GROUP BY
a.agent_id
) UNION ALL
...
...
@@ -258,15 +258,30 @@ class OPartialCommission extends BaseModel
LEFT JOIN a_agents d ON a.agent_id = d.id
LEFT JOIN o_bargain e ON a.bargain_id = e.id
WHERE
a.practical_fee IS NOT NULL
AND c.fee IS NULL
{
$params
}
AND a.practical_fee > 0
AND c.fee IS NULL
GROUP BY
a.agent_id
) limit
{
$pageNo
}
,
{
$pageSize
}
"
;
return
$this
->
query
(
$sql
);
}
/**
* @param $field
* @param $where
* @return float|int
*/
public
function
getCommissionTotalInfo
(
$field
,
$where
)
{
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
(
'a_agents d'
,
'a.agent_id = d.id'
,
'left'
)
->
join
(
'o_bargain e'
,
'a.bargain_id = e.id'
,
'left'
)
->
where
(
$where
)
->
sum
(
$field
);
}
/**
* 分佣提成汇总表
*
...
...
@@ -342,15 +357,68 @@ class OPartialCommission extends BaseModel
* @param $params
* @return int|string
*/
/**
* @param $params
* @return mixed
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public
function
getCommissionTotalListTotal
(
$params
)
{
return
$this
->
alias
(
'a'
)
->
join
(
'o_bargain b'
,
'a.bargain_id = b.id'
,
'left'
)
->
join
(
'o_real_income f'
,
'b.id = f.bargain_id'
,
'left'
)
->
join
(
'a_agents d'
,
'a.agent_id = d.id'
,
'left'
)
->
where
(
$params
)
->
group
(
'a.agent_id'
)
->
count
();
$sql
=
"SELECT
COUNT( * ) AS count
FROM
(
( SELECT
count(a.id) as num
FROM
o_partial_commission a
LEFT JOIN o_real_income b ON a.real_income_id = b.id
LEFT JOIN o_taxes c ON a.agent_id = c.agent_id
LEFT JOIN a_agents d ON a.agent_id = d.id
LEFT JOIN o_bargain e ON a.bargain_id = e.id
WHERE
{
$params
}
AND a.practical_fee > 0
AND c.fee > 0
GROUP BY
a.agent_id
) UNION ALL
(
SELECT
count(a.id)
FROM
o_partial_commission a
LEFT JOIN o_real_income b ON a.real_income_id = b.id
LEFT JOIN o_taxes c ON a.agent_id = c.agent_id
LEFT JOIN a_agents d ON a.agent_id = d.id
LEFT JOIN o_bargain e ON a.bargain_id = e.id
WHERE
{
$params
}
AND a.practical_fee IS NULL
AND c.fee > 0
GROUP BY
a.agent_id
) UNION ALL
(
SELECT
count(a.id)
FROM
o_partial_commission a
LEFT JOIN o_real_income b ON a.real_income_id = b.id
LEFT JOIN o_taxes c ON a.agent_id = c.agent_id
LEFT JOIN a_agents d ON a.agent_id = d.id
LEFT JOIN o_bargain e ON a.bargain_id = e.id
WHERE
{
$params
}
AND a.practical_fee > 0
AND c.fee IS NULL
GROUP BY
a.agent_id
) ) as _group_count_"
;
$num
=
$this
->
query
(
$sql
);
return
$num
[
0
][
'count'
];
}
/**
...
...
application/route.php
View file @
f4b58679
...
...
@@ -258,8 +258,7 @@ Route::group('index', [
'searchBargainAgents'
=>
[
'index/Finance/searchBargainAgents'
,
[
'method'
=>
'GET'
]],
//成交报告id获取盘方,客方,反签,独家,合作方
'searchOrderAgents'
=>
[
'index/Finance/searchOrderAgents'
,
[
'method'
=>
'GET'
]],
//order_id获取盘方,客方,反签,独家,合作方
'getTallAgeList'
=>
[
'index/Finance/getTallAgeList'
,
[
'method'
=>
'GET'
]],
//税费承担明细表
'getCommissionTotalList'
=>
[
'index/Finance/getCommissionTotalListV2'
,
[
'method'
=>
'GET'
]],
//分佣提成汇总表
'getCommissionTotalListV2'
=>
[
'index/Finance/getCommissionTotalList'
,
[
'method'
=>
'GET'
]],
//分佣提成汇总表
'getCommissionTotalList'
=>
[
'index/Finance/getCommissionTotalList'
,
[
'method'
=>
'GET'
]],
//分佣提成汇总表
'getCollection'
=>
[
'index/Finance/getCollection'
,
[
'method'
=>
'post|get'
]],
//收款记录
'addRealMoney'
=>
[
'index/Finance/addRealMoney'
,
[
'method'
=>
'post|get'
]],
//新增实收
'visitShop'
=>
[
'index/Supervise/visitShop'
,
[
'method'
=>
'get'
]],
//门店拜访
...
...
public/resource/js/commissionTotal.js
View file @
f4b58679
...
...
@@ -55,7 +55,7 @@ define(['doT', 'text!temp/commissionTotal_template_tpl.html', 'css!style/home.cs
$
(
'#confirm_commission'
).
val
(
day_end
);
//初始化收佣日期
business
.
getList
();
business
.
getList
(
1
);
business
.
event
();
business
.
getDistrict
();
},
...
...
@@ -432,6 +432,7 @@ define(['doT', 'text!temp/commissionTotal_template_tpl.html', 'css!style/home.cs
params
.
confirm_date
=
$
(
'#confirm_commission'
).
val
();
params
.
district_id
=
$
(
"#district_id"
).
val
();
//部门id 添加字段
params
.
store_id
=
$
(
'#guest_stores'
).
val
();
console
.
log
(
params
)
$
.
ajax
({
url
:
'/index/getCommissionTotalList'
,
//获取列表
type
:
'GET'
,
...
...
@@ -445,6 +446,8 @@ define(['doT', 'text!temp/commissionTotal_template_tpl.html', 'css!style/home.cs
$
(
"#business_list"
).
html
(
doTtmpl
(
data
.
data
.
list
));
//汇总总计
$
(
'.total-money'
).
html
(
data
.
data
.
total_money
);
$
(
'.total-taxes'
).
html
(
data
.
data
.
total_taxes
);
$
(
'.total-all'
).
html
(
data
.
data
.
total_money
-
data
.
data
.
total_taxes
);
/*分页代码*/
add_page
(
data
.
data
.
total
,
pageNo
,
business
.
pageSize
,
business
.
getList
);
}
else
{
...
...
public/resource/template/commissionTotal_template_tpl.html
View file @
f4b58679
...
...
@@ -31,7 +31,7 @@
[
%
}
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
'
over_
fee'
]
%
]
[
%=
it
[
item
][
'
practical_fee'
]
-
it
[
item
][
'
fee'
]
%
]
<
/td
>
<
/tr
>
[
%
}
%
]
...
...
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