Commit 4b48ffb2 authored by hujun's avatar hujun

-1 month

parent 77966bfa
......@@ -20,6 +20,7 @@ use app\model\FImg;
use app\model\FSettingLog;
use app\model\FStoreCost;
use app\model\FStoreCostExt;
use app\model\FStoreData;
class Cost extends Basic
{
......@@ -281,6 +282,8 @@ class Cost extends Basic
$m_check = new FApplyForFeeCheck();
$m_img = new FImg();
$redis = new RedisCacheService();
$m_store = new AStore();
$m_store_fee = new FStoreData();
$field = 'id,count_time,source,type,create_time,agent_id,total_fee,fee_item,purpose,status,site_id,status,bank,';
$field .= 'card_no,card_name,store_id,office_id';
......@@ -321,10 +324,14 @@ class Cost extends Basic
}
if ($data['office_id']) {
$ext_where['b.type'] = 1;
$ext_where['c.office_id'] = $data['office_id'];
$ext_where['a.setting_date'] = $data['count_time'];
$data['office_attendance_num'] = $m_store_cost->getFeeOfficeCostSum('b.office_attendance_num', $ext_where);
$store_id_arr = $m_store->getColumn('id', ['office_id'=>$data['office_id']]);
$store_fee_where['store_id'] = ['in', $store_id_arr];
$store_fee_where['setting_date'] = date('Y-m-d', strtotime($data['count_time']));
$data['office_attendance_num'] = $m_store_fee->getSumField('attendance_num', $store_fee_where);
if (empty($data)) {
$store_fee_where['setting_date'] = date('Y-m-d', strtotime('-1 month', strtotime($data['count_time'])));
$data['office_attendance_num'] = $m_store_fee->getSumField('attendance_num', $store_fee_where);
}
}
break;
case 2 :
......
......@@ -452,4 +452,16 @@ class AStore extends BaseModel
->select();
return $result;
}
/**
* @param $field
* @param $where
* @return array
*/
public function getColumn($field, $where)
{
$where['status'] = 0;
return $this->where($where)
->column($field);
}
}
\ No newline at end of file
......@@ -116,4 +116,14 @@ class FStoreData extends BaseModel
->where($where_)
->select();
}
/**
* @param $field
* @param $where
* @return float|int
*/
public function getSumField($field, $where)
{
return $this->where($where)->sum($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