sjqgorder.inc.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. global $_GPC, $_W;
  3. $storeid=$_COOKIE["storeid"];
  4. $cur_store = $this->getStoreById($storeid);
  5. $GLOBALS['frames'] = $this->getNaveMenu2($storeid);
  6. $pageindex = max(1, intval($_GPC['page']));
  7. $pagesize=10;
  8. $type=isset($_GPC['type'])?$_GPC['type']:'all';
  9. $where=" where a.uniacid=:uniacid and a.state!=1 and a.store_id=:store_id";
  10. $data[':uniacid']=$_W['uniacid'];
  11. $data[':store_id']=$storeid;
  12. if(isset($_GPC['keywords'])){
  13. $where.=" and (a.user_name LIKE concat('%', :name,'%') || a.order_num LIKE concat('%', :name,'%') || b.store_name LIKE concat('%', :name,'%'))";
  14. $data[':name']=$_GPC['keywords'];
  15. $type='all';
  16. }
  17. if($_GPC['time']){
  18. $start=$_GPC['time']['start'];
  19. $end=$_GPC['time']['end'];
  20. $where.=" and a.time >='{$start}' and a.time<='{$end}'";
  21. $type='all';
  22. }else{
  23. if($type=='now'){
  24. $where.=" and a.state=2";
  25. }
  26. if($type=='complete'){
  27. $where.=" and a.state=4";
  28. }
  29. if($type=='ok'){
  30. $where.=" and a.state=3";
  31. }
  32. }
  33. $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";
  34. $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);
  35. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  36. $pager = pagination($total, $pageindex, $pagesize);
  37. $list=pdo_fetchall($select_sql,$data);
  38. //print_R($list);die;
  39. include $this->template('web/sjqgorder');