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
c7f66ffe
Commit
c7f66ffe
authored
May 18, 2018
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
导出分佣提成明细表
parent
ebb83dbd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
151 additions
and
5 deletions
+151
-5
Finance.php
application/index/controller/Finance.php
+59
-5
ExportExcelUntil.php
application/index/untils/ExportExcelUntil.php
+44
-0
OPartialCommission.php
application/model/OPartialCommission.php
+47
-0
route.php
application/route.php
+1
-0
No files found.
application/index/controller/Finance.php
View file @
c7f66ffe
<?php
/**
* Created by PhpStorm.
* User:
fuju
* User:
hu jun
* Date: 2018/3/13
* Time: 15:48
*/
...
...
@@ -11,6 +11,7 @@ namespace app\index\controller;
use
app\api_broker\service\OrderLogService
;
use
app\index\extend\Basic
;
use
app\index\untils\ExportExcelUntil
;
use
app\model\AAgents
;
use
app\model\OBargainModel
;
use
app\model\OPartialCommission
;
...
...
@@ -41,10 +42,10 @@ class Finance extends Basic
$result
=
view
(
'finance/statement'
);
break
;
case
5
:
//待撤销
$result
=
view
(
'finance/wait_back
o
ut'
);
break
;
$result
=
view
(
'finance/wait_back
O
ut'
);
break
;
case
6
:
//已撤销
$result
=
view
(
'finance/statement_back
o
ut'
);
break
;
$result
=
view
(
'finance/statement_back
O
ut'
);
break
;
}
return
$result
;
...
...
@@ -141,7 +142,7 @@ class Finance extends Basic
$data
[
'data'
]
=
[];
$bargain
=
new
OBargainModel
();
//dump($this->params);die;
if
(
empty
(
$this
->
params
[
'id'
])
||
empty
(
$this
->
params
[
'source'
])
||
empty
(
$this
->
params
[
'status'
]))
{
$data
[
'code'
]
=
101
;
$data
[
'msg'
]
=
'Id is null'
;
...
...
@@ -201,7 +202,7 @@ class Finance extends Basic
$data
[
'msg'
]
=
'Id is null.'
;
}
else
{
$bargain
=
new
OBargainModel
();
$update_data
=
[];
if
(
!
empty
(
$this
->
params
[
'scale_fee'
]))
{
$update_data
[
'scale_fee'
]
=
$this
->
params
[
'scale_fee'
];
}
...
...
@@ -496,6 +497,8 @@ class Finance extends Basic
}
/**
* 分佣提成明细表
*
* @return \think\Response|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
...
...
@@ -545,4 +548,55 @@ class Finance extends Basic
$data
[
'data'
][
'total'
]
=
$m_commission
->
getCommissionBargainListTotal
(
$where
);
return
$this
->
response
(
"200"
,
"request success"
,
$data
);
}
/**
* 导出分佣提成明细表
*
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
exportExcel
()
{
$pageNo
=
1
;
$pageSize
=
250000
;
if
(
!
empty
(
$this
->
params
[
'create_time'
])
&&
empty
(
$this
->
params
[
'end_time'
]))
{
$where
[
'a.create_time'
]
=
[
'> time'
,
$this
->
params
[
'create_time'
]
.
' 00:00:00'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
empty
(
$this
->
params
[
'create_time'
]))
{
$where
[
'a.create_time'
]
=
[
'< time'
,
$this
->
params
[
'create_time'
]
.
' 23:59:59'
];
}
if
(
!
empty
(
$this
->
params
[
'end_time'
])
&&
!
empty
(
$this
->
params
[
'create_time'
]))
{
$where
[
'a.create_time'
]
=
[
'between time'
,
[
$this
->
params
[
'create_time'
]
.
' 00:00:00'
,
$this
->
params
[
'create_time'
]
.
' 23:59:59'
]];
}
if
(
!
empty
(
$this
->
params
[
'internal_address'
]))
{
$where
[
'd.internal_address'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'internal_address'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'phone'
]))
{
$where
[
'e.phone'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'phone'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'name'
]))
{
$where
[
'e.name'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'name'
]
.
'%'
];
}
if
(
!
empty
(
$this
->
params
[
'house_number'
]))
{
$where
[
'b.house_number'
]
=
[
'like'
,
'%'
.
$this
->
params
[
'house_number'
]
.
'%'
];
}
$where
=
[];
$field
=
'a.id,a.create_time,a.practical_fee,b.scale_fee,d.internal_address,b.agent_id,cash,service_charge,tallAge,charity_fund,real_fee'
;
$m_commission
=
new
OPartialCommission
();
$data
=
$m_commission
->
getCommissionBargainColumn
(
$pageNo
,
$pageSize
,
'a.id desc'
,
$field
,
$where
);
$export
=
new
ExportExcelUntil
();
$export
->
exportTable
(
'分佣提成明细'
,
$data
,
8
);
return
;
}
}
application/index/untils/ExportExcelUntil.php
0 → 100644
View file @
c7f66ffe
<?php
/**
* Created by PhpStorm.
* User: hu jun
* Date: 2018/5/18
* Time: 15:38
*/
namespace
app\index\untils
;
class
ExportExcelUntil
{
/**
* @param $file_name
* @param $data
* @param $row
*/
public
function
exportTable
(
string
$file_name
,
array
$data
,
int
$row
)
{
$filename
=
$file_name
.
'-'
.
date
(
'YmdHis'
)
.
".xlsx"
;
//设置 header,用于浏览器下载
header
(
'Content-disposition: attachment; filename="'
.
$filename
.
'"'
);
header
(
"Content-Type: application/vnd.openXmlFormats-officeDocument.spreadSheetMl.sheet"
);
header
(
'Content-Transfer-Encoding: binary'
);
header
(
'Cache-Control: must-revaLiDate'
);
header
(
'Pragma: public'
);
$class_xls
=
new
\XLSXWriter
();
$styles1
=
array
(
'font'
=>
'Arial'
,
'font-size'
=>
12
,
'font-style'
=>
'bold'
,
'fill'
=>
'#eee'
,
'halign'
=>
'center'
,
'border'
=>
'left,right,top,bottom'
,
'border-style'
=>
'thin'
,
'Valign'
=>
'center'
,
'height'
=>
20
);
$class_xls
->
writeSheetHeader
(
'Sheet1'
,
[
'string'
],[
'suppress_row'
=>
true
,
'widths'
=>
[
20
,
25
,
20
,
30
,
30
,
20
,
30
,
20
,
30
]]);
$class_xls
->
writeSheetRow
(
'Sheet1'
,
[
'分佣提成明细表'
],[
'height'
=>
32
,
'font-size'
=>
20
,
'font-style'
=>
'bold'
,
'halign'
=>
'center'
,
'valign'
=>
'center'
]);
$class_xls
->
writeSheetRow
(
'Sheet1'
,
[
'收佣日期'
,
'所属部门/门店'
,
'业务员'
,
'应分佣金(元)'
,
'实分佣金(元)'
,
'手续费(元)'
,
'慈善基金(元)'
,
'现金奖(元)'
,
'实收佣金(元)'
]
,
$styles1
);
foreach
(
$data
as
$k
=>
$v
)
{
$row_data
=
array_values
(
$v
);
$class_xls
->
writeSheetRow
(
'Sheet1'
,
$row_data
);
}
$class_xls
->
markMergedCell
(
'Sheet1'
,
$start_row
=
0
,
$start_col
=
0
,
$end_row
=
0
,
$end_col
=
$row
);
$class_xls
->
writeToStdOut
();
return
;
}
}
\ No newline at end of file
application/model/OPartialCommission.php
View file @
c7f66ffe
...
...
@@ -52,6 +52,53 @@ class OPartialCommission extends BaseModel
return
$result
;
}
/**
* 导出列表
*
* @param $pageNo
* @param $pageSize
* @param string $order_
* @param $fields
* @param $where
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
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
(
'a_agents e'
,
'b.agent_id = e.id'
,
'left'
)
->
where
(
$where
)
->
order
(
$order_
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
column
(
$fields
);
$result
=
[];
$m_agent
=
new
AAgents
();
$fields_str
=
'a.id,a.name,a.phone,b.store_name,c.district_name'
;
foreach
(
$data
as
$k
=>
$v
)
{
$result
[
$k
][
'create_time'
]
=
$v
[
'create_time'
];
if
(
$v
[
'agent_id'
])
{
$agent_data
=
$m_agent
->
getStoreDistrict
(
$fields_str
,
[
'a.id'
=>
$v
[
'agent_id'
]]);
$result
[
$k
][
'district_store'
]
=
$agent_data
[
'store_name'
]
.
'-'
.
$agent_data
[
'store_name'
];
$result
[
$k
][
'agent'
]
=
$agent_data
[
'name'
]
.
'-'
.
$agent_data
[
'phone'
];
}
$result
[
$k
][
'practical_fee'
]
=
$v
[
'practical_fee'
];
$result
[
$k
][
'scale_fee'
]
=
$v
[
'scale_fee'
];
$result
[
$k
][
'service_charge'
]
=
$v
[
'service_charge'
];
$result
[
$k
][
'charity_fund'
]
=
$v
[
'charity_fund'
];
$result
[
$k
][
'practical_fee'
]
=
$v
[
'practical_fee'
];
$result
[
$k
][
'cash'
]
=
$v
[
'cash'
];
$result
[
$k
][
'real_fee'
]
=
$v
[
'real_fee'
];
}
return
$result
;
}
/**
* @param $where
* @return int|string
...
...
application/route.php
View file @
c7f66ffe
...
...
@@ -207,6 +207,7 @@ Route::group('index', [
'overRuleManager/:check_status'
=>
[
'index/Finance/overRule'
,
[
'method'
=>
'post'
],
[
'check_status'
=>
1
]],
//退款审核-驳回-经理审核
'overRuleMajordomo/:check_status'
=>
[
'index/Finance/overRule'
,
[
'method'
=>
'post'
],
[
'check_status'
=>
2
]],
//退款审核-驳回-总监审核
'overRuleCashier/:check_status'
=>
[
'index/Finance/overRule'
,
[
'method'
=>
'post'
],
[
'check_status'
=>
3
]],
//退款审核-驳回-出纳审核
'exportExcel'
=>
[
'index/Finance/exportExcel'
,
[
'method'
=>
'get'
]],
//导出分佣
'bargainInfo'
=>
[
'index/Finance/bargainInfo'
,
[
'method'
=>
'get'
]
],
//获取成交报告详情
'editBargainInfo'
=>
[
'index/Finance/editBargainInfo'
,
[
'method'
=>
'post'
]
],
//修改成交报告佣金
'addBargain'
=>
[
'index/Finance/addBargain'
,
[
'method'
=>
'post'
]
],
//新增成交报告佣金(分佣提成)
...
...
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