1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <?php
- namespace Factory\Admin;
- use Dever;
- class Stat extends Core
- {
- # 列表
- public function getList()
- {
- $where = array();
- $where['factory_id'] = $this->id;
- $status = Dever::input('factory_status');
- if ($status) {
- $where['factory_status'] = $status;
- }
- $start = Dever::input('start');
- if ($start) {
- $where['start'] = $start;
- }
- $end = Dever::input('end');
- if ($end) {
- $where['end'] = $end;
- }
- $data = Dever::db('cash/factory')->getAll($where);
- $html = '';
- if ($data) {
- $config = Dever::db('cash/factory')->config;
- foreach ($data as $k => $v) {
- $view = Dever::url('stat_view?id=' . $v['id'] . '&type=factory&show=2', 'factory');
- $url = Dever::url('lib/set.audit_other&id='.$v['id'].'&type=factory', 'cash');
- $button = '<a href="'.$view.'"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-xs">查看详情</button></a>';
- if ($v['factory_status'] == 1) {
- $button .= ' <a href="javascript:;" onclick="load(\''.$url.'\', \''.Dever::load('cash/lib/set')->statYes($v, 'factory').'\', \'请确认\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-xs">确认对账金额</button></a>';
- }
- $html .= '<tr><td>'.Dever::load("cash/lib/set.statDate", $v['type'], $v['day']).'</td><td>'.Dever::load("cash/lib/set.statTime", $v['start'], $v['end']).'</td><td>'.round($v['cash'], 2).'</td><td>'.$config['config_status'][$v['factory_status']].'</td><td>'.$button.'</td></tr>';
- }
- }
- return $html;
- }
- # 获取列表页搜索信息
- public function getSearch()
- {
- $config = array
- (
- array('value' => '0', 'name' => '全部'),
- array('value' => 1, 'name' => '未对账'),
- array('value' => 2, 'name' => '已对账'),
- );
- $status = Dever::input('factory_status');
- $html = '';
- foreach ($config as $k => $v) {
- $selected = '';
- if ((!$status && $k == 0) || $status == $v['value']) {
- $selected = 'selected=""';
- }
- $html .= '<option value="'.$v['value'].'" '.$selected.'>'.$v['name'].'</option>';
- }
- return $html;
- }
- # 获取基本信息
- public function getConfig()
- {
- $data['search'] = Dever::url('stat', 'factory');
- return $data;
- }
- # 打印订单单
- public function print_api()
- {
- return Dever::load('cash/lib/set')->printer($this->user);
- }
- }
|