Commit 8d4d849f by Azhan Hannan

bod approval screen -> checking to display detail overhead and chargeable

parent 5ee38e76
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
</tbody> </tbody>
</table> </table>
@if(data_get($profile,'tp_project_type') == 1)
<table class="ui celled structured table unstackable"> <table class="ui celled structured table unstackable">
<thead> <thead>
<tr> <tr>
...@@ -185,6 +186,153 @@ ...@@ -185,6 +186,153 @@
<th>@if($totalchargehrs){{ number_format($totalchargehrs/8, 1, '.', '') }}@else 0 @endif</th> <th>@if($totalchargehrs){{ number_format($totalchargehrs/8, 1, '.', '') }}@else 0 @endif</th>
</tfoot> --> </tfoot> -->
</table> </table>
@else
<table class="ui celled structured table unstackable">
<thead>
<tr>
<th colspan="2" rowspan="3" class="center aligned" style="width: 27%;">Overhead</th>
<th colspan="@if($phase == 1) 15 @else {{$daymonth-15}} @endif" class="center aligned">Date</th>
<th colspan="2" rowspan="2" class="center aligned">Total</th>
</tr>
<tr>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th style="width: 4%;">{{$i+1}}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th style="width: 4%;">{{$i+1}}</th>
@endfor
@endif
</tr>
<tr>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<th>{{$strdays[$i]}}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<th>{{$strdays[$i]}}</th>
@endfor
@endif
<th>Hours</th>
<th>Days</th>
</tr>
</thead>
<tbody>
@foreach($overheadlist as $key => $projectoverhead)
<?php $totaloverhead = 0; ?>
<tr>
<td style="width: 4%;"></td>
<td style="width: 23%;">{{ $projectoverhead['pname']}}</td>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$valoverheadhour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($overheadhour)
{
// dd('masuk');
$valoverheadhour = $overheadhour->where('td_date','=',$date)
->where('fk_o_id',$projectoverhead['pid'])
->where('tm_phase',$phase)
->first();
$totaloverhead += data_get($valoverheadhour,'td_hours');
}
?>
@if($valoverheadhour)
<td style="width: 4%;">{{ data_get($valoverheadhour,'td_hours') }}</td>
@else
<td style="width: 4%;"></td>
@endif
@endfor
@else
@for($i = 15; $i < $daymonth ; $i++)
<?php
$valoverheadhour = '';
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if($overheadhour)
{
$valoverheadhour = $overheadhour->where('td_date','=',$date)
->where('fk_o_id',$projectoverhead['pid'])
->where('tm_phase',$phase)
->first();
$totaloverhead += data_get($valoverheadhour,'td_hours');
}
?>
@if($valoverheadhour)
<td style="width: 4%;">{{ data_get($valoverheadhour,'td_hours') }}</td>
@else
<td style="width: 4%;"></td>
@endif
@endfor
@endif
@if($totaloverhead)
<td style="width: 5%">{{ number_format($totaloverhead, 1, '.', '') }}</td>
<td style="width: 5%">{{ number_format($totaloverhead/8, 1, '.', '') }}</td>
@else
<td style="width: 5%">0</td>
<td style="width: 5%">0</td>
@endif
</tr>
@endforeach
</tbody>
<!-- <tfoot>
<th colspan="2">Total (B)</th>
@if($phase == 1)
@for($i = 0; $i < 15 ; $i++)
<?php
$totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if ($overheadhour) {
$valoverheadbyday = $overheadhour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valoverheadbyday as $key => $value) {
$totaloverheadbyday += data_get($value,'td_hours');
}
}
?>
<th style="width: 4%">{{ $totaloverheadbyday }}</th>
@endfor
@else
@for($i = 15; $i < $daymonth; $i++)
<?php
$totaloverheadbyday = 0;
$date = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
if ($overheadhour) {
$valoverheadbyday = $overheadhour->where('td_date','=', $date)
->where('tm_phase',$phase);
foreach($valoverheadbyday as $key => $value) {
$totaloverheadbyday += data_get($value,'td_hours');
}
}
?>
<th style="width: 4%">{{ $totaloverheadbyday }}</th>
@endfor
@endif
<th style="width: 5%">@if($totaloverheadhrs) {{ number_format($totaloverheadhrs, 1, '.', '') }} @else 0 @endif</th>
<th style="width: 5%">@if($totaloverheadhrs) {{ number_format($totaloverheadhrs/8, 1, '.', '') }} @else 0 @endif</th>
</tfoot> -->
</table>
@endif
</div> </div>
<div class="ui segment"> <div class="ui segment">
......
...@@ -981,7 +981,7 @@ class DashboardController extends Controller ...@@ -981,7 +981,7 @@ class DashboardController extends Controller
$bod = Users::find(Auth::id()); $bod = Users::find(Auth::id());
// dd($profile); // dd($profile->tp_project_type);
$phase = $profile->tp_phase; $phase = $profile->tp_phase;
...@@ -1019,7 +1019,7 @@ class DashboardController extends Controller ...@@ -1019,7 +1019,7 @@ class DashboardController extends Controller
->where('tm_phase', $phase) ->where('tm_phase', $phase)
->with('attachement') ->with('attachement')
->first(); ->first();
// dd($check);
$chargeableproject = Tproject::where('fk_tm_id', data_get($check,'id')) $chargeableproject = Tproject::where('fk_tm_id', data_get($check,'id'))
->where('tp_project_type', 1) ->where('tp_project_type', 1)
->with('project') ->with('project')
...@@ -1075,11 +1075,11 @@ class DashboardController extends Controller ...@@ -1075,11 +1075,11 @@ class DashboardController extends Controller
} }
} }
foreach ($tempOverhead as $key => $value) { if($profile->tp_project_type == 3){
$overheadlist[] = [ $overheadlist[] = [
'pid' => $tempOverheadid[$key], 'pid' => $profile->fk_o_id,
'pname' => $tempOverhead[$key], 'pname' => $profile->tp_project_name,
]; ];
} }
} }
...@@ -1111,7 +1111,7 @@ class DashboardController extends Controller ...@@ -1111,7 +1111,7 @@ class DashboardController extends Controller
$check = null; $check = null;
} }
return view('timesheet::dashboard.approvalaction', compact('profile', 'bod', 'page', 'staff', 'daymonth', 'strMonth', 'year', 'month', 'phase', 'strdays', 'chargeablelist', 'chargehour', 'totalchargehrs')); return view('timesheet::dashboard.approvalaction', compact('profile', 'bod', 'page', 'staff', 'daymonth', 'strMonth', 'year', 'month', 'phase', 'strdays', 'chargeablelist', 'chargehour', 'totalchargehrs', 'overheadlist', 'overheadhour', 'totaloverheadhrs'));
} }
public function approval(Request $request) public function approval(Request $request)
......
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