From b2d1803c00699a68ff9ca85ba639270ed5d61966 Mon Sep 17 00:00:00 2001 From: wlx Date: Wed, 21 Dec 2011 08:09:48 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E5=8D=95=E4=BD=8D=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=89=E7=89=9B=E5=88=86=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/StatController.php | 33 +++++++++++++++---- .../admin/views/scripts/stat/unit.phtml | 17 ++++++++-- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/application/admin/controllers/StatController.php b/application/admin/controllers/StatController.php index 980a52fd..805544fc 100644 --- a/application/admin/controllers/StatController.php +++ b/application/admin/controllers/StatController.php @@ -50,11 +50,28 @@ class Admin_StatController extends Zend_Controller_Action function unitAction() { - //各单位下载情况 - $sql = "select count(d.id) as num,o.unit from dataorder d - left join offlineapp o on o.id=d.offlineappid - where d.offlineappid>0 and o.unit is not null and d.status>4 - group by o.unit"; + $y = $this->_request->getParam('y'); + + if(!empty($y)||!is_numeric($y)) + { + $n = date("Y",time()); + if($y<2004 || $y>$n) + { + $y=$n; + } + } + $this->view->y = $y; + + //各单位下载情况,统计的离线申请数据条数,需要有对应的dataorder记录 + /*$sql = "select count(d.id) as num,o.unit from dataorder d + left join offlineapp o on o.id=d.offlineappid + where d.offlineappid>0 and o.unit is not null and d.status>4";*/ + //各单位下载情况,统计的离线申请数据次数 + $sql = "select count(o.id) as num,o.unit from offlineapp o + where o.unit is not null "; + if ($y) + $sql.=" and extract(year from o.ts_created)='$y'"; + $sql.=" group by o.unit"; $fe = $this->db->query($sql); $unitoffline = $fe->fetchAll(); @@ -63,8 +80,10 @@ class Admin_StatController extends Zend_Controller_Action //各单位在线下载情况 $sql = "select count(d.id) as num,o.unit from dataorder d left join onlineapp o on o.id=d.onlineappid - where d.onlineappid>0 and o.unit is not null - group by o.unit"; + where d.onlineappid>0 and o.unit is not null"; + if ($y) + $sql.=" and extract(year from o.ts_created)='$y'"; + $sql.=" group by o.unit"; $fe = $this->db->query($sql); $unitonline = $fe->fetchAll(); diff --git a/application/admin/views/scripts/stat/unit.phtml b/application/admin/views/scripts/stat/unit.phtml index 88764e80..be2ff3f9 100644 --- a/application/admin/views/scripts/stat/unit.phtml +++ b/application/admin/views/scripts/stat/unit.phtml @@ -21,13 +21,24 @@
-
+
+按年查看: +总体查看(默认) + 2004 + 2005 + 2006 + 2007 + 2008 + 2009 + 2010 + 2011 + 2012
- + unitoffline as $k=>$v) @@ -40,7 +51,7 @@ ?>
单位名称离线下载
单位名称离线申请次数
- + unitonline as $k=>$v)
单位名称在线下载
单位名称在线下载条数