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
8fff1e57
Commit
8fff1e57
authored
Jul 24, 2019
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6629e354
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
136 additions
and
10 deletions
+136
-10
StoreFeeService.php
application/api_broker/service/StoreFeeService.php
+88
-9
StoreFee.php
application/index/controller/StoreFee.php
+31
-1
FStoreCostExt.php
application/model/FStoreCostExt.php
+16
-0
route.php
application/route.php
+1
-0
No files found.
application/api_broker/service/StoreFeeService.php
View file @
8fff1e57
...
...
@@ -283,6 +283,7 @@ class StoreFeeService
foreach
(
$storeSettingInfo
as
$key
=>
$item
)
{
$applyForFeeArr
=
$this
->
getApplyForFee
(
$item
[
"store_id"
],
$setting_date
);
$site_id
=
$applyForFeeArr
[
0
][
"site_id"
];
$store_id
=
$item
[
"store_id"
];
$districtNum
=
$districtAttendanceNum
[
$site_id
][
"num"
];
//区域考勤人数
$attendance_num
=
$item
[
"attendance_num"
];
//门店参与考勤人数
$officeAttendanceNum
=
$this
->
sumAttendanceNum
(
$item
[
"store_id"
],
3
,
$setting_date
);
//办公室参与考勤人数
...
...
@@ -308,7 +309,7 @@ class StoreFeeService
continue
;
}
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
$type
,
$fee_item
,
$apply_for_id
,
$apply_for_time
,
$cost_id
,
$
store_id
,
$
type
,
$fee_item
,
$apply_for_id
,
$apply_for_time
,
$total_fee
,
$attendance_num
,
$officeAttendanceNum
,
$districtNum
,
$companyAttendanceNum
,
$assume_fee
,
$purpose
));
...
...
@@ -319,7 +320,7 @@ class StoreFeeService
$rent
=
$storeModel
->
getStoreCost
(
"b.id,b.rent"
,
[
"a.id"
=>
$item
[
"store_id"
]]);
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
1
,
100
,
0
,
$item
[
"create_time"
],
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
$store_id
,
1
,
100
,
0
,
$item
[
"create_time"
],
$rent
[
"rent"
],
$attendance_num
,
$officeAttendanceNum
,
$districtNum
,
$companyAttendanceNum
,
ceil
(
$attendance_num
*
100
/
$officeAttendanceNum
)
*
$rent
[
"rent"
]
*
0.01
,
""
));
...
...
@@ -333,11 +334,11 @@ class StoreFeeService
}
$assume_fee1
=
ceil
(
$attendance_discount
/
(
$companyAttendanceNum
-
$discountsNum
)
*
$tree
[
0
][
"fixed_fee"
]
*
100
)
*
0.01
;
$assume_fee2
=
ceil
(
$attendance_discount
/
(
$companyAttendanceNum
-
$discountsNum
)
*
$tree
[
0
][
"apply_for_fee"
]
*
100
)
*
0.01
;
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
2
,
201
,
0
,
$tree
[
0
][
"create_time"
],
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
$store_id
,
2
,
201
,
0
,
$tree
[
0
][
"create_time"
],
$tree
[
0
][
"fixed_fee"
],
$attendance_discount
,
$officeAttendanceNum
,
$districtNum
,
$companyAttendanceNum
-
$discountsNum
,
$assume_fee1
,
""
));
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
2
,
202
,
0
,
$tree
[
0
][
"create_time"
],
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
$store_id
,
2
,
202
,
0
,
$tree
[
0
][
"create_time"
],
$tree
[
0
][
"apply_for_fee"
],
$attendance_discount
,
$officeAttendanceNum
,
$districtNum
,
$companyAttendanceNum
-
$discountsNum
,
$assume_fee2
,
""
));
...
...
@@ -382,22 +383,22 @@ class StoreFeeService
}
//同联发展基金
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
4
,
401
,
0
,
$tree
[
4
][
"create_time"
],
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
$store_id
,
4
,
401
,
0
,
$tree
[
4
][
"create_time"
],
0
,
$attendance_num
,
$officeAttendanceNum
,
$districtNum
,
$companyAttendanceNum
,
$attendance_num
*
$tree
[
4
][
"fixed_fee"
],
""
));
//社保报销费用
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
5
,
502
,
0
,
$item
[
"create_time"
],
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
$store_id
,
5
,
502
,
0
,
$item
[
"create_time"
],
$item
[
"social_security_fee"
],
$attendance_num
,
$officeAttendanceNum
,
$districtNum
,
$companyAttendanceNum
,
$item
[
"social_security_fee"
],
""
));
//总经理基薪
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
5
,
503
,
0
,
$tree
[
6
][
"create_time"
],
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
$store_id
,
5
,
503
,
0
,
$tree
[
6
][
"create_time"
],
$tree
[
6
][
"fixed_fee"
],
$attendance_num
,
$officeAttendanceNum
,
$districtNum
,
$companyAttendanceNum
,
$tree
[
6
][
"fixed_fee"
],
""
));
//手续费
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
5
,
509
,
0
,
$item
[
"create_time"
],
array_push
(
$insertArr
,
$this
->
storeCostExtBin
(
$cost_id
,
$store_id
,
5
,
509
,
0
,
$item
[
"create_time"
],
$item
[
"transfer_charge"
],
$attendance_num
,
$officeAttendanceNum
,
$districtNum
,
$companyAttendanceNum
,
$item
[
"transfer_charge"
],
""
));
...
...
@@ -451,11 +452,12 @@ class StoreFeeService
return
0
;
}
private
function
storeCostExtBin
(
$cost_id
,
$type
,
$fee_item
,
$apply_for_id
,
$apply_for_time
,
$total_fee
,
$store_attendance_num
,
private
function
storeCostExtBin
(
$cost_id
,
$
store_id
,
$
type
,
$fee_item
,
$apply_for_id
,
$apply_for_time
,
$total_fee
,
$store_attendance_num
,
$office_attendance_num
,
$district_attendance_num
,
$total_attendance_num
,
$assume_fee
,
$purpose
)
{
$arr
=
[];
$arr
[
"cost_id"
]
=
$cost_id
;
$arr
[
"store_id"
]
=
$store_id
;
$arr
[
"type"
]
=
$type
;
$arr
[
"fee_item"
]
=
$fee_item
;
$arr
[
"apply_for_id"
]
=
$apply_for_id
;
...
...
@@ -542,4 +544,80 @@ class StoreFeeService
return
$arr
;
}
/**
* @param $setting_date
* @param $store_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getStoreFeeDetail
(
$setting_date
,
$store_id
)
{
$storeCostModel
=
new
FStoreCost
();
$storeCostInfo
=
$storeCostModel
->
findByOne
(
"id"
,
[
"setting_date"
=>
$setting_date
,
"status"
=>
0
]);
if
(
!
$storeCostInfo
)
{
return
false
;
}
$field
=
"id,cost_id,type,fee_item,apply_for_id,apply_for_time,total_fee,store_attendance_num,office_attendance_num,
district_attendance_num,total_attendance_num,assume_fee,purpose,create_time,update_time"
;
$storeCostExtModel
=
new
FStoreCostExt
();
$params
[
"store_id"
]
=
$store_id
;
$params
[
"cost_id"
]
=
$storeCostInfo
[
"id"
];
$params
[
"is_del"
]
=
0
;
$storeCostExtInfo
=
$storeCostExtModel
->
getStoreCostFeeList
(
$field
,
$params
);
if
(
!
$storeCostExtInfo
)
{
return
false
;
}
$tree
=
[];
foreach
(
$storeCostExtInfo
as
$key
=>
$item
)
{
$tree
[
$item
[
"type"
]][]
=
$item
;
}
$result
[
"store_list"
][
"info"
]
=
$tree
[
1
];
$result
[
"store_list"
][
"total"
]
=
$this
->
sumAssumeFee
(
$tree
[
1
]);
$result
[
"company_list"
][
"info"
]
=
$tree
[
2
];
$result
[
"company_list"
][
"total"
]
=
$this
->
sumAssumeFee
(
$tree
[
2
]);
$result
[
"district_list"
][
"info"
]
=
$tree
[
3
];
$result
[
"district_list"
][
"total"
]
=
$this
->
sumAssumeFee
(
$tree
[
3
]);
$result
[
"development_fund_list"
][
"info"
]
=
$tree
[
4
];
$result
[
"development_fund_list"
][
"total"
]
=
$this
->
sumAssumeFee
(
$tree
[
4
]);
$result
[
"store_alone_list"
][
"info"
]
=
$tree
[
5
];
$result
[
"store_alone_list"
][
"total"
]
=
$this
->
sumAssumeFee
(
$tree
[
5
]);
$storeDataModel
=
new
FStoreData
();
$storeDataInfo
=
$storeDataModel
->
findByOne
(
"id,store_id,setting_date,official_receipts,last_official_receipts,
deduct"
,
[
"store_id"
=>
$store_id
]);
if
(
!
$storeDataInfo
)
{
return
false
;
}
$result
[
"total_cost"
]
=
$this
->
sumAssumeFee
(
$storeCostInfo
);
$result
[
"official_receipts"
]
=
$storeDataInfo
[
"official_receipts"
];
$result
[
"last_official_receipts"
]
=
$storeDataInfo
[
"last_official_receipts"
];
$result
[
"deduct"
]
=
$storeDataInfo
[
"deduct"
];
$result
[
"profit"
]
=
$result
[
"official_receipts"
]
-
$result
[
"total_cost"
]
-
$result
[
"last_official_receipts"
];
return
$result
;
}
/**
* @param $result
* @return float
*/
private
function
sumAssumeFee
(
$result
)
{
$total
=
0
;
foreach
(
$result
as
$i
=>
$j
)
{
$total
+=
$j
[
"assume_fee"
];
}
return
round
(
$total
*
100
)
*
0.01
;
}
}
\ No newline at end of file
application/index/controller/StoreFee.php
View file @
8fff1e57
...
...
@@ -40,7 +40,7 @@ class StoreFee extends Basic
public
function
creationStoreFee
()
{
$params
=
$this
->
params
;
/*
$params = array(
/*
$params = array(
"setting_date" => "2019-06-01",
"agent_id" => 1,
);*/
...
...
@@ -67,6 +67,36 @@ class StoreFee extends Basic
}
else
{
return
$this
->
response
(
"200"
,
"success"
);
}
}
/**
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getStoreFeeDetail
(){
$params
=
$this
->
params
;
/* $params = array(
"setting_date" => "2019-06-01",
"store_id" => 49,
);*/
if
(
!
$params
[
"setting_date"
]
||
!
$params
[
"store_id"
])
{
return
$this
->
response
(
"101"
,
"请求参数错误 "
);
}
$setting_date
=
$params
[
"setting_date"
];
$store_id
=
$params
[
"store_id"
];
$result
=
$this
->
service_
->
getStoreFeeDetail
(
$setting_date
,
$store_id
);
if
(
$result
){
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
else
{
return
$this
->
response
(
"101"
,
"暂未生成
$setting_date
数据"
);
}
}
/**
...
...
application/model/FStoreCostExt.php
View file @
8fff1e57
...
...
@@ -143,4 +143,20 @@ class FStoreCostExt extends BaseModel
->
select
();
return
$result
;
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getStoreCostFeeList
(
$field
,
$params
){
return
$this
->
db_
->
field
(
$field
)
->
where
(
$params
)
->
select
();
}
}
application/route.php
View file @
8fff1e57
...
...
@@ -551,6 +551,7 @@ Route::group('index', [
'addFeeImage'
=>
[
'index/StoreFee/addFeeImage'
,
[
'method'
=>
'POST'
]],
//新增报销申请图片
'getStoreOffice'
=>
[
'index/Store/getStoreOffice'
,
[
'method'
=>
'GET'
]],
//获取费用承担办公室
'creationStoreFee'
=>
[
'index/StoreFee/creationStoreFee'
,
[
'method'
=>
'POST|GET'
]
],
'getStoreFeeDetail'
=>
[
'index/StoreFee/getStoreFeeDetail'
,
[
'method'
=>
'POST|GET'
]
],
'getStoreCostParameterList'
=>
[
'index/CostParameter/getStoreCostParameterList'
,
[
'method'
=>
'POST|GET'
]
],
'editCostParameter'
=>
[
'index/CostParameter/editCostParameter'
,
[
'method'
=>
'POST|GET'
]
],
...
...
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