1
0

goodghModel.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. //物品归还
  3. class flow_goodghClassModel extends flowModel
  4. {
  5. public function initModel()
  6. {
  7. $this->goodsobj = m('goods');
  8. }
  9. //标识已完成了审核归还
  10. protected function flowcheckfinsh($zt)
  11. {
  12. if($zt!=1)return;
  13. $mid = $this->rs['custid'];
  14. m('goodn')->update('`lygh`=2','`mid`='.$mid.' and `lygh`=1');
  15. }
  16. //作废或删除时
  17. protected function flowzuofeibill($sm)
  18. {
  19. //删除出库详情的
  20. m('goodss')->delete("`mid`='$this->id'");
  21. }
  22. //子表数据替换处理
  23. protected function flowsubdata($rows, $lx=0){
  24. foreach($rows as $k=>$rs){
  25. $one = $this->goodsobj->getone($rs['aid']);
  26. if($one){
  27. $name = $one['name'];
  28. if(!isempt($one['xinghao']))$name.='('.$one['xinghao'].')';
  29. if($lx==1){
  30. $rows[$k]['aid'] = $name;
  31. }
  32. $rows[$k]['unit'] = $one['unit'];
  33. $rows[$k]['temp_aid'] = $name;
  34. }
  35. }
  36. return $rows;
  37. }
  38. //$lx,0默认,1详情展示,2列表显示
  39. public function flowrsreplace($rs, $lx=0)
  40. {
  41. $rs['states']= $rs['state'];
  42. $rs['state'] = $this->goodsobj->crkstate($rs['state'],0);
  43. //读取物品
  44. if($lx==2){
  45. $rs['wupinlist'] = $this->goodsobj->getgoodninfo($rs['id'], 1);
  46. }
  47. if($lx==1){
  48. $url = $this->getxiangurl('goodly', $rs['custid'], 'auto');
  49. $rs['custname'] = '<a href="'.$url.'"><u>'.$rs['custname'].'</u></a>';
  50. }
  51. return $rs;
  52. }
  53. }
粤ICP备19079148号