shish 11 місяців тому
батько
коміт
873a67e9e4

+ 1 - 0
app-ghs/controllers/StatKdController.php

@@ -34,6 +34,7 @@ class StatKdController extends BaseController
         $incomeList = $return['incomeList'];
         $staffAmountList = $return['staffAmountList'];
         $payCodeIncome = $return['payCodeIncome'];
+        $lsAfterSale = $return['lsAfterSale'];
         $totalIncome = 0;
         if (!empty($incomeList)) {
             foreach ($incomeList as $item) {

+ 2 - 1
app-hd/controllers/StatController.php

@@ -82,13 +82,14 @@ class StatController extends BaseController
         $income = $respond['income'] ?? 0;
         $expend = $respond['expend'] ?? 0;
         $balance = $respond['balance'] ?? 0;
+        $payCodeIncome = $respond['payCodeIncome'] ?? 0;
 
         //由于损耗而造成少赚的钱
         $wastageRespond = \bizGhs\stat\classes\StatSaleClass::wastage($mainId);
         $wastagePrice = $wastageRespond['totalPrice'] ?? 0;
         $wastagePrice = floatval($wastagePrice);
 
-        util::success(['income' => $income, 'expend' => $expend, 'balance' => floatval($balance), 'wastagePrice' => $wastagePrice]);
+        util::success(['income' => $income, 'expend' => $expend, 'balance' => floatval($balance), 'wastagePrice' => $wastagePrice, 'payCodeIncome' => $payCodeIncome]);
     }
 
     //统计列表 ssh 2020.1.5

+ 3 - 1
app-hd/controllers/StatKdController.php

@@ -33,6 +33,8 @@ class StatKdController extends BaseController
         $contain = $get['contain'] ?? 0;
         $return = \bizGhs\stat\classes\StatKdClass::eachChannelIncome($this->mainId, $this->shop, $contain);
         $incomeList = $return['incomeList'];
+        $staffAmountList = $return['staffAmountList'];
+        $payCodeIncome = $return['payCodeIncome'];
         $totalIncome = 0;
         if (!empty($incomeList)) {
             foreach ($incomeList as $item) {
@@ -41,7 +43,7 @@ class StatKdController extends BaseController
                 $totalIncome = floatval($totalIncome);
             }
         }
-        util::success(['list' => $incomeList, 'totalIncome' => $totalIncome]);
+        util::success(['list' => $incomeList, 'totalIncome' => $totalIncome, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome]);
     }
 
 }

+ 4 - 2
biz-ghs/stat/classes/StatKdClass.php

@@ -275,6 +275,7 @@ class StatKdClass extends BaseClass
 
         //零售开单
         $payCodeIncome = 0;
+        $lsAfterSale = 0;
         $hdWhere = ['mainId' => $mainId, 'status' => ['in', [HdOrderClass::ORDER_STATUS_UN_SEND, HdOrderClass::ORDER_STATUS_SENDING, HdOrderClass::ORDER_STATUS_COMPLETE]]];
         $hdWhere['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
         $hdOrderList = HdOrderClass::getAllByCondition($hdWhere, null, '*');
@@ -296,7 +297,8 @@ class StatKdClass extends BaseClass
             $mainPay = bcsub($mainPay, $tkPrice, 2);
 
             if ($forward == 1) {
-                //售后付款不属于收入
+                //售后付款属于支出
+                $lsAfterSale = bcadd($lsAfterSale, $mainPay, 2);
                 continue;
             }
 
@@ -408,7 +410,7 @@ class StatKdClass extends BaseClass
                 $staffAmountList[$staffId] = ['num' => 1, 'amount' => $currentAmount, 'staffName' => $staffName];
             }
         }
-        return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome];
+        return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome, 'lsAfterSale' => $lsAfterSale];
 
     }
 

+ 23 - 20
biz-ghs/stat/classes/StatSaleClass.php

@@ -301,6 +301,7 @@ class StatSaleClass extends BaseClass
 
         //零售开单
         $payCodeIncome = 0;
+        $lsAfterSale = 0;
         $lsIncome = 0;
         $lsSendCost = 0;
         $lsServiceFee = 0;
