wuggemail@foxmail.com 2 bulan lalu
induk
melakukan
8c55330f5c

+ 13 - 2
app/cxinv/controller/Index.php

@@ -59,9 +59,20 @@ class Index extends Base
      * @param  \think\Request  $request
      * @return \think\Response
      */
-    public function save(Request $request)
+    public function ListV2()
     {
-        //
+        $param = $this->request->param(['goodName'=>"","code"=>"","companyNo"=>"","page"=>1,"size"=>20],"post",'trim');
+        $where=[["a.status","<>",0],["tax_category.is_del","=",0]];
+        if($param['goodName']!='') $where[]=['a.goodName|tax_category.cat_code|tax_category.cat_name|tax_category.merge_code|tax_category.short_name','like','%'.$param['goodName'].'%'];
+
+        $list = GodTemp::alias('a')->leftJoin("zswh_account_202304.sys_tax_category tax_category",'tax_category.merge_code=a.cat_code')
+            ->where($where)->field("a.id,a.code,a.goodName,a.cat_tax,a.cat_code,a.cat_name,tax_category.cat_code tax_cat_code,
+            tax_category.cat_name tax_cat_name, merge_code,short_name,1 is_check,tax_category.id tax_id")
+            ->order('a.id desc')->paginate(['page'=>$param['page'],'list_rows'=>$param['size']])->each(function ($item,$key)use($param){
+                $inTax = TaxCompany::with(['tax'])->where(['companyNo'=>$param['companyNo'],'income'=>1,'tax_id'=>$item->tax_id])->findOrEmpty();
+                $item->is_check=$inTax->isEmpty()?0:1;
+            });
+        return success("获取成功",['list'=>$list->items(),'count'=>$list->total()]);
     }
 
     /**

+ 1 - 1
app/cxinv/controller/OrderInvoice.php

@@ -113,7 +113,7 @@ class OrderInvoice extends Base
             "invNo"=>$invNo,
             "inv_value"=>$invfee,
             "inv_out"=> $companyNo,
-            "inv_company"=> $company['invoice_title']??"",
+            "inv_company"=>  $seller['invoice_title']??"",
             "apply_id"=>$this->uid,
             "apply_name"=>$this->uname,
             "inv_type"=>$params["invtype"],//发票类型  专用 普通 电子专用 电子普通 全电子票

+ 15 - 10
app/cxinv/listener/ComonQrd.php

@@ -54,18 +54,23 @@ class ComonQrd
             	$payArr=array_column($assoc->toArray(),"cancel_fee","orderCode");
             	$tag=[];
     	        $qrdSave=[];
+                IF($bool==false){
+                    $tagLog=TagLog::where(["code"=>$data['invNo'],"tag_id"=>107])->column("id","code");
+                }
             	foreach ($orderArr as $item){
             		if(!isset($payArr[$item->sequenceNo]))continue;
-		           $tag_temp=[
-		                'code'=>$item->sequenceNo,
-		                'tag_id'=>107,//开票申请同步QR
-		                'creater'=>'system',
-		                'createrid'=>0,
-		                'tag_fee'=>0,
-		                'tag_img'=>'',
-		                "tag_code"=>$data['invNo'],
-		                'status'=>$bool?1:0
-		                ];
+                    if($bool==false &&!isset($tagLog[$data['invNo']])) continue;
+                    $tag_temp=[
+                        "id"=>$bool?null:$tagLog[$data['invNo']],
+                        'code'=>$item->sequenceNo,
+                        'tag_id'=>107,//开票申请同步QR
+                        'creater'=>'system',
+                        'createrid'=>0,
+                        'tag_fee'=>0,
+                        'tag_img'=>'',
+                        "tag_code"=>$data['invNo'],
+                        'status'=>$bool?1:0
+                    ];
 		            $qrd=[
 		                'id'=>$item->id,
 			            'wpay_fee'=>$item->wpay_fee,

+ 1 - 1
app/cxinv/model/GodTemp.php

@@ -21,6 +21,6 @@ class GodTemp extends Base
         'companyName' => 'varchar:255',
     ];
     public function TaxInfo(){
-        return $this->hasOne(TaxCategory::class,'merge_code','cat_code')->bind(['tax_id'=>'id']);
+        return $this->hasOne(TaxCategory::class,'merge_code','cat_code')->bind(['tax_id'=>'id','short_name','cat_code','cat_name','merge_name']);
     }
 }

+ 13 - 10
app/user/controller/User.php

@@ -117,16 +117,19 @@ class User extends Base
     if(!empty($param['companyArr'])){
     	$codeArr = array_column($param['companyArr'],'companyCode');
     	$comp = Headquarters::whereIn('code',$codeArr)->column('name,type','code');
-    	foreach ($param['companyArr'] as $item){
-    		$temp=[];
-    	    $temp['companyName']=$comp[$item['companyCode']]['name']??'';
-    	    $temp['companyCode']=$item['companyCode'];
-    	    $temp['is_main']=$item['is_main'];
-    	    $temp['id']=$item['id']??null;
-    	    $temp['is_del']=$item['is_del']??0;
-    	    $temp['company_type']=$comp[$item['companyCode']]['type']==1?2:1;
-    	    $relation[]=$temp;
-    	}
+        if(!empty($comp)){
+            foreach ($param['companyArr'] as $item){
+                $temp=[];
+                $temp['companyName']=$comp[$item['companyCode']]['name']??'';
+                $temp['companyCode']=$item['companyCode'];
+                $temp['is_main']=$item['is_main'];
+                $temp['id']=$item['id']??null;
+                $temp['is_del']=$item['is_del']??0;
+                $temp['company_type']=$comp[$item['companyCode']]['type']==1?2:1;
+                $relation[]=$temp;
+            }
+        }
+
     }
    
     $this->model->startTrans();