PayInfo.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace app\cxinv\model;
  3. class PayInfo extends Base
  4. {
  5. //设置字段信息
  6. protected $schema = [
  7. 'id' =>'bigint',//
  8. 'cgdNo' =>'varchar',//采购单单号
  9. 'total_fee' =>'decimal',//采购单总金额
  10. 'apay_fee' =>'decimal',//已付金额
  11. 'wpay_fee' =>'decimal',//未付金额
  12. 'winv_fee' =>'decimal',//未开票金额
  13. 'ainv_fee' =>'decimal',//已开票金额
  14. 'payNo' =>'varchar',//付款编号
  15. 'status' =>'tinyint',//状态 正常1 解除0
  16. 'is_del' =>'tinyint',//是否删除
  17. 'addtime' =>'datetime',//
  18. 'updatetime' =>'datetime',//
  19. ];
  20. protected $createTime = 'addtime';
  21. protected $updateTime = 'updatetime';
  22. public static function CheckCgd($cgdNo,&$data){
  23. $payinfo=self::where(['cgdNo'=>$cgdNo,'status'=>1,'is_del'=>0])->findOrEmpty();
  24. if(!$payinfo->isEmpty()){
  25. $pay = Pay::where('payNo', $payinfo->payNo)->findOrEmpty();
  26. $data[]=['type'=>'采购对账单','username'=>$pay->apply_name,'orderCode'=>$pay->payNo,'companyName'=>$pay->companyName];
  27. $hp = PayInvoice::where(['payNo'=>$pay->payNo,'is_del'=>0,'status'=>[1,2,3,4]])
  28. ->column('hpNo,apply_name');
  29. if(!empty($hp)){
  30. foreach ($hp as $item){
  31. $data[]=['type'=>'采购对账单回票','username'=> $item['apply_name'],'orderCode'=>$item['hpNo'],'companyName'=>$pay->companyName];
  32. }
  33. }
  34. $paydz = PayPayment::where(['payNo'=>$pay->payNo,'is_del'=>0,'status'=>[1,2,3,4]])
  35. ->column('dzNo,apply_name');
  36. if(!empty($paydz)){
  37. foreach ($paydz as $item){
  38. $data[]=['type'=>'采购对账单付款','username'=> $item['apply_name'],'orderCode'=>$item['dzNo'],'companyName'=>$pay->companyName];
  39. }
  40. }
  41. }
  42. }
  43. }