123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- declare (strict_types = 1);
- namespace app\admin\model;
- use think\Model;
- /**
- * @mixin \think\Model
- */
- class QrdInfo extends Model
- {
- protected $createTime="addtime";
- protected $updateTime="updatetime";
- public function Category()
- {
- return $this->belongsTo(OrderCategory::class,"sequenceNo",'code')->bind(["cat_code","cat_name","cat_tax"=>"tax","inv_good_name"]);
- }
- public static function CheckQrd($orderCode,&$data)
- {
- $qrdinf =self::where(['sequenceNo|cxCode'=>$orderCode,'is_del'=>0])
- ->field('sequenceNo,ownerName,companyName,inv_tag,pay_tag')->select()->toArray();
- if(!empty($qrdinf)){
- foreach ($qrdinf as $item){
- if($item['inv_tag']==1){
- $uname= TagLog::alias('a')
- ->join("order_tag b","a.tag_id=b.id",'left')
- ->where(["code"=>$item['sequenceNo'],"b.type"=>2])
- ->order("a.id desc")
- ->value("creater",'');
- $data[]=['type'=>'结算销售单开票标签','username'=>$uname,'orderCode'=>$item['sequenceNo'],'companyName'=>$item['companyName']];
- }
- if($item['pay_tag']==1){
- $uname= TagLog::alias('a')
- ->join('order_tag b','a.tag_id=b.id','left')
- ->where(['code'=>$item['sequenceNo'],'b.type'=>1])
- ->order('a.id desc')
- ->value('creater','');
- $data[]=['type'=>'结算销售单付款标签','username'=> $uname,'orderCode'=>$item['sequenceNo'],'companyName'=>$item['companyName']];
- }
- Assoc::CheckQrd($item['sequenceNo'],$data);
- }
- }
- }
- }
|