Commit f9fe6c4b by Azhan Hannan

fixing timesheet overhead and chargeable phase 1 and phase 2

parent 12266a5c
......@@ -400,7 +400,6 @@ input[type=number] {
@endif
@else
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
......@@ -431,14 +430,17 @@ input[type=number] {
</td>
@if(count($lat) > 0)
@foreach($lat as $key => $value)
<?php
// dd($value);
$day = date_parse_from_format('Y-m-d', data_get($value,'DATE'))['day'];
// dd($day);
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
@php
$filteredData = $lat->filter(function ($item) use ($i) {
return date('d', strtotime($item['DATE'])) == $i+1;
});
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $day);
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
......@@ -449,40 +451,26 @@ input[type=number] {
$total += data_get($valuehour,'td_hours');
}
?>
@endphp
@if(data_get($value,'attendance_status') == 1)
@if($filteredData->isEmpty())
<td>
<input class="center aligned" type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@else
@foreach($filteredData as $key => $date)
@if(data_get($date,'attendance_status') == 1)
<td class="center aligned">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@else
<td class="center aligned" style="background-color: #DCDCDC;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@endif
@endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('td_project',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
@endif
<td>
<input class="center aligned" type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
......
......@@ -438,43 +438,18 @@ input[type=number] {
</td>
@if(count($lat) > 0)
@foreach($lat as $key => $value)
<?php
// dd($value);
$day = date_parse_from_format('Y-m-d', data_get($value,'DATE'))['day'];
// dd($day);
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $day);
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('fk_o_id',$project['td_project'])
->where('tm_phase',$phase)
->first();
@php
$filteredData = $lat->filter(function ($item) use ($i) {
return date('d', strtotime($item['DATE'])) == $i+1;
});
$total += data_get($valuehour,'td_hours');
}
?>
@if(data_get($value,'attendance_status') == 1)
<td style="width: 5%;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@else
<td style="width: 5%; background-color: #DCDCDC;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@endif
@endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
......@@ -485,10 +460,25 @@ input[type=number] {
$total += data_get($valuehour,'td_hours');
}
?>
<td >
@endphp
@if($filteredData->isEmpty())
<td class="center aligned">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{$project['td_project']}}');">
</td>
@else
@foreach($filteredData as $key => $date)
@if(data_get($date,'attendance_status') == 1)
<td class="center aligned">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@else
<td class="center aligned" style="background-color: #DCDCDC;">
<input type="text" onkeypress="onlynumber(event)" id="hour[{{$project['td_project']}}][{{$i+1}}]" name="hour[{{$project['td_project']}}][{{$i+1}}]" value="@if($valuehour){{data_get($valuehour,'td_hours')}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td>
@endif
@endforeach
@endif
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment