* Adjust code.

This commit is contained in:
leiyong
2020-12-07 15:05:19 +08:00
parent 611cda4fe7
commit 7aaf8a9014
11 changed files with 40 additions and 34 deletions
+14 -13
View File
@@ -7,44 +7,45 @@
* @author Xiying Guan <guanxiying@xirangit.com>
* @package workestimation
* @version $Id$
* @link http://www.chanzhi.org
* @link http://www.zentao.net
*/
class workestimation extends control
{
/**
* Index.
* Project workload estimations.
*
* @param int $program
* @param int $projectID
* @access public
* @return void
*/
public function index($program = 0)
public function index($projectID = 0)
{
$program = $program ? $program : $this->session->PRJ;
$projectID = $projectID ? $projectID : $this->session->PRJ;
if($_POST)
{
$result = $this->workestimation->save($program);
$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()));
}
$this->view->title = $this->lang->workestimation->common;
$this->view->programScale = $this->workestimation->getProgramScale($program);
$this->view->hourPoint = $this->config->custom->hourPoint;
$budget = $this->workestimation->getBudget($program);
$scale = $this->workestimation->getProgramScale($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 = $this->view->programScale;
$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->budget = $budget;
$this->view->title = $this->lang->workestimation->common;
$this->view->position[] = $this->lang->workestimation->common;
$this->view->hourPoint = $this->config->custom->hourPoint;
$this->view->programScale = $scale;
$this->view->budget = $budget;
$this->display();
}
}