shish 2 лет назад
Родитель
Сommit
4441f3b950
2 измененных файлов с 392 добавлено и 1 удалено
  1. 13 0
      app-ghs/controllers/StatController.php
  2. 379 1
      biz-ghs/stat/classes/StatSaleClass.php

+ 13 - 0
app-ghs/controllers/StatController.php

@@ -80,6 +80,19 @@ class StatController extends BaseController
         StatSaleClass::classProfile($mainId);
     }
 
+    public function actionIncomeOutItem()
+    {
+        ini_set('memory_limit', '2045M');
+        set_time_limit(0);
+        //查看财务的权限
+        $lookMoney = ShopAdminClass::lookMoneyPower($this->shopAdmin, $this->shop);
+        if ($lookMoney == 0) {
+            util::fail('无法查看');
+        }
+        $mainId = $this->mainId;
+        StatSaleClass::incomeOutItem($mainId);
+    }
+
     public function actionProfit()
     {
 

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

@@ -14,6 +14,7 @@ use bizGhs\order\classes\PurchaseOrderClass;
 use bizGhs\order\classes\PurchaseOrderItemClass;
 use bizGhs\order\classes\RefundOrderClass;
 use bizGhs\order\classes\StockWastageOrderClass;
+use bizGhs\product\classes\ProductClass;
 use bizGhs\staff\classes\SalaryClass;
 use bizHd\goods\classes\PlantCgClass;
 use bizHd\order\classes\OrderClass as HdOrderClass;
@@ -356,6 +357,300 @@ class StatSaleClass extends BaseClass
         return ['income' => $income, 'expend' => $expend, 'balance' => floatval($balance), 'totalOrderNum' => $totalOrderNum];
     }
 
