sealaplModel.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?php
  2. /**
  3. * 模块.印章申请
  4. */
  5. class flow_sealaplClassModel extends flowModel
  6. {
  7. protected function flowinit(){
  8. }
  9. //单据判断条件从写$lx类型,$uid用户Id
  10. protected function flowbillwhere($lx, $uid){
  11. return [
  12. 'order'=>'id desc'
  13. ];
  14. }
  15. //读取印章保管人来审批
  16. protected function flowcheckname($num)
  17. {
  18. // // 印章负责人
  19. // (select director from zqoa_seal where id = `seal_name`) is not null
  20. // if ($num == 'dept_process') {
  21. // $seal_info = m('seal')->getone("`id` = {$this->rs['seal_name']}");
  22. // if ($seal_info) {
  23. // $sid = $seal_info['director_id']; // 审核人Id
  24. // $sna = $seal_info['director']; // 审核人
  25. // return array($sid, $sna);
  26. // }
  27. //
  28. // }
  29. }
  30. //展示时替换一下
  31. public function flowrsreplace($rs, $lx=0)
  32. {
  33. $rs['date'] = $rs['applydt'];
  34. $rs['date_index'] = substr($rs['applydt'],0,4);
  35. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=1 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  36. $rs['dept_manager'] = $flow_info ? $flow_info['checkname'] : null;
  37. if (!empty($rs['opinion_dept'])) {
  38. $dept = $rs['opinion_dept'];
  39. if ($dept == 1) {
  40. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  41. $rs['advice_level1_applyer'] = $flow_info ? $flow_info['checkname'] : null;
  42. } else if ($dept == 2) {
  43. } else if ($dept == 3) {
  44. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  45. $rs['advice_level3_applyer'] = $flow_info ? $flow_info['checkname'] : null;
  46. } else if ($dept == 4) {
  47. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=3 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  48. $rs['advice_level4_applyer'] = $flow_info ? $flow_info['checkname'] : null;
  49. }
  50. }
  51. $flow_info = $this->flogmodel->getone("mid={$rs['id']} and step=2 and status=1 and `table` = 'sealapl'", 'checkname', 'id desc');
  52. $rs['office_applyer'] = $flow_info ? $flow_info['checkname'] : null;
  53. $seal = m('seal')->getone("id = {$rs['seal_name']}");
  54. $rs['office_applyer1'] = $seal['specialized'];
  55. $rs['seal_name'] = m('seal')->getone("id = {$rs['seal_name']}")['name'];
  56. $rs['opinion_relay'] = str_replace($rs['opinion_relay'], '\n', '<br />');
  57. return $rs;
  58. }
  59. public function inputtitle()
  60. {
  61. return "枣泉煤矿用印审批表";
  62. }
  63. protected function flowdatalog($arr)
  64. {
  65. $arr['title'] = $this->inputtitle();
  66. return $arr;
  67. }
  68. // $ors当前单据操作信息,$crs提交过来的信息
  69. public function flowoptmenu($ors, $crs)
  70. {
  71. if ($ors['num'] == 'dept_process') {
  72. }
  73. }
  74. //审核之前调用$zt 状态, $sm说明
  75. protected function flowcheckbefore($zt, $sm, $ufied){
  76. if ($zt == 1) {
  77. if ($this->nowcourse['step'] == 3 && $this->nowcourse['name'] == '负责部门审批') {
  78. $opinion_dept = $this->rs['opinion_dept'];
  79. if ($opinion_dept == 1) {
  80. m('sealapl')->update(["advice_level1"=>$sm],"id={$this->id}");
  81. } else if ($opinion_dept == 2) {
  82. m('sealapl')->update(["advice_level2"=>$sm],"id={$this->id}");
  83. } else if ($opinion_dept == 3) {
  84. m('sealapl')->update(["advice_level3"=>$sm],"id={$this->id}");
  85. } else if ($opinion_dept == 4) {
  86. m('sealapl')->update(["advice_level4"=>$sm],"id={$this->id}");
  87. }
  88. }
  89. }
  90. }
  91. }