Stat.php 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace store\Admin;
  3. use Dever;
  4. class Stat extends Core
  5. {
  6. # 列表
  7. public function getList()
  8. {
  9. $where = array();
  10. $where['store_id'] = $this->id;
  11. $status = Dever::input('store_status');
  12. if ($status) {
  13. $where['store_status'] = $status;
  14. }
  15. $start = Dever::input('start');
  16. if ($start) {
  17. $where['start'] = $start;
  18. }
  19. $end = Dever::input('end');
  20. if ($end) {
  21. $where['end'] = $end;
  22. }
  23. $data = Dever::db('cash/store')->getAll($where);
  24. $html = '';
  25. if ($data) {
  26. $config = Dever::db('cash/store')->config;
  27. foreach ($data as $k => $v) {
  28. $view = Dever::url('stat_view?id=' . $v['id'] . '&type=store&show=2', 'store');
  29. $url = Dever::url('lib/set.audit_other&id='.$v['id'].'&type=store', 'cash');
  30. $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>';
  31. if ($v['store_status'] == 1) {
  32. $button .= '&nbsp;&nbsp;<a href="javascript:;" onclick="load(\''.$url.'\', \''.Dever::load('cash/lib/set')->statYes($v, 'store').'\', \'请确认\')"><button type="button" class="btn btn-info btn-rounded waves-effect waves-light m-b-5 layui-btn layui-btn-xs">确认对账数量</button></a>';
  33. }
  34. $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>'.$v['num'].'</td><td>'.$config['config_status'][$v['store_status']].'</td><td>'.$button.'</td></tr>';
  35. }
  36. }
  37. return $html;
  38. }
  39. # 获取列表页搜索信息
  40. public function getSearch()
  41. {
  42. $config = array
  43. (
  44. array('value' => '0', 'name' => '全部'),
  45. array('value' => 1, 'name' => '未对账'),
  46. array('value' => 2, 'name' => '已对账'),
  47. );
  48. $status = Dever::input('store_status');
  49. $html = '';
  50. foreach ($config as $k => $v) {
  51. $selected = '';
  52. if ((!$status && $k == 0) || $status == $v['value']) {
  53. $selected = 'selected=""';
  54. }
  55. $html .= '<option value="'.$v['value'].'" '.$selected.'>'.$v['name'].'</option>';
  56. }
  57. return $html;
  58. }
  59. # 获取基本信息
  60. public function getConfig()
  61. {
  62. $data['search'] = Dever::url('stat', 'store');
  63. return $data;
  64. }
  65. # 打印订单单
  66. public function print_api()
  67. {
  68. return Dever::load('cash/lib/set')->printer($this->user);
  69. }
  70. }