@@ -312,31 +313,32 @@ class StatSaleClass extends BaseClass
             $onlinePay = $hdOrder['onlinePay'] ?? 1;
             $repeat = $hdOrder['repeat'] ?? 0;
             $forward = $hdOrder['forward'] ?? 0;
-            if ($forward == 1) {
-                //售后付款不属于收入
-                continue;
-            }
 
             if ($hdOrder['tkPrice'] && $hdOrder['tkPrice'] > 0) {
                 $actPrice = bcsub($actPrice, $hdOrder['tkPrice'], 2);
             }
-            $cash = $hdOrder['cash'] ?? 0;
-            $serviceFee = $hdOrder['serviceFee'] ?? 0;
-            $sendCost = $hdOrder['sendCost'] ?? 0;
-            $lsIncome = bcadd($actPrice, $lsIncome, 2);
-            $lsIncome = bcadd($lsIncome, $cash, 2);
-            //退款取消先不计算成本
-            if ($actPrice > 0) {
-                $lsSendCost = bcadd($lsSendCost, $sendCost, 2);
-                $lsServiceFee = bcadd($lsServiceFee, $serviceFee, 2);
-            }
-            $totalOrderNum++;
 
-            if ($onlinePay == 2 && floatval($cash) <= 0 && $repeat == 1) {
-                $payCodeIncome = bcadd($payCodeIncome, $actPrice, 2);
-                $payCodeIncome = floatval($payCodeIncome);
-            }
+            if ($forward == 1) {
+                //零售售后付款
+                $lsAfterSale = bcadd($lsAfterSale, $actPrice, 2);
+            } else {
+                $cash = $hdOrder['cash'] ?? 0;
+                $serviceFee = $hdOrder['serviceFee'] ?? 0;
+                $sendCost = $hdOrder['sendCost'] ?? 0;
+                $lsIncome = bcadd($actPrice, $lsIncome, 2);
+                $lsIncome = bcadd($lsIncome, $cash, 2);
+                //如果$actPrice<=0,则退款取消先不计算成本
+                if ($actPrice > 0) {
+                    $lsSendCost = bcadd($lsSendCost, $sendCost, 2);
+                    $lsServiceFee = bcadd($lsServiceFee, $serviceFee, 2);
+                }
+                $totalOrderNum++;
 
+                if ($onlinePay == 2 && floatval($cash) <= 0 && $repeat == 1) {
+                    $payCodeIncome = bcadd($payCodeIncome, $actPrice, 2);
+                    $payCodeIncome = floatval($payCodeIncome);
+                }
+            }
         }
 
         $condition = ['mainId' => $mainId, 'addTime' => ['between', [$currentStartTime, $currentEndTime]],];
@@ -362,7 +364,7 @@ class StatSaleClass extends BaseClass
                 $type = $item->type ?? 0;
                 $amount = $item->amount ?? 0;
                 $name = $expendTypeMap[$type] ?? '暂无';
-                if (isset($expendAmount[$type]['amount']) == false) {
+                if (!isset($expendAmount[$type]['amount'])) {
                     $expendAmount[$type]['amount'] = 0;
                 }
                 $expendAmount[$type]['name'] = $name;
@@ -379,6 +381,7 @@ class StatSaleClass extends BaseClass
             ['name' => '批发运费', 'id' => 'pfSendCost', 'amount' => floatval($pfSendCost)],
             ['name' => '批发包装费', 'id' => 'pfSendCost', 'amount' => floatval($pfPack)],
             ['name' => '零售运费', 'id' => 'lsSendCost', 'amount' => floatval($lsSendCost)],
+            ['name' => '零售售后付款', 'id' => 'lsSendCost', 'amount' => floatval($lsAfterSale)],
             ['name' => '美团手续费', 'id' => 'mtFee', 'amount' => floatval($lsServiceFee)],
             ['name' => '花材采购', 'id' => 'cg', 'amount' => floatval($cg)],
             ['name' => '绿植资材采购', 'id' => 'cg', 'amount' => floatval($lzCgAmount)],