Browse Source

Merge branch 'dev_wf' of wugg/cxinv into dev

wufeng 2 years ago
parent
commit
cd3025961c
1 changed files with 7 additions and 7 deletions
  1. 7 7
      app/admin/controller/InvCat.php

+ 7 - 7
app/admin/controller/InvCat.php

@@ -173,7 +173,7 @@ class InvCat extends BaseController{
             'inv_good_name|开票商品名称' => 'require|max:255',
             'inv_tag|税率标识' => 'require|between:0,3',
             'is_discount|是否有优惠政策' => 'require|in:0,1',
-            'addTax|增值税管理内容' => 'require|max:255',
+            'addTax|增值税管理内容' => 'max:255',
         ]);
 
         Db::startTrans();
@@ -192,23 +192,23 @@ class InvCat extends BaseController{
             foreach ($list as $value) {
                 if (!$val->check($value)) throw new Exception($val->getError());
 
-                if (!isset($all_spuCode[$value['spuCode']])) throw new Exception('商品数据未找到');
-                if (!isset($all_cat_code[$value['cat_code']])) throw new Exception('未找到对应的开票类目');
-                if (!in_array($value['tax'], $all_cat_code[$value['cat_code']]['tax'] != '' ? explode('、', $all_cat_code[$value['cat_code']]['tax']) : [])) throw new Exception('未找到对应的开票类目税率');
+                if (!isset($all_spuCode[$value['spuCode']])) throw new Exception($value['spuCode'].'商品数据未找到');
+                if (!isset($all_cat_code[$value['cat_code']])) throw new Exception($value['cat_code'].'未找到对应的开票类目');
+                if (!in_array($value['tax'], $all_cat_code[$value['cat_code']]['tax'] != '' ? explode('、', $all_cat_code[$value['cat_code']]['tax']) : [])) throw new Exception($value['tax'].'未找到对应的开票类目税率');
                 $value['tax'] = str_replace('%', '', $value['tax']);
                 $value['tax'] = round(bcdiv($value['tax'], 100, 3), 2);
 
 
                 if ($value['is_discount'] == 1) {
                     // 优惠政策下 税率标识只能选择 0非零说率 1免税 2不征税 增值税管理为空"出口零税/免税/不征税"
-                    if ($value['tax'] == 0 && $value['inv_tag'] == 3) throw new Exception('税率标识不能选择零税率');
+                    if ($value['tax'] == 0 && $value['inv_tag'] == 3) throw new Exception($value['spuCode'].'税率标识不能选择零税率');
 
-                    if ($value['addTax'] == '') throw new Exception('参数 addTax 不能为空');
+                    if ($value['addTax'] == '') throw new Exception($value['spuCode'].'参数 addTax 不能为空');
 
                 } else {
                     // 非优惠政策下 零税率 税率标识只能选择 3 普通零税率  增值税管理为空
                     // 非优惠政策下 非零税率 税率标识只能选择 0 非零税率  增值税管理为空
-                    if ($value['tax'] == 0 && $value['inv_tag'] != 3) throw new Exception('税率标识只能选择零税率');
+                    if ($value['tax'] == 0 && $value['inv_tag'] != 3) throw new Exception($value['spuCode'].'税率标识只能选择零税率');
 
                     $value['addTax'] = '';
                 }