Commit 5ee38e76 by Azhan Hannan

applied same features to hod verfication screen

parent 867ecb15
...@@ -28,20 +28,22 @@ ...@@ -28,20 +28,22 @@
if(data_get($value,'staffid') == data_get($staff,'staff_id') && data_get($value,'tp_timesheet_sts') == 3) if(data_get($value,'staffid') == data_get($staff,'staff_id') && data_get($value,'tp_timesheet_sts') == 3)
$over += 1; $over += 1;
} }
// dump($over);
// dump(data_get($staff,'status'));
?> ?>
@if($staff->status == 7) <i class="red attention icon"></i>Rejected by HR @if($staff->status == 7) <i class="red attention icon"></i>Rejected by HR
@elseif($staff->status == 6) <i class="red attention icon"></i>Rejected by HOD/HOU @elseif($staff->status == 6) <i class="red attention icon"></i>Rejected by HOD/HOU
@elseif($staff->status == 5) <i class="red attention icon"></i>Dissaproved by BOD @elseif($staff->status == 5) <i class="red attention icon"></i>Dissaproved by BOD
@elseif($staff->status == 4) <i class="green check icon"></i>Verified by BOD @elseif($staff->status == 4) <i class="green check icon"></i>Verified by BOD
@elseif($over == count(data_get($staff,'overheads'))) <i class="green check icon"></i> Verified by HOD/HOU @elseif($over > 0 && $over == count(data_get($staff,'overheads'))) <i class="green check icon"></i> Verified by HOD/HOU
@elseif($over != count(data_get($staff,'overheads')) || $staff->status == 2) <i class="red attention icon"></i> Submitted @elseif($over != count(data_get($staff,'overheads')) || $staff->status == 2) <i class="red attention icon"></i> Submitted
@elseif($staff->status == 1 || $staff->status == null) In Preparation @elseif($staff->status == 1 || $staff->status == null) In Preparation
@endif @endif
</th> </th>
<th style="width: 13%" class="text-center">Submitted on: {{ date("d/m/Y", strtotime(data_get($staff,'submission'))) }}</th> <th style="width: 13%" class="text-center">Submitted on: {{ date("d/m/Y", strtotime(data_get($staff,'submission'))) }}</th>
<th style="width: 12%" class="text-center"> <th style="width: 12%" class="text-center">
<button class="center aligned ui blue icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => data_get($staff,'tm_phase'), 'month' => data_get($staff,'tm_month'), 'year' => data_get($staff,'tm_year') ]) }}';" target='_blank'>View</button> <button class="center aligned ui blue icon button">View Details</button>
</th> </th>
</tr> </tr>
</thead> </thead>
...@@ -66,7 +68,7 @@ ...@@ -66,7 +68,7 @@
</tr> </tr>
</thead> </thead>
@foreach($details as $key => $tp) @foreach($detail as $key => $tp)
@if(data_get($staff, 'tmid') == data_get($tp, 'fk_tm_id')) @if(data_get($staff, 'tmid') == data_get($tp, 'fk_tm_id'))
<tr> <tr>
<td style="width: 25;">{{data_get($tp, 'tp_project_name')}}</td> <td style="width: 25;">{{data_get($tp, 'tp_project_name')}}</td>
...@@ -85,40 +87,52 @@ ...@@ -85,40 +87,52 @@
@elseif(data_get($tp, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR @elseif(data_get($tp, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR
@endif @endif
</td> </td>
<td style="width: 12%;" class="text-center"> <td style="width: 12%;" class="text-center single line">
@if(data_get($tp, 'tp_timesheet_sts') == 2) @if(data_get($tp, 'tp_timesheet_sts') == 2)
<button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.revaction', ['tpid'=>data_get($tp, 'id'), 'phase'=>data_get($tp,'tp_phase'), 'month'=>data_get($tp,'tp_month'), 'year'=>data_get($tp,'tp_year'), 'page'=>$page ]) }}';">Verify | Reject</button> <button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.revaction', ['tpid'=>data_get($tp, 'id'), 'phase'=>data_get($tp,'tp_phase'), 'month'=>data_get($tp,'tp_month'), 'year'=>data_get($tp,'tp_year'), 'page'=>$page ]) }}';">Verify | Reject</button>
@else @else
<button class="center aligned ui green icon button disabled">Verify | Reject</button> <button class="center aligned ui green icon button disabled">Verify | Reject</button>
@endif @endif
<a href="{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => data_get($staff,'tm_phase'), 'month' => data_get($staff,'tm_month'), 'year' => data_get($staff,'tm_year') ]) }}" class="center aligned ui blue icon button" target='_blank'>View</a>
</td> </td>
</tr> </tr>
@endif @endif
@endforeach @endforeach
</table> </table>
<table class="ui unstackable celled table"> <?php $n = null; ?>
<thead> @foreach($details as $key => $detail)
<tr> @if(data_get($staff,'tmid') == data_get($detail, 'fk_tm_id'))
<th style="width: 10%" class="center aligned">Date</th> @foreach(data_get($detail,'notes') as $key => $value)
<th style="width: 15%" class="single line"> Overhead Description</th> <?php $n = $value; ?>
<th class="center aligned">Notes</th> @endforeach
</tr> @endif
</thead> @endforeach
@foreach($details as $key => $detail)
@if(data_get($staff,'tmid') == data_get($detail, 'fk_tm_id')) @if($n)
@foreach(data_get($detail,'notes') as $key => $value) <table class="ui unstackable celled table">
@if(data_get($value,'td_hours')) <thead>
<tr> <tr>
<td style="width: 10%" class="center aligned">{{data_get($value, 'td_date')}}</td> <th style="width: 10%" class="center aligned">Date</th>
<td style="width: 15%" class="single line">{{data_get($value, 'td_overhead_desc')}}</td> <th style="width: 15%" class="single line"> Overhead Description</th>
<td>{{data_get($value, 'td_overhead_note')}}</td> <th class="center aligned">Notes</th>
</tr> </tr>
@endif </thead>
@endforeach @foreach($details as $key => $detail)
@endif @if(data_get($staff,'tmid') == data_get($detail, 'fk_tm_id'))
@endforeach @foreach(data_get($detail,'notes') as $key => $value)
</table> @if(data_get($value,'td_hours'))
<tr>
<td style="width: 10%" class="center aligned">{{data_get($value, 'td_date')}}</td>
<td style="width: 15%" class="single line">{{data_get($value, 'td_overhead_desc')}}</td>
<td>{{data_get($value, 'td_overhead_note')}}</td>
</tr>
@endif
@endforeach
@endif
@endforeach
</table>
@endif
@foreach ($ts as $key => $value) @foreach ($ts as $key => $value)
@if(data_get($value,'attachement')) @if(data_get($value,'attachement'))
......
...@@ -91,7 +91,7 @@ ...@@ -91,7 +91,7 @@
@else @else
<button class="center aligned ui green icon button disabled">Verify | Reject</button> <button class="center aligned ui green icon button disabled">Verify | Reject</button>
@endif @endif
<button class="center aligned ui blue icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => data_get($staff,'phase'), 'month' => data_get($staff,'month'), 'year' => data_get($staff,'year')]) }}', '_blank';">View</button> <a class="center aligned ui blue icon button" href="{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => data_get($staff,'phase'), 'month' => data_get($staff,'month'), 'year' => data_get($staff,'year')]) }}" target="_blank">View</a>
</td> </td>
</tr> </tr>
@endif @endif
......
...@@ -4,40 +4,204 @@ ...@@ -4,40 +4,204 @@
<div class="ui segment"> <div class="ui segment">
<a class="ui blue left ribbon label">Overhead Verification</a> <a class="ui blue left ribbon label">Overhead Verification</a>
<br><br> <br>
<table class="ui unstackable collapsing table" style="width: 100%">
<tbody>
<tr>
<td rowspan="3">
<img src="{{ url('img/3f-logo.svg') }}" height="126" width="126" alt="3f-logo">
</td>
<td>Name</td>
<td>:</td>
<td>{{ data_get($staff,'STAFF_NAME') }}</td>
<td rowspan="3"></td>
<td>Department</td>
<td>:</td>
<td>{{ data_get($staff,'DEPARTMENT') }}</td>
<td rowspan="3"></td>
</tr>
<tr>
<td>Staff No</td>
<td>:</td>
<td>{{ data_get($staff,'STAFF_ID') }}</td>
<td>Reporting Manager</td>
<td>:</td>
<td>{{ data_get($staff,'HOD_NAME') }}</td>
</tr>
<tr>
<td>Month</td>
<td>:</td>
<td>{{ $strMonth }}</td>
<td>Phase</td>
<td>:</td>
<td>
@if($phase == 1) 1st Half-month
@else 2nd Half-month
@endif
</td>
</tr>
</tbody>
</table>
<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>
<form action="{{ route('timesheet::dashboard.verifyoverhead') }}" method="POST" class="ui form"> <form action="{{ route('timesheet::dashboard.verifyoverhead') }}" method="POST" class="ui form">
{{csrf_field()}} {{csrf_field()}}
<input type="hidden" name="tpid" value="{{ data_get($profile,'id') }}"> <input type="hidden" name="tpid" value="{{ data_get($profile,'id') }}">
<input type="hidden" name="page" value="{{$page}}"> <input type="hidden" name="page" value="{{$page}}">
<div class="six wide field">
<label>Staff Name</label>
<input type="text" readonly="readonly" value="{{data_get($profile,'team.fullname')}}">
</div>
<div class="three fields">
<div class="two wide field">
<label>Year</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tp_year') }}">
</div>
<div class="two wide field">
<label>Month</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tp_month') }}">
</div>
<div class="two wide field">
<label>Phase</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tp_phase') }}">
</div>
</div>
<div class="two fields"> <div class="two fields">
<div class="six wide field"> <div class="field">
<input type="hidden" name="verifier" value="{{ data_get($hod,'id') }}"> <input type="hidden" name="verifier" value="{{ data_get($hod,'id') }}">
<label>Head of Department</label> <label>Head of Department</label>
<input type="text" readonly="readonly" value="{{ data_get($hod,'name') }}"> <input type="text" readonly="readonly" value="{{ data_get($hod,'name') }}">
</div> </div>
<div class="three wide field"> <div class="field">
<label>Action</label> <label>Action</label>
<select class="ui fluid dropdown" name="action"> <select class="ui fluid dropdown" name="action">
<option value="1">Verify</option> <option value="1">Verify</option>
...@@ -47,7 +211,7 @@ ...@@ -47,7 +211,7 @@
</div> </div>
<div class="field"> <div class="field">
<label>Remarks</label> <label>Remarks</label>
<textarea name="remarks"></textarea> <textarea rows="3" name="remarks"></textarea>
</div> </div>
<button class="ui primary button" type="submit">Submit</button> <button class="ui primary button" type="submit">Submit</button>
......
...@@ -475,8 +475,134 @@ class DashboardController extends Controller ...@@ -475,8 +475,134 @@ class DashboardController extends Controller
// ->where('tmid', $request->tmid) // ->where('tmid', $request->tmid)
// ->first(); // ->first();
$phase = $profile->tp_phase;
$month = $profile->tp_month;
$year = $profile->tp_year;
$daymonth=cal_days_in_month(CAL_GREGORIAN,$month,$year);
$myDate = $month.'/'.'1'.'/'.$year;
$date = Carbon::createFromFormat('m/d/Y', $myDate);
$staff = VwViewer::where('STAFF_ID', $profile->staffid)
->first();
$strMonth = $date->format('F');
$strdays = [];
for ($i=0; $i < $daymonth; $i++) {
$tempdate = $year.'-'.sprintf('%02d', $month).'-'.sprintf('%02d', $i+1);
$strday = Carbon::createFromFormat('Y-m-d', $tempdate)->format('l');
$strdays[$i] = substr($strday, 0, 3);
}
// dd($staff);
$chargeable = 1;
$overhead = 3;
$check = Ts_master::where('tm_staff_id', $profile->staffid)
->where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->with('attachement')
->first();
$chargeableproject = Tproject::where('fk_tm_id', data_get($check,'id'))
->where('tp_project_type', 1)
->with('project')
->get();
$chargeablelist = [];
$overheadlist = [];
foreach($chargeableproject as $key => $value) {
$chargeablelist[] = [
'pid' => $value->td_project,
'pcode' => $value->project->p_project_code,
'pname' => $value->project->p_project_description,
];
}
if($check)
{
$chargehour = Ts_detail::where('fk_tm_id',$check->id)
->where('td_project_type', $chargeable)
// ->where('td_hours', '!=', 0)
->get();
$overheadhour = Ts_detail::where('fk_tm_id',$profile->fk_tm_id)
->where('td_project_type', $overhead)
->where('td_hours', '!=', 0)
->get();
// dd($overheadhour);
$tempOverhead[0] = "";
$tempOverheadid[0] = 0;
if(isset($overheadhour[0]))
{
// dd('sini ke?');
$tempOverhead[0] = $overheadhour[0]->td_overhead_desc;
$tempOverheadid[0] = $overheadhour[0]->fk_o_id;
$j = 0;
for($i = 0; $i < count($overheadhour); $i++)
{
if ($tempOverhead[$j] == $overheadhour[$i]->td_overhead_desc) {
}
else
{
$j++;
$tempOverhead[$j] = $overheadhour[$i]->td_overhead_desc;
$tempOverheadid[$j] = $overheadhour[$i]->fk_o_id;
}
}
$overheadlist[] = [
'pid' => $profile->fk_o_id,
'pname' => $profile->tp_project_name,
];
}
else
{
// dd('ke sini?');
}
$totalchargehrs = $check->tm_chargeable_hrs;
$totaloverheadhrs = $check->tm_overhead_hrs;
$notes = Ts_detail::where('tm_year', $year)
->where('tm_month', $month)
->where('tm_phase', $phase)
->where('fk_tm_id', $check->id)
->where('tm_staff_id', $profile->staffid)
->where('td_project_type', $overhead)
->whereNotNull('td_hours')
->orderby('td_date')
->get();
}
else
{
$chargehour = null;
$overheadhour = null;
$totalchargehrs = null;
$totaloverheadhrs = null;
$notes = null;
$check = null;
}
return view('timesheet::dashboard.revaction', compact('profile', 'hod', 'page')); // dd($overheadlist);
return view('timesheet::dashboard.revaction', compact('profile', 'hod', 'page', 'staff', 'strMonth', 'year', 'month', 'phase', 'strdays', 'chargeablelist', 'chargehour', 'totalchargehrs', 'daymonth', 'overheadlist', 'overheadhour', 'totaloverheadhrs'));
} }
public function projectaction(Request $request) public function projectaction(Request $request)
...@@ -623,7 +749,7 @@ class DashboardController extends Controller ...@@ -623,7 +749,7 @@ class DashboardController extends Controller
$pm = Users::find(Auth::id()); $pm = Users::find(Auth::id());
return view('timesheet::dashboard.projectaction', compact('profile', 'pm', 'page', 'staff', 'strMonth', 'year', 'month', 'phase', 'strdays', 'chargeablelist', 'chargehour', 'totalchargehrs')); return view('timesheet::dashboard.projectaction', compact('profile', 'pm', 'page', 'staff', 'strMonth', 'year', 'month', 'phase', 'strdays', 'chargeablelist', 'chargehour', 'daymonth', 'totalchargehrs'));
} }
public function verify(Request $request) public function verify(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