ReportCode.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace app\cxinv\model;
  3. class ReportCode extends Base
  4. {
  5. //设置字段信息
  6. protected $schema = [
  7. 'id' =>'bigint',//
  8. 'qrdNo' =>'varchar',//销售单号
  9. 'cgdNo' =>'varchar',//采购单号
  10. 'companyNo' =>'varchar',//业务企业
  11. 'companyName' =>'varchar',//业务公司
  12. 'supplierName' =>'varchar',//
  13. 'supplierNo' =>'varchar',//供应商
  14. 'customerName' =>'varchar',//
  15. 'customerNo' =>'varchar',//客户企业
  16. 'seller' =>'varchar',//销售员
  17. 'seller_id' =>'int',//
  18. 'cgder' =>'varchar',//采购员
  19. 'cgder_id' =>'int',//
  20. 'payNo' =>'varchar',//采购单对账编号
  21. 'DzNo' =>'varchar',//采购付款申请编号
  22. 'hpNo' =>'varchar',//采购单回票申请编号
  23. 'invNo' =>'varchar',//销售单开票编号
  24. 'tradNo' =>'varchar',//销售单资金编号
  25. 'logNo' =>'varchar',//销售单资金认领编号
  26. 'returnInv' =>'varchar',//销售单退票申请编号
  27. 'returnTrad' =>'varchar',//销售单退款申请编号
  28. ];
  29. public function addField($filed,$vale){
  30. $arr= explode(',',$this->$filed);
  31. if(!in_array($vale,$arr)) $this->$filed == '' ? $this->$filed =$vale : $this->$filed .=','.$vale;
  32. }
  33. public function rmField($filed,$vale){
  34. $arr= explode(',',$this->$filed);
  35. if(is_array($vale)){
  36. foreach ($vale as $v){
  37. if(in_array($v,$arr)){
  38. $key = array_search($v,$arr);
  39. unset($arr[$key]);
  40. }
  41. }
  42. }else{
  43. if(in_array($vale,$arr)){
  44. $key = array_search($vale,$arr);
  45. unset($arr[$key]);
  46. }
  47. }
  48. $this->$filed=implode(',',$arr);
  49. }
  50. public function __destruct(){
  51. $this->save();
  52. }
  53. }