Parcourir la source

采购支出 流水

shish il y a 5 ans
Parent
commit
e5fcb420ee

+ 141 - 99
biz-ghs/order/classes/PurchaseOrderClass.php

@@ -4,12 +4,18 @@ namespace bizGhs\order\classes;
 
 use biz\ghs\classes\GhsClass;
 
+use biz\shop\classes\ShopCapitalClass;
+use biz\shop\classes\ShopClass;
+use biz\shop\services\ShopService;
+use biz\stat\classes\StatOutClass;
+use biz\stat\classes\StatOutMonthClass;
 use bizGhs\base\classes\BaseClass;
 use bizGhs\item\classes\ItemClass;
 use bizGhs\order\traits\OrderTrait;
 use bizGhs\stock\services\StockRecordService;
 use bizGhs\product\classes\ProductClass;
 use common\components\dateUtil;
+use common\components\dict;
 use common\components\orderSn;
 use common\components\util;
 use common\services\xhItemService;
@@ -24,16 +30,16 @@ class PurchaseOrderClass extends BaseClass
     const PURCHASE_ORDER_STATUS_WAIT = 1; //待确认
     const PURCHASE_ORDER_STATUS_UN_SEND = 2; //待配送
     const PURCHASE_ORDER_STATUS_SENDING = 3; //配送中
-    const PURCHASE_ORDER_STATUS_COMPLETE  = 4; //已完成
+    const PURCHASE_ORDER_STATUS_COMPLETE = 4; //已完成
 
     public static $statusMap = [
-        self::PURCHASE_ORDER_STATUS_WAIT =>'待确认',
-        self::PURCHASE_ORDER_STATUS_UN_SEND =>'待配送',
-        self::PURCHASE_ORDER_STATUS_SENDING =>'配送中',
-        self::PURCHASE_ORDER_STATUS_COMPLETE =>'已完成',
+        self::PURCHASE_ORDER_STATUS_WAIT => '待确认',
+        self::PURCHASE_ORDER_STATUS_UN_SEND => '待配送',
+        self::PURCHASE_ORDER_STATUS_SENDING => '配送中',
+        self::PURCHASE_ORDER_STATUS_COMPLETE => '已完成',
     ];
 
