longle.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class longle extends DooModel {
  4. public $lid;
  5. public $year;
  6. public $cid;
  7. public $category;
  8. public $status;
  9. public $statuslog;
  10. public $statusT;
  11. public $key_num;
  12. public $product;
  13. public $alloted_time;
  14. public $product_id;
  15. public $make_day;
  16. public $version;
  17. public $responsible;
  18. public $client;
  19. public $clientid;
  20. public $licences;
  21. public $SerialNumber;
  22. public $AuthorizeStr;
  23. public $AuthorizeFile;
  24. public $UpdateStr;
  25. public $UpdateFile;
  26. public $_table = 'CLD_longle';
  27. public $_primarykey = 'lid';
  28. public $_fields = array ('lid', 'year', 'cid','category','product_id', 'status','statuslog','statusT', 'key_num','SerialNumber','product','alloted_time', 'make_day','version', 'responsible','client','clientid'
  29. ,'licences' ,'AuthorizeStr','AuthorizeFile','UpdateStr','UpdateFile'
  30. );
  31. public function getLongleByStatus($year=0,$cid=0,$staff=0,$status=0,$search="",$productW=""){
  32. if(empty($search)){
  33. $str="( status=".$status." or statuslog like '%".$status."%' )";
  34. $str2=" and make_day like '%".$year."%'";
  35. $str3=" and cid =".$cid."";
  36. $str4=" and product like '%".$productW."%'";
  37. $str5=' and responsible="'.$staff.'"';
  38. if(empty($productW))
  39. $str4="";
  40. if($cid==0)
  41. $str3="";
  42. if($year==0)
  43. $str2="";
  44. if(empty($staff))
  45. $str5="";
  46. if($status==0)
  47. $str=" 1 ";
  48. //echo $str.$str2.$str3.$str4;
  49. // 'select * form CLD_longle as a left join CLD_client as b on (a.clientid =b.cid) where ( status=3 or statuslog like "%3%" ) and make_day like "%2015%" and cid =10';
  50. return $this->find ( array ('where' => $str.$str2.$str3.$str4.$str5, 'desc'=>'make_day', 'asArray' => TRUE ) );
  51. }else{
  52. return $this->find ( array ('where' => " key_num like '%".$search."%'",'desc'=>'make_day', 'asArray' => TRUE ) );
  53. }
  54. }
  55. public function getLongleReceive($cid,$status,$othercid=""){
  56. $str="";
  57. if(!empty($othercid))
  58. $str= " cid in (".$cid.",".$othercid." )";
  59. else
  60. $str= " cid in (".$cid." )";
  61. return $this->find ( array ('where' => $str." and (status=".$status." or responsible='') and make_day>='2019-01-01' ", 'asArray' => TRUE ) );
  62. }
  63. public function getLongleBykeynum($keynum){
  64. return $this->find ( array ('where' => " key_num = '".$keynum."'", 'asArray' => TRUE ) );
  65. }
  66. public function getLongleBykeynum2($keynum){
  67. return $this->find ( array ('where' => " key_num like '%".$keynum."%'",'limit'=>'10', 'asArray' => TRUE ) );
  68. }
  69. public function getLongleByKeyNumDetail($keynum,$SerialNumber=''){
  70. return $this->getOne ( array ('where' => " key_num = '".$keynum."' and SerialNumber like '".$SerialNumber."'", 'asArray' => TRUE ) );
  71. }
  72. public function getLongleByLid($lid){
  73. return $this->find ( array ('where' => " lid =".$lid, 'asArray' => TRUE ) );
  74. }
  75. public function getLongleByClient($clientname){
  76. return $this->find ( array ('where' => " client like '".$clientname."'", 'asArray' => TRUE ) );
  77. }
  78. public function getLongleBySerialNumber($SerialNumber){
  79. return $this->getOne ( array ('where' => " SerialNumber like '".$SerialNumber."'", 'asArray' => TRUE ) );
  80. }
  81. public function getLongleBySerialNumberList($SerialNumber){
  82. return $this->find ( array ('where' => " SerialNumber like '".$SerialNumber."'", 'asArray' => TRUE ) );
  83. }
  84. public function getLongleByClientid($client){
  85. return $this->find ( array ('where' => " clientid = '".$client."'", 'asArray' => TRUE ) );
  86. }
  87. // public function getLongleByRe($cid,$status=1){
  88. //
  89. // }
  90. public function getUser() {
  91. return $this->find ( array ('asc' => 'uid', 'asArray' => TRUE ) );
  92. }
  93. public function getUserByIdList($puid){
  94. return $this->find ( array ('where' => "uid= '".$puid."'", 'asArray' => TRUE ) );
  95. }
  96. }
  97. ?>