belongsTo(PayInfo::class,"sequenceNo","cgdNo")->bind(["payNo"]); } public function Category() { return $this->belongsTo(OrderCategory::class,'sequenceNo','code')->bind(['cat_code','cat_name','cat_tax'=>'tax','inv_good_name']); } public static function CheckCgd($where,&$data){ $cgdinfo= self::where($where)->where(['status'=>1,'is_del'=>0])->findOrEmpty(); if(!$cgdinfo->isEmpty()){ if($cgdinfo['inv_tag']==1){ $uname= TagLog::alias('a') ->join('order_tag b','a.tag_id=b.id','left') ->where(['code'=>$cgdinfo['sequenceNo'],'b.type'=>6]) ->order('a.id desc') ->value('creater',''); $data[]=['type'=>'结算采购单回票标签','username'=> $uname,'orderCode'=>$cgdinfo['sequenceNo'], 'companyName'=>$cgdinfo['companyName']]; } if($cgdinfo['pay_tag']==1){ $uname= TagLog::alias('a') ->join('order_tag b','a.tag_id=b.id','left') ->where(['code'=>$cgdinfo['sequenceNo'],'b.type'=>5]) ->order('a.id desc') ->value('creater',''); $data[]=['type'=>'结算采购单付款标签','username'=> $uname,'orderCode'=>$cgdinfo['sequenceNo'],'companyName'=>$cgdinfo['companyName']]; } PayInfo::CheckCgd($cgdinfo['sequenceNo'],$data); InvoiceOrder::CheckOrder($cgdinfo['sequenceNo'],$data); } } }