shish 1 год назад
Родитель
Сommit
9178d2b704

+ 12 - 3
app-hd/controllers/OrderController.php

@@ -231,6 +231,9 @@ class OrderController extends BaseController
         if (empty($order)) {
             util::fail('没有找到订单');
         }
+        if ($order->forward == 1) {
+            util::fail('售后付款单不能打印');
+        }
         OrderClass::valid($order, $this->mainId);
         OrderClass::onlinePrint($order, true);
         util::complete();
@@ -513,8 +516,6 @@ class OrderController extends BaseController
         $hdName = $hd->name ?? '';
         $post['hdId'] = $hdId;
         $post['hdName'] = $hdName;
-
-        //$post['customId'] = $customId;
         $customName = $custom->name ?? '';
         $post['customName'] = $customName;
         $post['customNamePy'] = stringUtil::py($customName);
@@ -540,7 +541,15 @@ class OrderController extends BaseController
         $forward = $post['forward'] ?? 0;
         if ($forward == 1) {
             if ($hasPay != 1) {
-                util::fail('负数订单只能线下转账');
+                util::fail('售后付款单只能走线下转账');
+            }
+        } else {
+            //如果不是售后付款单,并且选的不是余额支付,余额又够付当前订单,则自动切到余额支付
+            $balance = $custom->balance ?? 0;
+            $modifyPrice = $post['modifyPrice'] ?? 0;
+            if ($hasPay != 4 && $balance > $modifyPrice) {
+                $post['hasPay'] = 4;
+                $hasPay = 4;
             }
         }
 

+ 5 - 0
app-hd/controllers/StatCgGhsController.php

@@ -15,6 +15,11 @@ class StatCgGhsController extends BaseController
     //采购列表 ssh 20211017
     public function actionProfile()
     {
+
+        util::success(['list' => []]);
+
+        //数据不准确,重新开发
+
         $get = Yii::$app->request->get();
         $where = [];
         $where['mainId'] = $this->mainId;

+ 4 - 0
app-hd/controllers/StatItemController.php

@@ -16,6 +16,10 @@ class StatItemController extends BaseController
     public function actionProfile()
     {
 
+        util::success(['list' => []]);
+
+        //数据不准确,重新开发
+
         //查看财务的权限
         $lookMoney = \bizGhs\shop\classes\ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);
         if ($lookMoney == 0) {

+ 20 - 31
biz-ghs/stat/classes/StatKdClass.php

@@ -288,24 +288,21 @@ class StatKdClass extends BaseClass
             $remainDebtPrice = $hdOrder['remainDebtPrice'] ?? 0;
             $onlinePay = $hdOrder['onlinePay'] ?? 0;
             $fromType = $hdOrder['fromType'] ?? 0;
-
-            $staffId = $ghsOrder['shopAdminId'] ?? 0;
-            $staffName = $ghsOrder['shopAdminName'] ?? '';
-
+            $staffId = $hdOrder['shopAdminId'] ?? 0;
+            $staffName = $hdOrder['shopAdminName'] ?? '';
             $repeat = $hdOrder['repeat'] ?? 0;
+            $forward = $hdOrder['forward'] ?? 0;
+            $tkPrice = $hdOrder['tkPrice'] ?? 0;
+            $mainPay = bcsub($mainPay, $tkPrice, 2);
 
-            if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
+            if ($forward == 1) {
+                //售后付款不属于收入
+                continue;
+            }
 
-                if (isset($staffAmountList[$staffId])) {
-                    $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
-                    $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $mainPay, 2);
-                } else {
-                    $staffAmountList[$staffId] = ['num' => 1, 'amount' => $mainPay, 'staffName' => $staffName];
-                }
+            $currentAmount = 0;
+            if ($onlinePay == dict::getDict('onlinePay', 'yes')) {
 
-                //现金 和 微信支付宝付款,微信支付宝还存在退款情况
-                $tkPrice = $hdOrder['tkPrice'] ?? 0;
-                $mainPay = bcsub($mainPay, $tkPrice, 2);
                 $incomeList['system']['amount'] = bcadd($incomeList['system']['amount'], $mainPay, 2);
                 $incomeList['system']['num'] = bcadd($incomeList['system']['num'], 1);
                 $incomeList['system']['category']['ls']['amount'] = bcadd($incomeList['system']['category']['ls']['amount'], $mainPay, 2);
@@ -321,31 +318,21 @@ class StatKdClass extends BaseClass
                     $incomeList['cash']['category']['ls']['amount'] = bcadd($incomeList['cash']['category']['ls']['amount'], $cash, 2);
                     $incomeList['cash']['category']['ls']['num'] = bcadd($incomeList['cash']['category']['ls']['num'], 1);
                 }
+                $currentAmount = bcadd($mainPay, $cash, 2);
             } else {
 
-                if (isset($staffAmountList[$staffId])) {
-                    $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
-                    $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $actPrice, 2);
-                } else {
-                    $staffAmountList[$staffId] = ['num' => 1, 'amount' => $actPrice, 'staffName' => $staffName];
-                }
-
                 if ($fromType == dict::getDict('fromType', 'mt')) {
                     //美团!!!
                     $incomeList['mt']['amount'] = bcadd($incomeList['mt']['amount'], $actPrice, 2);
                     $incomeList['mt']['num'] = bcadd($incomeList['mt']['num'], 1);
                 } else {
-
-                    //非美团!!!
                     if ($debtPrice > 0) {
-
                         if ($remainDebtPrice > 0) {
                             $incomeList['debt']['amount'] = bcadd($incomeList['debt']['amount'], $remainDebtPrice, 2);
                             $incomeList['debt']['num'] = bcadd($incomeList['debt']['num'], 1);
                             $incomeList['debt']['category']['ls']['amount'] = bcadd($incomeList['debt']['category']['ls']['amount'], $remainDebtPrice, 2);
                             $incomeList['debt']['category']['ls']['num'] = bcadd($incomeList['debt']['category']['ls']['num'], 1);
                         }
-
                         $clearDebt = bcsub($debtPrice, $remainDebtPrice, 2);
                         if ($clearDebt > 0) {
                             $incomeList['debtClear']['amount'] = bcadd($incomeList['debtClear']['amount'], $clearDebt, 2);
@@ -353,13 +340,10 @@ class StatKdClass extends BaseClass
                             $incomeList['debtClear']['category']['ls']['amount'] = bcadd($incomeList['debtClear']['category']['ls']['amount'], $clearDebt, 2);
                             $incomeList['debtClear']['category']['ls']['num'] = bcadd($incomeList['debtClear']['category']['ls']['num'], 1);
                         }
-
-                        $currentAmount = bcsub($mainPay, $debtPrice, 2);
-
+                        $currentAmount = bcadd($remainDebtPrice, $clearDebt, 2);
                     } else {
                         $currentAmount = $mainPay;
                     }
-
                     if ($currentAmount > 0) {
                         //使用非在线支付
                         switch ($payWay) {
@@ -415,9 +399,14 @@ class StatKdClass extends BaseClass
                         }
                     }
                 }
