qggoodall.inc.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $type2=isset($_GPC['type'])?$_GPC['type']:'all';
  5. $where=" WHERE a.uniacid=:uniacid";
  6. $data[':uniacid']=$_W['uniacid'];
  7. if($_GPC['keywords']){
  8. $where .=" and (a.name LIKE :name || c.store_name LIKE :name)";
  9. $op=$_GPC['keywords'];
  10. $data[':name']="%$op%";
  11. }
  12. if($_GPC['type_id']){
  13. $where .=" and a.type_id=:type_id";
  14. $data[':type_id']=$_GPC['type_id'];
  15. }
  16. if($_GPC['is_shelves2']){
  17. $where .=" and a.state=:cid";
  18. $data[':cid']=$_GPC['is_shelves2'];
  19. }
  20. if($_GPC['is_tg']){
  21. $where.=" and a.is_tg={$_GPC['is_tg']} ";
  22. }
  23. $pageindex = max(1, intval($_GPC['page']));
  24. $pagesize=10;
  25. $sql="select a.* ,b.name as type_name,c.store_name from " . tablename("zhtc_qggoods") . " a" . " left join " . tablename("zhtc_qgtype") . " b on b.id=a.type_id left join " . tablename("zhtc_store") . " c on c.id=a.store_id ".$where." order by num asc";
  26. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  27. $list = pdo_fetchall($select_sql,$data);
  28. $total=pdo_fetchcolumn("select count(*) from " . tablename("zhtc_qggoods") . " a" . " left join " . tablename("zhtc_qgtype") . " b on b.id=a.type_id left join " . tablename("zhtc_store") . " c on c.id=a.store_id ".$where,$data);
  29. $pager = pagination($total, $pageindex, $pagesize);
  30. $type=pdo_getall('zhtc_qgtype',array('uniacid'=>$_W['uniacid']));
  31. if($_GPC['op']=='del'){
  32. $res=pdo_delete('zhtc_qggoods',array('id'=>$_GPC['id']));
  33. if($res){
  34. message('删除成功',$this->createWebUrl('qggoodall',array()),'success');
  35. }else{
  36. message('删除失败','','error');
  37. }
  38. }
  39. if($_GPC['state']){
  40. $res=pdo_update('zhtc_qggoods',array('state'=>$_GPC['state']),array('id'=>$_GPC['id']));
  41. if($res){
  42. message('编辑成功',$this->createWebUrl('qggoodall',array()),'success');
  43. }else{
  44. message('编辑失败','','error');
  45. }
  46. }
  47. if($_GPC['state2']){
  48. $res=pdo_update('zhtc_qggoods',array('state2'=>$_GPC['state2']),array('id'=>$_GPC['id']));
  49. if($res){
  50. message('编辑成功',$this->createWebUrl('qggoodall',array()),'success');
  51. }else{
  52. message('编辑失败','','error');
  53. }
  54. }
  55. if($_GPC['sh']){
  56. $res=pdo_update('zhtc_qggoods',array('is_tg'=>$_GPC['sh']),array('id'=>$_GPC['id']));
  57. if($res){
  58. message('编辑成功',$this->createWebUrl('qggoodall',array()),'success');
  59. }else{
  60. message('编辑失败','','error');
  61. }
  62. }
  63. include $this->template('web/qggoodall');