Merge branch 'master' of git@github.com:easysoft/zentaopms
This commit is contained in:
@@ -28,12 +28,18 @@ class report extends control
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function projectDeviation()
|
||||
public function projectDeviation($begin = 0, $end = 0)
|
||||
{
|
||||
$begin = $begin ? date('Y-m-d', strtotime($begin)) : date('Y-m-d', strtotime('last month', strtotime(date('Y-m',time()) . '-01 00:00:01')));
|
||||
$end = $end ? date('Y-m-d', strtotime($end)) : date('Y-m-d', strtotime('now'));
|
||||
|
||||
$this->view->title = $this->lang->report->projectDeviation;
|
||||
$this->view->position[] = $this->lang->report->projectDeviation;
|
||||
$this->view->projects = $this->report->getProjects();
|
||||
$this->view->submenu = 'project';
|
||||
|
||||
$this->view->projects = $this->report->getProjects($begin, $end);
|
||||
$this->view->begin = $begin;
|
||||
$this->view->end = $end;
|
||||
$this->view->submenu = 'project';
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,5 +30,4 @@ td .deviation{padding-left:20px; text-align:left;}
|
||||
.d0{color:#76B043;}
|
||||
.d20{color:#33A52E;}
|
||||
|
||||
#titlebar {display: none}
|
||||
#conditions{ padding: 10px; margin: 0 0 10px; border: 1px solid #ddd;}
|
||||
|
||||
23
module/report/js/projectdeviation.js
Normal file
23
module/report/js/projectdeviation.js
Normal file
@@ -0,0 +1,23 @@
|
||||
function changeDate(begin, end)
|
||||
{
|
||||
if(begin.indexOf('-') != -1)
|
||||
{
|
||||
var beginarray = begin.split("-");
|
||||
var begin = '';
|
||||
for(i=0 ; i < beginarray.length ; i++)
|
||||
{
|
||||
begin = begin + beginarray[i];
|
||||
}
|
||||
}
|
||||
if(end.indexOf('-') != -1)
|
||||
{
|
||||
var endarray = end.split("-");
|
||||
var end = '';
|
||||
for(i=0 ; i < endarray.length ; i++)
|
||||
{
|
||||
end = end + endarray[i];
|
||||
}
|
||||
}
|
||||
link = createLink('report', 'projectdeviation', 'begin=' + begin + '&end=' + end);
|
||||
location.href=link;
|
||||
}
|
||||
@@ -67,12 +67,11 @@ class reportModel extends model
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function getProjects()
|
||||
public function getProjects($begin = 0, $end = 0)
|
||||
{
|
||||
$projects = array();
|
||||
|
||||
$tasks = $this->dao->select('t1.*')
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
$tasks = $this->dao->select('t1.*')->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')
|
||||
->on('t1.project = t2.id')
|
||||
->where('t1.status')->ne('cancel')
|
||||
@@ -85,44 +84,13 @@ class reportModel extends model
|
||||
|
||||
$projects[$task->project]->estimate = isset($projects[$task->project]->estimate) ? $projects[$task->project]->estimate + $task->estimate : $task->estimate;
|
||||
$projects[$task->project]->consumed = isset($projects[$task->project]->consumed) ? $projects[$task->project]->consumed + $task->consumed : $task->consumed;
|
||||
$projects[$task->project]->tasks = isset($projects[$task->project]->tasks) ? $projects[$task->project]->tasks + 1 : 1;
|
||||
if($task->type == 'devel') $projects[$task->project]->devConsumed = isset($projects[$task->project]->devConsumed) ? $projects[$task->project]->devConsumed + $task->consumed : $task->consumed;
|
||||
if($task->type == 'test') $projects[$task->project]->testConsumed = isset($projects[$task->project]->testConsumed) ? $projects[$task->project]->testConsumed + $task->consumed : $task->consumed;
|
||||
}
|
||||
|
||||
$bugs = $this->dao->select('t1.project')
|
||||
->from(TABLE_BUG)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')
|
||||
->on('t1.project = t2.id')
|
||||
->where('t1.deleted')->eq(0)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
$projectList = $this->dao->select('id, name, status')->from(TABLE_PROJECT)
|
||||
->where('1=1')
|
||||
->beginIF($begin)->andWhere('begin')->ge($begin)->fi()
|
||||
->beginIF($end)->andWhere('end')->le($end)->fi()
|
||||
->fetchAll();
|
||||
foreach($bugs as $bug)
|
||||
{
|
||||
if($bug->project)
|
||||
{
|
||||
if(!isset($projects[$bug->project]))$projects[$bug->project] = new stdclass();
|
||||
$projects[$bug->project]->bugs = isset($projects[$bug->project]->bugs) ? $projects[$bug->project]->bugs + 1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
$stories = $this->dao->select('t1.project')
|
||||
->from(TABLE_PROJECTSTORY)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')
|
||||
->on('t1.project = t2.id')
|
||||
->leftJoin(TABLE_STORY)->alias('t3')
|
||||
->on('t1.story = t3.id')
|
||||
->where('t2.deleted')->eq(0)
|
||||
->andWhere('t3.deleted')->eq(0)
|
||||
->fetchAll();
|
||||
foreach($stories as $story)
|
||||
{
|
||||
if(!isset($projects[$story->project])) $projects[$story->project] = new stdclass();
|
||||
|
||||
$projects[$story->project]->stories = isset($projects[$story->project]->stories) ? $projects[$story->project]->stories + 1 : 1;
|
||||
}
|
||||
|
||||
$projectList = $this->dao->select('id, name, status')->from(TABLE_PROJECT)->fetchAll();
|
||||
$projectPairs = array();
|
||||
foreach($projectList as $project)
|
||||
{
|
||||
@@ -136,10 +104,6 @@ class reportModel extends model
|
||||
unset($projects[$id]);
|
||||
continue;
|
||||
}
|
||||
if(!isset($project->stories)) $projects[$id]->stories = 0;
|
||||
if(!isset($project->bugs)) $projects[$id]->bugs = 0;
|
||||
if(!isset($project->devConsumed)) $projects[$id]->devConsumed = 0;
|
||||
if(!isset($project->testConsumed)) $projects[$id]->testConsumed = 0;
|
||||
if(!isset($project->consumed)) $projects[$id]->consumed = 0;
|
||||
if(!isset($project->estimate)) $projects[$id]->estimate = 0;
|
||||
$projects[$id]->name = $projectPairs[$id];
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php include '../../common/view/header.html.php';?>
|
||||
<?php include '../../common/view/datepicker.html.php';?>
|
||||
<div id='titlebar'>
|
||||
<div class='heading'>
|
||||
<span class='prefix'><?php echo html::icon($lang->icons['report-file']);?></span>
|
||||
@@ -14,21 +15,20 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class='main'>
|
||||
<div class='input-group w-300px input-group-sm'>
|
||||
<div class='datepicker-wrapper datepicker-date'><?php echo html::input('date', $begin, "class='w-100px form-control form-date' onchange='changeDate(this.value, \"$end\")'");?></div>
|
||||
<span class='input-group-addon'><?php echo $lang->report->to;?></span>
|
||||
<div class='datepicker-wrapper datepicker-date'><?php echo html::input('date', $end, "class='form-control form-date' onchange='changeDate(\"$begin\", this.value)'");?></div>
|
||||
</div>
|
||||
<table class='table table-condensed table-striped table-bordered tablesorter table-fixed active-disabled'>
|
||||
<thead>
|
||||
<tr class='colhead'>
|
||||
<th class='w-id'><?php echo $lang->report->id;?></th>
|
||||
<th class="w-200px"><?php echo $lang->report->project;?></th>
|
||||
<th><?php echo $lang->report->task;?></th>
|
||||
<th><?php echo $lang->report->stories;?></th>
|
||||
<th><?php echo $lang->report->bugs;?></th>
|
||||
<th><?php echo $lang->report->devConsumed;?></th>
|
||||
<th><?php echo $lang->report->testConsumed;?></th>
|
||||
<th><?php echo $lang->report->devTestRate;?></th>
|
||||
<th><?php echo $lang->report->estimate;?></th>
|
||||
<th><?php echo $lang->report->consumed;?></th>
|
||||
<th><?php echo $lang->report->deviation;?></th>
|
||||
<th><?php echo $lang->report->deviationRate;?></th>
|
||||
<th><?php echo $lang->report->project;?></th>
|
||||
<th class="w-100px"><?php echo $lang->report->estimate;?></th>
|
||||
<th class="w-100px"><?php echo $lang->report->consumed;?></th>
|
||||
<th class="w-100px"><?php echo $lang->report->deviation;?></th>
|
||||
<th class="w-100px"><?php echo $lang->report->deviationRate;?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -36,18 +36,6 @@
|
||||
<tr class="a-center">
|
||||
<td><?php echo $id;?></td>
|
||||
<td align="left"><?php echo html::a($this->createLink('project', 'view', "projectID=$id"), $project->name);?></td>
|
||||
<td><?php echo isset($project->tasks) ? $project->tasks : 0;?></td>
|
||||
<td><?php echo isset($project->stories) ? $project->stories : 0;?></td>
|
||||
<td><?php echo isset($project->bugs) ? $project->bugs : 0;?></td>
|
||||
<?php
|
||||
$project->devConsumed = isset($project->devConsumed) ? $project->devConsumed : 0;
|
||||
$project->testConsumed = isset($project->testConsumed) ? $project->testConsumed : 0;
|
||||
$project->estimate = isset($project->estimate) ? $project->estimate : 0;
|
||||
$project->consumed = isset($project->consumed) ? $project->consumed : 0;
|
||||
?>
|
||||
<td><?php echo $project->devConsumed;?></td>
|
||||
<td><?php echo $project->testConsumed;?></td>
|
||||
<td><?php echo round($project->devConsumed / (($project->testConsumed < 1) ? 1 : $project->testConsumed), 1);?></td>
|
||||
<td><?php echo $project->estimate;?></td>
|
||||
<td><?php echo $project->consumed;?></td>
|
||||
<?php $deviation = $project->consumed - $project->estimate;?>
|
||||
|
||||
Reference in New Issue
Block a user