Commit 3b2235dd by hannan

changes

parent d9bc3526
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTmSubmissionAtColumnInTimesheetMaster extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('timesheet_master', function (Blueprint $table) {
$table->date('tm_submission_at')->after('tm_total_days')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('timesheet_master', function (Blueprint $table) {
$table->dropColumn('tm_submission_at');
});
}
}
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTimesheetPrjTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('timesheet_prj', function (Blueprint $table) {
$table->increments('id');
$table->string('td_project', 10)->nullable();
$table->integer('fk_td_id')->unsigned()->nullable();
$table->integer('fk_tm_id')->unsigned()->nullable();
$table->integer('tp_year')->unsigned()->nullable();
$table->integer('tp_month')->unsigned()->nullable();
$table->integer('tp_phase')->unsigned()->nullable();
$table->string('tp_project_name', 50)->nullable();
$table->integer('tp_hours')->unsigned()->nullable();
$table->integer('tp_timesheet_sts')->unsigned()->nullable();
$table->integer('tp_pm')->unsigned()->nullable();
$table->integer('tp_pm_flag')->unsigned()->nullable();
$table->integer('tp_pm_remark')->unsigned()->nullable();
$table->timestamps();
$table->integer('updated_by')->nullable();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('timesheet_prj');
}
}
......@@ -45,8 +45,9 @@
<th>Phase</th>
<th>Status</th>
<th>Action</th>
<th>Review Remark</th>
<th>Approval Remark</th>
<th>Submission Date</th>
<th>Verified Date</th>
<th>Approval Date</th>
</tr>
</thead>
<tbody>
......@@ -77,8 +78,9 @@
@elseif($value->tm_timesheet_master_sts == 8) Revised the timesheet
@endif
</td>
<td>{{ $value->tm_year }}</td>
<td>{{ $value->tm_year }}</td>
<td>{{ $value->tm_submission_at }}</td>
<td>{{ $value->tm_verified_at }}</td>
<td>{{ $value->tm_approval_at }}</td>
</tr>
@endforeach
</tbody>
......
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui blue left ribbon label">Staff Timesheet Approve / Reject</a>
<br><br>
<form action="{{ route('timesheet::dashboard.verify') }}" method="POST" class="ui form">
{{csrf_field()}}
<input type="hidden" name="tmid" value="{{ $profile->tmid }}">
<div class="six wide field">
<label>Staff Name</label>
<input type="text" readonly="readonly" value="{{ $profile->fullname }}">
</div>
<div class="three fields">
<div class="two wide field">
<label>Year</label>
<input type="text" readonly="readonly" value="{{ $profile->tm_year }}">
</div>
<div class="two wide field">
<label>Month</label>
<input type="text" readonly="readonly" value="{{ $profile->tm_month }}">
</div>
<div class="two wide field">
<label>Phase</label>
<input type="text" readonly="readonly" value="{{ $profile->tm_phase }}">
</div>
</div>
<div class="two fields">
<div class="six wide field">
<input type="hidden" name="verifier" value="{{ $hod->id }}">
<label>Head of Department</label>
<input type="text" readonly="readonly" value="{{ $hod->name }}">
</div>
<div class="three wide field">
<label>Action</label>
<select class="ui fluid dropdown" name="action">
<option value="1">Approve</option>
<option value="2">Reject</option>
</select>
</div>
</div>
<div class="field">
<label>Remarks</label>
<textarea name="remarks"></textarea>
</div>
<button class="ui button" type="submit">Submit</button>
</form>
</div>
@endsection
\ No newline at end of file
......@@ -18,20 +18,20 @@
</td>
<td>Name</td>
<td>:</td>
<td>{{ $user->fullname }}</td>
<td>{{ $profile->STAFF_NAME }}</td>
<td rowspan="3"></td>
<td>Department</td>
<td>:</td>
<td>{{ $dept->description }}</td>
<td>{{ $profile->DEPARTMENT }}</td>
<td rowspan="3"></td>
</tr>
<tr>
<td>Staff No</td>
<td>:</td>
<td>{{ $user->staff_id }}</td>
<td>{{ $profile->STAFF_ID }}</td>
<td>Reporting Manager</td>
<td>:</td>
<td>{{ $hod }}</td>
<td>{{ $profile->HOD_NAME }}</td>
</tr>
<tr>
<td>Month</td>
......@@ -714,11 +714,47 @@
</table>
</div>
<div class="ui segment">
<table id="printtable7" class="ui celled structured table unstackable">
<thead>
<tr>
<th class="center aligned">Submitted at</th>
<th class="center aligned">Verified by</th>
<th class="center aligned">Verified at</th>
<th class="center aligned">Approved by</th>
<th class="center aligned">Approved at</th>
</tr>
</thead>
<tbody>
<tr>
<?php $verifiername = $approvalname= ""; ?>
<td class="center aligned">@if($check){{ $check->tm_submission_at }}@endif</td>
<td class="center aligned">@if($check){{ $profile->HOD_NAME }}@endif</td>
<td class="center aligned">@if($check){{ $check->tm_verified_at }}@endif</td>
<td class="center aligned">
@if($check)
<?php
foreach ($bod as $key => $value) {
if ($check->tm_approved_by == $value->id) {
$approvalname = $value->fullname;
}
}
?>
{{$approvalname}}
@endif
</td>
<td class="center aligned">@if($check){{$check->tm_approved_at}}@endif</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
<button type="button" class="ui primary button" onclick="printdiv('print_div')">Print</button>
@if($check != null)
<button type="button" class="ui green button" onclick="window.location.href='{{ route('timesheet::dashboard.tsubmit', [ 'tid'=> $check->id ]) }}';">Submit</button>
<button type="button" class="ui green button" onclick="window.location.href='{{ route('timesheet::dashboard.tsubmit',[ 'tid'=> $check->id, 'totalot'=> $totalot, 'totalchargehrs'=>$totalchargehrs, 'totalnonchargehrs'=> $totalnonchargehrs, 'totaloverheadhrs'=>$totaloverheadhrs ]) }}';">Submit</button>
@else
<button type="button" class="ui disabled green button">Submit</button>
@endif
......@@ -729,57 +765,6 @@
@push('script')
<!-- <script type="text/javascript">
function printdiv(printpage)
{
// var oldstr = document.body.innerHTML;
// var el = document.getElementById("body1");
// el.classList.remove("on-the-fly-behavior");
// el.classList.add("print-fly");
// el.style.fontSize = "10px !important;background-color:white !important";
document.getElementById(printpage).style.width = "100%";
document.getElementById("printtable1").style.width = "100%";
document.getElementById("printtable1").style.fontSize = "10px";
document.getElementById("printtable2").style.width = "100%";
document.getElementById("printtable2").style.fontSize = "10px";
document.getElementById("printtable3").style.width = "100%";
document.getElementById("printtable3").style.fontSize = "10px";
document.getElementById("printtable4").style.width = "100%";
document.getElementById("printtable4").style.fontSize = "10px";
document.getElementById("printtable5").style.width = "100%";
document.getElementById("printtable5").style.fontSize = "10px";
document.getElementById("printtable6").style.width = "100%";
document.getElementById("printtable6").style.fontSize = "10px";
var headstr = "<html><head><title></title></head><body style='background-color: white;font-size:10px;margin-left:50px;margin-right:50px'>";
var footstr = "</body>";
var newstr = document.all.item(printpage).innerHTML;
var winPrint = window.open('', '', 'left=0,top=0,width=800,height=600,toolbar=0,scrollbars=0,status=0');
winPrint.document.write(headstr+newstr+footstr);
winPrint.document.close();
winPrint.focus();
setTimeout(function()
{
winPrint.print();
winPrint.close();
}, 1000);
}
</script> -->
<script type="text/javascript">
function printdiv(printpage)
{
......
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<div class="ui blue left ribbon label">
vm viewer
</div>
<br>
<br>
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 5%" class="center aligned">No</th>
<th class="center aligned">Staff Name</th>
<th class="center aligned">Department</th>
<th style="width: 15%" class="center aligned">Staff ID</th>
<th class="center aligned">HOD Name</th>
<th class="center aligned">BOD Name</th>
</tr>
</thead>
<tbody>
@foreach($data as $key => $value)
<tr>
<td>{{$key+1}}</td>
<td>{{data_get($value, 'STAFF_NAME')}}</td>
<td>{{data_get($value, 'DEPARTMENT')}}</td>
<td>{{data_get($value, 'STAFF_ID')}}</td>
<td>{{data_get($value, 'HOD_NAME')}}</td>
<td>{{data_get($value, 'BOD_NAME')}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
@endsection
\ No newline at end of file
@extends('timesheet::layouts.filtermonthphase')
@section('action')
<form class="ui form" action="{{ route('timesheet::form.noteselectmonthphase') }}" method="POST">
@endsection
\ No newline at end of file
......@@ -27,29 +27,15 @@
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<th colspan="6">
<div class="ui right floated pagination menu">
<a class="icon item">
<i class="left chevron icon"></i>
</a>
<a class="item">1</a>
<a class="item">2</a>
<a class="item">3</a>
<a class="item">4</a>
<a class="icon item">
<i class="right chevron icon"></i>
</a>
</div>
</th>
</tr>
</tfoot>
</table>
<button class="center aligned ui teal compact labeled icon button" onclick="window.location.href='{{ route('timesheet::form.overheadForm', ['phase' => $phase, 'month' => $month]) }}';">
<i class="angle double left icon"></i>
Back
</button>
<button class="center aligned ui green compact right labeled icon button" onclick="window.location.href='{{ route('timesheet::dashboard.timesheetViewer', ['phase' => $phase, 'month' => $month, 'year' => $year]) }}';">
<i class="angle double right icon"></i>
Timesheet Viewer
</button>
</div>
@endsection
......@@ -12,6 +12,7 @@ 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']);
......@@ -22,6 +23,8 @@ Route::group(
Route::post('reviewselectmonthphase', ['uses' => 'DashboardController@reviewselectmonthphase', 'as' => 'dashboard.reviewselectmonthphase']);
Route::post('viewerselectmonthphase', ['uses' => 'DashboardController@viewerselectmonthphase', 'as' => 'dashboard.viewerselectmonthphase']);
Route::get('tsubmit', ['uses' => 'DashboardController@tsubmit', 'as' => 'dashboard.tsubmit']);
Route::get('revaction', ['uses' => 'DashboardController@revaction', 'as' => 'dashboard.revaction']);
Route::post('verify', ['uses' => 'DashboardController@verify', 'as' => 'dashboard.verify']);
//maintenance
Route::get('senaraiProject',['uses' => 'MaintenanceController@senaraiProject', 'as' => 'maintenance.senaraiProject']);
......@@ -60,9 +63,11 @@ Route::group(
Route::get('filterChargeable',['uses' => 'FormController@filterChargeable', 'as' => 'form.filterChargeable']);
Route::get('filterNonChargeable',['uses' => 'FormController@filterNonChargeable', 'as' => 'form.filterNonChargeable']);
Route::get('filterOverhead',['uses' => 'FormController@filterOverhead', 'as' => 'form.filterOverhead']);
Route::get('filterNotes',['uses' => 'FormController@filterNotes', 'as' => 'form.filterNotes']);
Route::post('chargeableselectmonthphase', ['uses' => 'FormController@chargeableselectmonthphase', 'as' => 'form.chargeableselectmonthphase']);
Route::post('nonchargeableselectmonthphase', ['uses' => 'FormController@nonchargeableselectmonthphase', 'as' => 'form.nonchargeableselectmonthphase']);
Route::post('overheadselectmonthphase', ['uses' => 'FormController@overheadselectmonthphase', 'as' => 'form.overheadselectmonthphase']);
Route::post('noteselectmonthphase', ['uses' => 'FormController@noteselectmonthphase', 'as' => 'form.noteselectmonthphase']);
// nonChargeableForm
Route::post('addnonchargeabletask',['uses' => 'FormController@addnonchargeabletask', 'as' => 'form.addnonchargeabletask']);
......
......@@ -14,6 +14,8 @@ use Portal\Timesheet\Model\Pteam;
use Portal\Timesheet\Model\Staff_info;
use Portal\Timesheet\Model\Overhead;
use Portal\Timesheet\Model\Role;
use Portal\Timesheet\Model\VwViewer;
use Portal\Timesheet\Model\VwReviewProfile;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use File;
......@@ -80,6 +82,12 @@ class DashboardController extends Controller
}
}
public function vwviewer(){
$data = VwViewer::orderby('DEPARTMENT', 'DESC')->get();
// dd($data[0]);
return view('timesheet::dashboard.vwviewer', compact('data'));
}
public function filterViewer()
{
$currmonth = date('n');
......@@ -132,15 +140,16 @@ class DashboardController extends Controller
public function timesheetReview(Request $request)
{
// dd($request);
$curryear = date('Y');
if ($request->year) {
$curryear = $request->year;
}
$hod = Users::find(Auth::id());
// dd($hod->id);
$profile = VwReviewProfile::where('hod_id', $hod->id)
->where('tm_year', $curryear)
->get();
$staffs = Staff_info::where('penyokong', $hod->id)
->get();
......@@ -149,14 +158,14 @@ class DashboardController extends Controller
->where('tm_year', $curryear)
->where('tm_month', $request->month)
->where('tm_phase', $request->phase)
->get();
->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();
->get();
$cpt = Pteam::where('pt_project_type', 1)
->get();
......@@ -174,9 +183,50 @@ class DashboardController extends Controller
$pmname = Staff_info::where('fk_lkp_department', 4)
->get();
// dd($checktd);
return view('timesheet::dashboard.timesheetReview', compact('staffs', 'checkts', 'checktd', 'cpt', 'ncpt', 'cp', 'ncp', 'pmname'));
return view('timesheet::dashboard.timesheetReview', compact('profile', 'staffs', 'checkts', 'checktd', 'cpt', 'ncpt', 'cp', 'ncp', 'pmname'));
}
public function revaction(Request $request)
{
$hod = Users::find(Auth::id());
$profile = VwReviewProfile::where('hod_id', $hod->id)
->where('tmid', $request->tmid)
->first();
return view('timesheet::dashboard.revaction', compact('profile', 'hod'));
}
public function verify(Request $request)
{
$hod = Users::find(Auth::id());
$today = Carbon::today()->toDateString();
if ($request->action == 1) {
$ts = Ts_master::where('id', $request->tmid)
->update(
[
'tm_timesheet_master_sts' => 3,
'tm_verified_at' => $today,
'tm_verified_by' => $request->verifier
]);
$td = Ts_detail::where('fk_tm_id', $request->tmid)
->update([ 'td_timesheet_sts' => 3 ]);
} else {
dd('rejected');
}
$profile = VwReviewProfile::where('hod_id', $hod->id)
->where('tmid', $request->tmid)
->first();
$month = $profile->tm_month;
$phase = $profile->tm_phase;
return redirect()->route('timesheet::dashboard.timesheetReview', compact('month', 'phase'));
}
public function timesheetViewer(Request $request)
......@@ -184,25 +234,24 @@ class DashboardController extends Controller
$user = Staff_info::where('fk_users', Auth::id())
->first();
$profile = VwViewer::where('STAFF_ID', $user->staff_id)
->orderby('DEPARTMENT', 'DESC')
->first();
$dept = Department::where('id', $user->fk_lkp_department)
->first();
$hod = Staff_info::find($user->penyokong)
->fullname;
// $month = date('n');
$year = date('Y');
// $day = date('j');
$penyokong = Staff_info::where('penyokong', 0)
->get();
// $month = 7;
// $year = 2022;
// $day = 2;
$bod = Staff_info::select('id', 'fullname')
->whereIn('id', [45,46,47,48])
->get();
// if ($day < 16) {
// $phase = 1;
// } else {
// $phase = 2;
// }
$year = date('Y');
if(isset($request->phase))
{
......@@ -359,15 +408,23 @@ class DashboardController extends Controller
}
// dd($check->id);
return view('timesheet::dashboard.timesheetViewer', compact('user', 'dept', 'hod', 'phase', 'month', 'year', 'strMonth', 'daymonth', 'chargeablelist', 'nonchargeablelist', 'overheadlist', 'chargehour', 'nonchargehour', 'totalchargehrs', 'totalnonchargehrs', 'totaloverheadhrs', 'overheadhour', 'notes', 'check', 'strdays'));
return view('timesheet::dashboard.timesheetViewer', compact('user','profile', 'dept', 'hod', 'phase', 'month', 'year', 'strMonth', 'daymonth', 'chargeablelist', 'nonchargeablelist', 'overheadlist', 'chargehour', 'nonchargehour', 'totalchargehrs', 'totalnonchargehrs', 'totaloverheadhrs', 'overheadhour', 'notes', 'check', 'strdays', 'penyokong', 'bod'));
}
public function tsubmit(Request $request)
{
$today = Carbon::today()->toDateString();
$submit = 2;
$ts = Ts_master::where('id', $request->tid)
->update([ 'tm_timesheet_master_sts' => 2 ]);
->update(
[
'tm_timesheet_master_sts' => 2,
'tm_overtime_hrs' => $request->totalot,
'tm_total_hours' => $request->totalchargehrs + $request->totalnonchargehrs + $request->totaloverheadhrs,
'tm_total_days' => ($request->totalchargehrs + $request->totalnonchargehrs + $request->totaloverheadhrs)/8,
'tm_submission_at' => $today,
]);
$td = Ts_detail::where('fk_tm_id', $request->tid)
->update([ 'td_timesheet_sts' => 2 ]);
......
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
class Tproject extends Model
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'timesheet_prj';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwReviewProfile extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_review_profile_details';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwViewer extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_viewer_profile_detail';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
......@@ -54,6 +54,10 @@ class ServiceProvider extends BaseServiceProvider
$dashboard->add(__('Halaman Utama'), url('/home/'))
->data('icon', 'tachometer alternate icon')
->active('home/*');
$dashboard->add(__('vwviewer'), url('/vwviewer/'))
->data('icon', 'tachometer alternate icon')
->active('home/*');
// $dashboard->add(__('Timesheet Calendar'), route('timesheet::kalendar.kalendar'))
// ->data('icon', 'calendar alternate outline')
// ->active('kalendar/*')
......@@ -76,6 +80,11 @@ class ServiceProvider extends BaseServiceProvider
->active('overheadForm/*')
->data('permission', Permission::borang);
$form->add(__('Notes'), route('timesheet::form.filterNotes'))
->data('icon', 'circle outline')
->active('notelist/*')
->data('permission', Permission::borang);
$form->add(__('Timesheet Viewer'), route('timesheet::dashboard.filterViewer'))
->data('icon', 'eye icon')
->active('timesheetViewer/*')
......
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