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
66c27411
Commit
66c27411
authored
Sep 12, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方法拆分
parent
b24e0d92
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
74 deletions
+94
-74
Cost.php
application/index/controller/Cost.php
+94
-74
No files found.
application/index/controller/Cost.php
View file @
66c27411
...
@@ -22,9 +22,16 @@ use app\model\FSettingLog;
...
@@ -22,9 +22,16 @@ use app\model\FSettingLog;
use
app\model\FStoreCost
;
use
app\model\FStoreCost
;
use
app\model\FStoreCostExt
;
use
app\model\FStoreCostExt
;
use
app\model\FStoreData
;
use
app\model\FStoreData
;
use
think\Request
;
class
Cost
extends
Basic
class
Cost
extends
Basic
{
{
private
$fee_model
;
public
function
__construct
(
Request
$request
=
null
)
{
parent
::
__construct
();
$this
->
fee_model
=
new
FApplyForFee
();
}
/**
/**
* 费用报销列表
* 费用报销列表
*
*
...
@@ -57,88 +64,101 @@ class Cost extends Basic
...
@@ -57,88 +64,101 @@ class Cost extends Basic
$data
[
'total'
]
=
$fee_model
->
getJoinAgentListTotal
(
$where
);
$data
[
'total'
]
=
$fee_model
->
getJoinAgentListTotal
(
$where
);
return
$this
->
response
(
200
,
''
,
$data
);
return
$this
->
response
(
200
,
''
,
$data
);
}
else
{
}
else
{
$field
.=
',a.card_name,a.card_no,a.store_id,a.office_id'
;
$this
->
getCostListExcel
(
$field
,
$where
);
$list
=
$fee_model
->
getJoinAgentList
(
1
,
100000
,
'a.ID DESC'
,
$field
,
$where
);
}
$redis
=
new
RedisCacheService
();
}
$source
=
[
0
=>
'app申请'
,
1
=>
'excel导入'
];
$status
=
[
0
=>
'申请中'
,
1
=>
'总监通过'
,
2
=>
'一审通过'
,
3
=>
'二审通过'
,
4
=>
'三审通过'
,
];
foreach
(
$list
as
$k
=>
$v
)
{
/**
switch
(
$v
[
'type'
])
{
* 导出数据
case
5
:
*
$store_id
[]
=
$v
[
'store_id'
];
* @param $field
break
;
* @param $where
default
:
*/
$office_id
[]
=
$v
[
'office_id'
];
private
function
getCostListExcel
(
$field
,
$where
)
break
;
{
}
$field
.=
',a.card_name,a.card_no,a.store_id,a.office_id'
;
}
$list
=
$this
->
fee_model
->
getJoinAgentList
(
1
,
100000
,
'a.ID DESC'
,
$field
,
$where
);
$store_data
=
$office_data
=
[];
$redis
=
new
RedisCacheService
();
if
(
isset
(
$store_id
))
{
$source
=
[
$store_id
=
array_filter
(
$store_id
);
0
=>
'app申请'
,
$store_id
=
array_unique
(
$store_id
);
1
=>
'excel导入'
$m_store
=
new
AStore
();
];
$store_data
=
$m_store
->
getColumn
(
'id,store_name'
,
[
'id'
=>
[
'in'
,
$store_id
]]);
$status
=
[
}
0
=>
'申请中'
,
1
=>
'总监通过'
,
2
=>
'一审通过'
,
3
=>
'二审通过'
,
4
=>
'三审通过'
,
];
if
(
isset
(
$office_id
))
{
foreach
(
$list
as
$k
=>
$v
)
{
$office_id
=
array_filter
(
$office_id
);
switch
(
$v
[
'type'
])
{
$office_id
=
array_unique
(
$office_id
);
case
5
:
$m_office
=
new
FOffice
();
$store_id
[]
=
$v
[
'store_id'
];
$office_data
=
$m_office
->
getColumn
(
'id,office_name'
,
[
'id'
=>
[
'in'
,
$office_id
]]);
break
;
default
:
$office_id
[]
=
$v
[
'office_id'
];
break
;
}
}
}
$store_data
=
$office_data
=
[];
if
(
isset
(
$store_id
))
{
$store_id
=
array_filter
(
$store_id
);
$store_id
=
array_unique
(
$store_id
);
$m_store
=
new
AStore
();
$store_data
=
$m_store
->
getColumn
(
'id,store_name'
,
[
'id'
=>
[
'in'
,
$store_id
]]);
}
foreach
(
$list
as
$k
=>
$v
)
{
if
(
isset
(
$office_id
))
{
$type_name
=
$cost_service
->
getFeeType
(
$v
[
'type'
]);
$office_id
=
array_filter
(
$office_id
);
$fee_item_name
=
$cost_service
->
getFeeItem
(
$v
[
'fee_item'
]);
$office_id
=
array_unique
(
$office_id
);
if
(
$v
[
'type'
]
==
3
)
{
$m_office
=
new
FOffice
();
$city_name
=
$redis
->
getRedisCache
(
4
,
$v
[
'site_id'
]);
$office_data
=
$m_office
->
getColumn
(
'id,office_name'
,
[
'id'
=>
[
'in'
,
$office_id
]]);
$type_name
=
$city_name
.
'-'
.
$type_name
;
}
}
$store_name
=
$office_name
=
''
;
$cost_service
=
new
CostService
();
switch
(
$v
[
'type'
])
{
foreach
(
$list
as
$k
=>
$v
)
{
case
5
:
$type_name
=
$cost_service
->
getFeeType
(
$v
[
'type'
]);
$store_name
=
array_key_exists
(
$v
[
'store_id'
],
$store_data
)
?
$store_data
[
$v
[
'store_id'
]]
:
''
;
$fee_item_name
=
$cost_service
->
getFeeItem
(
$v
[
'fee_item'
]);
break
;
if
(
$v
[
'type'
]
==
3
)
{
default
:
$city_name
=
$redis
->
getRedisCache
(
4
,
$v
[
'site_id'
]);
$office_name
=
array_key_exists
(
$v
[
'office_id'
],
$office_data
)
?
$office_data
[
$v
[
'office_id'
]]
:
''
;
$type_name
=
$city_name
.
'-'
.
$type_name
;
break
;
}
}
$excel_data
[
$k
]
=
[
$store_name
=
$office_name
=
''
;
'id'
=>
$v
[
'id'
],
switch
(
$v
[
'type'
])
{
'count_time'
=>
$v
[
'count_time'
],
case
5
:
'create_time'
=>
$v
[
'create_time'
],
$store_name
=
array_key_exists
(
$v
[
'store_id'
],
$store_data
)
?
$store_data
[
$v
[
'store_id'
]]
:
''
;
'agent_name'
=>
$v
[
'agent_name'
],
break
;
'total_fee'
=>
$v
[
'total_fee'
],
default
:
'type_name'
=>
$type_name
,
$office_name
=
array_key_exists
(
$v
[
'office_id'
],
$office_data
)
?
$office_data
[
$v
[
'office_id'
]]
:
''
;
'fee_item_name'
=>
$fee_item_name
,
break
;
'purpose'
=>
$v
[
'purpose'
],
'source_name'
=>
$source
[
$v
[
'source'
]],
'status'
=>
$status
[
$v
[
'status'
]],
'card_name'
=>
$v
[
'card_name'
],
'card_no'
=>
"
\t
"
.
$v
[
'card_no'
],
'store_name'
=>
$store_name
,
'office_name'
=>
$office_name
];
}
}
if
(
isset
(
$excel_data
))
{
$export
=
new
ExportExcelUntil
();
$excel_data
[
$k
]
=
[
$title
=
[
'费用总ID'
,
'计入月份'
,
'提交时间'
,
'提交人'
,
'费用总金额'
,
'费用类型'
,
'费用项目'
,
'费用用途'
,
'id'
=>
$v
[
'id'
],
'来源'
,
'状态'
,
'收款卡户名'
,
'收款卡账号'
,
'费用承担门店'
,
'费用承担办公室'
];
'count_time'
=>
$v
[
'count_time'
],
$export
->
exportTable
(
'费用报销审核'
,
$excel_data
,
13
,
'费用报销审核'
,
$title
);
'create_time'
=>
$v
[
'create_time'
],
}
'agent_name'
=>
$v
[
'agent_name'
],
'total_fee'
=>
$v
[
'total_fee'
],
'type_name'
=>
$type_name
,
'fee_item_name'
=>
$fee_item_name
,
'purpose'
=>
$v
[
'purpose'
],
'source_name'
=>
$source
[
$v
[
'source'
]],
'status'
=>
$status
[
$v
[
'status'
]],
'card_name'
=>
$v
[
'card_name'
],
'card_no'
=>
"
\t
"
.
$v
[
'card_no'
],
'store_name'
=>
$store_name
,
'office_name'
=>
$office_name
];
}
if
(
isset
(
$excel_data
))
{
$export
=
new
ExportExcelUntil
();
$title
=
[
'费用总ID'
,
'计入月份'
,
'提交时间'
,
'提交人'
,
'费用总金额'
,
'费用类型'
,
'费用项目'
,
'费用用途'
,
'来源'
,
'状态'
,
'收款卡户名'
,
'收款卡账号'
,
'费用承担门店'
,
'费用承担办公室'
];
$export
->
exportTable
(
'费用报销审核'
,
$excel_data
,
13
,
'费用报销审核'
,
$title
);
}
}
return
;
}
}
/**
/**
...
...
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