function pageindex($inPath) { $url = $this->getUrlParams($inPath); $page = $url['page'] ? (int) $url['page'] : 1; $categoryObj = new m_category(); $purchaseObj = new m_purchase(); $condition = "isdel = 0"; if ($_POST) { $key = base_Utils::getStr($_POST['key']); $cat_id = (int) $_POST['cat_id']; $condition .= " and goods_name like '%{$key}%' or goods_sn like '%{$key}%'"; if ($cat_id) { $condition .= " and cat_id = {$cat_id}"; } $this->params['key'] = $key; } $purchaseObj->setCount(true); $purchaseObj->setPage($page); $purchaseObj->setLimit(base_Constant::PAGE_SIZE); $purchase = $purchaseObj->select($condition, "", "", "order by id desc"); $this->params['purchase'] = $purchase->items; $this->params['pagebar'] = $this->PageBar($purchase->totalSize, base_Constant::PAGE_SIZE, $page, $inPath); $this->params['catelist'] = $categoryObj->getOrderCate(' '); return $this->render('purchase/index.html', $this->params); }
function pagesales($inPath) { $ymd = date('Y-m-d', time()); if ($_POST) { $purchaseObj = new m_purchase(); $condi = ''; $start = base_Utils::getStr($_POST['start']); $end = base_Utils::getStr($_POST['end']); if ($start) { $condi = "dateymd>={$start}"; $condi .= $end ? " and dateymd<={$end}" : " and dateymd<={$ymd}"; } $this->params['title'] = "进货统计"; $rs = $purchaseObj->select($condi, "dateymd,sum(in_num*in_price) as money", "group by dateymd")->items; $this->params['start'] = $start; $this->params['end'] = $end; $this->params['line'] = $this->linedata($rs); } return $this->render('statistics/sales.html', $this->params); }