goodghModel.php 1.4 KB

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