shish 2 anni fa
parent
commit
a9f7fd06cf
1 ha cambiato i file con 26 aggiunte e 0 eliminazioni
  1. 26 0
      app-ghs/controllers/ExpendController.php

+ 26 - 0
app-ghs/controllers/ExpendController.php

@@ -7,6 +7,7 @@ use bizGhs\expend\classes\ExpendClass;
 use bizGhs\shop\classes\MainClass;
 use bizGhs\shop\classes\ShopAdminClass;
 use bizGhs\shop\classes\ShopMoneyClass;
+use common\components\dateUtil;
 use common\components\dict;
 use common\components\noticeUtil;
 use common\components\util;
@@ -93,8 +94,33 @@ class ExpendController extends BaseController
 
     public function actionList()
     {
+        $get = Yii::$app->request->get();
+        $bx = $get['bx'] ?? -1;
+        $type = $get['type'] ?? -1;
+        $staffId = $get['staffId'] ?? 0;
+
         $where = [];
         $where['mainId'] = $this->mainId;
+        if (!empty($staffId)) {
+            $where['staffId'] = $staffId;
+        }
+        if ($type != -1) {
+            $where['type'] = $type;
+        }
+        if ($bx != -1) {
+            $where['bx'] = $bx;
+        }
+        $searchTime = isset($get['searchTime']) && !empty($get['searchTime']) ? $get['searchTime'] : 'today';
+        $startTime = $get['startTime'] ?? '';
+        $endTime = $get['endTime'] ?? '';
+        $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
+        $start = $period['startTime'];
+        $end = $period['endTime'];
+        $currentStartDate = date('Y-m-d', strtotime($start));
+        $currentEndDate = date('Y-m-d', strtotime($end));
+        $currentStartTime = $currentStartDate . ' 00:00:00';
+        $currentEndTime = $currentEndDate . ' 23:59:59';
+        $where['addTime'] = ['between', [$currentStartTime, $currentEndTime]];
         $list = ExpendClass::getExpendList($where);
         util::success($list);
     }