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
5df3a52d
Commit
5df3a52d
authored
Dec 17, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
财务日报
parent
d5d202b9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
15 deletions
+96
-15
DailyPaperService.php
application/api_broker/service/DailyPaperService.php
+96
-15
No files found.
application/api_broker/service/DailyPaperService.php
View file @
5df3a52d
...
...
@@ -2,8 +2,10 @@
namespace
app\api_broker\service
;
use
app\api_broker\controller\Agent
;
use
app\api_broker\service\VerifyService
;
use
app\model\AAgents
;
use
app\model\GHouses
;
use
app\model\ODaily
;
use
app\model\ODailyLog
;
use
app\model\OPayLogAdjustment
;
...
...
@@ -38,7 +40,7 @@ class DailyPaperService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getDaily
(
$agent_id
,
$store_id
,
$is_store
,
$daily_data
)
public
function
getDaily
(
$agent_id
,
$store_id
,
$is_store
,
$daily_data
)
{
//todo 1.if is_store身份是店长 2验证店长身份 3.验证是否有提交过当天的日报,提交过不能在提交,4.身份是财务,验证身份
...
...
@@ -102,41 +104,119 @@ class DailyPaperService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private
function
getPayLogList
(
$store_id
){
private
function
getPayLogList
(
$store_id
)
{
$ids
=
$this
->
getAgentsByStoreId
(
$store_id
);
if
(
!
$ids
)
{
if
(
!
$ids
)
{
return
null
;
}
$payLogModel
=
new
OPayLogModel
();
//中介费入账
$field
=
"a.id,c.id as bargain_id,b.house_id,c.price,a.money,a.pay_type,a.transfer_name,
d.report_agent_id,c.is_open,a.is_dividend,a.receipt_number,a.create_time"
;
$params
[
"a.agent_id"
]
=
array
(
"in"
,
(
$ids
));
d.report_agent_id
as agent_id
,c.is_open,a.is_dividend,a.receipt_number,a.create_time"
;
$params
[
"a.agent_id"
]
=
array
(
"in"
,
(
$ids
));
$params
[
"a.is_del"
]
=
0
;
$params
[
"a.type"
]
=
91
;
$params
[
"c.father_id"
]
=
0
;
$info
[
"agency_fee"
]
=
$payLogModel
->
selectPayLogListByBargain
(
$field
,
$params
);
$info
[
"agency_fee"
]
=
$this
->
getHouseAndAgentInfo
(
$payLogModel
->
selectPayLogListByBargain
(
$field
,
$params
)
);
//案场费入账 盘方
$params
[
"a.type"
]
=
92
;
$info
[
"case_fee"
]
=
$payLogModel
->
selectPayLogListByBargain
(
$field
,
$params
);
$info
[
"case_fee"
]
=
$this
->
getHouseAndAgentInfo
(
$payLogModel
->
selectPayLogListByBargain
(
$field
,
$params
)
);
$field_money
=
"a.id,b.house_id,a.pay_type,a.transfer_name, d.report_agent_id,a.is_dividend,a.receipt_number,a.create_time"
;
$field_money
=
"a.id,b.house_id,a.pay_type,a.transfer_name, d.report_agent_id
as agent_id
,a.is_dividend,a.receipt_number,a.create_time"
;
//意向金
$params
[
"a.type"
]
=
10
;
unset
(
$params
[
"c.father_id"
]);
$info
[
"earnest_money"
]
=
$payLogModel
->
selectPayLogListByBargainReport
(
$field_money
,
$params
);
$info
[
"earnest_money"
]
=
$this
->
getHouseAndAgentInfo
(
$payLogModel
->
selectPayLogListByBargainReport
(
$field_money
,
$params
)
);
//保管金
$params
[
"a.type"
]
=
30
;
$info
[
"custody_money"
]
=
$payLogModel
->
selectPayLogListByBargainReport
(
$field_money
,
$params
);
$info
[
"custody_money"
]
=
$this
->
getHouseAndAgentInfo
(
$payLogModel
->
selectPayLogListByBargainReport
(
$field_money
,
$params
)
);
//调整出账
$field_adjustment
=
"b.id,c.house_id,a.income_time,b.type,a.receipt_number,a.create_time"
;
$params_adjustment
[
"a.agent_id"
]
=
array
(
"in"
,
(
$ids
));
$field_adjustment
=
"b.id,c.house_id,a.
agent_id,a.
income_time,b.type,a.receipt_number,a.create_time"
;
$params_adjustment
[
"a.agent_id"
]
=
array
(
"in"
,
(
$ids
));
$params_adjustment
[
"a.is_del"
]
=
0
;
$info
[
"adjustment"
]
=
$payLogModel
->
selectAdjustmentList
(
$field_adjustment
,
$params_adjustment
);
$info
[
"adjustment"
]
=
$this
->
getHouseAndAgentInfo
(
$payLogModel
->
selectAdjustmentList
(
$field_adjustment
,
$params_adjustment
)
);
return
$info
;
}
/**
* @param $data
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private
function
getHouseAndAgentInfo
(
$data
)
{
$agent_id_str
=
""
;
$house_id_str
=
""
;
if
(
count
(
$data
)
>
0
)
{
foreach
(
$data
as
$k
=>
$v
)
{
$agent_id_str
.=
$v
[
"agent_id"
]
.
","
;
$house_id_str
.=
$v
[
"house_id"
]
.
","
;
}
$agent_id_str
=
rtrim
(
$agent_id_str
,
","
);
$house_id_str
=
rtrim
(
$house_id_str
,
","
);
$agent_arr
=
$this
->
agentInfo
(
$agent_id_str
);
$house_arr
=
$this
->
houseInfo
(
$house_id_str
);
foreach
(
$data
as
$k
=>
$v
)
{
foreach
(
$agent_arr
as
$value
)
{
if
(
$v
[
"agent_id"
]
==
$value
[
"id"
])
{
$data
[
$k
][
"agent_name"
]
=
$value
[
"name"
];
$data
[
$k
][
"store_name"
]
=
$value
[
"store_name"
];
}
}
foreach
(
$house_arr
as
$item
)
{
if
(
$v
[
"house_id"
]
==
$item
[
"id"
])
{
$data
[
$k
][
"house_address"
]
=
$item
[
"internal_address"
];
}
}
}
}
return
$data
;
}
/**
* @param $agent_id_str
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private
function
agentInfo
(
$agent_id_str
){
$params
[
"a.id"
]
=
array
(
"in"
,(
$agent_id_str
));
return
$this
->
aAgentsModel
->
getAgentsInfoByAgentId
(
"a.id,a.name,b.store_name"
,
$params
);
}
/**
* @param $house_id_str
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private
function
houseInfo
(
$house_id_str
){
$houseModel
=
new
GHouses
();
$params
[
"id"
]
=
array
(
"in"
,(
$house_id_str
));
return
$houseModel
->
getHouseInfo
(
"id,internal_address"
,
$params
);
}
/**
* 根据门店id获取此门店的经纪人id string
* @param $store_id
...
...
@@ -145,9 +225,10 @@ class DailyPaperService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private
function
getAgentsByStoreId
(
$store_id
){
private
function
getAgentsByStoreId
(
$store_id
)
{
$params
[
"store_id"
]
=
$store_id
;
$arr_list
=
$this
->
aAgentsModel
->
getAgentById
(
"id"
,
$params
);
$arr_list
=
$this
->
aAgentsModel
->
getAgentById
(
"id"
,
$params
);
$ids
=
""
;
if
(
count
(
$arr_list
)
>
0
)
{
foreach
(
$arr_list
as
$item
)
{
...
...
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