分单位统计增加按牛分单位功能

This commit is contained in:
wlx 2011-12-21 08:09:48 +00:00
parent 80feb1c2d3
commit b2d1803c00
2 changed files with 40 additions and 10 deletions

View File

@ -50,11 +50,28 @@ class Admin_StatController extends Zend_Controller_Action
function unitAction() function unitAction()
{ {
//各单位下载情况 $y = $this->_request->getParam('y');
$sql = "select count(d.id) as num,o.unit from dataorder d
left join offlineapp o on o.id=d.offlineappid if(!empty($y)||!is_numeric($y))
where d.offlineappid>0 and o.unit is not null and d.status>4 {
group by o.unit"; $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); $fe = $this->db->query($sql);
$unitoffline = $fe->fetchAll(); $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 $sql = "select count(d.id) as num,o.unit from dataorder d
left join onlineapp o on o.id=d.onlineappid left join onlineapp o on o.id=d.onlineappid
where d.onlineappid>0 and o.unit is not null where d.onlineappid>0 and o.unit is not null";
group by o.unit"; if ($y)
$sql.=" and extract(year from o.ts_created)='$y'";
$sql.=" group by o.unit";
$fe = $this->db->query($sql); $fe = $this->db->query($sql);
$unitonline = $fe->fetchAll(); $unitonline = $fe->fetchAll();

View File

@ -21,13 +21,24 @@
</div> </div>
<div id="rightPanel"> <div id="rightPanel">
<div class="cp"> <div class="cp">
<span>按年查看:</span>
<a href="/admin/stat/unit/">总体查看(默认)</a>
<a href="/admin/stat/unit/y/2004">2004</a>
<a href="/admin/stat/unit/y/2005">2005</a>
<a href="/admin/stat/unit/y/2006">2006</a>
<a href="/admin/stat/unit/y/2007">2007</a>
<a href="/admin/stat/unit/y/2008">2008</a>
<a href="/admin/stat/unit/y/2009">2009</a>
<a href="/admin/stat/unit/y/2010">2010</a>
<a href="/admin/stat/unit/y/2011">2011</a>
<a href="/admin/stat/unit/y/2012">2012</a>
</div> </div>
<div id="unitdata"> <div id="unitdata">
</div> </div>
<table style="float:left;"> <table style="float:left;">
<tr><td>单位名称</td><td>离线下载</td></tr> <tr><td>单位名称</td><td>离线申请次数</td></tr>
<?php <?php
foreach ($this->unitoffline as $k=>$v) foreach ($this->unitoffline as $k=>$v)
@ -40,7 +51,7 @@
?> ?>
</table> </table>
<table style="float:left;margin-left:20px;"> <table style="float:left;margin-left:20px;">
<tr><td>单位名称</td><td>在线下载</td></tr> <tr><td>单位名称</td><td>在线下载条数</td></tr>
<?php <?php
foreach ($this->unitonline as $k=>$v) foreach ($this->unitonline as $k=>$v)