dmorder.inc.php 1.3 KB

12345678910111213141516171819202122232425
  1. <?php
  2. global $_GPC, $_W;
  3. $GLOBALS['frames'] = $this->getMainMenu();
  4. $operation = !empty($_GPC['op']) ? $_GPC['op'] : 'display';
  5. $pageindex = max(1, intval($_GPC['page']));
  6. $pagesize=10;
  7. $where=' WHERE a.uniacid=:uniacid and a.state=2';
  8. if($_GPC['keywords']){
  9. $op=$_GPC['keywords'];
  10. $where.=" and (b.store_name LIKE concat('%', :order_no,'%') or c.name LIKE concat('%', :order_no,'%'))";
  11. $data[':order_no']=$op;
  12. }
  13. if($_GPC['time']){
  14. $start=strtotime($_GPC['time']['start']);
  15. $end=strtotime($_GPC['time']['end']);
  16. $where.=" and unix_timestamp(a.time) >={$start} and unix_timestamp(a.time)<={$end}";
  17. }
  18. $sql="SELECT a.*,b.store_name,c.name as user_name FROM ".tablename('zhtc_dmorder') . " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id left join " . tablename("zhtc_user") . " c on a.user_id=c.id ".$where." ORDER BY a.id DESC";
  19. $data[':uniacid']=$_W['uniacid'];
  20. $total=pdo_fetchcolumn("SELECT count(*) FROM ".tablename('zhtc_dmorder') . " a" . " left join " . tablename("zhtc_store") . " b on a.store_id=b.id left join " . tablename("zhtc_user") . " c on a.user_id=c.id ".$where." ORDER BY a.id DESC",$data);
  21. $select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
  22. $list=pdo_fetchall($select_sql,$data);
  23. $pager = pagination($total, $pageindex, $pagesize);
  24. include $this->template('web/dmorder');