qgorder.inc.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $pageindex = max(1, intval($_GPC['page']));
  5. $pagesize=8;
  6. $type=isset($_GPC['type'])?$_GPC['type']:'all';
  7. $where=" where a.uniacid=:uniacid and a.state!=1";
  8. $data[':uniacid']=$_W['uniacid'];
  9. if(isset($_GPC['keywords'])){
  10. $where.=" and (a.user_name LIKE concat('%', :name,'%') || a.order_num LIKE concat('%', :name,'%') || b.store_name LIKE concat('%', :name,'%'))";
  11. $data[':name']=$_GPC['keywords'];
  12. $type='all';
  13. }
  14. if($_GPC['time']){
  15. $start=$_GPC['time']['start'];
  16. $end=$_GPC['time']['end'];
  17. $where.=" and a.time >='{$start}' and a.time<='{$end}'";
  18. $type='all';
  19. }else{
  20. if($type=='now'){
  21. $where.=" and a.state=2";
  22. }
  23. if($type=='complete'){
  24. $where.=" and a.state=4";
  25. }
  26. if($type=='ok'){
  27. $where.=" and a.state=3";
  28. }
  29. }
  30. $sql="SELECT a.*,b.store_name as md_name FROM ".tablename('zhtc_qgorder'). " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id ".$where." ORDER BY a.id DESC";
  31. $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zhtc_qgorder'). " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id ".$where." ORDER BY a.id DESC",$data);
  32. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  33. $pager = pagination($total, $pageindex, $pagesize);
  34. $list=pdo_fetchall($select_sql,$data);
  35. //print_R($list);die;
  36. include $this->template('web/qgorder');