shish преди 2 години
родител
ревизия
0a83d3fc04
променени са 2 файла, в които са добавени 11 реда и са изтрити 3 реда
  1. 9 1
      app-ghs/controllers/GhsController.php
  2. 2 2
      biz-ghs/ghs/classes/GhsClass.php

+ 9 - 1
app-ghs/controllers/GhsController.php

@@ -162,11 +162,19 @@ class GhsController extends BaseController
                 $where['name'] = ['like', $name];
             }
         }
+        $type = $get['type'] ?? -1;
         $location = $get['location'] ?? '';
         if (is_numeric($location)) {
             $where['location'] = $location;
         }
-        $respond = GhsClass::getGhsList($where);
+        $order = 'inTurn DESC,addTime DESC';
+        if ($type == 0) {
+            $order = 'debtAmount DESC';
+        }
+        if ($type == 1) {
+            $order = 'expendAmount DESC';
+        }
+        $respond = GhsClass::getGhsList($where, $order);
         $staff = $this->shopAdmin;
         //待结款合计,有财务权限才能查看
         if (isset($staff->finance) == false || $staff->finance == 0) {

+ 2 - 2
biz-ghs/ghs/classes/GhsClass.php

@@ -15,9 +15,9 @@ class GhsClass extends BaseClass
     public static $baseFile = '\bizGhs\ghs\models\Ghs';
 
     //供货商列表 ssh 20221220
-    public static function getGhsList($where)
+    public static function getGhsList($where,$order='inTurn DESC,addTime DESC')
     {
-        $data = self::getList('*', $where, 'inTurn DESC,addTime DESC');
+        $data = self::getList('*', $where, $order);
         $data['list'] = self::groupBaseInfo($data['list']);
         $num = Ghs::find()->where($where)->count();
         $data['num'] = $num;