wugg 2 年 前
コミット
e6836bbda3

+ 1 - 1
app/admin/command/GenerrateInvoice.php

@@ -75,7 +75,7 @@ class GenerrateInvoice extends Command
     }
 
     protected function GetAll(){
-        $list =Db::name("invoice_interface")->json(["DDMXXX"])->lock(true)->withoutField("id,status,is_check,result,remark,addtime,updatetime")->limit(1)->where(["status"=>0])->select();
+        $list =Db::name("invoice_interface")->json(["DDMXXX"])->lock(true)->withoutField("id,status,is_check,result,remark,addtime,updatetime")->limit(1)->where(["status"=>0])->select()->toArray();
         return $list;
     }
 

+ 3 - 0
app/admin/controller/InvCat.php

@@ -57,6 +57,9 @@ class InvCat extends BaseController{
 				if($tax==0 && $invTag!=3){
 					return error_show(1004,"税率标识只能选择零税率");
 				}
+				if($tax!=0 && $invTag!=0){
+					return error_show(1004,"税率标识只能选择非零税率");
+				}
 				$addTax='';
 			}
 

+ 72 - 9
app/admin/controller/OrderInv.php

@@ -8,7 +8,7 @@ use think\App;
 use think\Exception;
 use think\facade\Config;
 use think\facade\Db;
