Commit 02b986e0 by Azhan Hannan

flow approval by bod & pd

parent 2924cdde
......@@ -3,30 +3,30 @@
@section('content')
<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>
<form action="{{ route('timesheet::dashboard.approval') }}" method="POST" class="ui form">
{{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">
<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 class="three fields">
<div class="two wide field">
<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 class="two wide field">
<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 class="two wide field">
<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>
......
......@@ -28,9 +28,9 @@
@if($status == 1 || $status == null) In Preparation
@elseif($verified == $allproject) <i class="green check icon"></i> Verified by PM
@elseif($status == 2) <i class="red attention icon"></i> Submitted
@elseif($status == 4) <i class="green check icon"></i>Verified by BOD
@elseif($status == 5) <i class="red attention icon"></i>Dissaproved by BOD
@elseif($status == 6) <i class="red attention icon"></i>Rejected by HOD/HOU
@elseif($status == 4) <i class="green check icon"></i>Verified by PD
@elseif($status == 5) <i class="red attention icon"></i>Dissaproved by PD
@elseif($status == 6) <i class="red attention icon"></i>Rejected by PM
@elseif($status == 7) <i class="red attention icon"></i>Rejected by HR
@endif
</th>
......@@ -67,10 +67,10 @@
<td style="width: 13%" class="text-center">
@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') == 3) <i class="green check icon"></i> Verified by HOD/HOU
@elseif(data_get($detail, 'tp_timesheet_sts') == 4) <i class="green check icon"></i>Verified by BOD
@elseif(data_get($detail, 'tp_timesheet_sts') == 5) <i class="red attention icon"></i>Dissaproved by BOD
@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') == 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 PD
@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 PM
@elseif(data_get($detail, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR
@endif
</td>
......
......@@ -11,93 +11,144 @@
<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">
<table class="ui unstackable celled table">
<thead>
<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">
@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
@elseif($staff->status == 3) <i class="green check icon"></i>Verified by HOD/HOU/PM
@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 == 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
</th>
<th class="right aligned">
<th style="width: 15%" class="text-center">Verified at: {{data_get($staff,'verified')}}
@if($staff->status == 3)
<button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.approvalaction', [ 'tmid'=>$staff->tmid ]) }}';">Approve | Reject</button>
@else
<!-- <button class="center aligned ui green icon button disabled">Approve | Reject</button> -->
@endif
</th>
<th style="width: 10%" 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' => $phase, 'month' => $month, 'year' => $year]) }}';" target='_blank'>View</button>
</th>
</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>
</table>
</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;">
@if($checkchargeable)
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 6%;" class="center aligned">Type</th>
<th style="width: 17%;">Project Code</th>
<th style="width: 26%;">Project Name</th>
<th style="width: 26%;">Project Manager</th>
<th style="width: 12.5%;" class="center aligned">Total Hours</th>
<th style="width: 12.5%;" class="center aligned">Total Days</th>
<th style="width: 10%;">Project Code</th>
<th style="width: 15%;">Project Name</th>
<th style="width: 10%;" class="center aligned">Total Hours</th>
<th style="width: 10%;" class="center aligned">Total Days</th>
<th style="width: 15%;">PM Remarks</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>
</thead>
@if($detail->where('ptype', 1))
@foreach($detail->where('ptype', 1) as $key => $chargeable)
@if($detail->where('tp_project_type', 1))
@foreach($detail->where('tp_project_type', 1) as $key => $chargeable)
<tr>
<td style="width: 6%;" class="center aligned">{{ $cptype }}</td>
<td style="width: 17%;">{{ data_get($chargeable, 'pcode') }}</td>
<td style="width: 26%;">{{ data_get($chargeable, 'pname') }}</td>
<td style="width: 26%;">{{ data_get($chargeable, 'pmname') }}</td>
<td style="width: 12.5%;" class="center aligned">{{ data_get($chargeable, 'hours') }}</td>
<td style="width: 12.5%;" class="center aligned">{{ number_format(data_get($chargeable, 'hours')/8, 1, '.', '') }}</td>
<td style="width: 10%;">{{ data_get($chargeable, 'project.p_project_code') }}</td>
<td style="width: 15%;">{{ data_get($chargeable, 'tp_project_name') }}</td>
<td style="width: 10%;" class="center aligned">{{ data_get($chargeable, 'tp_hours') }}</td>
<td style="width: 10%;" class="center aligned">{{ number_format(data_get($chargeable, 'tp_hours')/8, 1, '.', '') }}</td>
<td style="width: 15%;">{{data_get($chargeable, 'verifier_remark')}}</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>
@endforeach
@endif
@if($detail->where('ptype', 3))
@foreach($detail->where('ptype', 3) as $key => $chargeable)
</table>
@endif
@if($checkoverhead)
<table class="ui unstackable celled table">
<thead>
<tr>
<td style="width: 6%;" class="center aligned">{{ $otype }}</td>
<td style="width: 17%;">{{ data_get($chargeable, 'pcode') }}</td>
<td style="width: 26%;">{{ data_get($chargeable, 'pname') }}</td>
<td style="width: 26%;">{{ data_get($chargeable, 'pmname') }}</td>
<td style="width: 12.5%;" class="center aligned">{{ data_get($chargeable, 'hours') }}</td>
<td style="width: 12.5%;" class="center aligned">{{ number_format(data_get($chargeable, 'hours')/8, 1, '.', '') }}</td>
<th style="width: 25%;">Overhead</th>
<th style="width: 10%;" class="center aligned">Total Hours</th>
<th style="width: 10%;" class="center aligned">Total Days</th>
<th style="width: 15%;">HOD Remarks</th>
<th style="width: 15%;">BOD Remarks</th>
<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>
@endforeach
@endif
</table>
@endif
@if(data_get($staff,'team.pelulus') == data_get($approval,'id'))
<table class="ui unstackable celled table">
<thead>
<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>
</tr>
</thead>
......@@ -105,17 +156,17 @@
@foreach($td as $key => $value)
@if($value->td_overhead_note)
<tr>
<td style="width: 15%" class="center aligned">{{ data_get($value,'td_date') }}</td>
<td>{{ data_get($value,'td_overhead_note') }}</td>
<td style="width: 10%" class="center aligned">{{data_get($value, 'td_date')}}</td>
<td style="width: 25%" class="single line">{{data_get($value, 'td_overhead_desc')}}</td>
<td>{{data_get($value, 'td_overhead_note')}}</td>
</tr>
@endif
@endforeach
@endif
</table>
@endif
@foreach ($ts as $key => $value)
@if(data_get($value,'attachement'))
@if(data_get($staff,'attachment'))
<table class="ui unstackable celled table">
<thead>
<tr>
......@@ -126,7 +177,7 @@
<tr>
<td style="width: 4%;"></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">
<i class="download icon"></i>
......@@ -137,9 +188,7 @@
</tr>
</tbody>
</table>
@endif
@endforeach
@if(data_get($staff,'hodremarks'))
......@@ -180,6 +229,8 @@
</table>
@endif
</div>
@endif
@endforeach
</div>
</div>
......
......@@ -16,14 +16,11 @@ Route::group(
//dashboard
Route::get('home',['uses' => 'DashboardController@index', 'as' => 'dashboard.index']);
Route::get('vwviewer',['uses' => 'DashboardController@vwviewer', 'as' => 'dashboard.vwviewer']);
//timesheet
Route::get('timesheetApproval',['uses' => 'DashboardController@timesheetApproval', 'as' => 'dashboard.timesheetApproval']);
Route::get('timesheetReport',['uses' => 'DashboardController@timesheetReport', 'as' => 'dashboard.timesheetReport']);
Route::get('projectVerify',['uses' => 'DashboardController@projectVerify', 'as' => 'dashboard.projectVerify']);
Route::get('timesheetReview',['uses' => 'DashboardController@timesheetReview', 'as' => 'dashboard.timesheetReview']);
Route::get('timesheetViewer',['uses' => 'DashboardController@timesheetViewer', 'as' => 'dashboard.timesheetViewer']);
Route::get('filterProjectVerify',['uses' => 'DashboardController@filterProjectVerify', 'as' => 'dashboard.filterProjectVerify']);
......@@ -42,7 +39,6 @@ Route::group(
Route::post('approval', ['uses' => 'DashboardController@approval', 'as' => 'dashboard.approval']);
Route::post('verifyoverhead', ['uses' => 'DashboardController@verifyoverhead', 'as' => 'dashboard.verifyoverhead']);
//laporan
Route::get('ringkasanLaporan', ['uses' => 'ReportController@ringkasanLaporan', 'as' => 'report.ringkasanLaporan']);
Route::post('generateRingkasan', ['uses' => 'ReportController@generateRingkasan', 'as' => 'report.generateRingkasan']);
......
......@@ -20,6 +20,7 @@ use Portal\Timesheet\Model\VwReviewProfile;
use Portal\Timesheet\Model\VwReviewDetails;
use Portal\Timesheet\Model\VwChargeableVerification;
use Portal\Timesheet\Model\VwChargeableReview;
use Portal\Timesheet\Model\VwApprovalProfiles;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use File;
......@@ -196,38 +197,54 @@ class DashboardController extends Controller
$approval = Users::find(Auth::id());
$profile = VwReviewProfile::where('bod_id', $approval->id)
->where('tm_year', $curryear)
->where('tm_month', $month)
->where('tm_phase', $phase)
$profiles = VwApprovalProfiles::where('pdid', $approval->id)
->where('year', $curryear)
->where('month', $month)
->where('phase', $phase)
->orderby('tmid')
->with('attachment')
->with('team')
->with('tproject')
->get();
$staffs = Staff_info::where('pelulus', $approval->id)
->first();
// dd($profiles);
$checkts = Ts_master::where('tm_timesheet_master_sts', '>' ,2)
->where('tm_year', $curryear)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
->with('attachement')
->get();
$tmid = [];
foreach ($profiles as $key => $value) {
$tmid[] = $value->tmid;
}
// $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);
$details = VwReviewDetails::where('year', $curryear)
->where('month', $request->month)
->where('phase', $request->phase)
->where('approval', $approval->id)
$details = Tproject::whereIn('fk_tm_id', $tmid)
->where('tp_pd', $approval->id)
->with('project')
->get();
$checktd = Ts_detail::where('tm_year', $curryear)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
// dd($details);
// $details = VwReviewDetails::where('year', $curryear)
// ->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)
// ->orwhereNotNull('td_overhead_note')
->get();
// 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()
......@@ -395,7 +412,7 @@ class DashboardController extends Controller
$profile->verifier_remark = data_get($request,'remarks');
$profile->save();
$td = Ts_detail::where('fk_tm_id', $request->tmid)
Ts_detail::where('fk_tm_id', $request->tmid)
->where('td_project', $request->pid)
->update([ 'td_timesheet_sts' => 3 ]);
......@@ -408,7 +425,7 @@ class DashboardController extends Controller
if(count($allproject) == count($checkapproved)){
$ts = Ts_master::where('id', $request->tmid)
Ts_master::where('id', $request->tmid)
->update(
[
'tm_timesheet_master_sts' => 3,
......@@ -426,19 +443,19 @@ class DashboardController extends Controller
$profile->verifier_remark = data_get($request,'remarks');
$profile->save();
$td = Ts_detail::where('fk_tm_id', $request->tmid)
Ts_detail::where('fk_tm_id', $request->tmid)
->where('td_project', $request->pid)
->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]);
$checkrejected = Tproject::where('fk_tm_id', $request->tmid)
->where('tp_timesheet_sts', 6)
->get();
->first();
if($checkrejected){
$ts = Ts_master::where('id', $request->tmid)
Ts_master::where('id', $request->tmid)
->update(
[
'tm_timesheet_master_sts' => 6,
......@@ -474,7 +491,7 @@ class DashboardController extends Controller
$profile->verifier_remark = data_get($request,'remarks');
$profile->save();
$td = Ts_detail::where('fk_tm_id', $tmid)
Ts_detail::where('fk_tm_id', $tmid)
->where('fk_o_id', $pid)
->update([ 'td_timesheet_sts' => 3 ]);
......@@ -487,7 +504,7 @@ class DashboardController extends Controller
if(count($allproject) == count($checkapproved)){
$ts = Ts_master::where('id', $tmid)
Ts_master::where('id', $tmid)
->update(
[
'tm_timesheet_master_sts' => 3,
......@@ -505,19 +522,19 @@ class DashboardController extends Controller
$profile->verifier_remark = data_get($request,'remarks');
$profile->save();
$td = Ts_detail::where('fk_tm_id', $tmid)
Ts_detail::where('fk_tm_id', $tmid)
->where('fk_o_id', $pid)
->update([ 'td_timesheet_sts' => 6 ]);
$tp = Tproject::where('fk_tm_id', $tmid)
Tproject::where('fk_tm_id', $tmid)
->update(['tp_timesheet_sts' => 6]);
$checkrejected = Tproject::where('fk_tm_id', $tmid)
->where('tp_timesheet_sts', 6)
->get();
->first();
if($checkrejected){
$ts = Ts_master::where('id', $tmid)
Ts_master::where('id', $tmid)
->update(
[
'tm_timesheet_master_sts' => 6,
......@@ -531,64 +548,103 @@ class DashboardController extends Controller
public function approvalaction(Request $request)
{
// dd($request);
$bod = Users::find(Auth::id());
$profile = VwReviewProfile::where('bod_id', $bod->id)
->where('tmid', $request->tmid)
$profile = Tproject::where('id', $request->tpid)
->with('team')
->first();
// dd($profile);
return view('timesheet::dashboard.approvalaction', compact('profile', 'bod'));
}
public function approval(Request $request)
{
// dd($request);
$bod = Users::find(Auth::id());
$today = Carbon::today()->toDateString();
$profile = VwReviewProfile::where('bod_id', $bod->id)
->where('tmid', $request->tmid)
$profile = Tproject::where('id', $request->tpid)
->first();
$month = $profile->tm_month;
$phase = $profile->tm_phase;
$month = $profile->tp_month;
$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) {
$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(
[
'tm_timesheet_master_sts' => 4,
'tm_approved_at' => $today,
'tm_approved_by' => $request->approval,
'bod_remarks' => $request->remarks
'tm_verified_at' => $today
]);
}
$td = Ts_detail::where('fk_tm_id', $request->tmid)
->update([ 'td_timesheet_sts' => 4 ]);
return redirect()->route('timesheet::dashboard.timesheetApproval', compact('month', 'phase'))->withSuccess('Staff project has been approved.');
$tp = Tproject::where('fk_tm_id', $request->tmid)
->update(['tp_timesheet_sts' => 4]);
} else {
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 {
$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(
[
'tm_timesheet_master_sts' => 5,
'bod_rejected_at' => $today,
'bod_remarks' => $request->remarks
'hod_rejected_at' => $today,
]);
}
$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
$today = Carbon::today()->toDateString();
$submit = 2;
$ts = Ts_master::where('id', $request->tid)
Ts_master::where('id', $request->tid)
->update(
[
'tm_timesheet_master_sts' => 2,
......@@ -782,10 +838,10 @@ class DashboardController extends Controller
'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 ]);
$tp = Tproject::where('fk_tm_id', $request->tid)
Tproject::where('fk_tm_id', $request->tid)
->update(['tp_timesheet_sts' => 2]);
......
......@@ -240,7 +240,7 @@ class FormController extends Controller
$checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update();
$checkTimesheetDetail->save();
}
else
......@@ -279,7 +279,7 @@ class FormController extends Controller
if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->update();
$checktproject->save();
}
else
{
......@@ -315,7 +315,7 @@ class FormController extends Controller
$checktotalhours = Ts_master::where('id', $tmasterid)->first();
$checktotalhours->tm_chargeable_hrs = $sumdetailhour;
$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');
}
......@@ -812,7 +812,7 @@ class FormController extends Controller
{
$checkTimesheetDetail->td_hours = $day;
$checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update();
$checkTimesheetDetail->save();
}
// dd($checkTimesheetDetail->td_hours);
}
......@@ -842,7 +842,7 @@ class FormController extends Controller
{
$checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update();
$checkTimesheetDetail->save();
$checkhours = Ts_detail::where('fk_tm_id', $tmasterid)
->where('fk_o_id', $projectid)
......@@ -855,7 +855,7 @@ class FormController extends Controller
if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->update();
$checktproject->save();
}
else
{
......@@ -916,7 +916,7 @@ class FormController extends Controller
if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->update();
$checktproject->save();
}
else
{
......@@ -1002,7 +1002,7 @@ class FormController extends Controller
$checkTimesheetDetail->td_overhead_note = $request->description;
$checkTimesheetDetail->td_timesheet_sts = 1;
$checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update();
$checkTimesheetDetail->save();
} else {
$pname = Overhead::where('o_overhead_desc', $request->task)
......@@ -1150,7 +1150,7 @@ class FormController extends Controller
->first();
$data->td_overhead_note = $request->description;
$data->update();
$data->save();
} else {
......@@ -1180,7 +1180,7 @@ class FormController extends Controller
$data->td_overhead_note = $request->description;
$data->td_timesheet_sts = 1;
$data->update();
$data->save();
}
......
......@@ -389,7 +389,7 @@ class MaintenanceController extends Controller
$team->updated_by = $userId;
// letak query utk update role
// $team->pt_role = $request->role;
$team->update();
$team->save();
// $project = Pteam::where('fk_project_id',$request->pid)
// ->get();
......@@ -476,7 +476,7 @@ class MaintenanceController extends Controller
$data->status = $request->status;
$data->updated_by = $userId;
$data->update();
$data->save();
return redirect()->route('timesheet::maintenance.senaraiPeranan')
->with('success', 'Role Updated Successfully');
......
......@@ -23,7 +23,7 @@ class Tproject extends Model
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()
......
<?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
->data('icon', 'calendar alternate outline icon')
->active('timesheetReview/*')
->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')
->active('timesheetApproval/*')
->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