Commit 91d832b1 authored by hujun's avatar hujun

store_name

parent e7df27eb
......@@ -297,9 +297,6 @@ class Cost extends Basic
$data['office_attendance_num'] = 0;
if ($this->params['is_self'] == 1) {
$agent_data = $redis->getRedisCache(2, $data['agent_id']);
$cost_where['b.store_id'] = $ext_where['c.store_id'] = $agent_data['store_id'];
$m_setting = new FSettingLog();
$setting_data = $m_setting->findByAll('type,operator_name', ['setting_date'=>$data['count_time']]);
foreach ($setting_data as $k => $v) {
......@@ -315,11 +312,17 @@ class Cost extends Basic
//费用类型 1办公室成本 2上海总部成本 3分部成本 4同联发展基金 5门店单独成本
switch($data['type']) {
case 1 :
$store_field = 'a.cost_id as id,a.assume_fee,a.store_attendance_num,c.store_name';
$cost_where['a.apply_for_id'] = $data['id'];
$store_cost_data = $m_store_cost_ext->getFeeStoreCost($store_field, $cost_where);
$store_field = 'c.id,b.assume_fee,b.store_attendance_num,b.store_id';
$cost_where['b.apply_for_id'] = $data['id'];
$cost_where['a.status'] = 0;
$cost_where['a.setting_date'] = $data['count_time'];
$store_cost_data = $m_store_cost->getFeeOfficeCostList($store_field, $cost_where);
if ($store_cost_data) {
$data['store_cost_data'] =$store_cost_data;
foreach ($store_cost_data as $k => $v) {
$store_cost_data[$k]['store_name'] = $m_store->getStoreKeyById('store_name', ['id' => $v['store_id']]);
}
$data['store_cost_data'] = $store_cost_data;
}
if ($data['office_id']) {
......
......@@ -92,7 +92,7 @@ class FStoreCost extends BaseModel
->select();
}
/**
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
......@@ -101,10 +101,22 @@ class FStoreCost extends BaseModel
{
return $this->alias('a')
->join('f_store_cost_ext b', 'a.id = b.cost_id', 'left')
->join('f_apply_for_fee c', 'b.apply_for_id = b.id', 'left')
->join('f_apply_for_fee c', 'b.apply_for_id = c.id', 'left')
->where($where)
->sum($field);
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
*/
public function getFeeOfficeCostList($field, $where)
{
return $this->field($field)->alias('a')
->join('f_store_cost_ext b', 'a.id = b.cost_id', 'left')
->join('f_apply_for_fee c', 'b.apply_for_id = c.id', 'left')
->where($where)
->select();
}
}
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