Commit 02b986e0 by Azhan Hannan

flow approval by bod & pd

parent 2924cdde
...@@ -3,30 +3,30 @@ ...@@ -3,30 +3,30 @@
@section('content') @section('content')
<div class="ui segment"> <div class="ui segment">
<a class="ui blue left ribbon label">Staff Timesheet Approve / Reject</a> <a class="ui blue left ribbon label">{{data_get($profile,'tp_project_name')}}</a>
<br><br> <br><br>
<form action="{{ route('timesheet::dashboard.approval') }}" method="POST" class="ui form"> <form action="{{ route('timesheet::dashboard.approval') }}" method="POST" class="ui form">
{{csrf_field()}} {{csrf_field()}}
<input type="hidden" name="tmid" value="{{ data_get($profile,'tmid') }}"> <input type="hidden" name="tpid" value="{{ data_get($profile,'id') }}">
<div class="six wide field"> <div class="six wide field">
<label>Staff Name</label> <label>Staff Name</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'fullname') }}"> <input type="text" readonly="readonly" value="{{ data_get($profile,'team.fullname') }}">
</div> </div>
<div class="three fields"> <div class="three fields">
<div class="two wide field"> <div class="two wide field">
<label>Year</label> <label>Year</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tm_year') }}"> <input type="text" readonly="readonly" value="{{ data_get($profile,'tp_year') }}">
</div> </div>
<div class="two wide field"> <div class="two wide field">
<label>Month</label> <label>Month</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tm_month') }}"> <input type="text" readonly="readonly" value="{{ data_get($profile,'tp_month') }}">
</div> </div>
<div class="two wide field"> <div class="two wide field">
<label>Phase</label> <label>Phase</label>
<input type="text" readonly="readonly" value="{{ data_get($profile,'tm_phase') }}"> <input type="text" readonly="readonly" value="{{ data_get($profile,'tp_phase') }}">
</div> </div>
</div> </div>
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
@if($status == 1 || $status == null) In Preparation @if($status == 1 || $status == null) In Preparation
@elseif($verified == $allproject) <i class="green check icon"></i> Verified by PM @elseif($verified == $allproject) <i class="green check icon"></i> Verified by PM
@elseif($status == 2) <i class="red attention icon"></i> Submitted @elseif($status == 2) <i class="red attention icon"></i> Submitted
@elseif($status == 4) <i class="green check icon"></i>Verified by BOD @elseif($status == 4) <i class="green check icon"></i>Verified by PD
@elseif($status == 5) <i class="red attention icon"></i>Dissaproved by BOD @elseif($status == 5) <i class="red attention icon"></i>Dissaproved by PD
@elseif($status == 6) <i class="red attention icon"></i>Rejected by HOD/HOU @elseif($status == 6) <i class="red attention icon"></i>Rejected by PM
@elseif($status == 7) <i class="red attention icon"></i>Rejected by HR @elseif($status == 7) <i class="red attention icon"></i>Rejected by HR
@endif @endif
</th> </th>
...@@ -67,10 +67,10 @@ ...@@ -67,10 +67,10 @@
<td style="width: 13%" class="text-center"> <td style="width: 13%" class="text-center">
@if(data_get($detail, 'tp_timesheet_sts') == 1 || data_get($detail, 'tp_timesheet_sts') == null) In Preparation @if(data_get($detail, 'tp_timesheet_sts') == 1 || data_get($detail, 'tp_timesheet_sts') == null) In Preparation
@elseif(data_get($detail, 'tp_timesheet_sts') == 2) <i class="red attention icon"></i> Submitted @elseif(data_get($detail, 'tp_timesheet_sts') == 2) <i class="red attention icon"></i> Submitted
@elseif(data_get($detail, 'tp_timesheet_sts') == 3) <i class="green check icon"></i> Verified by HOD/HOU @elseif(data_get($detail, 'tp_timesheet_sts') == 3) <i class="green check icon"></i> Verified by PM
@elseif(data_get($detail, 'tp_timesheet_sts') == 4) <i class="green check icon"></i>Verified by BOD @elseif(data_get($detail, 'tp_timesheet_sts') == 4) <i class="green check icon"></i>Verified by PD
@elseif(data_get($detail, 'tp_timesheet_sts') == 5) <i class="red attention icon"></i>Dissaproved by BOD @elseif(data_get($detail, 'tp_timesheet_sts') == 5) <i class="red attention icon"></i>Dissaproved by PD
@elseif(data_get($detail, 'tp_timesheet_sts') == 6) <i class="red attention icon"></i>Rejected by HOD/HOU @elseif(data_get($detail, 'tp_timesheet_sts') == 6) <i class="red attention icon"></i>Rejected by PM
@elseif(data_get($detail, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR @elseif(data_get($detail, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR
@endif @endif
</td> </td>
......
...@@ -11,93 +11,144 @@ ...@@ -11,93 +11,144 @@
<div class="ui styled fluid accordion"> <div class="ui styled fluid accordion">
@foreach($profile as $key => $staff) @foreach($profiles as $key => $staff)
<?php
$td = $checktd->where('tm_staff_id', $staff->staffid);
$detail = $details->where('staffid', $staff->staffid);
$checkchargeable = $detail->where('tp_project_type',1)->first();
$checkoverhead = $detail->where('tp_project_type',3)->first();
// dd($detail);
// dump(count($detail->where('tp_timesheet_sts',4)));
// dump(count($detail));
// dump(count($checkoverhead));
// dd('tengok');
?>
@if(count($detail->where('tp_timesheet_sts',4)) == count($detail))
@else
<div class="title"> <div class="title">
<table class="ui unstackable celled table"> <table class="ui unstackable celled table">
<thead> <thead>
<tr> <tr>
<th colspan="2" style="width: 60%;"><i class="dropdown icon"></i>{{ data_get($staff,'fullname') }}</th> <th style="width: 60%;"><i class="dropdown icon"></i>{{ data_get($staff,'fullname') }}</th>
<th style="width: 15%;" class="center aligned"> <th style="width: 15%;" class="center aligned">
@if($staff->status == 1 || $staff->status == null) In Preparation @if($staff->status == 1 || $staff->status == null) In Preparation
@elseif($staff->status == 2) <i class="red attention icon"></i> Submitted @elseif($staff->status == 3) <i class="green check icon"></i>Verified by HOD/HOU/PM
@elseif($staff->status == 3) <i class="green check icon"></i> Verified by HOD/HOU
@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($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 == 6) <i class="red attention icon"></i>Rejected by HOD/HOU
@elseif($staff->status == 7) <i class="red attention icon"></i>Rejected by HR
@endif @endif
</th> </th>
<th class="right aligned"> <th style="width: 15%" class="text-center">Verified at: {{data_get($staff,'verified')}}
@if($staff->status == 3) </th>
<button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.approvalaction', [ 'tmid'=>$staff->tmid ]) }}';">Approve | Reject</button> <th style="width: 10%" class="text-center">
@else
<!-- <button class="center aligned ui green icon button disabled">Approve | Reject</button> -->
@endif
<button class="center aligned ui blue icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => $phase, 'month' => $month, 'year' => $year]) }}';" target='_blank'>View</button> <button class="center aligned ui blue icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => $phase, 'month' => $month, 'year' => $year]) }}';" target='_blank'>View</button>
</th> </th>
</tr> </tr>
<tr>
<td style="width: 30%;">Chargeable (A) : {{ data_get($staff,'chargeable') }}</td>
<td style="width: 30%;">Overhead (B) : {{ data_get($staff,'overhead') }}</td>
<td style="width: 15%;">Overtime: {{ data_get($staff,'overtime') }}</td>
<td class="right aligned">Total Hours/Days: {{ data_get($staff,'totalhrs')." hours/ ".number_format(data_get($staff,'totalhrs')/8, 1, '.', '')." days" }}</td>
</tr>
</thead> </thead>
</table> </table>
</div> </div>
<?php
$cptype = "A";
$otype = "B";
$td = $checktd->where('tm_staff_id', $staff->staff_id);
$detail = $details->where('staffid', $staff->staff_id);
$ts = $checkts->where('tm_staff_id', $staff->staff_id);
?>
<div class="content" style="padding-top: 0px;"> <div class="content" style="padding-top: 0px;">
@if($checkchargeable)
<table class="ui unstackable celled table"> <table class="ui unstackable celled table">
<thead> <thead>
<tr> <tr>
<th style="width: 6%;" class="center aligned">Type</th> <th style="width: 10%;">Project Code</th>
<th style="width: 17%;">Project Code</th> <th style="width: 15%;">Project Name</th>
<th style="width: 26%;">Project Name</th> <th style="width: 10%;" class="center aligned">Total Hours</th>
<th style="width: 26%;">Project Manager</th> <th style="width: 10%;" class="center aligned">Total Days</th>
<th style="width: 12.5%;" class="center aligned">Total Hours</th> <th style="width: 15%;">PM Remarks</th>
<th style="width: 12.5%;" class="center aligned">Total Days</th> <th style="width: 15%;">PD Remarks</th>
<th style="width: 15%;" class="center aligned">Status</th>
<th style="width: 10%;" class="center aligned">Action</th>
</tr> </tr>
</thead> </thead>
@if($detail->where('ptype', 1)) @if($detail->where('tp_project_type', 1))
@foreach($detail->where('ptype', 1) as $key => $chargeable) @foreach($detail->where('tp_project_type', 1) as $key => $chargeable)
<tr> <tr>
<td style="width: 6%;" class="center aligned">{{ $cptype }}</td> <td style="width: 10%;">{{ data_get($chargeable, 'project.p_project_code') }}</td>
<td style="width: 17%;">{{ data_get($chargeable, 'pcode') }}</td> <td style="width: 15%;">{{ data_get($chargeable, 'tp_project_name') }}</td>
<td style="width: 26%;">{{ data_get($chargeable, 'pname') }}</td> <td style="width: 10%;" class="center aligned">{{ data_get($chargeable, 'tp_hours') }}</td>
<td style="width: 26%;">{{ data_get($chargeable, 'pmname') }}</td> <td style="width: 10%;" class="center aligned">{{ number_format(data_get($chargeable, 'tp_hours')/8, 1, '.', '') }}</td>
<td style="width: 12.5%;" class="center aligned">{{ data_get($chargeable, 'hours') }}</td> <td style="width: 15%;">{{data_get($chargeable, 'verifier_remark')}}</td>
<td style="width: 12.5%;" class="center aligned">{{ number_format(data_get($chargeable, 'hours')/8, 1, '.', '') }}</td> <td style="width: 15%;">{{data_get($chargeable, 'approver_remark')}}</td>
<td style="width: 15%;" class="center aligned">
@if(data_get($chargeable, 'tp_timesheet_sts') == 1 || data_get($chargeable, 'tp_timesheet_sts') == null) In Preparation
@elseif(data_get($chargeable, 'tp_timesheet_sts') == 2) <i class="red attention icon"></i> Submitted
@elseif(data_get($chargeable, 'tp_timesheet_sts') == 3) <i class="red attention icon"></i> Verified by PM
@elseif(data_get($chargeable, 'tp_timesheet_sts') == 4) <i class="green check icon"></i>Verified by PD
@elseif(data_get($chargeable, 'tp_timesheet_sts') == 5) <i class="red attention icon"></i>Dissaproved by PD
@elseif(data_get($chargeable, 'tp_timesheet_sts') == 6) <i class="red attention icon"></i>Rejected by PM
@elseif(data_get($chargeable, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR
@endif
</td>
<td style="width: 10%;" class="text-center single line">
@if(data_get($chargeable, 'tp_timesheet_sts') == 3)
<button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.approvalaction', ['tpid'=>data_get($chargeable, 'id'), 'phase'=>$phase, 'month'=>$month, 'year'=>$year ]) }}';">Approval</button>
@else
<button class="center aligned ui green icon button disabled">Approval</button>
@endif
</td>
</tr> </tr>
@endforeach @endforeach
@endif @endif
@if($detail->where('ptype', 3)) </table>
@foreach($detail->where('ptype', 3) as $key => $chargeable) @endif
@if($checkoverhead)
<table class="ui unstackable celled table">
<thead>
<tr> <tr>
<td style="width: 6%;" class="center aligned">{{ $otype }}</td> <th style="width: 25%;">Overhead</th>
<td style="width: 17%;">{{ data_get($chargeable, 'pcode') }}</td> <th style="width: 10%;" class="center aligned">Total Hours</th>
<td style="width: 26%;">{{ data_get($chargeable, 'pname') }}</td> <th style="width: 10%;" class="center aligned">Total Days</th>
<td style="width: 26%;">{{ data_get($chargeable, 'pmname') }}</td> <th style="width: 15%;">HOD Remarks</th>
<td style="width: 12.5%;" class="center aligned">{{ data_get($chargeable, 'hours') }}</td> <th style="width: 15%;">BOD Remarks</th>
<td style="width: 12.5%;" class="center aligned">{{ number_format(data_get($chargeable, 'hours')/8, 1, '.', '') }}</td> <th style="width: 15%;" class="center aligned">Status</th>
<th style="width: 10%;" class="center aligned">Action</th>
</tr>
</thead>
@if($detail->where('tp_project_type', 3))
@foreach($detail->where('tp_project_type', 3) as $key => $overhead)
<tr>
<td style="width: 25%;">{{ data_get($overhead, 'tp_project_name') }}</td>
<td style="width: 10%;" class="center aligned">{{ data_get($overhead, 'tp_hours') }}</td>
<td style="width: 10%;" class="center aligned">{{ number_format(data_get($overhead, 'tp_hours')/8, 1, '.', '') }}</td>
<td style="width: 15%;">{{data_get($overhead, 'verifier_remark')}}</td>
<td style="width: 15%;">{{data_get($overhead, 'approver_remark')}}</td>
<td style="width: 15%;" class="center aligned">
@if(data_get($overhead, 'tp_timesheet_sts') == 1 || data_get($overhead, 'tp_timesheet_sts') == null) In Preparation
@elseif(data_get($overhead, 'tp_timesheet_sts') == 2) <i class="red attention icon"></i> Submitted
@elseif(data_get($overhead, 'tp_timesheet_sts') == 3) <i class="red attention icon"></i> Verified by HOD
@elseif(data_get($overhead, 'tp_timesheet_sts') == 4) <i class="green check icon"></i>Verified by BOD
@elseif(data_get($overhead, 'tp_timesheet_sts') == 5) <i class="red attention icon"></i>Dissaproved by BOD
@elseif(data_get($overhead, 'tp_timesheet_sts') == 6) <i class="red attention icon"></i>Rejected by HOD
@elseif(data_get($overhead, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR
@endif
</td>
<td style="width: 10%;" class="text-center single line">
@if(data_get($overhead, 'tp_timesheet_sts') == 3)
<button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.approvalaction', ['tpid'=>data_get($overhead, 'id'), 'phase'=>$phase, 'month'=>$month, 'year'=>$year ]) }}';">Approval</button>
@else
<button class="center aligned ui green icon button disabled">Approval</button>
@endif
</td>
</tr> </tr>
@endforeach @endforeach
@endif @endif
</table> </table>
@endif
@if(data_get($staff,'team.pelulus') == data_get($approval,'id'))
<table class="ui unstackable celled table"> <table class="ui unstackable celled table">
<thead> <thead>
<tr> <tr>
<th style="width: 15%" class="center aligned">Date</th> <th style="width: 10%" class="center aligned">Date</th>
<th style="width: 25%" class="single line"> Overhead Description</th>
<th class="center aligned">Notes</th> <th class="center aligned">Notes</th>
</tr> </tr>
</thead> </thead>
...@@ -105,17 +156,17 @@ ...@@ -105,17 +156,17 @@
@foreach($td as $key => $value) @foreach($td as $key => $value)
@if($value->td_overhead_note) @if($value->td_overhead_note)
<tr> <tr>
<td style="width: 15%" class="center aligned">{{ data_get($value,'td_date') }}</td> <td style="width: 10%" class="center aligned">{{data_get($value, 'td_date')}}</td>
<td>{{ data_get($value,'td_overhead_note') }}</td> <td style="width: 25%" class="single line">{{data_get($value, 'td_overhead_desc')}}</td>
<td>{{data_get($value, 'td_overhead_note')}}</td>
</tr> </tr>
@endif @endif
@endforeach @endforeach
@endif @endif
</table> </table>
@endif
@foreach ($ts as $key => $value) @if(data_get($staff,'attachment'))
@if(data_get($value,'attachement'))
<table class="ui unstackable celled table"> <table class="ui unstackable celled table">
<thead> <thead>
<tr> <tr>
...@@ -126,7 +177,7 @@ ...@@ -126,7 +177,7 @@
<tr> <tr>
<td style="width: 4%;"></td> <td style="width: 4%;"></td>
<td> <td>
<a href="{{ asset(data_get($value,'attachement.path'))}}" target="_blank"> <a href="{{ asset(data_get($value,'attachment.path'))}}" target="_blank">
<button class="ui active button"> <button class="ui active button">
<i class="download icon"></i> <i class="download icon"></i>
...@@ -137,9 +188,7 @@ ...@@ -137,9 +188,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
@endif @endif
@endforeach
@if(data_get($staff,'hodremarks')) @if(data_get($staff,'hodremarks'))
...@@ -180,6 +229,8 @@ ...@@ -180,6 +229,8 @@
</table> </table>
@endif @endif
</div> </div>
@endif
@endforeach @endforeach
</div> </div>
</div> </div>
......
...@@ -16,14 +16,11 @@ Route::group( ...@@ -16,14 +16,11 @@ Route::group(
//dashboard //dashboard
Route::get('home',['uses' => 'DashboardController@index', 'as' => 'dashboard.index']); Route::get('home',['uses' => 'DashboardController@index', 'as' => 'dashboard.index']);
Route::get('vwviewer',['uses' => 'DashboardController@vwviewer', 'as' => 'dashboard.vwviewer']); Route::get('vwviewer',['uses' => 'DashboardController@vwviewer', 'as' => 'dashboard.vwviewer']);
//timesheet //timesheet
Route::get('timesheetApproval',['uses' => 'DashboardController@timesheetApproval', 'as' => 'dashboard.timesheetApproval']); Route::get('timesheetApproval',['uses' => 'DashboardController@timesheetApproval', 'as' => 'dashboard.timesheetApproval']);
Route::get('timesheetReport',['uses' => 'DashboardController@timesheetReport', 'as' => 'dashboard.timesheetReport']); Route::get('timesheetReport',['uses' => 'DashboardController@timesheetReport', 'as' => 'dashboard.timesheetReport']);
Route::get('projectVerify',['uses' => 'DashboardController@projectVerify', 'as' => 'dashboard.projectVerify']); Route::get('projectVerify',['uses' => 'DashboardController@projectVerify', 'as' => 'dashboard.projectVerify']);
Route::get('timesheetReview',['uses' => 'DashboardController@timesheetReview', 'as' => 'dashboard.timesheetReview']); Route::get('timesheetReview',['uses' => 'DashboardController@timesheetReview', 'as' => 'dashboard.timesheetReview']);
Route::get('timesheetViewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']); Route::get('timesheetViewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']);
Route::get('filterProjectVerify',['uses' => 'DashboardController@filterProjectVerify', 'as' => 'dashboard.filterProjectVerify']); Route::get('filterProjectVerify',['uses' => 'DashboardController@filterProjectVerify', 'as' => 'dashboard.filterProjectVerify']);
...@@ -42,7 +39,6 @@ Route::group( ...@@ -42,7 +39,6 @@ Route::group(
Route::post('approval', ['uses' => 'DashboardController@approval', 'as' => 'dashboard.approval']); Route::post('approval', ['uses' => 'DashboardController@approval', 'as' => 'dashboard.approval']);
Route::post('verifyoverhead', ['uses' => 'DashboardController@verifyoverhead', 'as' => 'dashboard.verifyoverhead']); Route::post('verifyoverhead', ['uses' => 'DashboardController@verifyoverhead', 'as' => 'dashboard.verifyoverhead']);
//laporan //laporan
Route::get('ringkasanLaporan', ['uses' => 'ReportController@ringkasanLaporan', 'as' => 'report.ringkasanLaporan']); Route::get('ringkasanLaporan', ['uses' => 'ReportController@ringkasanLaporan', 'as' => 'report.ringkasanLaporan']);
Route::post('generateRingkasan', ['uses' => 'ReportController@generateRingkasan', 'as' => 'report.generateRingkasan']); Route::post('generateRingkasan', ['uses' => 'ReportController@generateRingkasan', 'as' => 'report.generateRingkasan']);
......
...@@ -20,6 +20,7 @@ use Portal\Timesheet\Model\VwReviewProfile; ...@@ -20,6 +20,7 @@ use Portal\Timesheet\Model\VwReviewProfile;
use Portal\Timesheet\Model\VwReviewDetails; use Portal\Timesheet\Model\VwReviewDetails;
use Portal\Timesheet\Model\VwChargeableVerification; use Portal\Timesheet\Model\VwChargeableVerification;
use Portal\Timesheet\Model\VwChargeableReview; use Portal\Timesheet\Model\VwChargeableReview;
use Portal\Timesheet\Model\VwApprovalProfiles;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use File; use File;
...@@ -196,38 +197,54 @@ class DashboardController extends Controller ...@@ -196,38 +197,54 @@ class DashboardController extends Controller
$approval = Users::find(Auth::id()); $approval = Users::find(Auth::id());
$profile = VwReviewProfile::where('bod_id', $approval->id) $profiles = VwApprovalProfiles::where('pdid', $approval->id)
->where('tm_year', $curryear) ->where('year', $curryear)
->where('tm_month', $month) ->where('month', $month)
->where('tm_phase', $phase) ->where('phase', $phase)
->orderby('tmid')
->with('attachment')
->with('team')
->with('tproject')
->get(); ->get();
$staffs = Staff_info::where('pelulus', $approval->id) // dd($profiles);
->first();
$checkts = Ts_master::where('tm_timesheet_master_sts', '>' ,2) $tmid = [];
->where('tm_year', $curryear) foreach ($profiles as $key => $value) {
->where('tm_month', $request->month) $tmid[] = $value->tmid;
->where('tm_phase', $request->phase) }
->with('attachement')
->get(); // $checkts = Ts_master::whereIn('id', $tmid)
// ->with('attachement')
// ->get();
// dd($checkts);
// where('tm_timesheet_master_sts', '>' ,2)
// ->where('tm_year', $curryear)
// ->where('tm_month', $request->month)
// ->where('tm_phase', $request->phase)
// ->with('attachement')
// ->get();
// dd($checkts); // dd($checkts);
$details = VwReviewDetails::where('year', $curryear) $details = Tproject::whereIn('fk_tm_id', $tmid)
->where('month', $request->month) ->where('tp_pd', $approval->id)
->where('phase', $request->phase) ->with('project')
->where('approval', $approval->id)
->get(); ->get();
$checktd = Ts_detail::where('tm_year', $curryear) // dd($details);
->where('tm_month', $request->month) // $details = VwReviewDetails::where('year', $curryear)
->where('tm_phase', $request->phase) // ->where('month', $request->month)
// ->where('phase', $request->phase)
// ->where('approval', $approval->id)
// ->get();
$checktd = Ts_detail::whereIn('fk_tm_id', $tmid)
->where('td_hours', "<>", 0) ->where('td_hours', "<>", 0)
// ->orwhereNotNull('td_overhead_note')
->get(); ->get();
// dd($checktd); // dd($checktd);
// dd($checktd);
return view('timesheet::dashboard.timesheetApproval', compact('profile', 'staffs', 'details', 'checkts', 'checktd', 'year', 'month', 'phase')); return view('timesheet::dashboard.timesheetApproval', compact('approval', 'profiles', 'details', 'checktd', 'year', 'month', 'phase'));
} }
public function timesheetReport() public function timesheetReport()
...@@ -395,7 +412,7 @@ class DashboardController extends Controller ...@@ -395,7 +412,7 @@ class DashboardController extends Controller
$profile->verifier_remark = data_get($request,'remarks'); $profile->verifier_remark = data_get($request,'remarks');
$profile->save(); $profile->save();
$td = Ts_detail::where('fk_tm_id', $request->tmid) Ts_detail::where('fk_tm_id', $request->tmid)
->where('td_project', $request->pid) ->where('td_project', $request->pid)
->update([ 'td_timesheet_sts' => 3 ]); ->update([ 'td_timesheet_sts' => 3 ]);
...@@ -408,7 +425,7 @@ class DashboardController extends Controller ...@@ -408,7 +425,7 @@ class DashboardController extends Controller
if(count($allproject) == count($checkapproved)){ if(count($allproject) == count($checkapproved)){
$ts = Ts_master::where('id', $request->tmid) Ts_master::where('id', $request->tmid)
->update( ->update(
[ [
'tm_timesheet_master_sts' => 3, 'tm_timesheet_master_sts' => 3,
...@@ -426,19 +443,19 @@ class DashboardController extends Controller ...@@ -426,19 +443,19 @@ class DashboardController extends Controller
$profile->verifier_remark = data_get($request,'remarks'); $profile->verifier_remark = data_get($request,'remarks');
$profile->save(); $profile->save();
$td = Ts_detail::where('fk_tm_id', $request->tmid) Ts_detail::where('fk_tm_id', $request->tmid)
->where('td_project', $request->pid) ->where('td_project', $request->pid)
->update([ 'td_timesheet_sts' => 6 ]); ->update([ 'td_timesheet_sts' => 6 ]);
$tp = Tproject::where('fk_tm_id', $request->tmid) Tproject::where('fk_tm_id', $request->tmid)
->update(['tp_timesheet_sts' => 6]); ->update(['tp_timesheet_sts' => 6]);
$checkrejected = Tproject::where('fk_tm_id', $request->tmid) $checkrejected = Tproject::where('fk_tm_id', $request->tmid)
->where('tp_timesheet_sts', 6) ->where('tp_timesheet_sts', 6)
->get(); ->first();
if($checkrejected){ if($checkrejected){
$ts = Ts_master::where('id', $request->tmid) Ts_master::where('id', $request->tmid)
->update( ->update(
[ [
'tm_timesheet_master_sts' => 6, 'tm_timesheet_master_sts' => 6,
...@@ -474,7 +491,7 @@ class DashboardController extends Controller ...@@ -474,7 +491,7 @@ class DashboardController extends Controller
$profile->verifier_remark = data_get($request,'remarks'); $profile->verifier_remark = data_get($request,'remarks');
$profile->save(); $profile->save();
$td = Ts_detail::where('fk_tm_id', $tmid) Ts_detail::where('fk_tm_id', $tmid)
->where('fk_o_id', $pid) ->where('fk_o_id', $pid)
->update([ 'td_timesheet_sts' => 3 ]); ->update([ 'td_timesheet_sts' => 3 ]);
...@@ -487,7 +504,7 @@ class DashboardController extends Controller ...@@ -487,7 +504,7 @@ class DashboardController extends Controller
if(count($allproject) == count($checkapproved)){ if(count($allproject) == count($checkapproved)){
$ts = Ts_master::where('id', $tmid) Ts_master::where('id', $tmid)
->update( ->update(
[ [
'tm_timesheet_master_sts' => 3, 'tm_timesheet_master_sts' => 3,
...@@ -505,19 +522,19 @@ class DashboardController extends Controller ...@@ -505,19 +522,19 @@ class DashboardController extends Controller
$profile->verifier_remark = data_get($request,'remarks'); $profile->verifier_remark = data_get($request,'remarks');
$profile->save(); $profile->save();
$td = Ts_detail::where('fk_tm_id', $tmid) Ts_detail::where('fk_tm_id', $tmid)
->where('fk_o_id', $pid) ->where('fk_o_id', $pid)
->update([ 'td_timesheet_sts' => 6 ]); ->update([ 'td_timesheet_sts' => 6 ]);
$tp = Tproject::where('fk_tm_id', $tmid) Tproject::where('fk_tm_id', $tmid)
->update(['tp_timesheet_sts' => 6]); ->update(['tp_timesheet_sts' => 6]);
$checkrejected = Tproject::where('fk_tm_id', $tmid) $checkrejected = Tproject::where('fk_tm_id', $tmid)
->where('tp_timesheet_sts', 6) ->where('tp_timesheet_sts', 6)
->get(); ->first();
if($checkrejected){ if($checkrejected){
$ts = Ts_master::where('id', $tmid) Ts_master::where('id', $tmid)
->update( ->update(
[ [
'tm_timesheet_master_sts' => 6, 'tm_timesheet_master_sts' => 6,
...@@ -531,64 +548,103 @@ class DashboardController extends Controller ...@@ -531,64 +548,103 @@ class DashboardController extends Controller
public function approvalaction(Request $request) public function approvalaction(Request $request)
{ {
// dd($request);
$bod = Users::find(Auth::id()); $bod = Users::find(Auth::id());
$profile = VwReviewProfile::where('bod_id', $bod->id) $profile = Tproject::where('id', $request->tpid)
->where('tmid', $request->tmid) ->with('team')
->first(); ->first();
// dd($profile);
return view('timesheet::dashboard.approvalaction', compact('profile', 'bod')); return view('timesheet::dashboard.approvalaction', compact('profile', 'bod'));
} }
public function approval(Request $request) public function approval(Request $request)
{ {
// dd($request);
$bod = Users::find(Auth::id()); $bod = Users::find(Auth::id());
$today = Carbon::today()->toDateString(); $today = Carbon::today()->toDateString();
$profile = VwReviewProfile::where('bod_id', $bod->id) $profile = Tproject::where('id', $request->tpid)
->where('tmid', $request->tmid)
->first(); ->first();
$month = $profile->tm_month; $month = $profile->tp_month;
$phase = $profile->tm_phase; $phase = $profile->tp_phase;
$tmid = $profile->fk_tm_id;
$oid = data_get($profile, 'fk_o_id');
$pid = data_get($profile, 'td_project');
if ($request->action == 1) { if ($request->action == 1) {
$ts = Ts_master::where('id', $request->tmid)
$profile->tp_timesheet_sts = 4;
$profile->tp_approved_by = data_get($request,'approval');
$profile->tp_approved_at = $today;
$profile->approver_remark = data_get($request,'remarks');
$profile->save();
if($profile->tp_project_type == 1){
Ts_detail::where('fk_tm_id', $tmid)
->where('td_project', $pid)
->update([ 'td_timesheet_sts' => 4 ]);
} else {
Ts_detail::where('fk_tm_id', $tmid)
->where('fk_o_id', $oid)
->update([ 'td_timesheet_sts' => 4 ]);
}
$checkapproved = Tproject::where('fk_tm_id', $tmid)
->where('tp_timesheet_sts', 4)
->get();
$allproject = Tproject::where('fk_tm_id', $tmid)
->get();
if(count($allproject) == count($checkapproved)){
Ts_master::where('id', $tmid)
->update( ->update(
[ [
'tm_timesheet_master_sts' => 4, 'tm_timesheet_master_sts' => 4,
'tm_approved_at' => $today, 'tm_verified_at' => $today
'tm_approved_by' => $request->approval,
'bod_remarks' => $request->remarks
]); ]);
}
$td = Ts_detail::where('fk_tm_id', $request->tmid) return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withSuccess('Staff project has been approved.');
->update([ 'td_timesheet_sts' => 4 ]);
$tp = Tproject::where('fk_tm_id', $request->tmid) } else {
->update(['tp_timesheet_sts' => 4]);
return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withSuccess('Staff Timesheet has been approved'); $profile->tp_timesheet_sts = 5;
$profile->tp_approved_by = $request->approval;
$profile->tp_approved_at = $today;
$profile->verifier_remark = data_get($request,'remarks');
$profile->save();
if($profile->tp_project_type == 1){
Ts_detail::where('fk_tm_id', $tmid)
->where('td_project', $pid)
->update([ 'td_timesheet_sts' => 5 ]);
} else { } else {
$ts = Ts_master::where('id', $request->tmid) dd('sini');
Ts_detail::where('fk_tm_id', $tmid)
->where('fk_o_id', $oid)
->update([ 'td_timesheet_sts' => 5 ]);
}
$checkrejected = Tproject::where('fk_tm_id', $tmid)
->where('tp_timesheet_sts', 5)
->first();
if($checkrejected){
Ts_master::where('id', $tmid)
->update( ->update(
[ [
'tm_timesheet_master_sts' => 5, 'tm_timesheet_master_sts' => 5,
'bod_rejected_at' => $today, 'hod_rejected_at' => $today,
'bod_remarks' => $request->remarks
]); ]);
}
$td = Ts_detail::where('fk_tm_id', $request->tmid)
->update([ 'td_timesheet_sts' => 5 ]);
$tp = Tproject::where('fk_tm_id', $request->tmid)
->update(['tp_timesheet_sts' => 5]);
return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withErrors('Timesheet has been rejected with remarks'); return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withErrors('Staff project has been rejected with remarks');
} }
} }
...@@ -772,7 +828,7 @@ class DashboardController extends Controller ...@@ -772,7 +828,7 @@ class DashboardController extends Controller
$today = Carbon::today()->toDateString(); $today = Carbon::today()->toDateString();
$submit = 2; $submit = 2;
$ts = Ts_master::where('id', $request->tid) Ts_master::where('id', $request->tid)
->update( ->update(
[ [
'tm_timesheet_master_sts' => 2, 'tm_timesheet_master_sts' => 2,
...@@ -782,10 +838,10 @@ class DashboardController extends Controller ...@@ -782,10 +838,10 @@ class DashboardController extends Controller
'tm_submission_at' => $today, 'tm_submission_at' => $today,
]); ]);
$td = Ts_detail::where('fk_tm_id', $request->tid) Ts_detail::where('fk_tm_id', $request->tid)
->update([ 'td_timesheet_sts' => 2 ]); ->update([ 'td_timesheet_sts' => 2 ]);
$tp = Tproject::where('fk_tm_id', $request->tid) Tproject::where('fk_tm_id', $request->tid)
->update(['tp_timesheet_sts' => 2]); ->update(['tp_timesheet_sts' => 2]);
......
...@@ -240,7 +240,7 @@ class FormController extends Controller ...@@ -240,7 +240,7 @@ class FormController extends Controller
$checkTimesheetDetail->td_hours = $valuehour; $checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId; $checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update(); $checkTimesheetDetail->save();
} }
else else
...@@ -279,7 +279,7 @@ class FormController extends Controller ...@@ -279,7 +279,7 @@ class FormController extends Controller
if ($checktproject) { if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours'); $checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->update(); $checktproject->save();
} }
else else
{ {
...@@ -315,7 +315,7 @@ class FormController extends Controller ...@@ -315,7 +315,7 @@ class FormController extends Controller
$checktotalhours = Ts_master::where('id', $tmasterid)->first(); $checktotalhours = Ts_master::where('id', $tmasterid)->first();
$checktotalhours->tm_chargeable_hrs = $sumdetailhour; $checktotalhours->tm_chargeable_hrs = $sumdetailhour;
$checktotalhours->tm_chargeable_days = $sumdetailhour/8.0; $checktotalhours->tm_chargeable_days = $sumdetailhour/8.0;
$checktotalhours->update(); $checktotalhours->save();
return redirect()->route('timesheet::form.chargeableForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Timesheet Updated'); return redirect()->route('timesheet::form.chargeableForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Timesheet Updated');
} }
...@@ -812,7 +812,7 @@ class FormController extends Controller ...@@ -812,7 +812,7 @@ class FormController extends Controller
{ {
$checkTimesheetDetail->td_hours = $day; $checkTimesheetDetail->td_hours = $day;
$checkTimesheetDetail->updated_by = $userId; $checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update(); $checkTimesheetDetail->save();
} }
// dd($checkTimesheetDetail->td_hours); // dd($checkTimesheetDetail->td_hours);
} }
...@@ -842,7 +842,7 @@ class FormController extends Controller ...@@ -842,7 +842,7 @@ class FormController extends Controller
{ {
$checkTimesheetDetail->td_hours = $valuehour; $checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId; $checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update(); $checkTimesheetDetail->save();
$checkhours = Ts_detail::where('fk_tm_id', $tmasterid) $checkhours = Ts_detail::where('fk_tm_id', $tmasterid)
->where('fk_o_id', $projectid) ->where('fk_o_id', $projectid)
...@@ -855,7 +855,7 @@ class FormController extends Controller ...@@ -855,7 +855,7 @@ class FormController extends Controller
if ($checktproject) { if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours'); $checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->update(); $checktproject->save();
} }
else else
{ {
...@@ -916,7 +916,7 @@ class FormController extends Controller ...@@ -916,7 +916,7 @@ class FormController extends Controller
if ($checktproject) { if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours'); $checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->update(); $checktproject->save();
} }
else else
{ {
...@@ -1002,7 +1002,7 @@ class FormController extends Controller ...@@ -1002,7 +1002,7 @@ class FormController extends Controller
$checkTimesheetDetail->td_overhead_note = $request->description; $checkTimesheetDetail->td_overhead_note = $request->description;
$checkTimesheetDetail->td_timesheet_sts = 1; $checkTimesheetDetail->td_timesheet_sts = 1;
$checkTimesheetDetail->updated_by = $userId; $checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update(); $checkTimesheetDetail->save();
} else { } else {
$pname = Overhead::where('o_overhead_desc', $request->task) $pname = Overhead::where('o_overhead_desc', $request->task)
...@@ -1150,7 +1150,7 @@ class FormController extends Controller ...@@ -1150,7 +1150,7 @@ class FormController extends Controller
->first(); ->first();
$data->td_overhead_note = $request->description; $data->td_overhead_note = $request->description;
$data->update(); $data->save();
} else { } else {
...@@ -1180,7 +1180,7 @@ class FormController extends Controller ...@@ -1180,7 +1180,7 @@ class FormController extends Controller
$data->td_overhead_note = $request->description; $data->td_overhead_note = $request->description;
$data->td_timesheet_sts = 1; $data->td_timesheet_sts = 1;
$data->update(); $data->save();
} }
......
...@@ -389,7 +389,7 @@ class MaintenanceController extends Controller ...@@ -389,7 +389,7 @@ class MaintenanceController extends Controller
$team->updated_by = $userId; $team->updated_by = $userId;
// letak query utk update role // letak query utk update role
// $team->pt_role = $request->role; // $team->pt_role = $request->role;
$team->update(); $team->save();
// $project = Pteam::where('fk_project_id',$request->pid) // $project = Pteam::where('fk_project_id',$request->pid)
// ->get(); // ->get();
...@@ -476,7 +476,7 @@ class MaintenanceController extends Controller ...@@ -476,7 +476,7 @@ class MaintenanceController extends Controller
$data->status = $request->status; $data->status = $request->status;
$data->updated_by = $userId; $data->updated_by = $userId;
$data->update(); $data->save();
return redirect()->route('timesheet::maintenance.senaraiPeranan') return redirect()->route('timesheet::maintenance.senaraiPeranan')
->with('success', 'Role Updated Successfully'); ->with('success', 'Role Updated Successfully');
......
...@@ -23,7 +23,7 @@ class Tproject extends Model ...@@ -23,7 +23,7 @@ class Tproject extends Model
public function project() public function project()
{ {
return $this->hasOne('Portal\Timesheet\Model\Project','id','td_project'); return $this->hasOne('Portal\Timesheet\Model\Project','id','td_project')->with('projectManager');
} }
public function pm() public function pm()
......
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwApprovalProfiles extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_approval_profiles';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
public function attachment()
{
return $this->hasOne('Portal\Timesheet\Model\NotesAttachement','fk_timesheet_master','tmid');
}
public function team()
{
return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','staffid');
}
public function tproject()
{
return $this->hasMany('Portal\Timesheet\Model\Tproject','fk_tm_id','tmid');
}
}
...@@ -98,7 +98,7 @@ class ServiceProvider extends BaseServiceProvider ...@@ -98,7 +98,7 @@ class ServiceProvider extends BaseServiceProvider
->data('icon', 'calendar alternate outline icon') ->data('icon', 'calendar alternate outline icon')
->active('timesheetReview/*') ->active('timesheetReview/*')
->data('permission', Permission::kehadiran); ->data('permission', Permission::kehadiran);
$form->add(__('Overhead Approval'), route('timesheet::dashboard.filterApproval')) $form->add(__('Timesheet Approval'), route('timesheet::dashboard.filterApproval'))
->data('icon', 'calendar alternate outline icon') ->data('icon', 'calendar alternate outline icon')
->active('timesheetApproval/*') ->active('timesheetApproval/*')
->data('permission', Permission::kehadiran); ->data('permission', Permission::kehadiran);
......
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