belongsTo(ComonOrder::class,"cgdNo","cgdNo"); } public static function CheckCgd($cgdNo,&$data){ $payinfo=self::where(['cgdNo'=>$cgdNo,'status'=>1,'is_del'=>0])->findOrEmpty(); if(!$payinfo->isEmpty()){ $pay = Pay::where('payNo', $payinfo->payNo)->findOrEmpty(); $data[]=['type'=>'采购对账单','username'=>$pay->apply_name,'orderCode'=>$pay->payNo,'companyName'=>$pay->companyName]; $hp = PayInvoice::where(['payNo'=>$pay->payNo,'is_del'=>0,'status'=>[1,2,3,4]]) ->column('hpNo,apply_name'); if(!empty($hp)){ foreach ($hp as $item){ $data[]=['type'=>'采购对账单回票','username'=> $item['apply_name'],'orderCode'=>$item['hpNo'],'companyName'=>$pay->companyName]; } } $paydz = PayPayment::where(['payNo'=>$pay->payNo,'is_del'=>0,'status'=>[1,2,3,4]]) ->column('dzNo,apply_name'); if(!empty($paydz)){ foreach ($paydz as $item){ $data[]=['type'=>'采购对账单付款','username'=> $item['apply_name'],'orderCode'=>$item['dzNo'],'companyName'=>$pay->companyName]; } } } } }