Merge branch 'master' of bitbucket.org:colosa/processmaker into PM-2039
This commit is contained in:
@@ -356,17 +356,18 @@ class AppDelegation extends BaseAppDelegation
|
||||
$aCalendarUID = '';
|
||||
}
|
||||
|
||||
//use the dates class to calculate dates
|
||||
//Calendar - Use the dates class to calculate dates
|
||||
$calendar = new calendar();
|
||||
|
||||
$arrayCalendarData = array();
|
||||
|
||||
if ($calendar->pmCalendarUid == "") {
|
||||
$calendar->getCalendar(null, $task->getProUid(), $this->getTasUid());
|
||||
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
|
||||
|
||||
$arrayCalendarData = $calendar->getCalendarData();
|
||||
}
|
||||
|
||||
//Due date
|
||||
/*$iDueDate = $calendar->calculateDate( $this->getDelDelegateDate(), $aData['TAS_DURATION'], $aData['TAS_TIMEUNIT'] //hours or days, ( we only accept this two types or maybe weeks
|
||||
);*/
|
||||
$dueDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), $aData["TAS_DURATION"], $aData["TAS_TIMEUNIT"], $arrayCalendarData);
|
||||
@@ -378,10 +379,22 @@ class AppDelegation extends BaseAppDelegation
|
||||
public function calculateRiskDate($dueDate, $risk)
|
||||
{
|
||||
try {
|
||||
$numDueDate = strtotime($dueDate); //Seconds
|
||||
$numDueDate = $numDueDate - ($numDueDate * $risk);
|
||||
$riskTime = strtotime($dueDate) - strtotime($this->getDelDelegateDate()); //Seconds
|
||||
$riskTime = $riskTime - ($riskTime * $risk);
|
||||
|
||||
$riskDate = date("Y-m-d H:i:s", round($numDueDate));
|
||||
//Calendar - Use the dates class to calculate dates
|
||||
$calendar = new calendar();
|
||||
|
||||
$arrayCalendarData = array();
|
||||
|
||||
if ($calendar->pmCalendarUid == "") {
|
||||
$calendar->getCalendar(null, $this->getProUid(), $this->getTasUid());
|
||||
|
||||
$arrayCalendarData = $calendar->getCalendarData();
|
||||
}
|
||||
|
||||
//Risk date
|
||||
$riskDate = $calendar->dashCalculateDate($this->getDelDelegateDate(), round($riskTime / (60 * 60)), "HOURS", $arrayCalendarData);
|
||||
|
||||
//Return
|
||||
return $riskDate;
|
||||
|
||||
@@ -70,6 +70,28 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
$oldValue = current(reset($calculator->ueiHistoric($uid, $compareDate, $compareDate, \ReportingPeriodicityEnum::NONE)));
|
||||
$row['DAS_IND_VARIATION'] = $value - $oldValue;
|
||||
break;
|
||||
case '1050':
|
||||
$value = $calculator->statusIndicatorGeneral($userUid);
|
||||
$row['OVERDUE'] = 0;
|
||||
$row['ON_TIME'] = 0;
|
||||
$row['AT_RISK'] = 0;
|
||||
$row['PERCENTAGE_OVERDUE'] = 0;
|
||||
$row['PERCENTAGE_AT_RISK'] = 0;
|
||||
$row['PERCENTAGE_ON_TIME'] = 0;
|
||||
|
||||
if (is_array($value) && isset($value[0])) {
|
||||
$row['OVERDUE'] = $value[0]['OVERDUE'];
|
||||
$row['ON_TIME'] = $value[0]['ONTIME'];
|
||||
$row['AT_RISK'] = $value[0]['ATRISK'];
|
||||
|
||||
$total = $row['OVERDUE'] + $row['AT_RISK'] + $row['ON_TIME'];
|
||||
if ($total != 0) {
|
||||
$row['PERCENTAGE_OVERDUE'] = ($row['OVERDUE']*100)/$total;
|
||||
$row['PERCENTAGE_AT_RISK'] = ($row['AT_RISK']*100)/$total;
|
||||
$row['PERCENTAGE_ON_TIME'] = ($row['ON_TIME']*100)/$total;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
$arrResult = $calculator->generalIndicatorData($row['DAS_IND_UID'], $measureDate, $measureDate, \ReportingPeriodicityEnum::NONE);
|
||||
$value = $arrResult[0]['value'];
|
||||
|
||||
Reference in New Issue
Block a user