PayInfo.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare (strict_types = 1);
  3. namespace app\admin\model;
  4. use think\Model;
  5. /**
  6. * @mixin \think\Model
  7. */
  8. class PayInfo extends Model
  9. {
  10. protected $createTime='addtime';
  11. protected $updateTime='updatetime';
  12. public function Comon(){
  13. return $this->belongsTo(ComonOrder::class,"cgdNo","cgdNo");
  14. }
  15. public static function CheckCgd($cgdNo,&$data){
  16. $payinfo=self::where(['cgdNo'=>$cgdNo,'status'=>1,'is_del'=>0])->findOrEmpty();
  17. if(!$payinfo->isEmpty()){
  18. $pay = Pay::where('payNo', $payinfo->payNo)->findOrEmpty();
  19. $data[]=['type'=>'采购对账单','username'=>$pay->apply_name,'orderCode'=>$pay->payNo,'companyName'=>$pay->companyName];
  20. $hp = PayInvoice::where(['payNo'=>$pay->payNo,'is_del'=>0,'status'=>[1,2,3,4]])
  21. ->column('hpNo,apply_name');
  22. if(!empty($hp)){
  23. foreach ($hp as $item){
  24. $data[]=['type'=>'采购对账单回票','username'=> $item['apply_name'],'orderCode'=>$item['hpNo'],'companyName'=>$pay->companyName];
  25. }
  26. }
  27. $paydz = PayPayment::where(['payNo'=>$pay->payNo,'is_del'=>0,'status'=>[1,2,3,4]])
  28. ->column('dzNo,apply_name');
  29. if(!empty($paydz)){
  30. foreach ($paydz as $item){
  31. $data[]=['type'=>'采购对账单付款','username'=> $item['apply_name'],'orderCode'=>$item['dzNo'],'companyName'=>$pay->companyName];
  32. }
  33. }
  34. }
  35. }
  36. }