longle.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 $SerialNumber;
  21. public $_table = 'CLD_longle';
  22. public $_primarykey = 'lid';
  23. public $_fields = array ('lid', 'year', 'cid','category','product_id', 'status','statuslog','statusT', 'key_num','SerialNumber','product','alloted_time', 'make_day','version', 'responsible','client','clientid' );
  24. public function getLongleByStatus($year=0,$cid=0,$staff=0,$status=0,$search="",$productW=""){
  25. if(empty($search)){
  26. $str="( status=".$status." or statuslog like '%".$status."%' )";
  27. $str2=" and make_day like '%".$year."%'";
  28. $str3=" and cid =".$cid."";
  29. $str4=" and product like '%".$productW."%'";
  30. $str5=' and responsible="'.$staff.'"';
  31. if(empty($productW))
  32. $str4="";
  33. if($cid==0)
  34. $str3="";
  35. if($year==0)
  36. $str2="";
  37. if(empty($staff))
  38. $str5="";
  39. if($status==0)
  40. $str=" 1 ";
  41. //echo $str.$str2.$str3.$str4;
  42. // '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';
  43. return $this->find ( array ('where' => $str.$str2.$str3.$str4.$str5, 'asArray' => TRUE ) );
  44. }else{
  45. return $this->find ( array ('where' => " key_num like '%".$search."%'", 'asArray' => TRUE ) );
  46. }
  47. }
  48. public function getLongleReceive($cid,$status,$othercid=""){
  49. $str="";
  50. if(!empty($othercid))
  51. $str= " cid in (".$cid.",".$othercid." )";
  52. else
  53. $str= " cid in (".$cid." )";
  54. return $this->find ( array ('where' => $str." and status=".$status, 'asArray' => TRUE ) );
  55. }
  56. public function getLongleBykeynum($keynum){
  57. return $this->find ( array ('where' => " key_num = '".$keynum."'", 'asArray' => TRUE ) );
  58. }
  59. public function getLongleBykeynum2($keynum){
  60. return $this->find ( array ('where' => " key_num like '%".$keynum."%'",'limit'=>'10', 'asArray' => TRUE ) );
  61. }
  62. public function getLongleByLid($lid){
  63. return $this->find ( array ('where' => " lid =".$lid, 'asArray' => TRUE ) );
  64. }
  65. public function getLongleByClient($clientname){
  66. return $this->find ( array ('where' => " client like '".$clientname."'", 'asArray' => TRUE ) );
  67. }
  68. public function getLongleByClientid($client){
  69. return $this->find ( array ('where' => " clientid = '".$client."'", 'asArray' => TRUE ) );
  70. }
  71. // public function getLongleByRe($cid,$status=1){
  72. //
  73. // }
  74. public function getUser() {
  75. return $this->find ( array ('asc' => 'uid', 'asArray' => TRUE ) );
  76. }
  77. public function getUserByIdList($puid){
  78. return $this->find ( array ('where' => "uid= '".$puid."'", 'asArray' => TRUE ) );
  79. }
  80. }
  81. ?>