Adding a validation to calculate the Delay only when the actual date > dueDate

This commit is contained in:
jennylee
2015-04-30 14:15:43 -04:00
parent 2336c563b6
commit 02d85cf9f3

View File

@@ -522,10 +522,7 @@ class AppDelegation extends BaseAppDelegation
//getting the calendar
$calendar->getCalendar($row['USR_UID'], $row['PRO_UID'], $row['TAS_UID']);
$calData = $calendar->getCalendarData();
//Recalculating DueDate with the user calendar if it exist. It allways will take the derivation date like initial date.
$iDueDate = $calendar->dashCalculateDate($row['DEL_DELEGATE_DATE'], $fTaskDuration, $fTaskDurationUnit, $calData);
//if the task is not started
if ($isStarted == 0) {
if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') {
@@ -561,7 +558,6 @@ class AppDelegation extends BaseAppDelegation
//$delDuration = $this->getDiffDate( $iFinishDate, $iInitDate );
$delDuration = $calendar->dashCalculateDurationWithCalendar($row['DEL_INIT_DATE'], $row['DEL_FINISH_DATE'], $calData );//by jen
$delDuration = $delDuration / (24 * 60 * 60); //Saving the delDuration in days. The calculateDurationSLA func returns mins.
$oAppDel->setDelDuration( $delDuration );
//calculate due date if correspond
$dueDate = strtotime($iDueDate);
@@ -591,8 +587,12 @@ class AppDelegation extends BaseAppDelegation
//we are putting negative number if the task is not delayed, and positive number for the time the task is delayed
//$delayDuration = $this->getDiffDate( $now, $iDueDate );
$delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, date("Y-m-d H:i:s"), $calData );
$delayDuration = $delayDuration / (24 * 60 * 60); //Days
$delayDuration = 0;
if($now > $iDueDate){
$delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, date("Y-m-d H:i:s"), $calData );
$delayDuration = $delayDuration / (24 * 60 * 60);
}
//Days
$oAppDel->setDelDelayDuration( $delayDuration );
if ($fTaskDuration != 0) {
$overduePercentage = $delayDuration / $fTaskDuration;