Commit 2e046e26 authored by hujun's avatar hujun

申请费用导出

parent 6856a4fa
...@@ -35,20 +35,44 @@ class Cost extends Basic ...@@ -35,20 +35,44 @@ class Cost extends Basic
$fee_model = new FApplyForFee(); $fee_model = new FApplyForFee();
if ($this->params['excel'] != 1) { if ($this->params['excel'] != 1) {
$list = $fee_model->getJoinAgentList($pageNo, $pageSize, 'ID DESC', $field, $where); $list = $fee_model->getJoinAgentList($pageNo, $pageSize, 'a.ID DESC', $field, $where);
$data['list'] = &$list; $data['list'] = &$list;
$data['total'] = $fee_model->getJoinAgentListTotal($where); $data['total'] = $fee_model->getJoinAgentListTotal($where);
return $this->response(200, '', $data); return $this->response(200, '', $data);
} else { } else {
$list = $fee_model->getJoinAgentList(1, 100000, 'ID DESC', $field, $where); $list = $fee_model->getJoinAgentList(1, 100000, 'a.ID DESC', $field, $where);
$source = [
0=> 'app申请',
1=>'excel导入'
];
$status = [
0=>'申请中',
1=>'总监通过',
2=>'一审通过',
3=>'二审通过',
4=>'三审通过',
];
foreach ($list as $k=>$v) { foreach ($list as $k=>$v) {
$excel_data[$k] = [
'id'=>$v['id'],
'count_time'=>$v['count_time'],
'create_time'=>$v['create_time'],
'agent_name'=>$v['agent_name'],
'total_fee'=>$v['total_fee'],
'type_name'=>$this->getFeeType($v['type']),
'fee_item_name'=>$this->getFeeItem($v['fee_item']),
'purpose'=>$v['purpose'],
'source_name' => $source[$v['source']],
'status'=>$status[$v['status']]
];
} }
$export = new ExportExcelUntil(); if (isset($excel_data)) {
// $title = [ 'ID', '提交时间', '商铺地址', '商铺号', '成交价', '提交人', '成交类型', '应收佣金(元)','已收佣金(元)','未收佣金(元)' ]; $export = new ExportExcelUntil();
// $export->exportTable($excel_title, $excel_data, 11, $excel_title, $title); $title = [ '费用总ID', '计入月份', '提交时间', '提交人', '费用总金额', '费用类型', '费用项目', '费用用途','来源','状态' ];
$export->exportTable('费用报销审核', $excel_data, 11, '费用报销审核', $title);
}
} }
} }
...@@ -60,8 +84,8 @@ class Cost extends Basic ...@@ -60,8 +84,8 @@ class Cost extends Basic
*/ */
private function buildWhere($param) private function buildWhere($param)
{ {
if (isset($param['checkout_status'])) { if (isset($param['check_status'])) {
switch($this->params['check_status']) { switch($param['check_status']) {
case 0 : case 0 :
$where['a.status'] = 0;break; $where['a.status'] = 0;break;
case 1 : case 1 :
...@@ -217,4 +241,66 @@ class Cost extends Basic ...@@ -217,4 +241,66 @@ class Cost extends Basic
} }
return $this->response($code, $result['msg']); return $this->response($code, $result['msg']);
} }
/**
* 获取费用项目
*
* @param $key
* @return string
*/
private function getFeeItem($key)
{
$item_array = [
100=>'房租租金',
101=>'水电费',
102=>'其他费用',
201=>'总部固定成本',
301=>'分部固定成本',
401=>'同联发展基金',
501=>'家庭基金报销',
502=>'社保报销',
503=>'总经理基薪',
504=>'区域秘书基薪',
505=>'招聘成本',
506=>'区域经理基本工资平摊',
507=>'宿舍成本',
508=>'宿舍亏损',
509=>'手续费',
510=>'员工工资成本',
511=>'网络报销',
512=>'离职员工网络',
513=>'门店独有成本其他费用'
];
if (array_key_exists($key, $item_array)) {
$result = $item_array[$key];
} else {
$result = '未知';
}
return $result;
}
/**
* 获取费用报销类型
*
* @param $key
* @return string
*/
private function getFeeType($key)
{
$type_array = [
0=>'办公室成本',
1=>'总部成本',
2=>'分部成本',
3=>'门店独有成本',
];
if (array_key_exists($key, $type_array)) {
$result = $type_array[$key];
} else {
$result = '未知';
}
return $result;
}
} }
\ No newline at end of file
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