assetmlyModel.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. class flow_assetmlyClassModel extends flowModel
  3. {
  4. public function flowrsreplace($rs, $lx=0)
  5. {
  6. if($lx==2){
  7. $rows = $this->db->getall('select `pitem` from `[Q]plans` where `mid`='.$rs['id'].'');
  8. $s = '';
  9. foreach($rows as $k1=>$rs1)$s.=''.$rs1['pitem'].';';
  10. $rs['contentlist'] = $s;
  11. }
  12. $state = $rs['state'];
  13. if($state!='2'){
  14. if($rs['status']==1)$state = 1;
  15. }
  16. if($state != $rs['state'])$this->update('`state`='.$state.'', $rs['id']);
  17. if($state=='0')$rs['state']='待领取';
  18. if($state=='1')$rs['state']='已领取';
  19. if($state=='2')$rs['state']='已归还';
  20. return $rs;
  21. }
  22. //自定义审核人读取
  23. protected function flowcheckname($num){
  24. $sid = '';
  25. $sna = '';
  26. if($num=='queren'){
  27. $ssid = '';
  28. $runrenid = $this->rs['runrenid'];
  29. if(!isempt($runrenid)){
  30. $dbs = m('dept');
  31. $runa = explode(',', $runrenid);
  32. foreach($runa as $id1){
  33. $id1d = str_replace(array('d','u'),'', $id1);
  34. if(contain($id1,'d')){
  35. $drs = $dbs->getone($id1d);
  36. if($drs && !isempt($drs['headid']))$ssid.=','.$drs['headid'].'';
  37. }else{
  38. $ssid.=','.$id1d.'';
  39. }
  40. }
  41. }
  42. if($ssid){
  43. $ssid = substr($ssid, 1);
  44. $rows = $this->adminmodel->getall('id in('.$ssid.') and `status`=1');
  45. if($rows){
  46. foreach($rows as $k=>$rs){
  47. $sid.=','.$rs['id'].'';
  48. $sna.=','.$rs['name'].'';
  49. }
  50. $sid = substr($sid, 1);
  51. $sna = substr($sna, 1);
  52. }
  53. }
  54. }
  55. return array($sid, $sna);
  56. }
  57. //审批完成更新领用
  58. protected function flowcheckfinsh($zt)
  59. {
  60. if($zt==1){
  61. $rows = m('plans')->getall('`mid`='.$this->id.'');
  62. foreach($rows as $k=>$rs){
  63. m('assetm')->update(array(
  64. 'useid' => $this->rs['runrenid'],
  65. 'usename' => $this->rs['runren'],
  66. 'state' => 1
  67. ),$rs['itemid']);
  68. }
  69. $this->update('`state`=1', $this->id);
  70. }
  71. }
  72. //归还
  73. protected function flowoptmenu($ors, $crs)
  74. {
  75. if($ors['num']=='guihainoup'){
  76. $rows = m('plans')->getall('`mid`='.$this->id.'');
  77. foreach($rows as $k=>$rs){
  78. m('assetm')->update(array(
  79. 'useid' => '',
  80. 'usename' => '',
  81. 'state' => 0
  82. ),$rs['itemid']);
  83. }
  84. $this->update('`state`=2', $this->id);
  85. }
  86. }
  87. }
粤ICP备19079148号