wufeng 2 gadi atpakaļ
vecāks
revīzija
fcbe7cd306
3 mainītis faili ar 12 papildinājumiem un 45 dzēšanām
  1. 3 1
      app/admin/controller/Export.php
  2. 9 3
      app/admin/controller/Payment.php
  3. 0 41
      app/common.php

+ 3 - 1
app/admin/controller/Export.php

@@ -85,7 +85,7 @@ class Export extends BaseController
             ->alias('a')
             ->leftJoin('pay b', 'a.payNo=b.payNo')
             ->leftJoin('invoice_info c', 'c.hpNo=a.hpNo AND c.status=1')
-            ->field('"" 序号,a.hpNo,a.addtime,a.invoiceNumber,a.open_time,b.supplierName,a.invoiceType,a.status,a.updatetime,a.remark,c.item_list,c.total')
+            ->field('"" 序号,a.payNo,a.hpNo,a.addtime,a.invoiceNumber,a.open_time,b.supplierName,a.invoiceType,a.status,a.updatetime,a.remark,c.item_list,c.total')
             ->where($where)
             ->order('a.addtime desc')
             ->cursor();
@@ -99,6 +99,7 @@ class Export extends BaseController
                     $data[] = [
                         '序号' => $i++,
                         '回票申请编号' => $item['hpNo'],
+                        '对账编号' => $item['payNo'],
                         '年' => date('Y', strtotime($item['addtime'])),
                         '月' => date('m', strtotime($item['addtime'])),
                         '发票号' => $item['invoiceNumber'],
@@ -119,6 +120,7 @@ class Export extends BaseController
                 $data[] = [
                     '序号' => $i++,
                     '回票申请编号' => $item['hpNo'],
+                    '对账编号' => $item['payNo'],
                     '年' => date('Y', strtotime($item['addtime'])),
                     '月' => date('m', strtotime($item['addtime'])),
                     '发票号' => $item['invoiceNumber'],

+ 9 - 3
app/admin/controller/Payment.php

@@ -1801,11 +1801,11 @@ class Payment extends BaseController
             ->leftJoin("pay b", "a.payNo=b.payNo")
             ->where(['a.is_del' => 0, 'b.is_del' => 0])
             ->whereIn('a.hpNo', array_column($post['list'], 'hpNo'))
-            ->column("a.id,a.payNo,a.hpNo,a.invoiceType,a.inv_fee as invoice_fee,a.status,b.inv_status,b.inv_fee,b.companyNo,b.ainv_fee,b.winv_fee,a.hpNo");
+            ->column("a.id,a.payNo,a.hpNo,a.invoiceType,a.inv_fee as invoice_fee,a.status,b.inv_status,b.inv_fee,b.companyNo,b.ainv_fee,b.winv_fee,a.hpNo", "a.hpNo");
 
         $val_hpNo = Validate::rule([
             'hpNo|回票申请编号' => 'require',
-            'status|审核状态' => 'require|number|in:4,9',
+            'status|审核状态' => 'require|number|in:4,7',
             'remark|审核备注' => 'requireIf:status,7|max:255'
         ]);
 
@@ -1821,7 +1821,13 @@ class Payment extends BaseController
 
             $date = date('Y-m-d H:i:s');
 
-            foreach ($payArr as $value) {
+            foreach ($post['list'] as $val) {
+
+                if (!$val_hpNo->check($item)) throw new \Exception($val_hpNo->getError());
+                if (!isset($payArr[$val['hpNo']])) throw new \Exception("{$val['hpNo']}记录不存在");
+
+                $value = $payArr[$val['hpNo']];
+
                 if ($value['companyNo'] == '') throw new Exception("{$value['hpNo']}对账信息有误");
                 if ($value['companyNo'] != $companyNo) throw new Exception("{$value['hpNo']}不属于当前业务公司发票");
                 if ($value['status'] != '3') throw new Exception("{$value['hpNo']}状态有误");

+ 0 - 41
app/common.php

@@ -499,44 +499,3 @@ if(!function_exists('menuAction')){
 	}
 }
 
-
-/*
- * 大文件导出成csv文件,最多支持100w行数据(csv单个文件最多支持100w行数据)
- * @param file_name string 文件名
- * @param headArr array 标题
- * @param $db \think\db\Query 使用Db方法后生成的对象实例
- */
-if (!function_exists('largerDataExportToCsv')) {
-    function largerDataExportToCsv(string $fileName = '', array $headArr = [], \think\db\Query $db = null, int $num = 10000)
-    {
-        set_time_limit(0);//让程序一直运行
-
-        $fileName .= date('_Y_m_d_H_i_s');//文件名拼接日期
-
-        header('Content-Encoding:UTF-8');
-        header("Content-type:application/vnd.ms-excel;charset=UTF-8");
-        header('Content-Disposition:attachment;filename="' . $fileName . '.csv"');
-
-        $fp = fopen('php://output', 'a');//打开php标准输出流
-
-        fwrite($fp, chr(0xEF) . chr(0xBB) . chr(0xBF));//添加bom头,以UTF-8编码导出的csv文件,如果文件头未添加bom头,打开会出现乱码
-
-        fputcsv($fp, $headArr);//添加导出标题
-
-        $count = $db->count();//计算总数
-
-        $total = ceil($count / $num);//计算总页数
-
-        //写入数据
-        for ($i = 1; $i <= $total; $i++) {
-            $result = $db
-                ->page($i, $num)
-                ->cursor();
-            foreach ($result as $k => $value) {
-                fputcsv($fp, $value);
-            }
-            ob_flush();
-            flush();
-        }
-    }
-}