Selaa lähdekoodia

采购售后问题

shish 1 vuosi sitten
vanhempi
commit
c5d5ad2db2
1 muutettua tiedostoa jossa 7 lisäystä ja 4 poistoa
  1. 7 4
      biz-ghs/stat/classes/StatSaleClass.php

+ 7 - 4
biz-ghs/stat/classes/StatSaleClass.php

@@ -218,10 +218,15 @@ class StatSaleClass extends BaseClass
         $cgList = PurchaseOrderClass::getAllByCondition($cgWhere, null, '*');
         $cg = 0;
         if (!empty($cgList)) {
-            //print_r($cgList);
             foreach ($cgList as $cgKey => $cgItem) {
                 $actPrice = $cgItem['actPrice'] ?? 0;
-                $paidPrice = $cgItem['paidPrice'] ?? 0;
+                if($actPrice<=0){
+                    //如果应付供货商的actPrice金额已经清0,所以这个单子已经取消,那么代表提货费、本地运费、到付的短途和长途运费总金额的paidPrice,也已经清0
+                    //数据库端没有清零,但这边代码端先清0
+                    $paidPrice = 0;
+                }else{
+                    $paidPrice = $cgItem['paidPrice'] ?? 0;
+                }
                 $total = bcadd($actPrice, $paidPrice, 2);
                 //物流费用不算成本
                 if (isset($cgItem['isCost']) && $cgItem['isCost'] == 0) {
@@ -234,11 +239,9 @@ class StatSaleClass extends BaseClass
                     $a = bcadd($a1, $a2, 2);
                     $total = bcsub($total, $a, 2);
                 }
-                //echo $total.' '.$cgItem['orderSn']." \n<br/>";
                 $cg = bcadd($cg, $total, 2);
             }
         }
-        //die;
         $cg = floatval($cg);
 
         $lsCgWhere = ['mainId' => $mainId, 'status' => 4,'belongCost'=>1];