shish 2 anni fa
parent
commit
c40f0f2b69
1 ha cambiato i file con 35 aggiunte e 1 eliminazioni
  1. 35 1
      biz-ghs/order/classes/PurchaseOrderClass.php

+ 35 - 1
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -21,6 +21,7 @@ use bizGhs\stock\classes\OnStockRecordClass;
 use bizGhs\stock\classes\StockRecordClass;
 use bizGhs\stock\services\StockRecordService;
 use bizGhs\product\classes\ProductClass;
+use common\components\dateUtil;
 use common\components\dict;
 use common\components\imgUtil;
 use common\components\noticeUtil;
@@ -1198,4 +1199,37 @@ class PurchaseOrderClass extends BaseClass
 
     }
 
-}
+    //应付款统计 ssh 20240528
+    public function actionDueList()
+    {
+        $get = Yii::$app->request->get();
+        $where = [];
+        $mainId = $this->mainId;
+        $debt = isset($get['debt']) && is_numeric($get['debt']) ? $get['debt'] : -1;
+        $where['mainId'] = $mainId;
+        $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'];
+        $where['time'] = ['between', [$start, $end]];
+        if ($debt > -1) {
+            $where['debt'] = $debt;
+        }
+
+        $ghsList = GhsClass::getAllByCondition(['ownShopId' => $this->shopId], null, 'id,name', 'id');
+
+        $currentStartDate = date('Y-m-d', strtotime($start));
+        $currentEndDate = date('Y-m-d', strtotime($end));
+        $currentStartTime = $currentStartDate . ' 00:00:00';
+        $currentEndTime = $currentEndDate . ' 23:59:59';
+
+        $cgWhere = ['mainId' => $mainId, 'status' => 4];
+        $cgWhere['entryTime'] = ['between', [$currentStartTime, $currentEndTime]];
+        $cgList = PurchaseOrderClass::getAllByCondition($cgWhere, null, '*');
+
+    }
+
+}