Răsfoiți Sursa

统计数量

shish 4 ani în urmă
părinte
comite
e836dcabcf
1 a modificat fișierele cu 24 adăugiri și 21 ștergeri
  1. 24 21
      app-ghs/controllers/ConsoleController.php

+ 24 - 21
app-ghs/controllers/ConsoleController.php

@@ -54,18 +54,17 @@ class ConsoleController extends BaseController
         $where['status'] = ['in', [OrderClass::ORDER_STATUS_UN_SEND, OrderClass::ORDER_STATUS_SENDING, OrderClass::ORDER_STATUS_COMPLETE]];
         $where['payWay'] = ['in', [0, 1]];
         $where['addTime'] = ['between', [$todayStartTime, $todayEndTime]];
-        $ghActualCount = OrderClass::getCount($where); // 批发今日收入总笔数
-        $ghActIncome = OrderClass::sum($where, 'actPrice'); // 批发今日实收总数
-        Yii::info('批发今日收入总笔数:' . $ghActualCount . ', 批发今日实收总数:' . $ghActIncome);
+        $ghsOnlineCount = OrderClass::getCount($where); // 批发今日收入总笔数
+        $ghsActIncome = OrderClass::sum($where, 'actPrice'); // 批发今日实收总数
+        Yii::info('批发今日收入总笔数:' . $ghsOnlineCount . ', 批发今日实收总数:' . $ghsActIncome);
 
         unset($where['debt']);
         unset($where['debtPrice']);
         $hdActualCount = HdOrderClass::getCount($where); // 花店今日收入总笔数
         $hdActualIncome = HdOrderClass::sum($where, 'actPrice'); // 花店今日收入金额总数
         Yii::info('花店今日收入总笔数:' . $hdActualCount . ', 花店今日收入金额总数:' . $hdActualIncome);
-        $actualCount = $ghActualCount + $hdActualCount;
-        $actualIncome = bcadd($ghActIncome, $hdActualIncome, 2);
-
+        $actualCount = $ghsOnlineCount + $hdActualCount;
+        $actualIncome = bcadd($ghsActIncome, $hdActualIncome, 2);
 
         //现金收入 23笔  5980元
         //xhGhsOrder actPrice 字段,条件:debtPrice=0 and status in (2,3,4)  and payWay=4
@@ -74,32 +73,36 @@ class ConsoleController extends BaseController
         $where['status'] = ['in', [OrderClass::ORDER_STATUS_UN_SEND, OrderClass::ORDER_STATUS_SENDING, OrderClass::ORDER_STATUS_COMPLETE]];
         $where['payWay'] = 4;
         $where['addTime'] = ['between', [$todayStartTime, $todayEndTime]];
-        $ghCachCount = OrderClass::getCount($where); // 批发今日现金总笔数
-        $ghCachIncome = OrderClass::sum($where, 'actPrice'); // 批发今日现金金额总数
-        Yii::info('批发今日现金总笔数:' . $ghCachCount . ', 批发今日现金金额总数:' . $ghCachIncome);
+        $ghsCashCount = OrderClass::getCount($where); // 批发今日现金总笔数
+        $ghsCashIncome = OrderClass::sum($where, 'actPrice'); // 批发今日现金金额总数
+        Yii::info('批发今日现金总笔数:' . $ghsCashCount . ', 批发今日现金金额总数:' . $ghsCashIncome);
 
         unset($where['debt']);
         unset($where['debtPrice']);
-        $hdCachCount = HdOrderClass::getCount($where); // 花店今日现金总笔数
-        $hdCachIncome = HdOrderClass::sum($where, 'actPrice'); // 花店今日现金金额总数
-        Yii::info('花店今日现金总笔数:' . $hdCachCount . ', 花店今日现金金额总数:' . $hdCachIncome);
-        $cachCount = $ghCachCount + $hdCachCount;
-        $cachIncome = bcadd($ghCachIncome, $hdCachIncome, 2);
-
+        $hdCashCount = HdOrderClass::getCount($where); // 花店今日现金总笔数
+        $hdCashIncome = HdOrderClass::sum($where, 'actPrice'); // 花店今日现金金额总数
+        Yii::info('花店今日现金总笔数:' . $hdCashCount . ', 花店今日现金金额总数:' . $hdCashIncome);
+        $cashCount = $ghsCashCount + $hdCashCount;
+        $cashIncome = bcadd($ghsCashIncome, $hdCashIncome, 2);
 
         //批发欠款 39笔 13980元
         $where = ['shopId' => $this->shopId, 'debt' => 1];
         $where['addTime'] = ['between', [$todayStartTime, $todayEndTime]];
-        $ghDebtCount = OrderClass::getCount($where); // 批发今日欠款总笔数
-        $ghAllDebt = OrderClass::sum($where, 'remainDebtPrice'); // 批发今日总欠款
+        $ghsDebtCount = OrderClass::getCount($where); // 批发今日欠款总笔数
+        $ghsAllDebt = OrderClass::sum($where, 'remainDebtPrice'); // 批发今日总欠款
+
+        $totalCount = bcadd($cashCount, $ghsDebtCount);
+        $totalIncome = bcadd($cashIncome, $ghsAllDebt, 2);
 
         util::success([
             'actualCount' => $actualCount,
             'actualIncome' => $actualIncome,
-            'cachCount' => $cachCount,
-            'cachIncome' => $cachIncome,
-            'debtCount' => $ghDebtCount,
-            'allDebt' => $ghAllDebt,
+            'cashCount' => $cashCount,
+            'cashIncome' => $cashIncome,
+            'debtCount' => $ghsDebtCount,
+            'allDebt' => $ghsAllDebt,
+            'totalCount' => $totalCount,
+            'totalIncome' => $totalIncome,
         ]);
     }