Commit 61f7cf2b by Azhan Hannan

composer require compoships. overhead verification page and submission.

parent 107f86fb
......@@ -9,6 +9,7 @@
"license": "MIT",
"require": {
"php": "^7.1.3",
"awobaz/compoships": "^2.1",
"bensampo/laravel-enum": "^1.16",
"davejamesmiller/laravel-breadcrumbs": "5.x",
"doctrine/dbal": "^2.9",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "38d4c7ee604bc196c92364923fa41888",
"content-hash": "39f00326d7e6b0bb8d92af73c0a69db9",
"packages": [
{
"name": "adldap2/adldap2",
......@@ -172,6 +172,62 @@
"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",
"version": "1.16.1",
"source": {
......@@ -5749,6 +5805,7 @@
}
],
"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"
},
{
......@@ -6098,6 +6155,7 @@
"faker",
"fixtures"
],
"abandoned": true,
"time": "2018-07-12T10:23:15+00:00"
},
{
......@@ -6953,6 +7011,7 @@
"keywords": [
"tokenizer"
],
"abandoned": true,
"time": "2018-10-30T05:52:18+00:00"
},
{
......@@ -7710,12 +7769,12 @@
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/webmozart/assert.git",
"url": "https://github.com/webmozarts/assert.git",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
"url": "https://api.github.com/repos/webmozarts/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9",
"reference": "83e253c8e0be5b0257b881e1827274667c5c17a9",
"shasum": ""
},
......
......@@ -48,7 +48,7 @@
<thead>
<tr>
<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 Days</th>
<th style="width: 30%">Remarks</th>
......@@ -60,7 +60,7 @@
@if(data_get($detail,'staffid') == data_get($staff, 'staff_id'))
<tr>
<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')/8}}</td>
<td style="width: 30%">{{data_get($detail, 'verifier_remark')}}</td>
......@@ -75,8 +75,8 @@
@endif
</td>
<td style="width: 12%;" class="text-center">
@if((data_get($detail, 'tp_timesheet_sts') == 2) || (data_get($detail, 'tp_timesheet_sts') == 6))
<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>
@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>
@else
<button class="center aligned ui green icon button disabled">Verify | Reject</button>
@endif
......
......@@ -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">Overhead Verification</a>
<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()}}
<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>
......@@ -49,7 +49,7 @@
<textarea name="remarks"></textarea>
</div>
<button class="ui button" type="submit">Submit</button>
<button class="ui primary button" type="submit">Submit</button>
</form>
</div>
......
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<div class="ui blue left ribbon label">
Timesheet Review
......@@ -12,106 +11,108 @@
<div class="ui styled fluid accordion">
@foreach($profile as $key => $staff)
<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: 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 == 4) <i class="green check icon"></i>Verified by BOD
@elseif($staff->status == 5) <i class="red attention icon"></i>Dissaproved by BOD
<th style="width: 60%;"><i class="dropdown icon"></i>{{ data_get($staff,'fullname') }}</th>
<th style="width: 15%;" class="center aligned">
<?php
$over = 0;
// dd($details);
foreach ($details as $key => $value) {
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 == 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
</th>
<th class="right aligned">
@if($staff->status == 2)
<button class="center aligned ui green icon button" onclick="window.location.href='{{ route('timesheet::dashboard.revaction', [ 'tmid'=>$staff->tmid ]) }}';">Verify | Reject</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 style="width: 13%" class="text-center">Submitted on: {{data_get($staff,'submission')}}</th>
<th style="width: 12%" class="text-center">
<button class="center aligned ui blue icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', [ 'user'=>data_get($staff,'staff_id') ,'phase' => $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);
// dump($ts);
?>
<div class="content" style="padding-top: 0px;">
<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: 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: 30%">Remarks</th>
<th style="width: 13%" class="text-center">Status</th>
<th style="width: 12%;" class="text-center">Action</th>
</tr>
</thead>
@if($detail->where('ptype', 1))
@foreach($detail->where('ptype', 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>
</tr>
@endforeach
@endif
@if($detail->where('ptype', 3))
@foreach($detail->where('ptype', 3) as $key => $chargeable)
<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>
</tr>
@endforeach
@endif
@foreach($details as $key => $tp)
@if(data_get($staff, 'staff_id') == data_get($tp, 'staffid'))
<tr>
<td style="width: 25;">{{data_get($tp, 'tp_project_name')}}</td>
<td style="width: 10%;" class="center aligned">{{data_get($tp, 'tp_hours')}}</td>
<td style="width: 10%;" class="center aligned">{{data_get($tp, 'tp_hours')/8}}</td>
<td style="width: 30%">{{data_get($tp, 'verifier_remark')}}</td>
<td style="width: 13%" class="text-center">
@if(data_get($tp, 'tp_timesheet_sts') == 1 || data_get($tp, 'tp_timesheet_sts') == null) In Preparation
@elseif(data_get($tp, 'tp_timesheet_sts') == 2) <i class="red attention icon"></i> Submitted
@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
@elseif(data_get($tp, 'tp_timesheet_sts') == 5) <i class="red attention icon"></i>Dissaproved by BOD
@elseif(data_get($tp, 'tp_timesheet_sts') == 6) <i class="red attention icon"></i>Rejected by HOD/HOU
@elseif(data_get($tp, 'tp_timesheet_sts') == 7) <i class="red attention icon"></i>Rejected by HR
@endif
</td>
<td style="width: 12%;" class="text-center">
@if(data_get($tp, 'tp_timesheet_sts') == 2)
<button class="center aligned ui green icon button" onclick="window.location.href='{{route('timesheet::dashboard.revaction', ['tpid'=>data_get($tp, 'id'), 'phase'=>$phase, 'month'=>$month, 'year'=>$year ]) }}';">Verify | Reject</button>
@else
<button class="center aligned ui green icon button disabled">Verify | Reject</button>
@endif
</td>
</tr>
@endif
@endforeach
</table>
<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: 15%" class="single line"> Overhead Description</th>
<th class="center aligned">Notes</th>
</tr>
</thead>
@if($td)
@foreach($td as $key => $value)
@if($value->td_overhead_note)
@foreach($details as $key => $detail)
@if(data_get($staff,'staff_id') == data_get($detail, 'staffid'))
@foreach(data_get($detail,'notes') as $key => $value)
<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: 15%">{{data_get($value, 'td_overhead_desc')}}</td>
<td>{{data_get($value, 'td_overhead_note')}}</td>
</tr>
@endif
@endforeach
@endif
@endforeach
@endif
@endforeach
</table>
@foreach ($ts as $key => $value)
......
......@@ -40,6 +40,8 @@ Route::group(
Route::get('approvalaction', ['uses' => 'DashboardController@approvalaction', 'as' => 'dashboard.approvalaction']);
Route::post('verify', ['uses' => 'DashboardController@verify', 'as' => 'dashboard.verify']);
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']);
......
......@@ -307,46 +307,53 @@ class DashboardController extends Controller
}
$verifier = Users::find(Auth::id());
// dump($verifier->id);
$profile = VwReviewProfile::where('hod_id', $verifier->id)
->where('tm_year', $curryear)
->where('tm_month', $month)
->where('tm_phase', $phase)
->with('overheads')
->get();
// dd($profile);
$staffs = Staff_info::where('penyokong', $verifier->id)
->first();
$details = Tproject::where('tp_year', $curryear)
->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)
->where('tm_year', $curryear)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
->with('attachement')
->get() ;
->get() ;
$details = VwReviewDetails::where('year', $curryear)
->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();
// dd($checkts);
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)
{
// dd($request);
$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'));
}
......@@ -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)
{
$bod = Users::find(Auth::id());
......
......@@ -760,6 +760,10 @@ class FormController extends Controller
$userId = users::find(Auth::id())
->u_staffID;
$staffinfo = Staff_info::where('staff_id', $userId)
->first();
// dd($staffinfo);
$check = Ts_master::where('tm_staff_id', $userId)
->where('tm_year', $request->year)
->where('tm_month', $request->month)
......@@ -839,6 +843,44 @@ class FormController extends Controller
$checkTimesheetDetail->td_hours = $valuehour;
$checkTimesheetDetail->updated_by = $userId;
$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
{
......@@ -862,15 +904,16 @@ class FormController extends Controller
$tmdetail->td_timesheet_sts = 1;
$tmdetail->save();
$checktproject = Tproject::where('fk_tm_id', $tmasterid)
->where('fk_o_id', $projectid)
->first();
$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();
......@@ -885,6 +928,8 @@ class FormController extends Controller
$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();
......@@ -910,7 +955,7 @@ class FormController extends Controller
$checktotalhours = Ts_master::where('id', $tmasterid)->first();
$checktotalhours->tm_overhead_hrs = $sumdetailhour;
$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 😊');
}
......
......@@ -31,11 +31,25 @@ class Tproject extends Model
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()
{
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()
{
......
......@@ -6,6 +6,8 @@ use Illuminate\Database\Eloquent\Model;
class Ts_detail extends Model
{
use \Awobaz\Compoships\Compoships ;
/**
* The database table used by the model.
*
......
......@@ -22,6 +22,12 @@ class VwReviewProfile extends Model
* @return void
* @author
**/
public function overheads()
{
return $this->hasMany('Portal\Timesheet\Model\Tproject','fk_tm_id','tmid')->where('tp_project_type', 3);
}
public function info()
{
......
......@@ -29,5 +29,9 @@ class Ts_master extends Model
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