* Move workestimation.

This commit is contained in:
Yagami
2021-02-25 13:11:40 +08:00
parent 2c75e1bd67
commit cd59ba3da3
16 changed files with 1 additions and 420 deletions
+1 -1
View File
@@ -1245,7 +1245,7 @@ class block extends control
*/
public function printWaterfallEstimateBlock()
{
if(isset($this->config->maxVersion)) $this->app->loadLang('durationestimation');
$this->app->loadLang('durationestimation');
$programID = $this->session->PRJ;
$members = $this->loadModel('project')->getTeamMemberPairs($programID);
$budget = $this->loadModel('workestimation')->getBudget($programID);
@@ -1,13 +1,11 @@
<style> .block-waterfallestimate table{margin-bottom: 15px} </style>
<table class='table table-data'>
<?php if(isset($config->maxVersion)):?>
<tr>
<th class='w-100px'><?php echo $lang->durationestimation->people;?></th>
<td><?php echo $people ? $people : 0;?></td>
<th class='w-80px'><?php echo $lang->durationestimation->members;?></th>
<td><?php echo $members;?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->workestimation->duration;?></th>
<td><?php echo zget($budget, 'duration', 0);?></td>
-9
View File
@@ -60,12 +60,9 @@ $lang->moduleOrder[190] = 'backup';
$lang->moduleOrder[195] = 'cron';
$lang->moduleOrder[200] = 'dev';
$lang->moduleOrder[205] = 'message';
$lang->moduleOrder[210] = 'design';
$lang->moduleOrder[215] = 'programplan';
$lang->moduleOrder[235] = 'budget';
$lang->moduleOrder[240] = 'workestimation';
$lang->resource = new stdclass();
@@ -1191,12 +1188,6 @@ $lang->company->methodOrder[5] = 'browse';
$lang->company->methodOrder[15] = 'edit';
$lang->company->methodOrder[25] = 'dynamic';
/* Work estimation. */
$lang->resource->workestimation = new stdclass();
$lang->resource->workestimation->index = 'index';
$lang->workestimation->methodOrder[0] = 'index';
/* Budget. */
$lang->resource->budget = new stdclass();
$lang->resource->budget->browse = 'browse';
-4
View File
@@ -1,4 +0,0 @@
<?php
$config->workestimation = new stdclass;
$config->workestimation->index = new stdclass;
$config->workestimation->index->requiredFields = 'scale,productivity,duration,unitLaborCost,totalLaborCost';
-52
View File
@@ -1,52 +0,0 @@
<?php
/**
* The control file of workestimation module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package workestimation
* @version $Id
* @link http://www.zentao.net
*/
class workestimation extends control
{
/**
* Project workload estimations.
*
* @param int $projectID
* @access public
* @return void
*/
public function index($projectID = 0)
{
$projectID = $projectID ? $projectID : $this->session->PRJ;
if($_POST)
{
$result = $this->workestimation->save($projectID);
if($result) $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->server->http_referer));
$this->send(array('result' => 'fail', 'message' => dao::getError()));
}
$scale = $this->workestimation->getProjectScale($projectID);
$budget = $this->workestimation->getBudget($projectID);
if(!isset($this->config->project)) $this->config->project = new stdclass();
if(empty($budget))
{
$this->app->loadConfig('estimate');
$budget = new stdclass();
$budget->scale = $scale;
$budget->productivity = zget($this->config->custom, 'efficiency', '');
$budget->unitLaborCost = zget($this->config->custom, 'cost', '');
$budget->dayHour = zget($this->config->project, 'defaultWorkhours', '');
}
$this->view->title = $this->lang->workestimation->common;
$this->view->position[] = $this->lang->workestimation->common;
$this->view->hourPoint = $this->config->custom->hourPoint;
$this->view->scale = $scale;
$this->view->budget = $budget;
$this->display();
}
}
-22
View File
@@ -1,22 +0,0 @@
<?php
$lang->workestimation->common = 'Workload Estimation';
$lang->workestimation->budget = 'Estimate';
$lang->workestimation->index = 'Overview';
$lang->workestimation->scale = 'Scale';
$lang->workestimation->productivity = 'Productivity';
$lang->workestimation->duration = 'Total Estimation';
$lang->workestimation->unitLaborCost = 'Unit Labour cost';
$lang->workestimation->totalLaborCost = 'Estimated Labor Cost';
$lang->workestimation->dayHour = 'Daily Man-hours';
$lang->workestimation->hour = 'Man-hour';
$lang->workestimation->consumed = 'Cost Man-hours';
$lang->workestimation->scaleTip = "Actual scale of current project: <strong>%s{$lang->hourCommon}</strong> <a href='###' id='useScale' class='btn btn-xs'> uses </span>";
$lang->workestimation->tips = 'Estimate the duration of the project only after the estimate of the workload has been completed';
$lang->workestimation->placeholder = new stdclass();
$lang->workestimation->placeholder->scale = '';
$lang->workestimation->placeholder->productivity = '';
$lang->workestimation->placeholder->duration = '';
$lang->workestimation->placeholder->unitLaborCost = '';
$lang->workestimation->placeholder->totalLaborCost = '';
-22
View File
@@ -1,22 +0,0 @@
<?php
$lang->workestimation->common = 'Workload Estimation';
$lang->workestimation->budget = 'Estimate';
$lang->workestimation->index = 'Overview';
$lang->workestimation->scale = 'Scale';
$lang->workestimation->productivity = 'Productivity';
$lang->workestimation->duration = 'Total Estimation';
$lang->workestimation->unitLaborCost = 'Unit Labour cost';
$lang->workestimation->totalLaborCost = 'Estimated Labor Cost';
$lang->workestimation->dayHour = 'Daily Man-hours';
$lang->workestimation->hour = 'Man-hour';
$lang->workestimation->consumed = 'Cost Man-hours';
$lang->workestimation->scaleTip = "Actual scale of current project: <strong>%s{$lang->hourCommon}</strong> <a href='###' id='useScale' class='btn btn-xs'> uses </span>";
$lang->workestimation->tips = 'Estimate the duration of the project only after the estimate of the workload has been completed';
$lang->workestimation->placeholder = new stdclass();
$lang->workestimation->placeholder->scale = '';
$lang->workestimation->placeholder->productivity = '';
$lang->workestimation->placeholder->duration = '';
$lang->workestimation->placeholder->unitLaborCost = '';
$lang->workestimation->placeholder->totalLaborCost = '';
-22
View File
@@ -1,22 +0,0 @@
<?php
$lang->workestimation->common = 'Workload Estimation';
$lang->workestimation->budget = 'Estimate';
$lang->workestimation->index = 'Overview';
$lang->workestimation->scale = 'Scale';
$lang->workestimation->productivity = 'Productivity';
$lang->workestimation->duration = 'Total Estimation';
$lang->workestimation->unitLaborCost = 'Unit Labour cost';
$lang->workestimation->totalLaborCost = 'Estimated Labor Cost';
$lang->workestimation->dayHour = 'Daily Man-hours';
$lang->workestimation->hour = 'Man-hour';
$lang->workestimation->consumed = 'Cost Man-hours';
$lang->workestimation->scaleTip = "Actual scale of current project: <strong>%s{$lang->hourCommon}</strong> <a href='###' id='useScale' class='btn btn-xs'> uses </span>";
$lang->workestimation->tips = 'Estimate the duration of the project only after the estimate of the workload has been completed';
$lang->workestimation->placeholder = new stdclass();
$lang->workestimation->placeholder->scale = '';
$lang->workestimation->placeholder->productivity = '';
$lang->workestimation->placeholder->duration = '';
$lang->workestimation->placeholder->unitLaborCost = '';
$lang->workestimation->placeholder->totalLaborCost = '';
-22
View File
@@ -1,22 +0,0 @@
<?php
$lang->workestimation->common = 'Workload Estimation';
$lang->workestimation->budget = 'Estimate';
$lang->workestimation->index = 'Overview';
$lang->workestimation->scale = 'Scale';
$lang->workestimation->productivity = 'Productivity';
$lang->workestimation->duration = 'Total Estimation';
$lang->workestimation->unitLaborCost = 'Unit Labour cost';
$lang->workestimation->totalLaborCost = 'Estimated Labor Cost';
$lang->workestimation->dayHour = 'Daily Man-hours';
$lang->workestimation->hour = 'Man-hour';
$lang->workestimation->consumed = 'Cost Man-hours';
$lang->workestimation->scaleTip = "Actual scale of current project: <strong>%s{$lang->hourCommon}</strong> <a href='###' id='useScale' class='btn btn-xs'> uses </span>";
$lang->workestimation->tips = 'Estimate the duration of the project only after the estimate of the workload has been completed';
$lang->workestimation->placeholder = new stdclass();
$lang->workestimation->placeholder->scale = '';
$lang->workestimation->placeholder->productivity = '';
$lang->workestimation->placeholder->duration = '';
$lang->workestimation->placeholder->unitLaborCost = '';
$lang->workestimation->placeholder->totalLaborCost = '';
-22
View File
@@ -1,22 +0,0 @@
<?php
$lang->workestimation->common = '工作量估算';
$lang->workestimation->budget = '估算';
$lang->workestimation->index = '总览';
$lang->workestimation->scale = '规模';
$lang->workestimation->productivity = '生产率';
$lang->workestimation->duration = '估算总工时';
$lang->workestimation->unitLaborCost = '单位人工成本';
$lang->workestimation->totalLaborCost = '估算人工成本';
$lang->workestimation->dayHour = '每日工时';
$lang->workestimation->hour = '工时';
$lang->workestimation->consumed = '已消耗工时';
$lang->workestimation->scaleTip = "当前项目实际规模:<strong>%s{$lang->hourCommon}</strong> <a href='###' id='useScale' class='btn btn-xs'>使用</span>";
$lang->workestimation->tips = '完成工作量估算后,才能进行工期估算';
$lang->workestimation->placeholder = new stdclass();
$lang->workestimation->placeholder->scale = '';
$lang->workestimation->placeholder->productivity = '';
$lang->workestimation->placeholder->duration = '';
$lang->workestimation->placeholder->unitLaborCost = '';
$lang->workestimation->placeholder->totalLaborCost = '';
-22
View File
@@ -1,22 +0,0 @@
<?php
$lang->workestimation->common = '工作量估算';
$lang->workestimation->budget = '估算';
$lang->workestimation->index = '總覽';
$lang->workestimation->scale = '規模';
$lang->workestimation->productivity = '生產率';
$lang->workestimation->duration = '估算總工時';
$lang->workestimation->unitLaborCost = '單位人工成本';
$lang->workestimation->totalLaborCost = '估算人工成本';
$lang->workestimation->dayHour = '每日工時';
$lang->workestimation->hour = '工時';
$lang->workestimation->consumed = '已消耗工時';
$lang->workestimation->scaleTip = "當前項目實際規模:<strong>%s{$lang->hourCommon}</strong> <a href='###' id='useScale' class='btn btn-xs'>使用</span>";
$lang->workestimation->tips = '完成工作量估算後,才能進行工期估算';
$lang->workestimation->placeholder = new stdclass();
$lang->workestimation->placeholder->scale = '';
$lang->workestimation->placeholder->productivity = '';
$lang->workestimation->placeholder->duration = '';
$lang->workestimation->placeholder->unitLaborCost = '';
$lang->workestimation->placeholder->totalLaborCost = '';
-63
View File
@@ -1,63 +0,0 @@
<?php
/**
* The model file of workestimation module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package workestimation
* @version $Id
* @link http://www.zentao.net
*/
class workestimationModel extends model
{
/**
* Get a budget.
*
* @param int $projectID
* @access public
* @return array
*/
public function getBudget($projectID)
{
return $this->dao->select('*')->from(TABLE_WORKESTIMATION)->where('PRJ')->eq($projectID)->fetch();
}
/**
* Get project scale.
*
* @param int $projectID
* @access public
* @return int
*/
public function getProjectScale($projectID)
{
$products = $this->loadModel('product')->getProductPairsByProject($projectID);
$productIdList = array_keys($products);
return $this->dao->select('cast(sum(estimate) as decimal(10,2)) as scale')->from(TABLE_STORY)->where('product')->in($productIdList)->andWhere('type')->eq('requirement')->andWhere('deleted')->eq(0)->fetch('scale');
}
/*
* Save a budget.
*
* @param int $projectID
* @access public
* @return bool
*/
public function save($projectID)
{
$data = fixer::input('post')
->setDefault('PRJ', $projectID)
->setIF(!isset($_POST['productivity']), 'productivity', 1)
->get();
$budget = $this->getBudget($projectID);
if(!empty($budget)) $data->id = $budget->id;
$this->dao->replace(TABLE_WORKESTIMATION)->data($data)
->batchCheck($this->config->workestimation->index->requiredFields, 'notempty')
->exec();
return !dao::isError();
}
}
-117
View File
@@ -1,117 +0,0 @@
<?php
/**
* The index of workestimation module of ZenTaoPMS.
*
* @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
* @license ZPL (http://zpl.pub/page/zplv12.html)
* @author Chunsheng Wang <chunsheng@cnezsoft.com>
* @package workestimation
* @version $Id: index.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $
* @link http://www.zentao.net
*/
?>
<?php include '../../common/view/header.html.php';?>
<style>.unify-padding{width:94px;}</style>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
<h2><?php echo $lang->workestimation->common;?></h2>
</div>
<form class='load-indicator main-form form-ajax' id='dataform' method='post' enctype='multipart/form-data'>
<table class='table table-form'>
<tbody>
<tr>
<th class='w-100px'><?php echo $lang->workestimation->scale;?></th>
<td class='w-300px'>
<div class='input-group'>
<?php echo html::input('scale', zget($budget, 'scale', ''), "class='form-control' required");?>
<span class='input-group-addon unify-padding'><?php echo $lang->hourCommon;?></span>
</div>
</td>
<td><?php if(isset($budget->duration) and $budget->duration) printf($lang->workestimation->scaleTip, $scale);?></td>
<td></td>
<td></td>
</tr>
<?php $hidden = $hourPoint == 0 ? 'hidden' : '';?>
<tr class="efficiency <?php echo $hidden?>">
<th><?php echo $lang->workestimation->productivity;?></th>
<td>
<div class='input-group'>
<?php echo html::input('productivity', zget($budget, 'productivity', ''), "class='form-control'");?>
<span class='input-group-addon unify-padding'>
<?php
if($hourPoint == 0) echo $lang->hourCommon;
if($hourPoint == 1) echo $lang->custom->unitList['efficiency'] . $lang->hourCommon;
if($hourPoint == 2) echo $lang->custom->unitList['manhour'] . $lang->custom->unitList['loc'];
?>
</span>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->workestimation->duration;?></th>
<td>
<div class='input-group'>
<?php echo html::input('duration', zget($budget, 'duration', ''), "class='form-control'");?>
<span class='input-group-addon unify-padding'><?php echo $lang->workestimation->hour;?></span>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->workestimation->unitLaborCost;?></th>
<td>
<div class='input-group'>
<?php echo html::input('unitLaborCost', zget($budget, 'unitLaborCost', ''), "class='form-control'");?>
<span class='input-group-addon unify-padding'><?php echo $lang->custom->unitList['cost'];?></span>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->workestimation->totalLaborCost;?></th>
<td>
<div class='input-group'>
<?php echo html::input('totalLaborCost', zget($budget, 'totalLaborCost', ''), "class='form-control'");?>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->workestimation->dayHour;?></th>
<td><?php echo html::input('dayHour', zget($budget, 'dayHour', ''), "class='form-control'");?></td>
</tr>
<tr>
<td></td>
<td colspan='2' class='text-left form-actions'>
<?php echo html::submitButton();?>
<?php echo html::backButton();?>
</td>
</tr>
</tbody>
</table>
<div class='alert alert-info mg-0'> <?php echo $lang->workestimation->tips;?></div>
</form>
</div>
</div>
<script>
$(function()
{
$('#useScale').click(function()
{
$('#scale').val('<?php echo $scale;?>').keyup();
});
$(':input').keyup(function()
{
duration = parseFloat($('#scale').val()) * parseFloat($('#productivity').val()).toFixed(2);
duration = duration.toFixed(2);
if(!isNaN(duration)) $('#duration').val(duration);
if(isNaN(duration)) $('#duration').val('');
totalLaborCost = parseFloat($('#unitLaborCost').val()) * parseFloat($('#duration').val());
totalLaborCost = totalLaborCost.toFixed(2);
if(!isNaN(totalLaborCost)) $('#totalLaborCost').val(totalLaborCost);
if(isNaN(totalLaborCost)) $('#totalLaborCost').val('');
});
$('#scale').change();
});
</script>
<?php include '../../common/view/footer.html.php';?>