progress.html.php 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. namespace zin;
  3. $buildProgress = function() use($process, $nextMilestone, $lang)
  4. {
  5. $thead = h::thead
  6. (
  7. h::tr
  8. (
  9. h::th(set::rowspan(2), $lang->milestone->paogressForecast),
  10. h::th(setClass('text-center'), set::colspan(3), $lang->milestone->duration),
  11. h::th(setClass('text-center'), set::colspan(3), $lang->milestone->cost),
  12. h::th(set::rowspan(2), set::colspan(3), $lang->milestone->forecastResults)
  13. ),
  14. h::tr
  15. (
  16. h::th($lang->milestone->plannedValue),
  17. h::th($lang->milestone->predictedValue, icon('help', setClass('ml-1'), set::title($lang->milestone->predictedValueDesc))),
  18. h::th($lang->milestone->periodDeviation),
  19. h::th($lang->milestone->plannedValue),
  20. h::th($lang->milestone->predictedValue),
  21. h::th($lang->milestone->costDeviation)
  22. )
  23. );
  24. $nextDuration = empty($process->milestoneSPI) || empty($nextMilestone->nextDays) ? 0 : round($nextMilestone->nextDays / $process->milestoneSPI, 2);
  25. $nextDurationValue = $nextMilestone->nextDays - $nextDuration;
  26. $nextCost = empty($process->nowCPI) || empty($nextMilestone->nextHours) ? 0 : round($nextMilestone->nextHours/$process->milestoneCPI);
  27. $nextCostValue = $nextMilestone->nextHours - $nextCost;
  28. $resultText = $nextDurationValue < 0 ? sprintf($lang->milestone->timeOverrun, abs($nextDurationValue)) : '';
  29. $resultText .= $nextCostValue < 0 ? sprintf($lang->milestone->costOverrun, abs($nextCostValue)) : '';
  30. $trList = array();
  31. $trList[] = h::tr
  32. (
  33. h::th($lang->milestone->nextStage),
  34. h::td($nextMilestone->nextDays),
  35. h::td($nextDuration),
  36. h::td($nextDurationValue),
  37. h::td($nextMilestone->nextHours),
  38. h::td($nextCost),
  39. h::td($nextCostValue),
  40. h::td(set::colspan(3), $resultText)
  41. );
  42. $totalDuration = empty($process->milestoneSPI) || empty($nextMilestone->totalDays) ? 0 : round($nextMilestone->totalDays / $process->milestoneSPI, 2);
  43. $totalDurationValue = $nextMilestone->totalDays - $totalDuration;
  44. $totalCost = empty($process->nowCPI) || empty($nextMilestone->totalHours) ? 0 : round($nextMilestone->totalHours/$process->nowCPI, 2);
  45. $totalCostValue = $nextMilestone->totalHours - $totalCost;
  46. $resultText = $totalDurationValue < 0 ? sprintf($lang->milestone->timeOverrun, abs($totalDurationValue)) : '';
  47. $resultText .= $totalCostValue < 0 ? sprintf($lang->milestone->costOverrun, abs($totalCostValue)) : '';
  48. $trList[] = h::tr
  49. (
  50. h::th($lang->milestone->overallProject),
  51. h::td($nextMilestone->totalDays),
  52. h::td($totalDuration),
  53. h::td($totalDurationValue),
  54. h::td($nextMilestone->totalHours),
  55. h::td($totalCost),
  56. h::td($totalCostValue),
  57. h::td(set::colspan(3), $resultText)
  58. );
  59. $tbody = h::tbody($trList);
  60. return h::table(setClass('table bordered bg-white mb-4'), $thead, $tbody);
  61. };