-	//添加采购单 lqh 2021.1.19
+    //添加采购单 lqh 2021.1.19
     public static function addOrder($data)
     {
 
@@ -49,11 +55,11 @@ class PurchaseOrderClass extends BaseClass
         $smallNum = 0; //总共多少支
         $totalItemPrice = 0;
 
-        if(!empty($ghsItemInfo)){
-            foreach ($ghsItemInfo as $v){
-                $bigNum += $v['bigNum']??0;
-                $smallNum += $v['smallNum']??0;
-                $totalItemPrice = bcadd($totalItemPrice,$v['itemPrice'],2);
+        if (!empty($ghsItemInfo)) {
+            foreach ($ghsItemInfo as $v) {
+                $bigNum += $v['bigNum'] ?? 0;
+                $smallNum += $v['smallNum'] ?? 0;
+                $totalItemPrice = bcadd($totalItemPrice, $v['itemPrice'], 2);
             }
         }
         $data['bigNum'] = $bigNum;
@@ -61,56 +67,60 @@ class PurchaseOrderClass extends BaseClass
         $data['price'] = $totalItemPrice;
 
         //计算订单总价
-        $data['packingCharge'] =  empty($data['packingCharge'])?0:$data['packingCharge'];
-        $data['shortCharge'] = empty($data['shortCharge'])?0:$data['shortCharge'];
-        $data['longCharge'] = empty($data['longCharge'])?0:$data['longCharge'];
-        $data['pickCharge'] = empty($data['pickCharge'])?0:$data['pickCharge'];
-        $data['localCharge'] = empty($data['localCharge'])?0:$data['localCharge'];
-        if(empty($data['entryTime'])){
+        $data['packingCharge'] = empty($data['packingCharge']) ? 0 : $data['packingCharge'];
+        $data['shortCharge'] = empty($data['shortCharge']) ? 0 : $data['shortCharge'];
+        $data['longCharge'] = empty($data['longCharge']) ? 0 : $data['longCharge'];
+        $data['pickCharge'] = empty($data['pickCharge']) ? 0 : $data['pickCharge'];
+        $data['localCharge'] = empty($data['localCharge']) ? 0 : $data['localCharge'];
+        if (empty($data['entryTime'])) {
             $data['entryTime'] = date('Y-m-d H:i:s');
         }
 
-        $packingCharge = $data['packingCharge']??0;
-        $shortCharge = $data['shortCharge']??0;
-        $longCharge = $data['longCharge']??0;
-        $pickCharge = $data['pickCharge']??0;
-        $localCharge = $data['localCharge']??0;
-        $orderPrice = bcadd($totalItemPrice,$packingCharge,2);
-        $orderPrice = bcadd($orderPrice,$shortCharge,2);
-        $orderPrice = bcadd($orderPrice,$longCharge,2);
-        $orderPrice = bcadd($orderPrice,$pickCharge,2);
-        $orderPrice = bcadd($orderPrice,$localCharge,2);
+        $packingCharge = $data['packingCharge'] ?? 0;
+        $shortCharge = $data['shortCharge'] ?? 0;
+        $longCharge = $data['longCharge'] ?? 0;
+        $pickCharge = $data['pickCharge'] ?? 0;
+        $localCharge = $data['localCharge'] ?? 0;
+        $orderPrice = bcadd($totalItemPrice, $packingCharge, 2);
+        $orderPrice = bcadd($orderPrice, $shortCharge, 2);
+        $orderPrice = bcadd($orderPrice, $longCharge, 2);
+        $orderPrice = bcadd($orderPrice, $pickCharge, 2);
+        $orderPrice = bcadd($orderPrice, $localCharge, 2);
         $data['orderPrice'] = $orderPrice;
 
         //总运费
-        $totalFreight = bcadd($packingCharge,$shortCharge,2);
-        $totalFreight = bcadd($totalFreight,$longCharge,2);
-        $totalFreight = bcadd($totalFreight,$pickCharge,2);
-        $totalFreight = bcadd($totalFreight,$localCharge,2);
-
-
+        $totalFreight = bcadd($packingCharge, $shortCharge, 2);
+        $totalFreight = bcadd($totalFreight, $longCharge, 2);
+        $totalFreight = bcadd($totalFreight, $pickCharge, 2);
+        $totalFreight = bcadd($totalFreight, $localCharge, 2);
 
         $connection = Yii::$app->db;
         $transaction = $connection->beginTransaction();
 
-        try{
+        try {
+
             $order = self::add($data);
+
+
+            //采购支出
+
+
             //组装详情表数据
-            $batchData = self::groupOrderItem($ghsItemInfo,$orderSn);
+            $batchData = self::groupOrderItem($ghsItemInfo, $orderSn);
             //写入详情表
             PurchaseOrderItemClass::batchAddOrderItem($batchData);
 
             //总共多少扎(总扎数)
             $totalItemNum = 0;
-            foreach ($batchData as $v){
-                $totalItemNum = bcadd($totalItemNum,$v['itemNum'],2);
+            foreach ($batchData as $v) {
+                $totalItemNum = bcadd($totalItemNum, $v['itemNum'], 2);
             }
             //平均计算出每扎得运费:总运费/总扎数
-            $avgFreight = bcdiv($totalFreight,$totalItemNum,2);
+            $avgFreight = bcdiv($totalFreight, $totalItemNum, 2);
 
 
             //现在暂时点击确定,完成 加库存
-            foreach ($batchData as $v){
+            foreach ($batchData as $v) {
                 $itemId = $v['itemId'];
                 $productId = $v['productId'];
                 //流水记录
@@ -121,34 +131,66 @@ class PurchaseOrderClass extends BaseClass
                 $record['itemId'] = $itemId;
                 $record['itemNum'] = $v['itemNum'];
                 $record['oldStock'] = $v['itemStock'];
-                $record['newStock'] =  bcadd($v['itemStock'],$v['itemNum'],2);
+                $record['newStock'] = bcadd($v['itemStock'], $v['itemNum'], 2);
                 StockRecordService::addPurchaseOrderRecord($record);
                 //加库存
-                ProductClass::addStockByItemNum($productId,$v['itemNum']);
+                ProductClass::addStockByItemNum($productId, $v['itemNum']);
                 //
                 //每扎的采购价
                 //总的采购价/扎数
                 $avgItemCost = 0;
-                if($v['itemNum']>0){
-                    $avgItemCost = bcdiv($v['itemPrice'],$v['itemNum'],2);
+                if ($v['itemNum'] > 0) {
+                    $avgItemCost = bcdiv($v['itemPrice'], $v['itemNum'], 2);
                 }
                 // 每扎采购价+每扎运费 = 每扎成本价
-                $avgCost = bcadd($avgItemCost,$avgFreight,2);
+                $avgCost = bcadd($avgItemCost, $avgFreight, 2);
                 //修改 ghsItem 中的成本价
                 // ItemClass::changeCost($itemId,$merchantId,$avgCost);
 
                 //2021.4.6修改product 成本价
-                ProductClass::changeCost($productId,$avgCost);
+                ProductClass::changeCost($productId, $avgCost);
                 //触发自动调价 2021.4.26 linqh
                 ProductClass::autoPriceById($productId);
 
             }
-            self::updateStatByPurchase($order);
+
+            //当天和当月支出统计
+            StatOutClass::updateOrInsert($order['merchantId'], $order['shopId'], $order['orderPrice']);
+
+            //门店支出增加
+            $shop = ShopClass::getLockById($shopId);
+            if (empty($shop)) {
+                util::fail('没有找到门店');
+            }
+            $shop->totalPurchaseOrder += 1;
+            $currentTotalExpend = bcadd($shop->totalExpend, $order['orderPrice'], 2);
+            $shop->totalExpend = $currentTotalExpend;
+            $shop->save();
+
+            //支出流水
+            $payWay = dict::getDict('payWay', 'unknown');
+            $capitalType = dict::getDict('capitalType', 'ghsPurchase');
+            $sjId = $order['merchantId'] ?? 0;
+            $shopId = $order['shopId'] ?? 0;
+            $event = '采购支出';
+            $capitalData = [
+                'capitalType' => $capitalType,
+                'io' => 0,
+                'totalExpend' => $currentTotalExpend,
+                'payWay' => $payWay,
+                'amount' => $order['orderPrice'],
+                'sjId' => $sjId,
+                'shopId' => $shopId,
+                'event' => $event,
+            ];
+            ShopCapitalClass::addCapital($capitalData);
+
+
             $transaction->commit();
             return $order;
-        }catch (\Exception $exception){
+        } catch (\Exception $exception) {
             $transaction->rollBack();
-            util::fail('保存失败:'.$exception->getMessage());
+            util::fail('保存失败:' . $exception->getMessage());
         }
         return false;
     }
@@ -165,41 +207,41 @@ class PurchaseOrderClass extends BaseClass
     }
 
     //获取订单详情信息 lqh 2021.1.20
-    public static function getOrderDetail($orderSn,$shopId)
+    public static function getOrderDetail($orderSn, $shopId)
     {
         $where = [
-            'orderSn'=>$orderSn,
-            'shopId'=>$shopId,
+            'orderSn' => $orderSn,
+            'shopId' => $shopId,
         ];
         $orderData = self::getByCondition($where);
         $orderData['ghsInfo'] = json_decode($orderData['ghsInfo']);
-        if(!$orderData) {
+        if (!$orderData) {
             util::fail('订单不存在');
         }
         $orderInfo = PurchaseOrderItemClass::getOrderItemDetail($orderSn);
         $itemData = [];
-        if($orderInfo) {
+        if ($orderInfo) {
             foreach ($orderInfo as $v) {
-                $info = json_decode($v['itemInfo'],true);
+                $info = json_decode($v['itemInfo'], true);
                 $tmp = $info;
                 $tmp['itemCover'] = self::groupImg($info['itemCover']);
                 unset($v['itemInfo']);
                 //兼容 旧数据,没有 rank (花材等级 默认给B)
-                if(!isset($tmp['rank'])){
-                    $tmp['rank']= 'B';
+                if (!isset($tmp['rank'])) {
+                    $tmp['rank'] = 'B';
                 }
-                $tmp = array_merge($tmp,$v);
+                $tmp = array_merge($tmp, $v);
                 $itemData[] = $tmp;
             }
         }
         $orderData = self::groupAdmin($orderData);
 
-		//供货商信息
+        //供货商信息
         $ghsId = $orderData['ghsId'] ?? 0;
         $ghsInfo = GhsClass::getGhsInfo($ghsId);
         $orderData['supplierName'] = $ghsInfo['name'] ?? '';
         $orderData['supplierMobile'] = $ghsInfo['mobile'] ?? '';
-	    $orderData['supplierAddress'] = $ghsInfo['address'] ?? '';
+        $orderData['supplierAddress'] = $ghsInfo['address'] ?? '';
 
         $orderData['itemInfo'] = $itemData;
         $orderData['statusName'] = self::getStatusName($orderData['status']);
@@ -208,7 +250,7 @@ class PurchaseOrderClass extends BaseClass
     }
 
     // 组装 orderItem  linqh 2021.1.25
-    public static function groupOrderItem($ghsItemInfo,$orderSn)
+    public static function groupOrderItem($ghsItemInfo, $orderSn)
     {
         $productData = self::getProductMapData($ghsItemInfo);
         //$itemIds =  array_column($productData,'itemId');
@@ -216,31 +258,31 @@ class PurchaseOrderClass extends BaseClass
         //$itemData = array_column($itemData, NULL, 'id');
         //写入详情表
         $batchData = [];
-        foreach($ghsItemInfo as $v){
+        foreach ($ghsItemInfo as $v) {
             $tmp = [];
             $productId = $v['productId'];
             $itemId = $productData[$productId]['itemId'];
-            $rank = $productData[$productId]['rank']??'B';// 花材级别
+            $rank = $productData[$productId]['rank'] ?? 'B';// 花材级别
             $tmp['orderSn'] = $orderSn;
             $tmp['itemId'] = $itemId;
             $tmp['productId'] = $v['productId'];
-            $ratio = $productData[$productId]['ratio']??0;
-            $tmp['itemStock'] = $productData[$productId]['stock']??0;//当时库存
-            $tmp['itemNum'] = ProductClass::mergeItemNum($v['bigNum'],$v['smallNum'],$ratio);// 采购数量
+            $ratio = $productData[$productId]['ratio'] ?? 0;
+            $tmp['itemStock'] = $productData[$productId]['stock'] ?? 0;//当时库存
+            $tmp['itemNum'] = ProductClass::mergeItemNum($v['bigNum'], $v['smallNum'], $ratio);// 采购数量
             $tmp['itemPrice'] = $v['itemPrice']; //采购价格
-            $stockFormat= ProductClass::formatStock($tmp['itemStock'],$ratio); // 库存总单位数量转大小单位的数量
+            $stockFormat = ProductClass::formatStock($tmp['itemStock'], $ratio); // 库存总单位数量转大小单位的数量
             $itemInfo = [
-                'itemName'=> $productData[$productId]['name']??'',//花材名称
-                'itemCover'=> $productData[$productId]['cover']??'',//花材图片
-                'bigNum'=> $v['bigNum']??0,//采购数量(大单位)
-                'smallNum'=> $v['smallNum']??0,//采购数量(小单位)
-                'bigNumStock'=> $stockFormat['bigNum'],// 当时库存大单位数
-                'smallNumStock'=> $stockFormat['smallNum'],//当时库存 小单位数
-                'itemUnit'=> $ratio?2:1,//单位
-                'ratio'=>$ratio,// 比例
-                'rank'=>$rank,// 花材级别
-                'bigUnit'=> $productData[$productId]['bigUnit'],//大单位名称 扎
-                'smallUnit'=> $productData[$productId]['smallUnit'],//小单位名称 支
+                'itemName' => $productData[$productId]['name'] ?? '',//花材名称
+                'itemCover' => $productData[$productId]['cover'] ?? '',//花材图片
+                'bigNum' => $v['bigNum'] ?? 0,//采购数量(大单位)
+                'smallNum' => $v['smallNum'] ?? 0,//采购数量(小单位)
+                'bigNumStock' => $stockFormat['bigNum'],// 当时库存大单位数
+                'smallNumStock' => $stockFormat['smallNum'],//当时库存 小单位数
+                'itemUnit' => $ratio ? 2 : 1,//单位
+                'ratio' => $ratio,// 比例
+                'rank' => $rank,// 花材级别
+                'bigUnit' => $productData[$productId]['bigUnit'],//大单位名称 扎
+                'smallUnit' => $productData[$productId]['smallUnit'],//小单位名称 支
             ];
             $tmp['itemInfo'] = json_encode($itemInfo);
             $batchData[] = $tmp;
@@ -262,36 +304,36 @@ class PurchaseOrderClass extends BaseClass
     // 获取状态码名称
     public static function getStatusName($status)
     {
-        return self::$statusMap[$status]??'';
+        return self::$statusMap[$status] ?? '';
     }
 
     //获取各个状态下的订单数量 allNum unPayNum unSendNum sendingNum finishNum
     public static function statNum($shopId)
     {
         $data = [
-            'allNum'=>0,
-            'unPayNum'=>0,
-            'unSendNum'=>0,
-            'sendingNum'=>0,
-            'finishNum'=>0,
+            'allNum' => 0,
+            'unPayNum' => 0,
+            'unSendNum' => 0,
+            'sendingNum' => 0,
+            'finishNum' => 0,
         ];
-        $res = self::getAllList("status",['shopId'=>$shopId]);
-        foreach($res as $v){
-            $data['allNum'] ++;
+        $res = self::getAllList("status", ['shopId' => $shopId]);
+        foreach ($res as $v) {
+            $data['allNum']++;
             $status = $v['status'];
-            switch ($status){
+            switch ($status) {
                 case self::PURCHASE_ORDER_STATUS_WAIT:
                     //待支付
                     $data['unPayNum']++;
                     break;
                 case self::PURCHASE_ORDER_STATUS_UN_SEND:
-                    $data['unSendNum'] ++;
+                    $data['unSendNum']++;
                     break;
                 case self::PURCHASE_ORDER_STATUS_SENDING:
-                    $data['sendingNum'] ++;
+                    $data['sendingNum']++;
                     break;
                 case self::PURCHASE_ORDER_STATUS_COMPLETE:
-                    $data['finishNum'] ++;
+                    $data['finishNum']++;
                     break;
             }
         }
@@ -300,25 +342,25 @@ class PurchaseOrderClass extends BaseClass
 
 
     //采购数,采购金额统计(根据时间,今日,昨天,7天,30天)
-    public static function statOrderInfo($shopId,$statType)
+    public static function statOrderInfo($shopId, $statType)
     {
         $start = '';
         $end = '';
-        switch ($statType){
+        switch ($statType) {
             case "today":
                 $start = date('Y-m-d');
                 $end = $start;
                 break;
             case "yesterday" :
-                $start = date('Y-m-d',strtotime("-1 day"));
+                $start = date('Y-m-d', strtotime("-1 day"));
                 $end = $start;
                 break;
             case "seven":
-                $start = date('Y-m-d',strtotime("-6 day"));
+                $start = date('Y-m-d', strtotime("-6 day"));
                 $end = date('Y-m-d');
                 break;
             case "thirty":
-                $start = date('Y-m-d',strtotime("-29 day"));
+                $start = date('Y-m-d', strtotime("-29 day"));
                 $end = date('Y-m-d');
                 break;
             default:
@@ -330,12 +372,12 @@ class PurchaseOrderClass extends BaseClass
         $res = self::getAllByCondition($where, null, "id,orderPrice");
         $totalAmount = 0;
         $totalNum = count($res);
-        foreach ($res as $v){
-            $totalAmount = bcadd($totalAmount,$v['orderPrice'],2);
+        foreach ($res as $v) {
+            $totalAmount = bcadd($totalAmount, $v['orderPrice'], 2);
         }
         return [
-            'totalAmount'=>$totalAmount,
-            'totalNum'=>$totalNum,
+            'totalAmount' => $totalAmount,
+            'totalNum' => $totalNum,
         ];
 
     }

+ 0 - 22
biz-ghs/order/traits/OrderTrait.php

@@ -9,13 +9,6 @@ namespace bizGhs\order\traits;
 use biz\ghs\classes\GhsClass;
 use bizGhs\admin\classes\AdminClass;
 use bizGhs\product\classes\ProductClass;
-use biz\shop\services\ShopService;
-use biz\stat\classes\StatOutClass;
-use biz\stat\classes\StatOutMonthClass;
-use bizHd\stat\classes\StatIncomeClass;
-use bizHd\stat\classes\StatIncomeMonthClass;
-use bizHd\stat\classes\StatOrderClass;
-use bizHd\stat\classes\StatOrderMonthClass;
 
 trait OrderTrait
 {
@@ -110,21 +103,6 @@ trait OrderTrait
         return $newItemInfo;
     }
 
-    //采购时更新统计
-    //更新统计
-    public static function updateStatByPurchase($order)
-    {
-        //记录支出
-        //当天
-        StatOutClass::updateOrInsert($order['merchantId'],$order['shopId'],$order['orderPrice']);
-        //当月
-        StatOutMonthClass::updateOrInsert($order['merchantId'],$order['shopId'],$order['orderPrice']);
-        //总采购+1
-        ShopService::totalPurchaseOrderPlus($order['shopId']);
-        //总支出
-        ShopService::updateTotalExpend($order['shopId'],$order['orderPrice']);
-    }
-
     //出库时更新统计
     public static function updateStatByStockOut($order)
     {

+ 0 - 24
biz/shop/services/ShopService.php

@@ -109,18 +109,6 @@ class ShopService extends BaseService
 
     }
 
-    //总采购+1
-    public static function totalPurchaseOrderPlus($shopId)
-    {
-        $shop = ShopClass::getById($shopId);
-        if($shop){
-            $data = [
-                'totalPurchaseOrder'=>$shop['totalPurchaseOrder'] + 1
-            ];
-            ShopClass::updateById($shopId,$data);
-        }
-
-    }
 
     //更新总收入
     public static function updateTotalIncome($shopId,$amount)
@@ -134,18 +122,6 @@ class ShopService extends BaseService
         }
     }
 
-    //更新总支出
-    public static function updateTotalExpend($shopId,$amount)
-    {
-        $shop = ShopClass::getById($shopId);
-        if($shop){
-            $data = [
-                'totalExpend'=>bcadd($shop['totalExpend'],$amount,2)
-            ];
-            ShopClass::updateById($shopId,$data);
-        }
-    }
-
     //更新客户数 +1
     public static function totalUserPlus($shopId)
     {

+ 19 - 15
biz/stat/classes/StatOutClass.php

@@ -7,47 +7,51 @@
 namespace biz\stat\classes;
 
 use biz\base\classes\BaseClass;
+
 class StatOutClass extends BaseClass
 {
+
     public static $baseFile = '\biz\stat\models\StatOut';
 
     //更新当前商家的数据 linqh 2021.4.13
     // 当采购后台,将价格更新
-    public static function updateOrInsert($sjId,$shopId,$amount)
+    public static function updateOrInsert($sjId, $shopId, $amount)
     {
         $time = date('Ymd');
         $where = [
-            'merchantId'=>$sjId,
-            'shopId'=>$shopId,
-            'time'=>$time,
+            'merchantId' => $sjId,
+            'shopId' => $shopId,
+            'time' => $time,
         ];
         $model = self::getByCondition($where);
-        if($model){
+        if ($model) {
             $id = $model['id'];
             //累加金额 amount
-            $newAmount = bcadd($amount,$model['amount'],2);
-            $totalAmount = bcadd($amount,$model['totalAmount'],2);
-            self::updateById($id,['amount'=>$newAmount,'totalAmount'=>$totalAmount]);
-        }else{
+            $newAmount = bcadd($amount, $model['amount'], 2);
+            $totalAmount = bcadd($amount, $model['totalAmount'], 2);
+            self::updateById($id, ['amount' => $newAmount, 'totalAmount' => $totalAmount]);
+        } else {
             //insert
             $data = $where;
             $data['amount'] = $amount;
             //totalAmount = 前一天的 totalAmount
             $totalAmount = 0;
-            $lastDate = date('Ymd',strtotime("-1 day"));
+            $lastDate = date('Ymd', strtotime("-1 day"));
             $lastWhere = [
-                'merchantId'=>$sjId,
-                'shopId'=>$shopId,
-                'time'=>$lastDate,
+                'merchantId' => $sjId,
+                'shopId' => $shopId,
+                'time' => $lastDate,
             ];
             $lastModel = self::getByCondition($lastWhere);
-            if($lastModel){
+            if ($lastModel) {
                 $totalAmount = $lastModel['totalAmount'];
             }
-            $data['totalAmount'] = bcadd($amount,$totalAmount,2);
+            $data['totalAmount'] = bcadd($amount, $totalAmount, 2);
             $data['createTime'] = date('Y-m-d H:i:s');
             self::add($data);
         }
+        //当月
+        StatOutMonthClass::updateOrInsert($sjId, $shopId, $amount);
     }
 
 }

+ 5 - 2
common/components/dict.php

@@ -28,10 +28,10 @@ class dict
         //采购和销售单的有效期
         'sale_purchase_order_valid' => 180,
 
-        //需要显示国兰的信息 0不需要 1需要(要审核小程序请显示国兰信息)
+        //需要显示国兰的信息 0不需要 1需要(提交审核小程序请显示国兰信息)
         'showGlInfo' => 1,
 
-        //显示零售和供货商的演示入口
+        //显示零售和供货商的演示入口 0不需要 1需要
         'showDemo' => 0,
 
         //零售演示的管理员id
@@ -134,6 +134,8 @@ class dict
             'pxApply' => ['id' => 12, 'name' => 'pxApply'],
             //花店采购结算
             'hdPurchaseClear' => ['id' => 20, 'name' => 'hdPurchaseClear'],
+            //供货商采购
+            'ghsPurchase' => ['id' => 25, 'name' => 'ghsPurchase'],
         ],
         "capitalTypeList" => [//流水类型的对应链接,后台收支明细查看时跳转的链接
             0 => ['link' => '/capital/order-detail', 'name' => '网店', 'orderLink' => '/order/detail', 'id' => 0,],
@@ -148,6 +150,7 @@ class dict
             11 => ['link' => '/capital/purchase-detail', 'name' => '订单', 'orderLink' => '', 'id' => 11,],
             12 => ['link' => '/capital/purchase-detail', 'name' => '培训报名', 'orderLink' => '', 'id' => 12,],
             20 => ['link' => '', 'name' => '采购结算', 'orderLink' => '', 'id' => 20,],
+            25 => ['link' => '', 'name' => '采购', 'orderLink' => '', 'id' => 25,],
         ],