| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace ghs\controllers;
- use biz\stat\classes\StatBookClass;
- use common\components\dateUtil;
- use Yii;
- use common\components\util;
- class StatBookController extends BaseController
- {
- //花材销量 ssh 20211021
- public function actionProfile()
- {
- $get = Yii::$app->request->get();
- $where = [];
- $where['mainId'] = $this->mainId;
- $searchTime = $get['searchTime'] ?? 'today';
- if (!empty($searchTime)) {
- $startTime = $get['startTime'] ?? '';
- $endTime = $get['endTime'] ?? '';
- $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
- $where['time'] = ['between', [$period['startTime'], $period['endTime']]];
- }
- $list = StatBookClass::getAllByCondition($where, 'time DESC', '*');
- util::success(['list' => $list]);
- }
- public function actionPrintOrder()
- {
- $get = Yii::$app->request->get();
- $where = [];
- $where['mainId'] = $this->mainId;
- $searchTime = $get['searchTime'] ?? 'today';
- if (!empty($searchTime)) {
- $startTime = $get['startTime'] ?? '';
- $endTime = $get['endTime'] ?? '';
- $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
- $where['time'] = ['between', [$period['startTime'], $period['endTime']]];
- }
- $list = StatBookClass::getAllByCondition($where, 'time DESC', '*');
- if (empty($list)) {
- util::fail('没有花材需要打印');
- }
- $num = count($list);
- $pageSize = 6;
- $ratio = ceil($num / $pageSize);
- echo $num;
- $content = "<CB>预订汇总</CB><BR><BR>";
- if ($ratio > 1) {
- for ($i = 1; $i <= $ratio; $i++) {
- $offset = ($i - 1) * $pageSize;
- $current = array_slice($list, $offset, $pageSize);
- print_r($current);
- }
- } else {
- }
- die;
- }
- }
|