Commit 7e31ead9 by Azhan Hannan

changes chargeable overhead form

parent e1278a7d
...@@ -53,11 +53,8 @@ input[type=number] { ...@@ -53,11 +53,8 @@ input[type=number] {
// dd(count($lat)); // dd(count($lat));
?> ?>
<th colspan="2" rowspan="2" class="center aligned">Chargeable</th> <th colspan="2" rowspan="2" class="center aligned">Chargeable</th>
@if(count($lat) > 0) <!-- <th colspan="{{count($lat)}}" class="center aligned">Date</th> -->
<th colspan="{{count($lat)}}" class="center aligned">Date</th>
@else
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th> <th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
@endif
<th rowspan="2"> <th rowspan="2">
<!-- @if($projectlist == []) <!-- @if($projectlist == [])
<button type="submit" class="ui disabled fluid center aligned ui blue compact labeled icon button"> <button type="submit" class="ui disabled fluid center aligned ui blue compact labeled icon button">
...@@ -75,25 +72,34 @@ input[type=number] { ...@@ -75,25 +72,34 @@ input[type=number] {
<tr> <tr>
@if(count($lat) > 0) @if(count($lat) > 0)
@foreach($lat as $key => $date) @foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1 ) @if(data_get($date,'attendance_status') == 1)
<th>{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}</th> <th class="center aligned">
{{ date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day'] }}
</th>
@else @else
<th style="background-color: #DCDCDC;"> <th class="center aligned" style="background-color: #DCDCDC;">
{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}} {{ date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day'] }}
</th> </th>
@endif @endif
@endforeach @endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<th class="center aligned">{{$i+1}}</th>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<th class="center aligned">{{$i+1}}</th>
@endfor
@endif
@else @else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th> <th class="center aligned">{{$i+1}}</th>
@endfor @endfor
@else @else
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th> <th class="center aligned">{{$i+1}}</th>
@endfor @endfor
@endif @endif
@endif @endif
</tr> </tr>
...@@ -102,25 +108,35 @@ input[type=number] { ...@@ -102,25 +108,35 @@ input[type=number] {
<th class="single line">Project Name</th> <th class="single line">Project Name</th>
@if(count($lat) > 0) @if(count($lat) > 0)
@foreach($lat as $key => $date) @foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1) @if(data_get($date,'attendance_status') == 1)
<th> <th class="center aligned">
{{ date('D', strtotime(data_get($date,'DATE')) ) }} {{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th> </th>
@else @else
<th style="background-color: #DCDCDC;"> <th class="center aligned" style="background-color: #DCDCDC;">
{{ date('D', strtotime(data_get($date,'DATE')) ) }} {{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th> </th>
@endif @endif
@endforeach @endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@endif
@else @else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<th>{{ $strdays[$i] }}</th> <th class="center aligned">{{ $strdays[$i] }}</th>
@endfor @endfor
@else @else
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
<th>{{ $strdays[$i] }}</th> <th class="center aligned">{{ $strdays[$i] }}</th>
@endfor @endfor
@endif @endif
...@@ -132,6 +148,7 @@ input[type=number] { ...@@ -132,6 +148,7 @@ input[type=number] {
<?php <?php
$all = 0; $all = 0;
$lasttd = count($projectlist); $lasttd = count($projectlist);
// dd($lat);
?> ?>
@foreach($projectlist as $key => $project) @foreach($projectlist as $key => $project)
...@@ -165,16 +182,62 @@ input[type=number] { ...@@ -165,16 +182,62 @@ input[type=number] {
} }
?> ?>
@if(data_get($value,'day_type') == 1) @if(data_get($value,'attendance_status') == 1)
<td> <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']}}][{{$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> </td>
@else @else
<td style="background-color: #DCDCDC;"> <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']}}][{{$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> </td>
@endif @endif
@endforeach @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');
}
?>
<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++)
<?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');
}
?>
<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
@endif
@else @else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
...@@ -196,7 +259,7 @@ input[type=number] { ...@@ -196,7 +259,7 @@ input[type=number] {
?> ?>
<td> <td>
<input 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'] }}');"> <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> </td>
@endfor @endfor
@else @else
...@@ -218,7 +281,7 @@ input[type=number] { ...@@ -218,7 +281,7 @@ input[type=number] {
?> ?>
<td> <td>
<input 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']}}');"> <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> </td>
@endfor @endfor
@endif @endif
......
...@@ -61,11 +61,9 @@ input[type=number] { ...@@ -61,11 +61,9 @@ input[type=number] {
<thead> <thead>
<tr> <tr>
<th rowspan="3" class="center aligned">Overhead</th> <th rowspan="3" class="center aligned">Overhead</th>
@if(count($lat) > 0) <!-- <th colspan="{{count($lat)}}" class="center aligned">Date</th> -->
<th colspan="{{count($lat)}}" class="center aligned">Date</th>
@else
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th> <th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
@endif
<th rowspan="2"> <th rowspan="2">
<!-- <button type="submit" class="fluid center aligned ui blue compact labeled icon button"> <!-- <button type="submit" class="fluid center aligned ui blue compact labeled icon button">
<i class="save icon"></i> <i class="save icon"></i>
...@@ -76,22 +74,33 @@ input[type=number] { ...@@ -76,22 +74,33 @@ input[type=number] {
<tr> <tr>
@if(count($lat) > 0) @if(count($lat) > 0)
@foreach($lat as $key => $date) @foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1 ) @if(data_get($date,'attendance_status') == 1)
<th>{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}}</th> <th class="center aligned">
{{ date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day'] }}
</th>
@else @else
<th style="background-color: #DCDCDC;"> <th class="center aligned" style="background-color: #DCDCDC;">
{{date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day']}} {{ date_parse_from_format('Y-m-d', data_get($date,'DATE'))['day'] }}
</th> </th>
@endif @endif
@endforeach @endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<th class="center aligned">{{$i+1}}</th>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<th class="center aligned">{{$i+1}}</th>
@endfor
@endif
@else @else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<th>{{$i+1}}</th> <th class="center aligned">{{$i+1}}</th>
@endfor @endfor
@else @else
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
<th>{{$i+1}}</th> <th class="center aligned">{{$i+1}}</th>
@endfor @endfor
@endif @endif
@endif @endif
...@@ -99,26 +108,37 @@ input[type=number] { ...@@ -99,26 +108,37 @@ input[type=number] {
<tr> <tr>
@if(count($lat) > 0) @if(count($lat) > 0)
@foreach($lat as $key => $date) @foreach($lat as $key => $date)
@if(data_get($date,'day_type') == 1) @if(data_get($date,'attendance_status') == 1)
<th> <th class="center aligned">
{{ date('D', strtotime(data_get($date,'DATE')) ) }} {{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th> </th>
@else @else
<th style="background-color: #DCDCDC;"> <th class="center aligned" style="background-color: #DCDCDC;">
{{ date('D', strtotime(data_get($date,'DATE')) ) }} {{ date('D', strtotime(data_get($date,'DATE')) ) }}
</th> </th>
@endif @endif
@endforeach @endforeach
@if($phase == 1)
@for($i = count($lat); $i < 15 ; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<th class="center aligned">{{ $strdays[$i] }}</th>
@endfor
@endif
@else @else
<!-- <th>Task</th> -->
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
<th>{{ $strdays[$i] }}</th> <th class="center aligned">{{ $strdays[$i] }}</th>
@endfor @endfor
@else @else
@for($i = 15; $i < $daymonth; $i++) @for($i = 15; $i < $daymonth; $i++)
<th>{{ $strdays[$i] }}</th> <th class="center aligned">{{ $strdays[$i] }}</th>
@endfor @endfor
@endif @endif
@endif @endif
<th>Hours</th> <th>Hours</th>
...@@ -154,16 +174,60 @@ input[type=number] { ...@@ -154,16 +174,60 @@ input[type=number] {
} }
?> ?>
@if(data_get($value,'day_type') == 1) @if(data_get($value,'attendance_status') == 1)
<td> <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){{$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']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td> </td>
@else @else
<td style="background-color: #DCDCDC;"> <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){{$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']}}][{{$day}}]" name="hour[{{$project['td_project']}}][{{$day}}]" value="@if($valuehour){{$valuehour->td_hours}}@else @endif" min="0" max="24" style="padding:2px;margin:unset;background-color: #DCDCDC;" onchange="limiter(this,'{{ $project['td_project'] }}');">
</td> </td>
@endif @endif
@endforeach @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('fk_o_id',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td >
<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>
@endfor
@else
@for($i = 15+count($lat); $i < $daymonth; $i++)
<?php
$valuehour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($hour)
{
$valuehour = $hour->where('td_date','=',$date)
->where('fk_o_id',$project['td_project'])
->where('tm_phase',$phase)
->first();
$total += data_get($valuehour,'td_hours');
}
?>
<td>
<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>
@endfor
@endif
@else @else
@if($phase == 1) @if($phase == 1)
@for($i = 0; $i < 15 ; $i++) @for($i = 0; $i < 15 ; $i++)
......
...@@ -200,9 +200,10 @@ class FormController extends Controller ...@@ -200,9 +200,10 @@ class FormController extends Controller
$lat = LAttendance::where('staff_id', $userId) $lat = LAttendance::where('staff_id', $userId)
->whereIn('DATE', $dt) ->whereIn('DATE', $dt)
->groupby('DATE')
->get(); ->get();
$lat = []; // $lat = [];
// dd($lat); // dd($lat);
// dd(date('w', strtotime(data_get($lat1,'DATE')))); // dd(date('w', strtotime(data_get($lat1,'DATE'))));
// dd(date_parse_from_format('Y-m-d', data_get($lat1,'DATE'))['day']); // dd(date_parse_from_format('Y-m-d', data_get($lat1,'DATE'))['day']);
...@@ -863,9 +864,10 @@ class FormController extends Controller ...@@ -863,9 +864,10 @@ class FormController extends Controller
$lat = LAttendance::where('staff_id', $userId) $lat = LAttendance::where('staff_id', $userId)
->whereIn('DATE', $dt) ->whereIn('DATE', $dt)
->groupby('DATE')
->get(); ->get();
$lat = []; // $lat = [];
// dd($lat); // dd($lat);
return view('timesheet::form.overheadForm', compact('checkoverhead','projectlist','userId','month','phase','daymonth','year', 'hour', 'project', 'fk_tm_id', 'strdays', 'lat')); return view('timesheet::form.overheadForm', compact('checkoverhead','projectlist','userId','month','phase','daymonth','year', 'hour', 'project', 'fk_tm_id', 'strdays', 'lat'));
......
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