CgdInfo.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 CgdInfo extends Model
  9. {
  10. public function PayInfo(){
  11. return $this->belongsTo(PayInfo::class,"sequenceNo","cgdNo")->bind(["payNo"]);
  12. }
  13. public function Category()
  14. {
  15. return $this->belongsTo(OrderCategory::class,'sequenceNo','code')->bind(['cat_code','cat_name','cat_tax'=>'tax','inv_good_name']);
  16. }
  17. public static function CheckCgd($where,&$data){
  18. $cgdinfo= self::where($where)->where(['status'=>1,'is_del'=>0])->findOrEmpty();
  19. if(!$cgdinfo->isEmpty()){
  20. if($cgdinfo['inv_tag']==1){
  21. $uname= TagLog::alias('a')
  22. ->join('order_tag b','a.tag_id=b.id','left')
  23. ->where(['code'=>$cgdinfo['sequenceNo'],'b.type'=>6])
  24. ->order('a.id desc')
  25. ->value('creater','');
  26. $data[]=['type'=>'结算采购单回票标签','username'=> $uname,'orderCode'=>$cgdinfo['sequenceNo'],
  27. 'companyName'=>$cgdinfo['companyName']];
  28. }
  29. if($cgdinfo['pay_tag']==1){
  30. $uname= TagLog::alias('a')
  31. ->join('order_tag b','a.tag_id=b.id','left')
  32. ->where(['code'=>$cgdinfo['sequenceNo'],'b.type'=>5])
  33. ->order('a.id desc')
  34. ->value('creater','');
  35. $data[]=['type'=>'结算采购单付款标签','username'=> $uname,'orderCode'=>$cgdinfo['sequenceNo'],'companyName'=>$cgdinfo['companyName']];
  36. }
  37. PayInfo::CheckCgd($cgdinfo['sequenceNo'],$data);
  38. InvoiceOrder::CheckOrder($cgdinfo['sequenceNo'],$data);
  39. }
  40. }
  41. }