1
0

mode_tovoidAction.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. class mode_tovoidClassAction extends inputAction{
  3. protected function savebefore($table, $arr, $id, $addbo){
  4. $tonum = $arr['tonum'];
  5. if(m($table)->rows("`id`<>$id and `tonum`='$tonum'")>0)return '此单据已申请过了';
  6. }
  7. protected function saveafter($table, $arr, $id, $addbo){
  8. }
  9. //读取可作废的单据是,申请日期只能是30天内的单据
  10. public function modebill()
  11. {
  12. $dts = date('Y-m-d', time()-30*24*3600);
  13. $rows = $this->db->getrows('[Q]flow_bill',"`uid`='$this->adminid' and `status`=1 and `isdel`=0 and `applydt`>='$dts' group by `modeid`",'`modeid`,`modename`','optdt desc');
  14. $row = array();
  15. foreach($rows as $k=>$rs){
  16. $row[] = array(
  17. 'value' => $rs['modeid'],
  18. 'name' => $rs['modename'],
  19. );
  20. }
  21. return $row;
  22. }
  23. //获取作废单据
  24. public function gettonum()
  25. {
  26. $row = array();
  27. if($this->rs){
  28. $row[] = array(
  29. 'name' => $this->rs['tonum'],
  30. 'value' => $this->rs['tonum'],
  31. );
  32. }
  33. return $row;
  34. }
  35. /**
  36. * 联动获取
  37. */
  38. public function gettonumAjax()
  39. {
  40. $modeid = (int)$this->get('modeid');
  41. $dts = date('Y-m-d', time()-30*24*3600);
  42. $rows = $this->db->getrows('[Q]flow_bill',"`uid`='$this->adminid' and `modeid`='$modeid' and `status`=1 and `isdel`=0 and `applydt`>='$dts'",'`sericnum`','optdt desc');
  43. $row = array();
  44. foreach($rows as $k=>$rs){
  45. $row[] = array(
  46. 'name' => $rs['sericnum'],
  47. );
  48. }
  49. $this->returnjson($row);
  50. }
  51. }
粤ICP备19079148号