+    //按花材统计收入 ssh 20231111
+    public static function incomeOutItem($mainId)
+    {
+        $get = Yii::$app->request->get();
+        $export = $get['export'] ?? 0;
+        $where = [];
+        $where['mainId'] = $mainId;
+        $searchTime = isset($get['searchTime']) && !empty($get['searchTime']) ? $get['searchTime'] : 'today';
+
+        $startTime = $get['startTime'] ?? '';
+        $endTime = $get['endTime'] ?? '';
+        $period = dateUtil::formatTime($searchTime, $startTime, $endTime, true);
+        $start = $period['startTime'];
+        $end = $period['endTime'];
+        $where['time'] = ['between', [$start, $end]];
+
+        $currentStartDate = date('Y-m-d', strtotime($start));
+        $currentEndDate = date('Y-m-d', strtotime($end));
+        $currentStartTime = $currentStartDate . ' 00:00:00';
+        $currentEndTime = $currentEndDate . ' 23:59:59';
+
+        $s = strtotime($currentStartTime);
+        $e = strtotime($currentEndTime);
+        $p = bcsub($e, $s);
+        $xx = bcmul(86400, 90);
+        if ($p > $xx) {
+            util::fail('查询时间不能超过三个月');
+        }
+
+        $productList = ProductClass::getAllByCondition(['mainId'=>$mainId],null,'id,name','id');
+        if(empty($productList)){
+            util::fail('没有找到花材');
+        }
+
+        $arr = [];
+        //打包费和运费
+        $packFreight = 0;
+        $onlyRefundCg = 0;
+        $onlyRefund = 0;
+        $totalDiscountAmount = 0;
+        $totalLabourCost = 0;
+
+        //采购入库
+        $tbCgIncome = [];
+        $tbCgIncomeStaff = [];
+        $cgWhere = ['mainId' => $mainId, 'status' => 4];
+        $cgWhere['entryTime'] = ['between', [$currentStartTime, $currentEndTime]];
+        $cgList = PurchaseOrderClass::getAllByCondition($cgWhere, null, '*');
+        if (!empty($cgList)) {
+            foreach ($cgList as $cgKey => $cgItem) {
+                $packingCharge = $cgItem['packingCharge'] ?? 0;
+                $shortCharge = $cgItem['shortCharge'] ?? 0;
+                $longCharge = $cgItem['longCharge'] ?? 0;
+                $pickCharge = $cgItem['pickCharge'] ?? 0;
+                $localCharge = $cgItem['localCharge'] ?? 0;
+                $packFreight = bcadd($packFreight, $packingCharge, 2);
+                $packFreight = bcadd($packFreight, $shortCharge, 2);
+                $packFreight = bcadd($packFreight, $longCharge, 2);
+                $packFreight = bcadd($packFreight, $pickCharge, 2);
+                $packFreight = bcadd($packFreight, $localCharge, 2);
+
+                $tkPrice = $cgItem['tkPrice'] ?? 0;
+                $orderSn = $cgItem['orderSn'] ?? '';
+                $cgItemInfoList = PurchaseOrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
+                if (!empty($cgItemInfoList)) {
+                    foreach ($cgItemInfoList as $cgData) {
+                        $itemNum = $cgData->itemNum ?? 0;
+                        $productId = $cgData->productId ?? 0;
+                        $refundNum = $cgData->refundNum ?? 0;
+                        $remainNum = bcsub($itemNum, $refundNum);
+                        $bigPrice = $cgData->bigPrice ?? 0;
+                        $amount = bcmul($remainNum, $bigPrice, 2);
+                        $itemName = $productList[$productId]['name']??'已删除';
+                        $arr[$productId]['name'] = $itemName;
+                        $arr[$productId]['id'] = $productId;
+                        if (isset($arr[$productId]['expend'])) {
+                            $arr[$productId]['expend'] = bcadd($amount, $arr[$productId]['expend'], 2);
+                            $arr[$productId]['outNum'] = bcadd($arr[$productId]['outNum'],$remainNum,2);
+                        } else {
+                            $arr[$productId]['expend'] = $amount;
+                            $arr[$productId]['outNum'] = $remainNum;
+                            $arr[$productId]['inNum'] = 0;
+                            $arr[$productId]['income'] = 0;
+                        }
+                    }
+                    if ($tkPrice > 0) {
+                        $cgRefundOrderList = CgRefundClass::getAllByCondition(['relateOrderSn' => $orderSn], null, '*', null, true);
+                        if (!empty($cgRefundOrderList)) {
+                            foreach ($cgRefundOrderList as $cgRefundOrder) {
+                                if ($cgRefundOrder->refundType == 2) {
+                                    $onlyRefundCg = bcadd($cgRefundOrder->refundPrice, $onlyRefundCg, 2);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        //批发开单
+        $pfIncome = 0;
+        $tbSaleIncome = [];
+        $tbSaleIncomeStaff = [];
+        $where = ['mainId' => $mainId, 'status' => ['in', [OrderClass::ORDER_STATUS_UN_SEND, OrderClass::ORDER_STATUS_SENDING, OrderClass::ORDER_STATUS_COMPLETE]]];
+        $where['payTime'] = ['between', [$currentStartTime, $currentEndTime]];
+        $ghsOrderList = OrderClass::getAllByCondition($where, null, '*');
+        if (!empty($ghsOrderList)) {
+            foreach ($ghsOrderList as $ghsKey => $ghsOrder) {
+                $book = $ghsOrder['book'] ?? 0;
+                $status = $ghsOrder['status'] ?? 0;
+                if ($book == 1 && $status == 2) {
+                    //预订单待发货的不算收入
+                    continue;
+                }
+                if ($status == 0 || $status == 5) {
+                    continue;
+                }
+                $shopAdminId = $ghsOrder['shopAdminId']??0;
+                $shopAdminName = $ghsOrder['shopAdminName']??'';
+                $orderSn = $ghsOrder['orderSn'] ?? '';
+                $actPrice = $ghsOrder['actPrice'] ?? 0;
+                $tkPrice = $ghsOrder['tkPrice'] ?? 0;
+                $pfIncome = bcadd($pfIncome, $actPrice, 2);
+                $labourCost = $ghsOrder['labourCost'] ?? 0;
+                $discountAmount = $ghsOrder['discountAmount'] ?? 0;
+                $totalLabourCost = bcadd($labourCost, $totalLabourCost, 2);
+                $totalDiscountAmount = bcadd($totalDiscountAmount, $discountAmount, 2);
+                $orderItemList = OrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
+                if (!empty($orderItemList)) {
+                    foreach ($orderItemList as $orderItem) {
+                        $refundNum = $orderItem->refundNum ?? 0;
+                        $name = $orderItem->name ?? '';
+                        $productId = $orderItem->productId ?? 0;
+                        $num = $orderItem->xhNum ?? 0;
+                        $remainNum = bcsub($num, $refundNum);
+
+                        $xhUnitPrice = $orderItem->xhUnitPrice ?? 0;
+                        $amount = bcmul($remainNum, $xhUnitPrice, 2);
+
+                        $itemName = $productList[$productId]['name']??'已删除';
+
+                        $arr[$productId]['name'] = $itemName;
+                        $arr[$productId]['id'] = $productId;
+                        if (isset($arr[$productId]['income'])) {
+                            $arr[$productId]['income'] = bcadd($amount, $arr[$productId]['income'], 2);
+                            $arr[$productId]['inNum'] = bcadd($arr[$productId]['inNum'],$remainNum,2);
+                        } else {
+                            $arr[$productId]['expend'] = 0;
+                            $arr[$productId]['outNum'] = 0;
+                            $arr[$productId]['inNum'] = $remainNum;
+                            $arr[$productId]['income'] = $amount;
+                        }
+
+                        //单独统计
+                        $belongCost = $orderItem->belongCost ?? 0;
+                        if ($belongCost == 1) {
+                            if (isset($tbSaleIncome[$productId])) {
+                                $tbSaleIncome[$productId]['num'] = bcadd($tbSaleIncome[$productId]['num'], $remainNum);
+                                $tbSaleIncome[$productId]['price'] = bcadd($tbSaleIncome[$productId]['price'], $amount, 2);
+                            } else {
+                                $tbSaleIncome[$productId] = ['name' => $name, 'num' => $remainNum, 'price' => $amount];
+                            }
+                            if(isset($tbSaleIncomeStaff[$productId]) && isset($tbSaleIncomeStaff[$productId][$shopAdminId])){
+                                $tbSaleIncomeStaff[$productId][$shopAdminId]['num'] = bcadd($tbSaleIncomeStaff[$productId][$shopAdminId]['num'], $remainNum);
+                                $tbSaleIncomeStaff[$productId][$shopAdminId]['price'] = bcadd($tbSaleIncomeStaff[$productId][$shopAdminId]['price'], $amount, 2);
+                            }else{
+                                $tbSaleIncomeStaff[$productId][$shopAdminId] = ['name' => $name, 'num' => $remainNum, 'price' => $amount,'staffName'=>$shopAdminName];
+                            }
+                        }
+                    }
+                    if ($tkPrice > 0) {
+                        $refundList = RefundOrderClass::getAllByCondition(['relateOrderSn' => $orderSn], null, '*', null, true);
+                        if (!empty($refundList)) {
+                            foreach ($refundList as $refund) {
+                                if ($refund->refundType == 1) {
+                                    //退货退款前面已经考虑,这里不再处理 OK
+                                } else {
+                                    $onlyRefund = bcadd($onlyRefund, $refund->refundPrice, 2);
+                                }
+                            }
+                        }
+                    }
+
+                }
+            }
+        }
+
+        //零售开单
+        $lsIncome = 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, '*');
+        foreach ($hdOrderList as $hdKey => $hdOrder) {
+            $actPrice = $hdOrder['mainPay'] ?? 0;
+            $cash = $hdOrder['cash'] ?? 0;
+            $lsIncome = bcadd($actPrice, $lsIncome, 2);
+            $lsIncome = bcadd($lsIncome, $cash, 2);
+            $orderSn = $hdOrder['orderSn'] ?? '';
+            $tkPrice = $hdOrder['tkPrice'] ?? 0;
+            $orderItemList = \bizHd\order\classes\OrderItemClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
+            if (!empty($orderItemList)) {
+                foreach ($orderItemList as $orderItem) {
+                    $unitPrice = $orderItem->unitPrice ?? 0;
+                    $refundNum = $orderItem->refundNum ?? 0;
+                    $num = $orderItem->num ?? 0;
+                    $productId = $orderItem->itemId ?? 0;
+                    $remainNum = bcsub($num, $refundNum);
+                    $amount = bcmul($remainNum, $unitPrice, 2);
+                    $itemName = $productList[$productId]['name']??'已删除';
+                    $arr[$productId]['name'] = $itemName;
+                    $arr[$productId]['id'] = $productId;
+                    if (isset($arr[$productId]['income'])) {
+                        $arr[$productId]['income'] = bcadd($amount, $arr[$productId]['income'], 2);
+                        $arr[$productId]['inNum'] = bcadd($arr[$productId]['inNum'],$remainNum,2);
+                    } else {
+                        $arr[$productId]['expend'] = 0;
+                        $arr[$productId]['outNum'] = 0;
+                        $arr[$productId]['inNum'] = $remainNum;
+                        $arr[$productId]['income'] = $amount;
+                    }
+                }
+                if ($tkPrice > 0) {
+                    $refundList = HdRefundClass::getAllByCondition(['orderSn' => $orderSn], null, '*', null, true);
+                    if (!empty($refundList)) {
+                        foreach ($refundList as $refund) {
+                            if ($refund->refundType == 2) {
+                                $onlyRefund = bcadd($onlyRefund, $refund->refundPrice, 2);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        $totalIncome = 0;
+        $totalExpend = 0;
+        if (!empty($arr)) {
+            foreach ($arr as $key => $val) {
+                $income = $val['income'] ?? 0;
+                $income = floatval($income);
+                $totalIncome = bcadd($totalIncome, $income, 2);
+                $expend = $val['expend'] ?? 0;
+                $expend = floatval($expend);
+                $totalExpend = bcadd($totalExpend, $expend, 2);
+                $profit = bcsub($income, $expend, 2);
+                $arr[$key]['profit'] = floatval($profit);
+                $arr[$key]['income'] = floatval($income);
+                $arr[$key]['expend'] = floatval($expend);
+            }
+        }
+
+        //总成本算上物流打包等费用
+        $totalExpend = bcadd($totalExpend, $packFreight, 2);
+        //总收入算上采购仅退款
+        $totalIncome = bcadd($totalIncome, $onlyRefundCg, 2);
+        //总收入加上人工费
+        $totalIncome = bcadd($totalIncome, $totalLabourCost, 2);
+        //总收入减掉优惠金额
+        $totalIncome = bcsub($totalIncome, $totalDiscountAmount, 2);
+        //总成本算上销售仅退款
+        $totalExpend = bcadd($totalExpend, $onlyRefund, 2);
+        $totalProfit = bcsub($totalIncome, $totalExpend, 2);
+        $totalIncome = floatval($totalIncome);
+        $totalExpend = floatval($totalExpend);
+        $totalProfit = floatval($totalProfit);
+
+        $arr = array_values($arr);
+        $arr = arrayUtil::arraySort($arr, 'profit');
+
+        if ($export == 1) {
+            $statData = [
+                ['id' => 0, 'name' => '物流打包费', 'income' => 0, 'expend' => $packFreight, 'profit' => -$packFreight,'inNum'=>0,'outNum'=>0],
+                ['id' => 0, 'name' => '采购仅退款', 'income' => $onlyRefundCg, 'expend' => 0, 'profit' => $onlyRefundCg,'inNum'=>0,'outNum'=>0],
+                ['id' => 0, 'name' => '销售仅退款', 'income' => 0, 'expend' => $onlyRefund, 'profit' => -$onlyRefund,'inNum'=>0,'outNum'=>0],
+                ['id' => 0, 'name' => '附加人工费', 'income' => $totalLabourCost, 'expend' => 0, 'profit' => $totalLabourCost,'inNum'=>0,'outNum'=>0],
+                ['id' => 0, 'name' => '优惠金额', 'income' => -$totalDiscountAmount, 'expend' => 0, 'profit' => -$totalDiscountAmount,'inNum'=>0,'outNum'=>0],
+                ['id' => 0, 'name' => '【汇总金额】', 'income' => $totalIncome, 'expend' => $totalExpend, 'profit' => $totalProfit,'inNum'=>0,'outNum'=>0],
+            ];
+            $list = array_merge($arr, $statData);
+            self::exportIncomeOutItem($list, $mainId);
+        }
+
+        util::success(['list' => $arr, 'packFreight' => $packFreight, 'onlyRefundCg' => $onlyRefundCg, 'onlyRefund' => $onlyRefund,
+            'totalIncome' => $totalIncome,
+            'totalExpend' => $totalExpend,
+            'totalProfit' => $totalProfit,
+            'tbSaleIncome' => $tbSaleIncome,
+            'tbCgIncome' => $tbCgIncome,
+            'tbCgIncomeStaff'=>$tbCgIncomeStaff,
+            'tbSaleIncomeStaff'=>$tbSaleIncomeStaff,
+            'totalLabourCost' => $totalLabourCost,
+            'totalDiscountAmount' => $totalDiscountAmount,
+        ]);
+    }
+
     //按分类统计收入 ssh 20231111
     public static function classProfile($mainId)
     {
@@ -675,6 +970,89 @@ class StatSaleClass extends BaseClass
         ]);
     }
 
+    public static function exportIncomeOutItem($list, $mainId)
+    {
+        $phpExcelFile = Yii::getAlias("@vendor/phpoffice/phpexcel/");
+        require_once($phpExcelFile . 'Classes/PHPExcel.php');
+
+        $objPHPExcel = new \PHPExcel();
+
+        $objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
+            ->setLastModifiedBy("Maarten Balliauw")
+            ->setTitle("Office 2007 XLSX Document")
+            ->setSubject("Office 2007 XLSX Document")
+            ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
+            ->setKeywords("office 2007 openxml php")
+            ->setCategory("file");
+
+        $ghsTitle = '供货商';
+        $objPHPExcel->getActiveSheet()->getHeaderFooter()->setOddHeader(date('n月j日') . " " . $ghsTitle);
+
+        $objPHPExcel->getActiveSheet()->getPageMargins()->setTop(0.7);
+        $objPHPExcel->getActiveSheet()->getPageMargins()->setBottom(0.1);
+        $objPHPExcel->getActiveSheet()->getPageMargins()->setLeft(0.5);
+        $objPHPExcel->getActiveSheet()->getPageMargins()->setRight(0);
+        $objPHPExcel->getActiveSheet()->getPageMargins()->setHeader(0.1);
+        $objPHPExcel->getActiveSheet()->getPageMargins()->setFooter(0);
+
+        $objPHPExcel->getActiveSheet()->setCellValue('A1', '名称');
+        $objPHPExcel->getActiveSheet()->setCellValue('B1', '销售收入');
+        $objPHPExcel->getActiveSheet()->setCellValue('C1', '销售数量');
+        $objPHPExcel->getActiveSheet()->setCellValue('D1', '采购成本');
+        $objPHPExcel->getActiveSheet()->setCellValue('E1', '采购数量');
+        $objPHPExcel->getActiveSheet()->setCellValue('F1', '利润');
+
+        //设置宽度
+        $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(30);
+        $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(20);
+        $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
+        $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(20);
+        //加粗
+        $objPHPExcel->getActiveSheet()->getStyle('A1')->getFont()->setSize(9)->setBold(true);
+        $objPHPExcel->getActiveSheet()->getStyle('B1')->getFont()->setSize(9)->setBold(true);
+        $objPHPExcel->getActiveSheet()->getStyle('C1')->getFont()->setSize(9)->setBold(true);
+        $objPHPExcel->getActiveSheet()->getStyle('D1')->getFont()->setSize(9)->setBold(true);
+
+        $objPHPExcel->getActiveSheet()->getStyle('A1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+        $objPHPExcel->getActiveSheet()->getStyle('B1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+        $objPHPExcel->getActiveSheet()->getStyle('C1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+        $objPHPExcel->getActiveSheet()->getStyle('D1')->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+
+        $baseRow = 2;
+        foreach ($list as $key => $custom) {
+            $i = $baseRow + $key;
+            $objPHPExcel->getActiveSheet()->setCellValue('A' . $i, $custom['name']);
+            $objPHPExcel->getActiveSheet()->setCellValue('B' . $i, $custom['income']);
+            $objPHPExcel->getActiveSheet()->setCellValue('C' . $i, $custom['inNum']);
+            $objPHPExcel->getActiveSheet()->setCellValue('D' . $i, $custom['expend']);
+            $objPHPExcel->getActiveSheet()->setCellValue('E' . $i, $custom['outNum']);
+            $objPHPExcel->getActiveSheet()->setCellValue('F' . $i, $custom['profit']);
+            //居左
+            $objPHPExcel->getActiveSheet()->getStyle('A' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+            $objPHPExcel->getActiveSheet()->getStyle('B' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+            $objPHPExcel->getActiveSheet()->getStyle('C' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+            $objPHPExcel->getActiveSheet()->getStyle('D' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+            $objPHPExcel->getActiveSheet()->getStyle('E' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+            $objPHPExcel->getActiveSheet()->getStyle('F' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
+        }
+        $fileName = '收支花材-' . date("m-d");
+        $objPHPExcel->getActiveSheet()->setTitle($fileName);
+        $objPHPExcel->setActiveSheetIndex(0);
+        $dir = './priceTable/' . $mainId;
+        if (file_exists($dir) == false) {
+            mkdir($dir, 0777, true);
+        }
+        $date = $fileName;
+        $file = $date . '.xls';
+        $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+        if (file_exists($dir . '/' . $file)) {
+            unlink($dir . '/' . $file);
+        }
+        $objWriter->save($dir . '/' . $file);
+        $fileUrl = Yii::$app->params['ghsHost'] . '/priceTable/' . $mainId . '/' . $file;
+        util::success(['file' => $fileUrl, 'shortFile' => $file]);
+    }
+
     public static function exportIncomeClass($list, $mainId)
     {
         $phpExcelFile = Yii::getAlias("@vendor/phpoffice/phpexcel/");
@@ -734,7 +1112,7 @@ class StatSaleClass extends BaseClass
             $objPHPExcel->getActiveSheet()->getStyle('C' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
             $objPHPExcel->getActiveSheet()->getStyle('D' . $i)->getAlignment()->setHorizontal(\PHPExcel_Style_Alignment::HORIZONTAL_LEFT);
         }
-        $fileName = '收分类-' . date("m-d");
+        $fileName = '收分类-' . date("m-d");
         $objPHPExcel->getActiveSheet()->setTitle($fileName);
         $objPHPExcel->setActiveSheetIndex(0);
         $dir = './priceTable/' . $mainId;