Adding a validation to calculate the Delay only when the actual date > dueDate
This commit is contained in:
@@ -522,10 +522,7 @@ class AppDelegation extends BaseAppDelegation
|
|||||||
//getting the calendar
|
//getting the calendar
|
||||||
$calendar->getCalendar($row['USR_UID'], $row['PRO_UID'], $row['TAS_UID']);
|
$calendar->getCalendar($row['USR_UID'], $row['PRO_UID'], $row['TAS_UID']);
|
||||||
$calData = $calendar->getCalendarData();
|
$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 the task is not started
|
||||||
if ($isStarted == 0) {
|
if ($isStarted == 0) {
|
||||||
if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') {
|
if ($row['DEL_INIT_DATE'] != null && $row['DEL_INIT_DATE'] != '') {
|
||||||
@@ -561,7 +558,6 @@ class AppDelegation extends BaseAppDelegation
|
|||||||
//$delDuration = $this->getDiffDate( $iFinishDate, $iInitDate );
|
//$delDuration = $this->getDiffDate( $iFinishDate, $iInitDate );
|
||||||
$delDuration = $calendar->dashCalculateDurationWithCalendar($row['DEL_INIT_DATE'], $row['DEL_FINISH_DATE'], $calData );//by jen
|
$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.
|
$delDuration = $delDuration / (24 * 60 * 60); //Saving the delDuration in days. The calculateDurationSLA func returns mins.
|
||||||
|
|
||||||
$oAppDel->setDelDuration( $delDuration );
|
$oAppDel->setDelDuration( $delDuration );
|
||||||
//calculate due date if correspond
|
//calculate due date if correspond
|
||||||
$dueDate = strtotime($iDueDate);
|
$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
|
//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 = $this->getDiffDate( $now, $iDueDate );
|
||||||
$delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, date("Y-m-d H:i:s"), $calData );
|
$delayDuration = 0;
|
||||||
$delayDuration = $delayDuration / (24 * 60 * 60); //Days
|
if($now > $iDueDate){
|
||||||
|
$delayDuration = $calendar->dashCalculateDurationWithCalendar( $iDueDate, date("Y-m-d H:i:s"), $calData );
|
||||||
|
$delayDuration = $delayDuration / (24 * 60 * 60);
|
||||||
|
}
|
||||||
|
//Days
|
||||||
$oAppDel->setDelDelayDuration( $delayDuration );
|
$oAppDel->setDelDelayDuration( $delayDuration );
|
||||||
if ($fTaskDuration != 0) {
|
if ($fTaskDuration != 0) {
|
||||||
$overduePercentage = $delayDuration / $fTaskDuration;
|
$overduePercentage = $delayDuration / $fTaskDuration;
|
||||||
|
|||||||
Reference in New Issue
Block a user