-use think\facade\Cache;
+use think\facade\Cache;use think\facade\Validate;
 
 class OrderInv extends BaseController{
 	protected $typename;
@@ -291,20 +291,20 @@ class OrderInv extends BaseController{
         if($status==3){
 			$open_type = $invinfo['open_type'];
            if($open_type!=1){
-               if($invCode==='') return error_show(1004,"参数 invCode 不能为空");
+
                if($invNum==='') return error_show(1004,"参数 invNum 不能为空");
                if($open_date==='') return error_show(1004,"参数 open_date 不能为空");
                if(in_array($invinfo['inv_type'],['normal','roll',"toll",'electronic'])){
                	    if($checkCode==='') return error_show(1004,"参数 checkCode 不能为空");
                }
-               if($subtotal_fee==='') return error_show(1004,"参数 subtotal_fee 不能为空");
-               //全电子发票 信息需要全填补充切无法接口识别验真
+               //全电子发票
 	           if(in_array($invinfo['inv_type'],['fully_digitalized_special_electronic','fully_digitalized_normal_electronic'])){
-	              if($invNum==='') return error_show(1004,"参数 invNum 不能为空");
-	              if($open_date==='') return error_show(1004,"参数 open_date 不能为空");
-	              if($subtotal_fee==='') return error_show(1004,"参数 subtotal_fee 不能为空");
+	           	    //全电发票传含税金额
 	              if($total_fee=='') return error_show(1004,"参数 total_fee 不能为空");
-					$status=3;
+	           }else{
+	           	//全电发票无invCode
+	           	 if($invCode==='') return error_show(1004,"参数 invCode 不能为空");
+	           	 if($subtotal_fee==='') return error_show(1004,"参数 subtotal_fee 不能为空");
 	           }
            }
 
@@ -1170,7 +1170,6 @@ class OrderInv extends BaseController{
            	->field("c.*,a.cancel_fee")
            	->select()->toArray();
          foreach ($orderinfo as &$item){
-//			$good_num = Db::name("qrd_info")->where("sequenceNo",$item['orderCode'])->value("goodNum",0);
              $item['ainv_num'] = Db::name("invoice_pool")
                  ->alias("a")
                  ->leftJoin("invoice_good b", "a.invNo=b.invNo and b.is_del=0")
@@ -1182,6 +1181,70 @@ class OrderInv extends BaseController{
         }
         $poolinfo['orderinfo']=$orderinfo;
        return app_show(0,"获取成功",$poolinfo);
+    }
+	//开票异常失败后修改票面信息
+    public function TicketEdit(){
+		$post=$this->request->only([
+			"invNo"=>"", //开票申请编号
+			"inv_code"=>"",//发票编码
+			"inv_number"=>"",//发票号码
+			"inv_subtotal"=>"",//发票税前额度
+			"inv_total"=>"",//发票额度
+			"open_date"=>"",//开票日期
+			"check_code"=>"",//发票校验码
+			],"post","trim");
+		$valid=Validate::rule([
+			"invNo|开票申请编号"=>"require|max:255",
+			"inv_code|开票代码"=>"number",
+			"inv_number|开票编号"=>"number",
+			"inv_subtotal|不含税金额"=>"float",
+			"inv_total|价税合计"=>"float",
+			"open_date|开票日期"=>"date",
+			"check_code|校验码"=>"max:255",
+			]);
+		if($valid->check($post)==false) return error_show(1004,$valid->getError());
+		$ticketinfo =Db::name("invoice_ticket")->where(["invNo"=>$post['invNo'],"is_del"=>0,"type"=>0])->findOrEmpty();
+		if(empty($ticketinfo)) return error_show(1004,"未找到开票数据");
+		$pool = Db::name("invoice_pool")->where(["invNo"=>$post['invNo'],"is_del"=>0,"status"=>[5,9]])->findOrEmpty();
+		if(empty($pool)) return error_show(1004,"开票申请数据不可修改");
+		if($pool['open_type']==1)return error_show(1004,"金税开票数据不可修改");
+				if($post['inv_number']==='') return error_show(1004,"参数 inv_number不能为空");
+               if($post['open_date']==='') return error_show(1004,"参数 open_date 不能为空");
+               if(in_array($pool['inv_type'],['normal','roll',"toll",'electronic'])){
+               	    if($post['check_code']==='') return error_show(1004,"参数 check_code不能为空");
+               }
+               //全电子发票
+	           if(in_array($pool['inv_type'],['fully_digitalized_special_electronic','fully_digitalized_normal_electronic'])){
+	           	    //全电发票传含税金额
+	              if($post['inv_total']=='') return error_show(1004,"参数 inv_total 不能为空");
+	           }else{
+	           	//全电发票无invCode
+	           	 if($post['inv_code']==='') return error_show(1004,"参数 inv_code不能为空");
+	           	 if($post['inv_subtotal']==='') return error_show(1004,"参数 inv_subtotal 不能为空");
+	           }
+		Db::startTrans();
+		try{
+			$Ticket=[
+				"inv_code"=>$post['inv_code'],//发票编码
+				"inv_number"=>$post['inv_number'],//发票号码
+				"inv_subtotal"=>$post['inv_subtotal'],//发票税前额度
+				"inv_total"=>$post['inv_total'],//发票额度
+				"open_date"=>$post['open_date'],//开票日期
+				"check_code"=>$post['check_code'],//发票校验码
+				"status"=>0,//带校验
+				"updatetime"=>date("Y-m-d H:i:s")//发票校验码
+				];
+			$ticket =Db::name("invoice_ticket")->where($ticketinfo)->update($Ticket);
+			if($ticket==false) throw new \Exception("开票信息更新失败");
+			$polup =Db::name("invoice_pool")->where($pool)->update(["status"=>3,"check_remark"=>"","updatetime"=>date("Y-m-d H:i:s")]);
+			if($polup==false) throw new \Exception("开票申请信息更新失败");
+			Db::commit();
+			return app_show(0,"开票信息更新成功");
+		}catch (Exception $e){
+			Db::rollback();
+			return error_show(1005,$e->getMessage());
+		}
+
     }
     //退票列表
     public function returnList(){

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

@@ -879,6 +879,12 @@ class Payment extends BaseController
         if($supplierNo!=""){
           $condition []=["supplierNo","=",$supplierNo];
         }
+		$start=isset($post['start'])&& $post['start']!=''?trim($post['start']):"";
+		$end=isset($post['end'])&& $post['end']!=''?trim($post['end']):"";
+		if($start!='') $condition []=["cgdTime",">=",date("Y-m-d 00:00:00",strtotime($start))];
+		if($end!='') $condition []=["cgdTime","<=",date("Y-m-d 23:59:59",strtotime($end))];
+
+
 		  $cgder= isset($post['cgder']) && $post['cgder']!='' ? trim($post['cgder']) :"";
         if($cgder!='') $condition []=["ownerName","like","%$cgder%"];
         $cgderid= isset($post['cgderid']) && $post['cgderid']!='' ? trim($post['cgderid']) :"";
@@ -1223,9 +1229,6 @@ class Payment extends BaseController
         if($status==""){
             return error_show(1004,"参数status 不能为空");
         }
-//        if(!in_array($status,[0,1,2,3,4,5,6,7,8,9,10,11,12])){
-//            return error_show(1004,"参数status 无效值");
-//        }
         if(!in_array($status,[0,1,2,3,4,5,6,7])){
             return error_show(1004,"参数status 无效值");
         }

+ 2 - 0
app/admin/route/app.php

@@ -147,6 +147,8 @@ Route::rule("stagereturninfo","admin/Payment/stageReturnInfo");
 Route::rule("paycgdexport","admin/Payment/payCgdExport");
 
 Route::rule("returninvinfo","admin/OrderInv/returnInfo");
+Route::rule("ticketedit","admin/OrderInv/TicketEdit");
+
 Route::rule("tradeloginfo","admin/OrderPay/logInfo");
 Route::rule("tradeinfo","admin/OrderPay/tradeInfo");
 Route::rule("returnpayinfo","admin/OrderPay/returnInfo");