プロジェクト内の各タスクの仮の期日を計算しています。最初のタスクの期日は問題なく計算できました。プロジェクトの開始日から 5 営業日でしたが、前のタスクに基づいてそれぞれの新しい期日を計算したいと考えています。期日。
プロジェクトの開始日は 7-15-13 です タスク 1 の期間は 5 日間で、期限日を 7-22-13 に設定する必要があります タスク 2 の期間は 5 日間で、期限日を 7-19-13 に設定する必要がありますタスク 3 の期間は 3 日間で、締め切り日を 7-24-13 に設定する必要があります。
各プロジェクトには、さまざまな数のタスクを含めることができます。
//Format the Start Date
$startDate = date("Y-m-d", strtotime($projectStart));
//Subtract one day to project length to include the starting date in the count.
$projectLengthMinusOne = ($projectLength - 1);
//Calculate estimated deadline date based off of out of office, absence, holidays, and weekdays.
$deadlineDate = date("Y-m-d", strtotime($projectLengthMinusOne . ' weekdays', strtotime($startDate)));
//Check for holidays
$checkHolidays = mysql_query("SELECT id FROM fm_calendar_holidays WHERE fromDate BETWEEN '".$startDate."' AND '".$deadlineDate."'") or die("Check Holidays: " . mysql_error());
$numHolidays = mysql_num_rows($checkHolidays);
//Check for Absences
$checkAbsences = mysql_query("SELECT numDays FROM fm_calendar_absenceRequest WHERE startDate BETWEEN '".$startDate."' AND '".$deadlineDate."' and respid = '".$taskData['assignedTo']."'") or die("Check Absences: " . mysql_error());
if(mysql_num_rows($checkAbsences) > 0)
{
$totalAbsences = 0;
while($abData = mysql_fetch_array($checkAbsences))
{
$numDays = $abData['numDays'];
$totalAbsences += $numDays;
}
}
$numAbsences = $totalAbsences;
//Check for out of office
$checkOutOffice = mysql_query("SELECT startDate, endDate FROM fm_calendar_outofOffice WHERE startDate BETWEEN '".$startDate."' AND '".$deadlineDate."' and requesterId = '".$taskData['assignedTo']."'") or die("Check Out of Office: " . mysql_error());
if(mysql_num_rows($checkOutOffice) > 0)
{
$totalOutOffice = 0;
while($oooData = mysql_fetch_array($checkOutOffice))
{
$oooStart = $oooData['startDate'];
$oooEnd = $oooData['endDate'];
$numWorkingDays = getWorkingDays($oooStart, $oooEnd);
$totalOutOffice += $numWorkingDays;
}
}
$numOutOffice = $totalOutOffice;
//Add up all days off from the calendar
$totalDaysAdded = ($numHolidays + $numAbsences + $numOutOffice);
//Recalculate the deadline date based off of the new days off information
$deadlineDate = date("Y-m-d", strtotime($totalDaysAdded . ' weekdays', strtotime($deadlineDate)));
$deadlineDate = date("Y-m-d", strtotime($taskData['taskLength'] . ' weekdays', strtotime($deadlineDate)));
echo '<div class="page_collapsible" id="body-section1">'.$taskData['taskName'] . '<span></span></div>';
echo '<div class="container">
<div class="collapseContainer">';
echo '<table width = "900px" cellspacing = "5" cellpadding = "5" border = "0">
<tr>
<td width = "125px" align="right"><strong>Description:</strong></td>
<td width = "775px" align="left">'.$taskData['taskDescription'] . '</td>
</tr>
<tr>
<td width = "125px" align="right"><strong>Programmer:</strong></td>
<td width = "775px" align="left">'.getCkname($taskData['assignedTo']). '</td>
</tr>
<tr>
<td width = "125px" align="right"><strong>Task Status:</strong></td>
<td width = "775px" align="left">'.$taskData['taskStatus'] . '</td>
</tr>
<tr>
<td width = "125px" align="right"><strong>Task Duration:</strong></td>
<td width = "775px" align="left">'.$taskData['taskLength'] . ' days</td>
</tr>
<tr>
<td width = "125px" align="right"><strong>Tentative Due Date:</strong></td>
<td width = "775px" align="left">'.$deadlineDate . '</td>
</tr>
</table>
</div>
</div>';
}
}