* fix the error of computeDays() for project.

This commit is contained in:
wangchunsheng
2012-02-21 01:25:07 +00:00
parent 611962dd01
commit bd7580f0fd
3 changed files with 18 additions and 7 deletions
+14 -3
View File
@@ -37,14 +37,25 @@ function computeDaysDelta(date1, date2)
return (date2 - date1) / (1000 * 60 * 60 * 24)
}
/**
* Compute work days.
*
* @access public
* @return void
*/
function computeWorkDays()
{
beginDate = $('#begin').val();
endDate = $('#end').val();
if(beginDate && endDate) $('#days').val(computeDaysDelta(beginDate, endDate));
}
/* Auto compute the work days. */
$(function()
{
$(".date").bind('dateSelected', function()
{
beginDate = $('#begin').val();
endDate = $('#end').val();
if(beginDate && endDate) $('#days').val(computeDaysDelta(beginDate, endDate));
computeWorkDays();
})
});
+2 -2
View File
@@ -44,11 +44,11 @@ $(document).ready(function()
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->begin;?></th>
<td><?php echo html::input('begin', '', "class='text-3 date' onchange='computeDays()'");?></td>
<td><?php echo html::input('begin', '', "class='text-3 date' onchange='computeWorkDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->end;?></th>
<td><?php echo html::input('end', '', "class='text-3 date' onchange='computeDays()'");?></td>
<td><?php echo html::input('end', '', "class='text-3 date' onchange='computeWorkDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->days;?></th>
+2 -2
View File
@@ -26,11 +26,11 @@
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->begin;?></th>
<td><?php echo html::input('begin', $project->begin, "class='text-3 date' onchange='computeDays()'");?></td>
<td><?php echo html::input('begin', $project->begin, "class='text-3 date' onchange='computeWorkDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->end;?></th>
<td><?php echo html::input('end', $project->end, "class='text-3 date' onchange='computeDays()'");?></td>
<td><?php echo html::input('end', $project->end, "class='text-3 date' onchange='computeWorkDays()'");?></td>
</tr>
<tr>
<th class='rowhead'><?php echo $lang->project->days;?></th>