Commit 61f7cf2b by Azhan Hannan

composer require compoships. overhead verification page and submission.

parent 107f86fb
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
"license": "MIT", "license": "MIT",
"require": { "require": {
"php": "^7.1.3", "php": "^7.1.3",
"awobaz/compoships": "^2.1",
"bensampo/laravel-enum": "^1.16", "bensampo/laravel-enum": "^1.16",
"davejamesmiller/laravel-breadcrumbs": "5.x", "davejamesmiller/laravel-breadcrumbs": "5.x",
"doctrine/dbal": "^2.9", "doctrine/dbal": "^2.9",
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "38d4c7ee604bc196c92364923fa41888", "content-hash": "39f00326d7e6b0bb8d92af73c0a69db9",
"packages": [ "packages": [
{ {
"name": "adldap2/adldap2", "name": "adldap2/adldap2",
...@@ -172,6 +172,62 @@ ...@@ -172,6 +172,62 @@
"time": "2019-02-25T10:51:21+00:00" "time": "2019-02-25T10:51:21+00:00"
}, },
{ {
"name": "awobaz/compoships",
"version": "2.1.4",
"source": {
"type": "git",
"url": "https://github.com/topclaudy/compoships.git",
"reference": "ba86741d9b439d1179a6432dded92b0ecc89a63a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/topclaudy/compoships/zipball/ba86741d9b439d1179a6432dded92b0ecc89a63a",
"reference": "ba86741d9b439d1179a6432dded92b0ecc89a63a",
"shasum": ""
},
"require": {
"illuminate/database": ">=5.6 <10.0"
},
"require-dev": {
"ext-sqlite3": "*"
},
"suggest": {
"awobaz/blade-active": "Blade directives for the Laravel 'Active' package",
"awobaz/eloquent-auto-append": "Automatically append accessors to model serialization",
"awobaz/eloquent-mutators": "Reusable mutators (getters/setters) for Laravel 5's Eloquent",
"awobaz/syntactic": "Syntactic sugar for named and indexed parameters call."
},
"type": "library",
"autoload": {
"psr-4": {
"Awobaz\\Compoships\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Claudin J. Daniel",
"email": "cdaniel@awobaz.com"
}
],
"description": "Laravel relationships with support for composite/multiple keys",
"keywords": [
"laravel",
"laravel composite keys",
"laravel relationships"
],
"funding": [
{
"url": "https://paypal.me/awobaz",
"type": "custom"
}
],
"time": "2022-06-22T11:42:37+00:00"
},
{
"name": "bensampo/laravel-enum", "name": "bensampo/laravel-enum",
"version": "1.16.1", "version": "1.16.1",
"source": { "source": {
...@@ -5749,6 +5805,7 @@ ...@@ -5749,6 +5805,7 @@
} }
], ],
"description": "Reload your Laravel Tinker session from inside Tinker, plus magic shortcuts for first(), find(), where(), and more!", "description": "Reload your Laravel Tinker session from inside Tinker, plus magic shortcuts for first(), find(), where(), and more!",
"abandoned": true,
"time": "2019-02-05T05:48:27+00:00" "time": "2019-02-05T05:48:27+00:00"
}, },
{ {
...@@ -6098,6 +6155,7 @@ ...@@ -6098,6 +6155,7 @@
"faker", "faker",
"fixtures" "fixtures"
], ],
"abandoned": true,
"time": "2018-07-12T10:23:15+00:00" "time": "2018-07-12T10:23:15+00:00"
}, },
{ {
...@@ -6953,6 +7011,7 @@ ...@@ -6953,6 +7011,7 @@
"keywords": [ "keywords": [
"tokenizer" "tokenizer"
], ],
"abandoned": true,
"time": "2018-10-30T05:52:18+00:00" "time": "2018-10-30T05:52:18+00:00"
}, },
{ {
...@@ -7710,12 +7769,12 @@ ...@@ -7710,12 +7769,12 @@
"version": "1.4.0", "version": "1.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/webmozart/assert.git", "url": "https://github.com/webmozarts/assert.git",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", "url": "https://api.github.com/repos/webmozarts/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
"shasum": "" "shasum": ""
}, },
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<thead> <thead>
<tr> <tr>
<th style="width: 10%;">Project Code</th> <th style="width: 10%;">Project Code</th>
<th style="width: 10;">Project Name</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 Hours</th>
<th style="width: 10%;" class="center aligned">Total Days</th> <th style="width: 10%;" class="center aligned">Total Days</th>
<th style="width: 30%">Remarks</th> <th style="width: 30%">Remarks</th>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
@if(data_get($detail,'staffid') == data_get($staff, 'staff_id')) @if(data_get($detail,'staffid') == data_get($staff, 'staff_id'))
<tr> <tr>
<td style="width: 10%;">{{data_get($detail, 'project.p_project_code')}}</td> <td style="width: 10%;">{{data_get($detail, 'project.p_project_code')}}</td>
<td style="width: 10;">{{data_get($detail, 'project.p_project_description')}}</td> <td style="width: 15;">{{data_get($detail, 'project.p_project_description')}}</td>
<td style="width: 10%;" class="center aligned">{{data_get($detail, 'tp_hours')}}</td> <td style="width: 10%;" class="center aligned">{{data_get($detail, 'tp_hours')}}</td>
<td style="width: 10%;" class="center aligned">{{data_get($detail, 'tp_hours')/8}}</td> <td style="width: 10%;" class="center aligned">{{data_get($detail, 'tp_hours')/8}}</td>
<td style="width: 30%">{{data_get($detail, 'verifier_remark')}}</td> <td style="width: 30%">{{data_get($detail, 'verifier_remark')}}</td>
...@@ -75,8 +75,8 @@ ...@@ -75,8 +75,8 @@
@endif @endif
</td> </td>
<td style="width: 12%;" class="text-center"> <td style="width: 12%;" class="text-center">
@if((data_get($detail, 'tp_timesheet_sts') == 2) || (data_get($detail, 'tp_timesheet_sts') == 6)) @if(data_get($detail, 'tp_timesheet_sts') == 2)
<button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.projectaction', ['tpid'=>data_get($detail, 'id'), 'phase'=>$phase, 'month'=>$month, 'year'=>$year]) }})';">Verify | Reject</button> <button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.projectaction', ['tpid'=>data_get($detail, 'id'), 'phase'=>$phase, 'month'=>$month, 'year'=>$year]) }}';">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
......
...@@ -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">Overhead Verification</a>
<br><br> <br><br>
<form action="{{ route('timesheet::dashboard.verify') }}" method="POST" class="ui form"> <form action="{{ route('timesheet::dashboard.verifyoverhead') }}" 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>
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<textarea name="remarks"></textarea> <textarea name="remarks"></textarea>
</div> </div>
<button class="ui button" type="submit">Submit</button> <button class="ui primary button" type="submit">Submit</button>
</form> </form>
</div> </div>
......
@extends('ui::layouts.app') @extends('ui::layouts.app')
@section('content') @section('content')
<div class="ui segment"> <div class="ui segment">
<div class="ui blue left ribbon label"> <div class="ui blue left ribbon label">
Timesheet Review Timesheet Review
...@@ -12,106 +11,108 @@ ...@@ -12,106 +11,108 @@
<div class="ui styled fluid accordion"> <div class="ui styled fluid accordion">
@foreach($profile as $key => $staff) @foreach($profile as $key => $staff)
<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 <?php
@elseif($staff->status == 2) <i class="red attention icon"></i> Submitted $over = 0;
@elseif($staff->status == 3) <i class="green check icon"></i> Verified by HOD/HOU // dd($details);
@elseif($staff->status == 4) <i class="green check icon"></i>Verified by BOD foreach ($details as $key => $value) {
@elseif($staff->status == 5) <i class="red attention icon"></i>Dissaproved by BOD
if(data_get($value,'staffid') == data_get($staff,'staff_id') && data_get($value,'tp_timesheet_sts') == 3)
$over += 1;
}
?>
@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 == 7) <i class="red attention icon"></i>Rejected by HR @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($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($staff->status == 1 || $staff->status == null) In Preparation
@endif @endif
</th> </th>
<th class="right aligned"> <th style="width: 13%" class="text-center">Submitted on: {{data_get($staff,'submission')}}</th>
@if($staff->status == 2) <th style="width: 12%" class="text-center">
<button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.revaction', [ 'tmid'=>$staff->tmid ]) }}';">Verify | Reject</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>
@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>
</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 <?php
$cptype = "A";
$otype = "B";
$td = $checktd->where('tm_staff_id', $staff->staff_id);
$detail = $details->where('staffid', $staff->staff_id); $detail = $details->where('staffid', $staff->staff_id);
$ts = $checkts->where('tm_staff_id', $staff->staff_id); $ts = $checkts->where('tm_staff_id', $staff->staff_id);
// dump($ts);
?> ?>
<div class="content" style="padding-top: 0px;"> <div class="content" style="padding-top: 0px;">
<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: 25%;">Overhead</th>
<th style="width: 17%;">Project Code</th> <th style="width: 10%;" class="center aligned">Total Hours</th>
<th style="width: 26%;">Project Name</th> <th style="width: 10%;" class="center aligned">Total Days</th>
<th style="width: 26%;">Project Manager</th> <th style="width: 30%">Remarks</th>
<th style="width: 12.5%;" class="center aligned">Total Hours</th> <th style="width: 13%" class="text-center">Status</th>
<th style="width: 12.5%;" class="center aligned">Total Days</th> <th style="width: 12%;" class="text-center">Action</th>
</tr> </tr>
</thead> </thead>
@if($detail->where('ptype', 1))
@foreach($detail->where('ptype', 1) as $key => $chargeable) @foreach($details as $key => $tp)
<tr> @if(data_get($staff, 'staff_id') == data_get($tp, 'staffid'))
<td style="width: 6%;" class="center aligned">{{ $cptype }}</td> <tr>
<td style="width: 17%;">{{ data_get($chargeable, 'pcode') }}</td> <td style="width: 25;">{{data_get($tp, 'tp_project_name')}}</td>
<td style="width: 26%;">{{ data_get($chargeable, 'pname') }}</td> <td style="width: 10%;" class="center aligned">{{data_get($tp, 'tp_hours')}}</td>
<td style="width: 26%;">{{ data_get($chargeable, 'pmname') }}</td> <td style="width: 10%;" class="center aligned">{{data_get($tp, 'tp_hours')/8}}</td>
<td style="width: 12.5%;" class="center aligned">{{ data_get($chargeable, 'hours') }}</td> <td style="width: 30%">{{data_get($tp, 'verifier_remark')}}</td>
<td style="width: 12.5%;" class="center aligned">{{ number_format(data_get($chargeable, 'hours')/8, 1, '.', '') }}</td> <td style="width: 13%" class="text-center">
</tr> @if(data_get($tp, 'tp_timesheet_sts') == 1 || data_get($tp, 'tp_timesheet_sts') == null) In Preparation
@endforeach @elseif(data_get($tp, 'tp_timesheet_sts') == 2) <i class="red attention icon"></i> Submitted
@endif @elseif(data_get($tp, 'tp_timesheet_sts') == 3) <i class="green check icon"></i> Verified by HOD/HOU
@elseif(data_get($tp, 'tp_timesheet_sts') == 4) <i class="green check icon"></i>Verified by BOD
@if($detail->where('ptype', 3)) @elseif(data_get($tp, 'tp_timesheet_sts') == 5) <i class="red attention icon"></i>Dissaproved by BOD
@foreach($detail->where('ptype', 3) as $key => $chargeable) @elseif(data_get($tp, 'tp_timesheet_sts') == 6) <i class="red attention icon"></i>Rejected by HOD/HOU
<tr> @elseif(data_get($tp, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR
<td style="width: 6%;" class="center aligned">{{ $otype }}</td> @endif
<td style="width: 17%;">{{ data_get($chargeable, 'pcode') }}</td> </td>
<td style="width: 26%;">{{ data_get($chargeable, 'pname') }}</td> <td style="width: 12%;" class="text-center">
<td style="width: 26%;">{{ data_get($chargeable, 'pmname') }}</td> @if(data_get($tp, 'tp_timesheet_sts') == 2)
<td style="width: 12.5%;" class="center aligned">{{ data_get($chargeable, 'hours') }}</td> <button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.revaction', ['tpid'=>data_get($tp, 'id'), 'phase'=>$phase, 'month'=>$month, 'year'=>$year ]) }}';">Verify | Reject</button>
<td style="width: 12.5%;" class="center aligned">{{ number_format(data_get($chargeable, 'hours')/8, 1, '.', '') }}</td> @else
</tr> <button class="center aligned ui green icon button disabled">Verify | Reject</button>
@endforeach @endif
@endif </td>
</tr>
@endif
@endforeach
</table> </table>
<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: 15%" class="single line"> Overhead Description</th>
<th class="center aligned">Notes</th> <th class="center aligned">Notes</th>
</tr> </tr>
</thead> </thead>
@if($td) @foreach($details as $key => $detail)
@foreach($td as $key => $value) @if(data_get($staff,'staff_id') == data_get($detail, 'staffid'))
@if($value->td_overhead_note) @foreach(data_get($detail,'notes') as $key => $value)
<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: 15%">{{data_get($value, 'td_overhead_desc')}}</td>
<td>{{data_get($value, 'td_overhead_note')}}</td>
</tr> </tr>
@endif @endforeach
@endforeach @endif
@endif @endforeach
</table> </table>
@foreach ($ts as $key => $value) @foreach ($ts as $key => $value)
......
...@@ -40,6 +40,8 @@ Route::group( ...@@ -40,6 +40,8 @@ Route::group(
Route::get('approvalaction', ['uses' => 'DashboardController@approvalaction', 'as' => 'dashboard.approvalaction']); Route::get('approvalaction', ['uses' => 'DashboardController@approvalaction', 'as' => 'dashboard.approvalaction']);
Route::post('verify', ['uses' => 'DashboardController@verify', 'as' => 'dashboard.verify']); Route::post('verify', ['uses' => 'DashboardController@verify', 'as' => 'dashboard.verify']);
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']);
//laporan //laporan
Route::get('ringkasanLaporan', ['uses' => 'ReportController@ringkasanLaporan', 'as' => 'report.ringkasanLaporan']); Route::get('ringkasanLaporan', ['uses' => 'ReportController@ringkasanLaporan', 'as' => 'report.ringkasanLaporan']);
......
...@@ -307,46 +307,53 @@ class DashboardController extends Controller ...@@ -307,46 +307,53 @@ class DashboardController extends Controller
} }
$verifier = Users::find(Auth::id()); $verifier = Users::find(Auth::id());
// dump($verifier->id);
$profile = VwReviewProfile::where('hod_id', $verifier->id) $profile = VwReviewProfile::where('hod_id', $verifier->id)
->where('tm_year', $curryear) ->where('tm_year', $curryear)
->where('tm_month', $month) ->where('tm_month', $month)
->where('tm_phase', $phase) ->where('tm_phase', $phase)
->with('overheads')
->get(); ->get();
// dd($profile);
$staffs = Staff_info::where('penyokong', $verifier->id) $details = Tproject::where('tp_year', $curryear)
->first(); ->where('tp_month', $request->month)
->where('tp_phase', $request->phase)
->where('tp_project_type', 3)
->where('tp_pm', $verifier->id)
->with('notes')
->get();
// dd($details);
$checkts = Ts_master::where('tm_timesheet_master_sts', '>' ,1) $checkts = Ts_master::where('tm_timesheet_master_sts', '>' ,1)
->where('tm_year', $curryear) ->where('tm_year', $curryear)
->where('tm_month', $request->month) ->where('tm_month', $request->month)
->where('tm_phase', $request->phase) ->where('tm_phase', $request->phase)
->with('attachement') ->with('attachement')
->get() ; ->get() ;
$details = VwReviewDetails::where('year', $curryear) // dd($checkts);
->where('month', $request->month)
->where('phase', $request->phase)
->where('verifier', $verifier->id)
->get();
$checktd = Ts_detail::where('tm_year', $curryear)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
->where('td_hours', "<>", 0)
// ->orwhereNotNull('td_overhead_note')
->get();
return view('timesheet::dashboard.timesheetReview', compact('profile', 'staffs', 'details', 'checkts', 'checktd', 'year', 'month', 'phase')); return view('timesheet::dashboard.timesheetReview', compact('profile', 'details', 'checkts', 'year', 'month', 'phase'));
} }
public function revaction(Request $request) public function revaction(Request $request)
{ {
// dd($request);
$hod = Users::find(Auth::id()); $hod = Users::find(Auth::id());
$profile = Tproject::where('id', $request->tpid)
->with('team')
->with('hod')
->first();
// dd($profile);
// $profile = VwReviewProfile::where('hod_id', $hod->id)
// ->where('tmid', $request->tmid)
// ->first();
$profile = VwReviewProfile::where('hod_id', $hod->id)
->where('tmid', $request->tmid)
->first();
return view('timesheet::dashboard.revaction', compact('profile', 'hod')); return view('timesheet::dashboard.revaction', compact('profile', 'hod'));
} }
...@@ -443,6 +450,85 @@ class DashboardController extends Controller ...@@ -443,6 +450,85 @@ class DashboardController extends Controller
} }
} }
public function verifyoverhead(Request $request)
{
$hod = Users::find(Auth::id());
$today = Carbon::today()->toDateString();
$profile = Tproject::where('id', $request->tpid)
->first();
$month = $profile->tp_month;
$phase = $profile->tp_phase;
$tmid = $profile->fk_tm_id;
$pid = $profile->fk_o_id;
// dd($request);
if ($request->action == 1) {
$profile->tp_timesheet_sts = 3;
$profile->tp_verified_by = $request->verifier;
$profile->tp_verified_at = $today;
$profile->verifier_remark = data_get($request,'remarks');
$profile->save();
$td = Ts_detail::where('fk_tm_id', $tmid)
->where('fk_o_id', $pid)
->update([ 'td_timesheet_sts' => 3 ]);
$checkapproved = Tproject::where('fk_tm_id', $tmid)
->where('tp_timesheet_sts', 3)
->get();
$allproject = Tproject::where('fk_tm_id', $tmid)
->get();
if(count($allproject) == count($checkapproved)){
$ts = Ts_master::where('id', $tmid)
->update(
[
'tm_timesheet_master_sts' => 3,
'tm_verified_at' => $today
]);
}
return redirect()->route('timesheet::dashboard.timesheetReview', compact('month', 'phase'))->withSuccess('Staff overhead has been verified.');
} else {
$profile->tp_timesheet_sts = 6;
$profile->tp_verified_by = $request->verifier;
$profile->tp_verified_at = $today;
$profile->verifier_remark = data_get($request,'remarks');
$profile->save();
$td = Ts_detail::where('fk_tm_id', $tmid)
->where('fk_o_id', $pid)
->update([ 'td_timesheet_sts' => 6 ]);
$tp = Tproject::where('fk_tm_id', $tmid)
->update(['tp_timesheet_sts' => 6]);
$checkrejected = Tproject::where('fk_tm_id', $tmid)
->where('tp_timesheet_sts', 6)
->get();
if($checkrejected){
$ts = Ts_master::where('id', $tmid)
->update(
[
'tm_timesheet_master_sts' => 6,
'hod_rejected_at' => $today,
]);
}
return redirect()->route('timesheet::dashboard.timesheetReview', compact('month', 'phase'))->withErrors('Staff overhead has been rejected with remarks');
}
}
public function approvalaction(Request $request) public function approvalaction(Request $request)
{ {
$bod = Users::find(Auth::id()); $bod = Users::find(Auth::id());
......
...@@ -760,6 +760,10 @@ class FormController extends Controller ...@@ -760,6 +760,10 @@ class FormController extends Controller
$userId = users::find(Auth::id()) $userId = users::find(Auth::id())
->u_staffID; ->u_staffID;
$staffinfo = Staff_info::where('staff_id', $userId)
->first();
// dd($staffinfo);
$check = Ts_master::where('tm_staff_id', $userId) $check = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $request->year) ->where('tm_year', $request->year)
->where('tm_month', $request->month) ->where('tm_month', $request->month)
...@@ -839,6 +843,44 @@ class FormController extends Controller ...@@ -839,6 +843,44 @@ class FormController extends Controller
$checkTimesheetDetail->td_hours = $valuehour; $checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId; $checkTimesheetDetail->updated_by = $userId;
$checkTimesheetDetail->update(); $checkTimesheetDetail->update();
$checkhours = Ts_detail::where('fk_tm_id', $tmasterid)
->where('fk_o_id', $projectid)
->where('td_hours', '!=', '0')
->get();
$checktproject = Tproject::where('fk_tm_id', $tmasterid)
->where('fk_o_id', $projectid)
->first();
if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->update();
}
else
{
$tpdetail = new Tproject;
$tpdetail->fk_o_id = $projectid;
$tpdetail->staffid = $userId;
$tpdetail->fk_tm_id = $tmasterid;
$tpdetail->tp_project_type = 3;
$tpdetail->tp_year = $request->year;
$tpdetail->tp_month = $request->month;
$tpdetail->tp_phase = $request->phase;
$tpdetail->tp_pm = data_get($staffinfo,'penyokong');
$tpdetail->tp_pd = data_get($staffinfo,'pelulus');
$project = Overhead::where('id', $projectid)
->first();
$tpdetail->tp_project_name = $project->o_overhead_desc;
$tpdetail->tp_hours = $checkhours->sum('td_hours');
$tpdetail->tp_timesheet_sts = 1;
$tpdetail->updated_by = $userId;
$tpdetail->save();
}
} }
else else
{ {
...@@ -862,15 +904,16 @@ class FormController extends Controller ...@@ -862,15 +904,16 @@ class FormController extends Controller
$tmdetail->td_timesheet_sts = 1; $tmdetail->td_timesheet_sts = 1;
$tmdetail->save(); $tmdetail->save();
$checktproject = Tproject::where('fk_tm_id', $tmasterid)
->where('fk_o_id', $projectid)
->first();
$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)
->where('td_hours', '!=', '0') ->where('td_hours', '!=', '0')
->get(); ->get();
$checktproject = Tproject::where('fk_tm_id', $tmasterid)
->where('fk_o_id', $projectid)
->first();
if ($checktproject) { if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours'); $checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->update(); $checktproject->update();
...@@ -885,6 +928,8 @@ class FormController extends Controller ...@@ -885,6 +928,8 @@ class FormController extends Controller
$tpdetail->tp_year = $request->year; $tpdetail->tp_year = $request->year;
$tpdetail->tp_month = $request->month; $tpdetail->tp_month = $request->month;
$tpdetail->tp_phase = $request->phase; $tpdetail->tp_phase = $request->phase;
$tpdetail->tp_pm = data_get($staffinfo,'penyokong');
$tpdetail->tp_pd = data_get($staffinfo,'pelulus');
$project = Overhead::where('id', $projectid) $project = Overhead::where('id', $projectid)
->first(); ->first();
...@@ -910,7 +955,7 @@ class FormController extends Controller ...@@ -910,7 +955,7 @@ class FormController extends Controller
$checktotalhours = Ts_master::where('id', $tmasterid)->first(); $checktotalhours = Ts_master::where('id', $tmasterid)->first();
$checktotalhours->tm_overhead_hrs = $sumdetailhour; $checktotalhours->tm_overhead_hrs = $sumdetailhour;
$checktotalhours->tm_overhead_days = $sumdetailhour/8.0; $checktotalhours->tm_overhead_days = $sumdetailhour/8.0;
$checktotalhours->update(); $checktotalhours->save();
return redirect()->route('timesheet::form.overheadForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Overhead form updated! Kindly update your notes accordingly before proceed with timesheet submission. Thank you 😊'); return redirect()->route('timesheet::form.overheadForm', ['phase' => $request->phase, 'month' =>$request->month,'year',$request->year])->with('success', 'Overhead form updated! Kindly update your notes accordingly before proceed with timesheet submission. Thank you 😊');
} }
......
...@@ -31,11 +31,25 @@ class Tproject extends Model ...@@ -31,11 +31,25 @@ class Tproject extends Model
return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','tp_pm'); return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','tp_pm');
} }
public function hod()
{
return $this->hasOne('Portal\Timesheet\Model\Staff_info','id','tp_pm');
}
public function team() public function team()
{ {
return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','staffid'); return $this->hasOne('Portal\Timesheet\Model\Staff_info','staff_id','staffid');
} }
use \Awobaz\Compoships\Compoships;
public function notes()
{
// return $this->hasMany('Portal\Timesheet\Model\Ts_detail','fk_tm_id','fk_tm_id')->where('td_project_type', 3);
return $this->hasMany('Portal\Timesheet\Model\Ts_detail',['fk_tm_id','fk_o_id'],['fk_tm_id','fk_o_id'])->orderby('td_date');
}
public function info() public function info()
{ {
......
...@@ -6,6 +6,8 @@ use Illuminate\Database\Eloquent\Model; ...@@ -6,6 +6,8 @@ use Illuminate\Database\Eloquent\Model;
class Ts_detail extends Model class Ts_detail extends Model
{ {
use \Awobaz\Compoships\Compoships ;
/** /**
* The database table used by the model. * The database table used by the model.
* *
......
...@@ -22,6 +22,12 @@ class VwReviewProfile extends Model ...@@ -22,6 +22,12 @@ class VwReviewProfile extends Model
* @return void * @return void
* @author * @author
**/ **/
public function overheads()
{
return $this->hasMany('Portal\Timesheet\Model\Tproject','fk_tm_id','tmid')->where('tp_project_type', 3);
}
public function info() public function info()
{ {
......
...@@ -29,5 +29,9 @@ class Ts_master extends Model ...@@ -29,5 +29,9 @@ class Ts_master extends Model
return $this->hasOne('Portal\Timesheet\Model\NotesAttachement','fk_timesheet_master','id'); return $this->hasOne('Portal\Timesheet\Model\NotesAttachement','fk_timesheet_master','id');
} }
public function staff()
{
return $this->belongsTo('Portal\Timesheet\Model\Staff_info','staff_id','tm_staff_id');
}
} }
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