QrdInfo.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\model;
  4. use think\Model;
  5. /**
  6. * @mixin \think\Model
  7. */
  8. class QrdInfo extends Model
  9. {
  10. protected $createTime="addtime";
  11. protected $updateTime="updatetime";
  12. public function Category()
  13. {
  14. return $this->belongsTo(OrderCategory::class,"sequenceNo",'code')->bind(["cat_code","cat_name","cat_tax"=>"tax","inv_good_name"]);
  15. }
  16. public static function CheckQrd($orderCode,&$data)
  17. {
  18. $qrdinf =self::where(['sequenceNo|cxCode'=>$orderCode,'is_del'=>0])
  19. ->field('sequenceNo,ownerName,companyName,inv_tag,pay_tag')->select()->toArray();
  20. if(!empty($qrdinf)){
  21. foreach ($qrdinf as $item){
  22. if($item['inv_tag']==1){
  23. $uname= TagLog::alias('a')
  24. ->join("order_tag b","a.tag_id=b.id",'left')
  25. ->where(["code"=>$item['sequenceNo'],"b.type"=>2])
  26. ->order("a.id desc")
  27. ->value("creater",'');
  28. $data[]=['type'=>'结算销售单开票标签','username'=>$uname,'orderCode'=>$item['sequenceNo'],'companyName'=>$item['companyName']];
  29. }
  30. if($item['pay_tag']==1){
  31. $uname= TagLog::alias('a')
  32. ->join('order_tag b','a.tag_id=b.id','left')
  33. ->where(['code'=>$item['sequenceNo'],'b.type'=>1])
  34. ->order('a.id desc')
  35. ->value('creater','');
  36. $data[]=['type'=>'结算销售单付款标签','username'=> $uname,'orderCode'=>$item['sequenceNo'],'companyName'=>$item['companyName']];
  37. }
  38. Assoc::CheckQrd($item['sequenceNo'],$data);
  39. }
  40. }
  41. }
  42. }