Commit 13305089 authored by hujun's avatar hujun

费用报销导出增加字段

parent 1fb6959a
...@@ -53,8 +53,10 @@ class Cost extends Basic ...@@ -53,8 +53,10 @@ 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';
$list = $fee_model->getJoinAgentList(1, 100000, 'a.ID DESC', $field, $where); $list = $fee_model->getJoinAgentList(1, 100000, 'a.ID DESC', $field, $where);
$cost_service = new CostService(); $cost_service = new CostService();
$redis = new RedisCacheService();
$source = [ $source = [
0=> 'app申请', 0=> 'app申请',
1=>'excel导入' 1=>'excel导入'
...@@ -67,7 +69,31 @@ class Cost extends Basic ...@@ -67,7 +69,31 @@ class Cost extends Basic
4=>'三审通过', 4=>'三审通过',
]; ];
$redis = new RedisCacheService(); foreach ($list as $k=>$v) {
switch ($v['type']) {
case 5 :
$store_id[] = $v['store_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]]);
}
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]]);
}
foreach ($list as $k=>$v) { foreach ($list as $k=>$v) {
$type_name = $cost_service->getFeeType($v['type']); $type_name = $cost_service->getFeeType($v['type']);
$fee_item_name = $cost_service->getFeeItem($v['fee_item']); $fee_item_name = $cost_service->getFeeItem($v['fee_item']);
...@@ -76,6 +102,16 @@ class Cost extends Basic ...@@ -76,6 +102,16 @@ class Cost extends Basic
$type_name = $city_name.'-'.$type_name; $type_name = $city_name.'-'.$type_name;
} }
$store_name = $office_name = '';
switch ($v['type']) {
case 5 :
$store_name = array_key_exists($v['store_id'], $store_data) ? $store_data[$v['store_id']] : '';
break;
default :
$office_name = array_key_exists($v['office_id'], $office_data) ? $office_data[$v['office_id']] : '';
break;
}
$excel_data[$k] = [ $excel_data[$k] = [
'id'=>$v['id'], 'id'=>$v['id'],
'count_time'=>$v['count_time'], 'count_time'=>$v['count_time'],
...@@ -86,14 +122,18 @@ class Cost extends Basic ...@@ -86,14 +122,18 @@ class Cost extends Basic
'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' => $source[$v['source']],
'status'=>$status[$v['status']] 'status'=>$status[$v['status']],
'card_name'=>$v['card_name'],
'card_no'=>$v['card_no'],
'store_name'=>$store_name,
'office_name'=>$office_name
]; ];
} }
if (isset($excel_data)) { if (isset($excel_data)) {
$export = new ExportExcelUntil(); $export = new ExportExcelUntil();
$title = [ '费用总ID', '计入月份', '提交时间', '提交人', '费用总金额', '费用类型', '费用项目', '费用用途','来源','状态' ]; $title = [ '费用总ID', '计入月份', '提交时间', '提交人', '费用总金额', '费用类型', '费用项目', '费用用途',
$export->exportTable('费用报销审核', $excel_data, 11, '费用报销审核', $title); '来源','状态','收款户名','收款卡账号','费用承担门店','费用承担办公室' ];
$export->exportTable('费用报销审核', $excel_data, 13, '费用报销审核', $title);
} }
} }
} }
......
...@@ -97,5 +97,14 @@ class FOffice extends BaseModel ...@@ -97,5 +97,14 @@ class FOffice extends BaseModel
return $this->db_->update($params); return $this->db_->update($params);
} }
/**
* @param $field
* @param $where
* @return array
*/
public function getColumn($field, $where)
{
return $this->db_->where($where)
->column($field);
}
} }
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