Commit 88473de3 authored by hujun's avatar hujun

1

parent 66c27411
...@@ -20,17 +20,32 @@ use app\model\FImg; ...@@ -20,17 +20,32 @@ use app\model\FImg;
use app\model\FOffice; use app\model\FOffice;
use app\model\FSettingLog; use app\model\FSettingLog;
use app\model\FStoreCost; use app\model\FStoreCost;
use app\model\FStoreCostExt;
use app\model\FStoreData; use app\model\FStoreData;
use think\Request; use think\Request;
class Cost extends Basic class Cost extends Basic
{ {
private $fee_model; private $fee_model;
private $source;
private $status;
public function __construct(Request $request = null) public function __construct(Request $request = null)
{ {
parent::__construct(); parent::__construct();
$this->fee_model = new FApplyForFee(); $this->fee_model = new FApplyForFee();
$this->source = [
0 => 'app申请',
1 => 'excel导入'
];
$this->status = [
0 => '总监审核',
1 => '财务一审',
2 => '财务二审',
3 => '出纳审核',
4 => '已出款',
5 => '行政审核'
];
} }
/** /**
* 费用报销列表 * 费用报销列表
...@@ -47,7 +62,7 @@ class Cost extends Basic ...@@ -47,7 +62,7 @@ class Cost extends Basic
$where = $this->buildWhere($this->params); $where = $this->buildWhere($this->params);
$field = 'a.id,a.count_time,a.source,a.type,a.create_time,a.agent_id,a.total_fee,a.fee_item,a.purpose,a.status,'; $field = 'a.id,a.count_time,a.source,a.type,a.create_time,a.agent_id,a.total_fee,a.fee_item,a.purpose,a.status,';
$field .= 'b.name as agent_name,a.site_id'; $field .= 'b.name as agent_name,a.site_id';
$fee_model = new FApplyForFee();
$cost_service = new CostService(); $cost_service = new CostService();
if (empty($this->params['excel'])) { if (empty($this->params['excel'])) {
if (in_array($this->params['check_status'], [1,2,3,4])) { if (in_array($this->params['check_status'], [1,2,3,4])) {
...@@ -55,13 +70,13 @@ class Cost extends Basic ...@@ -55,13 +70,13 @@ class Cost extends Basic
} else { } else {
$order = 'a.ID DESC'; $order = 'a.ID DESC';
} }
$list = $fee_model->getJoinAgentList($pageNo, $pageSize, $order, $field, $where); $list = $this->fee_model->getJoinAgentList($pageNo, $pageSize, $order, $field, $where);
foreach($list as $k=>$v) { foreach($list as $k=>$v) {
$list[$k]['type_name'] = $cost_service->getFeeType($v['type']); $list[$k]['type_name'] = $cost_service->getFeeType($v['type']);
$list[$k]['fee_item_name'] = $cost_service->getFeeItem($v['fee_item']); $list[$k]['fee_item_name'] = $cost_service->getFeeItem($v['fee_item']);
} }
$data['list'] = $list; $data['list'] = $list;
$data['total'] = $fee_model->getJoinAgentListTotal($where); $data['total'] = $this->fee_model->getJoinAgentListTotal($where);
return $this->response(200, '', $data); return $this->response(200, '', $data);
} else { } else {
$this->getCostListExcel($field, $where); $this->getCostListExcel($field, $where);
...@@ -79,18 +94,6 @@ class Cost extends Basic ...@@ -79,18 +94,6 @@ class Cost extends Basic
$field .= ',a.card_name,a.card_no,a.store_id,a.office_id'; $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); $list = $this->fee_model->getJoinAgentList(1, 100000, 'a.ID DESC', $field, $where);
$redis = new RedisCacheService(); $redis = new RedisCacheService();
$source = [
0 => 'app申请',
1 => 'excel导入'
];
$status = [
0 => '申请中',
1 => '总监通过',
2 => '一审通过',
3 => '二审通过',
4 => '三审通过',
];
foreach ($list as $k => $v) { foreach ($list as $k => $v) {
switch ($v['type']) { switch ($v['type']) {
case 5 : case 5 :
...@@ -144,8 +147,8 @@ class Cost extends Basic ...@@ -144,8 +147,8 @@ class Cost extends Basic
'type_name' => $type_name, 'type_name' => $type_name,
'fee_item_name' => $fee_item_name, 'fee_item_name' => $fee_item_name,
'purpose' => $v['purpose'], 'purpose' => $v['purpose'],
'source_name' => $source[$v['source']], 'source_name' => $this->source[$v['source']],
'status' => $status[$v['status']], 'status' => $this->status[$v['status']],
'card_name' => $v['card_name'], 'card_name' => $v['card_name'],
'card_no' => "\t" . $v['card_no'], 'card_no' => "\t" . $v['card_no'],
'store_name' => $store_name, 'store_name' => $store_name,
...@@ -283,8 +286,8 @@ class Cost extends Basic ...@@ -283,8 +286,8 @@ class Cost extends Basic
if (empty($this->params['id'])) { if (empty($this->params['id'])) {
return $this->response($code, '参数错误'); return $this->response($code, '参数错误');
} }
$fee_model = new FApplyForFee();
$data = $fee_model->findByOne('id,type,status', ['id'=>$this->params['id'], 'is_del'=>0]); $data = $this->fee_model->findByOne('id,type,status', ['id'=>$this->params['id'], 'is_del'=>0]);
if (empty($data)) { if (empty($data)) {
return $this->response(101, '没有该数据或已删除'); return $this->response(101, '没有该数据或已删除');
...@@ -294,7 +297,7 @@ class Cost extends Basic ...@@ -294,7 +297,7 @@ class Cost extends Basic
return $this->response(101, '已经财务三审,无法删除!'); return $this->response(101, '已经财务三审,无法删除!');
} }
$is_ok = $fee_model->editData(['is_del'=>1], $this->params['id']); $is_ok = $this->fee_model->editData(['is_del'=>1], $this->params['id']);
if ($is_ok) { if ($is_ok) {
$check_model = new FApplyForFeeCheck(); $check_model = new FApplyForFeeCheck();
...@@ -371,7 +374,6 @@ class Cost extends Basic ...@@ -371,7 +374,6 @@ class Cost extends Basic
return $this->response($code, '参数错误!'); return $this->response($code, '参数错误!');
} }
$cost_service = new CostService(); $cost_service = new CostService();
$fee_model = new FApplyForFee();
$m_store_cost = new FStoreCost(); $m_store_cost = new FStoreCost();
$m_check = new FApplyForFeeCheck(); $m_check = new FApplyForFeeCheck();
$m_img = new FImg(); $m_img = new FImg();
...@@ -382,7 +384,7 @@ class Cost extends Basic ...@@ -382,7 +384,7 @@ class Cost extends Basic
$field = 'id,count_time,source,type,create_time,agent_id,total_fee,fee_item,purpose,status,site_id,status,bank,'; $field = 'id,count_time,source,type,create_time,agent_id,total_fee,fee_item,purpose,status,site_id,status,bank,';
$field .= 'card_no,card_name,store_id,office_id'; $field .= 'card_no,card_name,store_id,office_id';
$where['id'] = $this->params['id']; $where['id'] = $this->params['id'];
$data = $fee_model->findByOne($field, $where); $data = $this->fee_model->findByOne($field, $where);
if (empty($data['id'])) { if (empty($data['id'])) {
return $this->response($code, '无该记录'); return $this->response($code, '无该记录');
...@@ -467,21 +469,8 @@ class Cost extends Basic ...@@ -467,21 +469,8 @@ class Cost extends Basic
$agent_data = $redis->getRedisCache(2, $data['agent_id']); $agent_data = $redis->getRedisCache(2, $data['agent_id']);
$data['agent_name'] = $agent_data['name']; $data['agent_name'] = $agent_data['name'];
$data['source_name'] = $this->source[$data['source']];
$source = [ $data['status_name'] = $this->status[$data['status']];
0 => 'app申请',
1 => 'excel导入'
];
$status = [
0 => '申请中',
1 => '总监通过',
2 => '一审通过',
3 => '二审通过',
4 => '三审通过',
];
$data['source_name'] = $source[$data['source']];
$data['status_name'] = $status[$data['status']];
$data['type_name'] = $cost_service->getFeeType($data['type']); $data['type_name'] = $cost_service->getFeeType($data['type']);
$data['fee_item_name'] = $cost_service->getFeeItem($data['fee_item']); $data['fee_item_name'] = $cost_service->getFeeItem($data['fee_item']);
return $this->response(200, '', $data); return $this->response(200, '', $data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment