collectmModel.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. class flow_collectmClassModel extends flowModel
  3. {
  4. public function flowrsreplace($rs, $lx=0)
  5. {
  6. $state = $rs['state'];
  7. if($state=='0')$rs['state']='<font color=blue>待生成</font>';
  8. if($state=='1')$rs['state']='<font color=green>已生成</font>';
  9. $rs['fenleival'] = $rs['fenlei'];
  10. if($rs['fenlei']=='0')$rs['fenlei']='内部';
  11. if($rs['fenlei']=='1')$rs['fenlei']='<font color=blue>外部</font>';
  12. if($rs['fenleival']=='0'){
  13. $yixs = $this->rows('`type`=3 and `leixing`='.$rs['id'].' and `isturn`=1');
  14. $rs['leixing'] = ''.$rs['leixing'].'/'.$yixs.'';
  15. }
  16. return $rs;
  17. }
  18. //生成收集表格
  19. protected function flowoptmenu($ors, $crs)
  20. {
  21. if($ors['num']=='noupcreate' && $this->rs['fenlei']=='0'){
  22. $where = $this->adminmodel->gjoin($this->rs['runrenid'], 'ud', 'where');
  23. $where = '`status`=1 and `workdate`<=\''.substr($this->rs['startdt'],0,10).'\' and '.$where.'';
  24. $rows = $this->adminmodel->getall($where);
  25. $flow = m('flow')->initflow('collects');
  26. $shu = 0;
  27. foreach($rows as $k=>$rs){
  28. $shu++;
  29. $uarr = array(
  30. 'uid' => $rs['id'],
  31. 'optdt' => $this->rock->now,
  32. 'optid' => $rs['id'],
  33. 'optname' => $rs['name'],
  34. 'applydt' => $this->rock->date,
  35. 'status' => 0,
  36. 'type' => 3,
  37. 'isturn' => 0,
  38. 'comid' => $this->rs['comid'],
  39. 'name' => $this->rs['name'],
  40. 'startdt' => $this->rs['startdt'],
  41. 'enddt' => $this->rs['enddt'],
  42. 'leixing' => $this->id,
  43. 'psren' => $this->uname,
  44. 'psrenid' => $this->rs['uid'],
  45. );
  46. $mid = $flow->insert($uarr);
  47. $flow->loaddata($mid, false);
  48. $flow->submit('保存', $crs['sm']);
  49. $cont = '名称:'.$uarr['name'].'\n评审人:'.$uarr['psren'].'\n截止时间:'.$uarr['enddt'].'';
  50. $flow->pushs($rs['id'],$cont, '你有信息收集表待完成');
  51. }
  52. $this->update('`state`=1,`leixing`='.$shu.'', $this->id);
  53. }
  54. //复制
  55. if($ors['num']=='noupfuzhi'){
  56. $flow = m('flow')->initflow('collectm');
  57. $uarr = array(
  58. 'uid' => $this->adminid,
  59. 'optdt' => $this->rock->now,
  60. 'optid' => $this->adminid,
  61. 'optname' => $this->adminname,
  62. 'applydt' => $this->rock->date,
  63. 'status' => 0,
  64. 'state' => 0,
  65. 'type' => 2,
  66. 'isturn' => 0,
  67. 'comid' => $this->rs['comid'],
  68. 'name' => $this->rs['name'],
  69. 'startdt' => $this->rock->now,
  70. 'enddt' => date('Y-m-d H:i:s', time()+24*3600),
  71. 'leixing' => $this->rs['leixing'],
  72. 'runren' => $this->rs['runren'],
  73. 'runrenid' => $this->rs['runrenid'],
  74. 'explain' => $this->rs['explain'],
  75. 'fenlei' => $this->rs['fenlei'],
  76. );
  77. $mid = $flow->insert($uarr);
  78. $dsbs = m('plans');
  79. $zrows = $dsbs->getall('mid='.$this->id.'');
  80. foreach($zrows as $k=>$rs1){
  81. $iuarr = $rs1;
  82. unset($iuarr['id']);
  83. $iuarr['mid'] = $mid;
  84. $dsbs->insert($iuarr);
  85. }
  86. $flow->loaddata($mid, false);
  87. $flow->submit('保存', $crs['sm']);
  88. }
  89. }
  90. }
粤ICP备19079148号