Commit f4be07e6 authored by hujun's avatar hujun

费用报销详情

parent b05eaf7e
......@@ -9,6 +9,7 @@
namespace app\index\controller;
use app\api_broker\service\RedisCacheService;
use app\index\extend\Basic;
use app\index\service\CostService;
use app\index\untils\ExportExcelUntil;
......@@ -279,23 +280,24 @@ class Cost extends Basic
foreach ($office_store as $k => $v) {
$cost_ext_where['store_id'] = $v['id'];
$store_cost_data = $m_store_cost->getCostExt($cost_ext_field, $cost_ext_where);
if (empty($store_cost_data)) {
$list[$k] = [
'id' => 0,
'store_name' => $v['store_name'],
'store_attendance_num' => 0,
'assume_fee' => 0
];
} else {
if (!empty($store_cost_data)) {
$list[$k] = [
'id' => $store_cost_data['id'],
'store_name' => $v['store_name'],
'store_attendance_num' => $store_cost_data['store_attendance_num'],
'assume_fee' => $store_cost_data['assume_fee']
];
$store_cost_id[] = $store_cost_data['id'];
}
}
if (isset($store_cost_id)) {
$data['office_attendance_num'] = $m_store_cost->sumData('office_attendance_num', ['id'=>['in'=>$store_cost_id]]);
} else {
$data['office_attendance_num'] = 0;
}
$check_field = 'b.name,a.create_time,a.remark';
$data['check_log'] = $m_check->findByAll($check_field, ['apply_for_id' => $data['id']]);
......@@ -303,6 +305,10 @@ class Cost extends Basic
$data['store_cost_data'] = $list;
$data['image_base_url'] = 'static/chat_image/';
$redis = new RedisCacheService();
$agent_data = $redis->getRedisCache(2, $data['id']);
$data['agent_name'] = $agent_data['name'];
$source = [
0 => 'app申请',
1 => 'excel导入'
......
......@@ -41,6 +41,20 @@ class FStoreCost extends BaseModel
return $result;
}
/**
* 查询单条数据
*/
/**
* @param $field
* @param $params
* @return float|int
*/
public function sumData($field, $params)
{
return $this->db_->where($params)->sum($field);
}
/**
* @param $field
* @param $where
......
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