left_of_task_in_project.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * 按项目统计的任务剩余工时数。
  4. * Left of task in project.
  5. *
  6. * 范围:project
  7. * 对象:task
  8. * 目的:hour
  9. * 度量名称:按项目统计的任务剩余工时数
  10. * 单位:小时
  11. * 描述:按项目统计的任务剩余工时数是指当前未消耗的工时总和,用于完成所有任务。该度量项可以用来评估项目在任务执行过程中剩余的工作量和时间,以及为完成任务所需的资源和计划。较小的任务剩余工时总数可能表示项目将及时完成任务,而较大的任务剩余工时总数可能需要重新评估进度和资源分配。
  12. * 定义:项目中任务的剩余工时数求和;过滤已删除的任务;过滤已取消的任务;过滤父任务;过滤已删除执行的任务;过滤已删除的项目;
  13. *
  14. * @copyright Copyright 2009-2023 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.zentao.net)
  15. * @author zhouxin <zhouxin@easycorp.ltd>
  16. * @package
  17. * @uses func
  18. * @license ZPL(https://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  19. * @Link https://www.zentao.net
  20. */
  21. class left_of_task_in_project extends baseCalc
  22. {
  23. public $dataset = 'getTasks';
  24. public $fieldList = array('t1.left', 't1.project', 't1.parent', 't1.status', 't1.isParent');
  25. public $result = array();
  26. public function calculate($row)
  27. {
  28. if($row->isParent == '1' || $row->status == 'cancel' || $row->status == 'closed') return false;
  29. if(!isset($this->result[$row->project])) $this->result[$row->project] = 0;
  30. $this->result[$row->project] += $row->left;
  31. }
  32. public function getResult($options = array())
  33. {
  34. $records = $this->getRecords(array('project', 'value'));
  35. return $this->filterByOptions($records, $options);
  36. }
  37. }