Commit 66c27411 authored by hujun's avatar hujun

方法拆分

parent b24e0d92
......@@ -22,9 +22,16 @@ use app\model\FSettingLog;
use app\model\FStoreCost;
use app\model\FStoreCostExt;
use app\model\FStoreData;
use think\Request;
class Cost extends Basic
{
private $fee_model;
public function __construct(Request $request = null)
{
parent::__construct();
$this->fee_model = new FApplyForFee();
}
/**
* 费用报销列表
*
......@@ -57,22 +64,34 @@ class Cost extends Basic
$data['total'] = $fee_model->getJoinAgentListTotal($where);
return $this->response(200, '', $data);
} else {
$this->getCostListExcel($field, $where);
}
}
/**
* 导出数据
*
* @param $field
* @param $where
*/
private function getCostListExcel($field, $where)
{
$field .= ',a.card_name,a.card_no,a.store_id,a.office_id';
$list = $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();
$source = [
0=> 'app申请',
1=>'excel导入'
0 => 'app申请',
1 => 'excel导入'
];
$status = [
0=>'申请中',
1=>'总监通过',
2=>'一审通过',
3=>'二审通过',
4=>'三审通过',
0 => '申请中',
1 => '总监通过',
2 => '一审通过',
3 => '二审通过',
4 => '三审通过',
];
foreach ($list as $k=>$v) {
foreach ($list as $k => $v) {
switch ($v['type']) {
case 5 :
$store_id[] = $v['store_id'];
......@@ -87,22 +106,23 @@ class Cost extends Basic
$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]]);
$store_data = $m_store->getColumn('id,store_name', ['id' => ['in', $store_id]]);
}
if (isset($office_id)) {
$office_id = array_filter($office_id);
$office_id = array_unique($office_id);
$m_office = new FOffice();
$office_data = $m_office->getColumn('id,office_name', ['id'=>['in', $office_id]]);
$office_data = $m_office->getColumn('id,office_name', ['id' => ['in', $office_id]]);
}
foreach ($list as $k=>$v) {
$cost_service = new CostService();
foreach ($list as $k => $v) {
$type_name = $cost_service->getFeeType($v['type']);
$fee_item_name = $cost_service->getFeeItem($v['fee_item']);
if ($v['type'] == 3) {
$city_name = $redis->getRedisCache(4, $v['site_id']);
$type_name = $city_name.'-'.$type_name;
$type_name = $city_name . '-' . $type_name;
}
$store_name = $office_name = '';
......@@ -134,11 +154,11 @@ class Cost extends Basic
}
if (isset($excel_data)) {
$export = new ExportExcelUntil();
$title = [ '费用总ID', '计入月份', '提交时间', '提交人', '费用总金额', '费用类型', '费用项目', '费用用途',
'来源','状态','收款卡户名','收款卡账号','费用承担门店','费用承担办公室' ];
$title = ['费用总ID', '计入月份', '提交时间', '提交人', '费用总金额', '费用类型', '费用项目', '费用用途',
'来源', '状态', '收款卡户名', '收款卡账号', '费用承担门店', '费用承担办公室'];
$export->exportTable('费用报销审核', $excel_data, 13, '费用报销审核', $title);
}
}
return ;
}
/**
......
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