-
             }
-
+            //员工业绩
+            if (isset($staffAmountList[$staffId])) {
+                $staffAmountList[$staffId]['num'] = bcadd($staffAmountList[$staffId]['num'], 1);
+                $staffAmountList[$staffId]['amount'] = bcadd($staffAmountList[$staffId]['amount'], $currentAmount, 2);
+            } else {
+                $staffAmountList[$staffId] = ['num' => 1, 'amount' => $currentAmount, 'staffName' => $staffName];
+            }
         }
         return ['incomeList' => $incomeList, 'staffAmountList' => $staffAmountList, 'payCodeIncome' => $payCodeIncome];
 

+ 6 - 1
biz-ghs/stat/classes/StatSaleClass.php

@@ -311,6 +311,11 @@ class StatSaleClass extends BaseClass
             $actPrice = $hdOrder['mainPay'] ?? 0;
             $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);
@@ -320,7 +325,7 @@ class StatSaleClass extends BaseClass
             $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);

+ 1 - 1
biz-hd/order/classes/OrderClass.php

@@ -246,7 +246,7 @@ class OrderClass extends BaseClass
 
     public static function valid($order, $mainId)
     {
-        if (isset($order->mainId) == false || $order->mainId != $mainId) {
+        if (!isset($order->mainId) || $order->mainId != $mainId) {
             Yii::info(json_encode($order));
             Yii::info('mainId: ' . $mainId);
             util::fail('无法访问的订单');

+ 2 - 2
biz-hd/recharge/classes/RechargeClass.php

@@ -203,11 +203,11 @@ class RechargeClass extends BaseClass
 
         $getBalance = $amount;
         if ($onlinePay == 2) {
-            $event = $payWay == 0 ? '线上 微信充值' : '线上 支付宝充值';
+            $event = $payWay == 0 ? '线上微信 充值' : '线上支付宝 充值';
         } else {
             $payWayName = dict::getDict('payWayName');
             $channel = $payWayName[$payWay] ?? '微信';
-            $event = "线下 {$channel}充值";
+            $event = "线下{$channel} 充值";
         }
 
         //赠送的金额