xieruidong 2 年之前
父节点
当前提交
8aae0530b1

+ 2 - 2
application/admin/controller/GoodsData.php

@@ -81,7 +81,7 @@ class GoodsData extends Backend
                 ->where($where)
                 ->where('order_id','in',$orderIds)
                 ->where('is_return_goods',0)
-                ->where('goods_id',$v['goods_id'])->sum('amount_cost');//某商品总成本
+                ->where('goods_id',$v['goods_id'])->sum('amount_cost_total');//某商品总成本
             $amountCostTotal = $amountCostTotal*$saleTotalNum;
             $gross = bcsub($saleTotal, $amountCostTotal);//某商品毛利
             $grossRate = 0;
@@ -137,7 +137,7 @@ class GoodsData extends Backend
         //毛利、毛利率
         $install = Db('Orders')->where($where)->where('status', 'in', '5,10,20')->sum('amount_install');//总安装费
         $orderIds = Db('Orders')->where($where)->where('status', 'in', '5,10,20')->column('id');
-        $cost = Db('OrderInfo')->where('order_id', 'in', $orderIds)->sum('amount_cost');//总成本
+        $cost = Db('OrderInfo')->where('order_id', 'in', $orderIds)->sum('amount_cost_total');//总成本
         $gross_profit = bcsub($sale, $install);
         $gross_profit = bcsub($gross_profit, $cost);
         $gross_profit_margin = 0;

+ 1 - 1
application/admin/controller/Overview.php

@@ -59,7 +59,7 @@ class Overview extends Backend
         //毛利、毛利率
         $install = Db('Orders')->where($where)->where('status','in','5,10,20')->sum('amount_install');//总安装费
         $orderIds =  Db('Orders')->where($where)->where('status','in','5,10,20')->column('id');
-        $cost = Db('OrderInfo')->where('order_id','in',$orderIds)->sum('amount_cost');//总成本
+        $cost = Db('OrderInfo')->where('order_id','in',$orderIds)->sum('amount_cost_total');//总成本
         $gross_profit = bcsub($sale,$install);
         $gross_profit = bcsub($gross_profit,$cost);
         $gross_profit_margin = 0;

+ 1 - 1
application/common/model/OrderInfo.php

@@ -51,7 +51,7 @@ class OrderInfo extends Model
         $orderInfo['amount']=$goods['sku']['amount'];
         $orderInfo['amount_kill']=$goods['sku']['amount_kill'];
         $orderInfo['amount_cost']=$goods['sku']['amount_cost'];
-        $orderInfo['amount_cost_total']=bcmul($orderInfo['num'],$goods['sku']['amount_cost']);
+        $orderInfo['amount_cost_total']=bcmul($orderInfo['num'],$orderInfo['amount_cost']);
         $orderInfo['goods_bak_id']=$orderInfoGoods['id'];
         $orderInfo['amount_goods']=$goods['amount_goods'];
         $orderInfo['amount_goods_real']=$goods['amount_goods_real'];