Example #1
0
 /**
  * 获取出库单数据列表
  */
 public function act_getOutStoreList()
 {
     //查询条件初始化
     $conditions = array();
     $conditions[] = 'ioType=1';
     if (isset($_GET['type']) && !empty($_GET['type'])) {
         //$conditions[] = 'ioType=2';
     }
     if (isset($_GET['ordersn']) && !empty($_GET['ordersn'])) {
         $_ordersn = trim($_GET['ordersn']);
         if (preg_match("/^[a-z\\-]*[\\d]*\$/i", $_ordersn)) {
             $conditions[] = "ordersn='{$_ordersn}'";
         }
         unset($_ordersn);
     }
     if (isset($_GET['iostatus']) && !empty($_GET['iostatus'])) {
         $conditions[] = "ioStatus=" . intval($_GET['iostatus']);
     }
     if (isset($_GET['storeid']) && !empty($_GET['storeid'])) {
         $conditions[] = "storeId=" . intval($_GET['storeid']);
     }
     if (isset($_GET['invoicetypeid']) && !empty($_GET['invoicetypeid'])) {
         $conditions[] = "invoiceTypeId=" . intval($_GET['invoicetypeid']);
     }
     if (isset($_GET['cStartTime']) && !empty($_GET['cStartTime'])) {
         $startTime = strtotime(intval($_GET['cStartTime']) . ' 00:00:00');
         $conditions[] = "createdTime >='{$startTime}' ";
     }
     if (isset($_GET['cEndTime']) && !empty($_GET['cEndTime'])) {
         $endTime = strtotime(intval($_GET['cEndTime']) . ' 23:59:59');
         $conditions[] = "createdTime <='{$endTime}' ";
     }
     $where = 'WHERE ' . implode(' AND ', $conditions);
     $page = isset($_GET['page']) && intval($_GET['page']) > 0 ? intval($_GET['page']) : 1;
     $perpage = isset($_GET['perpage']) && !empty($_GET['perpage']) ? intval($_GET['perpage']) : 30;
     $sort = 'ORDER BY id DESC';
     $whIoStoreAct = new WhIoStoreModel();
     $total = $whIoStoreAct->getIOStoreCount($where);
     $page = new Page($total, $perpage, '', 'CN');
     $InStoreList = $whIoStoreAct->getInStoreList($where, $sort, $page->limit);
     $show_page = $total > $num ? $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9)) : $page->fpage(array(0, 2, 3));
     $invoiceTypeList = WhIoStoreModel::getInvoiceTypeListByioType(0);
     $InStoreList['pageinfo']['total'] = $total;
     $InStoreList['pageinfo']['perpage'] = $perpage;
     $InStoreList['pageinfo']['nowpage'] = $page;
     $InStoreList['pageinfo']['show_page'] = $show_page;
     $InStoreList['typelist'] = $invoiceTypeList;
     return $InStoreList;
 }