Commit c1a3273d authored by hujun's avatar hujun

财务日报列表

parent 6d2bd075
......@@ -4270,25 +4270,30 @@ class Finance extends Basic
$where['a.site_id'] = $this->params['site_id'];
}
$m_daily = new ODaily();
$m_store = new AStore();
$field = 'a.id,a.agent_id,a.create_time,a.daily_date,a.store_id,a.status,a.agent_name,a.back_img';
if (isset($this->params['is_self']) && $this->params['is_self'] != -1) {
if ($this->params['is_self']) {
$where['b.operation_id'] = $this->userId;
$list = $m_daily->getDailyLogListRight($pageNo, $pageSize, 'a.id desc', $field, $where);
$data['total'] = $m_daily->getDailyLogTotalRight($where);
} else {
$where[] = ['EXP', 'a.id NOT IN (SELECT daily_id FROM o_daily_log WHERE operation_id ='.$this->userId.')'];
$where['b.operation_id'] = ['NULL'];
$list = $m_daily->getDailyLogListLeft($pageNo, $pageSize, 'id desc', $field, $where);
$data['total'] = $m_daily->getDailyLogTotalLeft($where);
}
} else {
$list = $m_daily->getDailyPageList($pageNo, $pageSize, 'id desc', $field, $where);
$data['total'] = $m_daily->getDailyTotal($where);
}
$m_daily = new ODaily();
$m_store = new AStore();
$field = 'a.id,a.agent_id,a.create_time,a.daily_date,a.store_id,a.status,a.agent_name,a.back_img';
$list = $m_daily->getDailyLogList($pageNo, $pageSize, 'id desc', $field, $where);
foreach ($list as $k=>$v) {
$store_name = $m_store->getStoreKeyById('store_name', ['id'=>$v['store_id']]);
$list[$k]['store_name'] = empty($store_name) ? '':$store_name;
}
$data['list'] = $list;
$data['total'] = $m_daily->getDailyLogTotal($where);
return $this->response(200, '', $data);
}
......
......@@ -104,7 +104,30 @@ class ODaily extends BaseModel
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDailyLogList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
public function getDailyLogListRight($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->alias('a')
->field($field)
->join('o_daily_log b', 'a.id=b.daily_id', 'right')
->where($params)
->order($order_)
->limit($pageSize)
->group('a.id')
->page($pageNo)
->select();
}
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDailyLogListLeft($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->alias('a')
->field($field)
->join('o_daily_log b', 'a.id=b.daily_id', 'left')
......@@ -116,18 +139,61 @@ class ODaily extends BaseModel
->select();
}
/**
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getDailyPageList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field = '', $params = '') {
return $this->alias('a')
->field($field)
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
}
/**
* @param $params
* @return int|string
*/
public function getDailyLogTotal($params) {
public function getDailyLogTotalRight($params) {
return $this->alias('a')
->join('o_daily_log b', 'a.id=b.daily_id', 'left')
->join('o_daily_log b', 'a.id=b.daily_id', 'right')
->where($params)
->group('a.id')
->count();
}
/**
* @param $params
* @return int|string
*/
public function getDailyLogTotalLeft($params) {
return $this->alias('a')
->join('o_daily_log b', 'a.id=b.daily_id', 'right')
->where($params)
->group('a.id')
->count();
}
/**
* @param $params
* @return int|string
*/
public function getDailyTotal($params) {
return $this->alias('a')
->where($params)
->count();
}
public function getFieldValue($filed, $where) {
return $this->where($where)->value($filed);
}
......
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