wugg il y a 2 ans
Parent
commit
fb80916b41
1 fichiers modifiés avec 47 ajouts et 16 suppressions
  1. 47 16
      app/admin/controller/InvCat.php

+ 47 - 16
app/admin/controller/InvCat.php

@@ -216,24 +216,55 @@ class InvCat extends BaseController{
                 $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){
+//                    	if ( $value['inv_tag'] == 3) throw new Exception($value['spuCode'].'税率标识不能选择零税率');
+//                        if ($value['addTax'] == '') throw new Exception($value['spuCode'].'参数 addTax 不能为空');
+//                        if($value['addTax']!=$this->Tax[$value['inv_tag']]){
+//                        	throw new Exception($value['spuCode'].'税率标识与增值税管理内容不符');
+//						}
+//                    }
+//
+//
+//                } else {
+//                    // 非优惠政策下 零税率 税率标识只能选择 3 普通零税率  增值税管理为空
+//                    // 非优惠政策下 非零税率 税率标识只能选择 0 非零税率  增值税管理为空
+//                    if ($value['tax'] == 0 && $value['inv_tag'] != 3) throw new Exception($value['spuCode'].'税率标识只能选择零税率');
+//					$value['addTax'] = '';
+//                }
 
-                if ($value['is_discount'] == 1) {
-                    // 优惠政策下 税率标识只能选择 0非零说率 1免税 2不征税 增值税管理为空"出口零税/免税/不征税"
-                    if($value['tax'] == 0){
-                    	if ( $value['inv_tag'] == 3) throw new Exception($value['spuCode'].'税率标识不能选择零税率');
-                        if ($value['addTax'] == '') throw new Exception($value['spuCode'].'参数 addTax 不能为空');
-                        if($value['addTax']!=$this->Tax[$value['inv_tag']]){
-                        	throw new Exception($value['spuCode'].'税率标识与增值税管理内容不符');
-						}
-                    }
-
+                if($value['is_discount'] ==1){
+//				1.如果YHZCBS为1, 则ZZSTSGL必须填; 如果YHZCBS为0,ZZSTSGL不填。
+//				2.如果YHZCBS为1, 且税率为0, 则LSLBS只能根据实际情况选择"1或2"中的一种, 不能选择3, 且ZZSTSGL内容也只能写与1/2对应的"免税/不征税";
+//				3.如果税率为0,但并不属于优惠政策(即普通的零税率),则YHZCBS填0,LSLBS填3,ZZSTSGL为空;
+//				4.如果税率不为0, 但属于优惠政策,则YHZCBS填1,LSLBS填空或不填,ZZSTSGL根据实际情况填写;
+//				5.如果税率不为0, 且不属于优惠政策, 则YHZCBS填0,LSLBS填空或不填,ZZSTSGL不填或空.
+				// 优惠政策下 税率标识只能选择 0非零说率 1免税 2不征税 增值税管理为空"出口零税/免税/不征税"
+				if($value['tax'] ==0){
+					if($value['inv_tag']==3){
+						throw new Exception($value['spuCode'].'税率标识不能选择零税率');
+					}
+					if($value['addTax']==''){
+						throw new Exception($value['spuCode'].'参数 addTax 不能为空');
+					}
+					if($value['addTax']!=$this->Tax[$value['inv_tag']]){
+						throw new Exception($value['spuCode'].'参数 addTax 不能为空');
+					}
+				}
 
-                } else {
-                    // 非优惠政策下 零税率 税率标识只能选择 3 普通零税率  增值税管理为空
-                    // 非优惠政策下 非零税率 税率标识只能选择 0 非零税率  增值税管理为空
-                    if ($value['tax'] == 0 && $value['inv_tag'] != 3) throw new Exception($value['spuCode'].'税率标识只能选择零税率');
-					$value['addTax'] = '';
-                }
+			}else{
+				// 非优惠政策下 零税率 税率标识只能选择 3 普通零税率  增值税管理为空
+				// 非优惠政策下 非零税率 税率标识只能选择 0 非零税率  增值税管理为空
+				if($value['tax'] == 0 && $value['inv_tag'] != 3){
+					throw new Exception($value['spuCode'].'税率标识只能选择零税率');
+				}
+				if($value['tax']!=0 && $value['inv_tag']!=0){
+					throw new Exception($value['spuCode']."税率标识只能选择非零税率");
+				}
+				$value['addTax']='';
+			}
 
                 $data = [
                     'inv_cat_name' => $all_cat_code[$value['cat_code']]['short_name'],