Commit b949217a by Azhan Hannan

changes, update display project report, fix bugs validation add new project.

parent 20406395
......@@ -141,7 +141,11 @@
<th style="width: 12%;" class="text-center">Action</th>
</tr>
</thead>
@if($overhead)
@if(count($overhead) == 0)
<tr>
<td class="text-center" colspan="5">No Overhead Submitted</td>
</tr>
@else
@foreach($overhead as $key => $tpoverhead)
<tr>
<td style="width: 15;">{{data_get($tpoverhead,'tp_project_name')}}</td>
......
......@@ -638,6 +638,7 @@ function printdiv(printpage)
document.body.innerHTML = headstr+newstr+footstr;
window.print();
document.margin='none';
el.classList.remove("print-flys");
el.classList.add("on-the-fly-behavior");
document.body.innerHTML = oldstr;
......
......@@ -9,11 +9,11 @@
<div class="two fields">
<div class="eight wide field">
<label>Project Code</label>
<input type="text" name="projectcode" placeholder="Project Code">
<input type="text" name="projectcode" placeholder="Project Code" required="required">
</div>
<div class="eight wide field">
<label>Project Name</label>
<input type="text" name="projectname" placeholder="Project Name">
<input type="text" name="projectname" placeholder="Project Name" required="required">
</div>
</div>
......
......@@ -23,37 +23,47 @@
</tr>
</thead>
<tbody>
@foreach($projectlist as $key => $project)
<tr>
<td>{{$key+1}} </td>
<td class="single line">{{ data_get($project,'projectcode') }} </td>
<td class="single line">{{ data_get($project,'projectname') }} </td>
<td class="single line">{{ data_get($project,'projectmanager') }} </td>
<td class="single line">{{ data_get($project,'projectdirector') }} </td>
<td class="text-center single line">
@if(data_get($project,'status') == 1)
Active
@else
Inactive
@endif
</td>
<td class="text-center single line">
<button class="compact green ui button" onclick="window.location.href='{{ route('timesheet::maintenance.senaraiProjectTeam', ['id' => $project['id']]) }}';">
Team
</button>
<button class="compact olive ui button" onclick="window.location.href='{{ route('timesheet::maintenance.updateProject', ['id' => $project['id']]) }}';">
Edit Project
</button>
<button class="compact purple ui button" onclick="window.location.href='{{ route('timesheet::maintenance.mandays', ['id' => $project['id']]) }}';">
Mandays
</button>
<button type="button" class="compact ui red button" id="uploadmodal" onclick="window.location.href='{{ route('timesheet::maintenance.deleteproject', ['id' => $project['id']]) }}';">
Delete
</button>
</td>
</tr>
@endforeach
@if($checkproject)
@foreach($projectlist as $key => $project)
<tr>
<td>{{$key+1}} </td>
<td class="single line">{{ data_get($project,'projectcode') }} </td>
<td class="single line">{{ data_get($project,'projectname') }} </td>
<td class="single line">{{ data_get($project,'projectmanager') }} </td>
<td class="single line">{{ data_get($project,'projectdirector') }} </td>
<td class="text-center single line">
@if(data_get($project,'status') == 1)
Active
@else
Inactive
@endif
</td>
<td class="text-center single line">
<button class="compact green ui button" onclick="window.location.href='{{ route('timesheet::maintenance.senaraiProjectTeam', ['id' => $project['id']]) }}';">
Team
</button>
<button class="compact olive ui button" onclick="window.location.href='{{ route('timesheet::maintenance.updateProject', ['id' => $project['id']]) }}';">
Edit Project
</button>
<button class="compact purple ui button" onclick="window.location.href='{{ route('timesheet::maintenance.mandays', ['id' => $project['id']]) }}';">
Mandays
</button>
<button type="button" class="compact ui red button" id="uploadmodal" onclick="window.location.href='{{ route('timesheet::maintenance.deleteproject', ['id' => $project['id']]) }}';">
Delete
</button>
</td>
</tr>
@endforeach
@else
<tr>
<td colspan="7" class="text-center">No Ongoing Project</td>
</tr>
@endif
</tbody>
</table>
</div>
......
......@@ -16,6 +16,7 @@
<div class="ui styled fluid">
<div class="title">
<table class="ui unstackable celled table">
<thead>
<tr>
......@@ -30,11 +31,18 @@
</tr>
</thead>
</table>
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 45%">staff name</th>
<th style="width: 25%" class="center aligned">role</th>
<th style="width: 10%" class="center aligned" rowspan="2">role</th>
<th style="width: 10%" class="center aligned" rowspan="2">allocation</th>
<th style="width: 10%" class="center aligned" rowspan="2">total accumulate</th>
<th style="width: 10%" class="center aligned" rowspan="2">staff name</th>
<th style="width: 20%" class="center aligned" colspan="2">Mandays</th>
<th style="width: 15%" class="center aligned" rowspan="2">balance</th>
</tr>
<tr>
<th style="width: 15%" class="center aligned">total hours</th>
<th style="width: 15%" class="center aligned">total days</th>
</tr>
......@@ -42,47 +50,50 @@
<tbody>
<?php $totalhours = $totaldays = 0; ?>
@foreach($pteam as $key => $team)
<tr>
<td style="width: 40%">{{data_get($team,'name')}}</td>
<td style="width: 30%" class="center aligned">{{data_get($team,'role')}}</td>
<td style="width: 15%" class="center aligned">
<?php $sumhours = 0; ?>
@foreach($ptdetail as $key => $hours)
@if(data_get($hours,'staffid') == data_get($team,'staffid'))
<?php $sumhours += data_get($hours,'hours'); ?>
<?php $totalhours += data_get($hours,'hours'); ?>
@endif
@endforeach
@if($sumhours == 0)
@else
{{$sumhours}}
@endif
</td>
<td style="width: 15%" class="center aligned">
<?php $sumdays = 0; ?>
@foreach($ptdetail as $key => $hours)
@if(data_get($hours,'staffid') == data_get($team,'staffid'))
<!-- {{number_format(data_get($hours,'hours')/8, 1, '.', '')}} -->
<?php $sumdays += number_format(data_get($hours,'hours')/8, 1, '.', ''); ?>
<?php $totaldays += number_format(data_get($hours,'hours')/8, 1, '.', ''); ?>
@endif
@endforeach
@if($sumdays == 0)
@else
{{$sumdays}}
@endif
</td>
</tr>
<tr>
<td style="width: 10%" class="center aligned">{{data_get($team,'role')}}</td>
<td class="center aligned">allocation</td>
<td class="center aligned">accumulate</td>
<td style="width: 10%">{{data_get($team,'name')}}</td>
<td style="width: 15%" class="center aligned">
<?php $sumhours = 0; ?>
@foreach($ptdetail as $key => $hours)
@if(data_get($hours,'staffid') == data_get($team,'staffid'))
<?php $sumhours += data_get($hours,'hours'); ?>
<?php $totalhours += data_get($hours,'hours'); ?>
@endif
@endforeach
@if($sumhours == 0)
@else
{{$sumhours}}
@endif
</td>
<td style="width: 15%" class="center aligned">
<?php $sumdays = 0; ?>
@foreach($ptdetail as $key => $hours)
@if(data_get($hours,'staffid') == data_get($team,'staffid'))
<!-- {{number_format(data_get($hours,'hours')/8, 1, '.', '')}} -->
<?php $sumdays += number_format(data_get($hours,'hours')/8, 1, '.', ''); ?>
<?php $totaldays += number_format(data_get($hours,'hours')/8, 1, '.', ''); ?>
@endif
@endforeach
@if($sumdays == 0)
@else
{{$sumdays}}
@endif
</td>
<td class="center aligned">balance</td>
</tr>
@endforeach
</tbody>
<tfoot class="full-width">
<!-- <tfoot class="full-width">
<tr>
<th style="width: 40%"><strong>Total</strong></th>
<th style="width: 30%"></th>
<th style="width: %"><strong>Total</strong></th>
<th style="width: %"></th>
<th style="width: 15%" class="center aligned"><strong>{{$totalhours}} / {{data_get($pdetail,'mandays.p_total_hours')}}</strong></th>
<th style="width: 15%" class="center aligned"><strong>{{$totaldays}} / {{data_get($pdetail,'mandays.p_total_days')}}</strong></th>
</tr>
</tfoot>
</tfoot> -->
</table>
</div>
</div>
......
......@@ -26,9 +26,13 @@
<div class="three wide field">
<label>Year</label>
<select name="year" class="ui fluid dropdown" required="required">
@foreach($year as $key => $value)
<option value="{{ data_get($value,'tm_year') }}">{{ data_get($value,'tm_year') }}</option>
@endforeach
@if($checkyear)
@foreach($year as $key => $value)
<option value="{{ data_get($value,'tm_year') }}">{{ data_get($value,'tm_year') }}</option>
@endforeach
@else
<option value="{{ $year}}">{{ $year }}</option>
@endif
</select>
</div>
<div class="three wide field">
......
......@@ -1122,7 +1122,10 @@ class DashboardController extends Controller
->update([ 'td_timesheet_sts' => 3 ]);
Tproject::where('fk_tm_id', $request->tid)
->update([ 'tp_timesheet_sts' => 3] );
->update([
'tp_timesheet_sts' => 3,
'verifier_remark' => 'Verified',
] );
}
if( ($roleid != ('9'||'2'||'8')) && (data_get($user,'penyokong') == '0') )
......
......@@ -186,9 +186,11 @@ class FormController extends Controller
public function savechargeablehours(Request $request)
{
$roleid = auth()->user()->roles['0']->id;
$chargeable = 1;
$userId = users::find(Auth::id())
$userId = Users::find(Auth::id())
->u_staffID;
$user = Staff_info::where('fk_users', Auth::id())
......@@ -303,7 +305,15 @@ class FormController extends Controller
if ($checktproject) {
$checktproject->tp_hours = $checkhours->sum('td_hours');
$checktproject->tp_pm = data_get($user, 'penyokongpm.staff_id');
if ($roleid == 8) {
$checktproject->tp_pm = data_get($user, 'penyokongpm.staff_id');
}
else
{
$project = Project::where('id', $projectid)
->first();
$checktproject->tp_pm = data_get($project, 'p_project_task_team');
}
$checktproject->save();
}
else
......@@ -322,7 +332,18 @@ class FormController extends Controller
$tpdetail->tp_project_name = $project->p_project_description;
$tpdetail->tp_hours = $checkhours->sum('td_hours');
$tpdetail->tp_pm = data_get($user, 'penyokongpm.staff_id');
if ($roleid == 8) {
$tpdetail->tp_pm = data_get($user, 'penyokongpm.staff_id');
}
else
{
$project = Project::where('id', $projectid)
->first();
$tpdetail->tp_pm = data_get($project, 'p_project_task_team');
}
$tpdetail->tp_pd = $project->p_project_director;
$tpdetail->tp_timesheet_sts = 1;
$tpdetail->updated_by = $userId;
......
......@@ -45,6 +45,13 @@ class MaintenanceController extends Controller
->orderBy('created_at', 'desc')
->orderBy('p_project_sts', 'desc')
->get();
$checkproject = Project::where('p_project_type', $chargeable)
->with('projectDirector')
->with('projectManager')
->orderBy('created_at', 'desc')
->orderBy('p_project_sts', 'desc')
->first();
}
else
// if($roleid == '8')
......@@ -56,6 +63,14 @@ class MaintenanceController extends Controller
->orderBy('created_at', 'desc')
->orderBy('p_project_sts', 'desc')
->get();
$checkproject = Project::where('p_project_type', $chargeable)
->where('p_project_task_team', $user->staff_id)
->with('projectDirector')
->with('projectManager')
->orderBy('created_at', 'desc')
->orderBy('p_project_sts', 'desc')
->first();
}
// dd($project);
......@@ -84,7 +99,7 @@ class MaintenanceController extends Controller
// dd($roleid);
return view('timesheet::maintenance.senaraiProject',compact('projectlist', 'roleid'));
return view('timesheet::maintenance.senaraiProject',compact('projectlist', 'roleid', 'checkproject'));
}
public function penambahanProject()
......@@ -105,6 +120,8 @@ class MaintenanceController extends Controller
public function addnewproject(Request $request)
{
// dd($request);
$checkcode = Project::where('p_project_code', $request->projectcode)
->first();
......@@ -118,12 +135,14 @@ class MaintenanceController extends Controller
$userId = users::find(Auth::id())
->u_staffID;
if ($request->projectcode == null || $request->projectname == null || $request->projectmanager == null) {
if ($request->projectcode == null || $request->projectname == null || $request->projectdirector == null) {
return redirect()->route('timesheet::maintenance.penambahanProject')
->withErrors('The information is not complete. Please re-enter the details.');
// dd('masuk sini');
} else {
// dd('ke sini?');
$project = new Project;
$project->p_project_code = $request->projectcode;
......
......@@ -143,13 +143,27 @@ class ReportController extends Controller
$month[] = date('F', mktime(0,0,0,$m, 1, date('Y')));
}
$year = Ts_master::select('tm_year')
$checkyear = Ts_master::select('tm_year')
->where('tm_timesheet_master_sts', 4)
->distinct('tm_year')
->orderby('tm_year','DESC')
->first();
if ($checkyear) {
$year = Ts_master::select('tm_year')
->where('tm_timesheet_master_sts', 4)
->distinct('tm_year')
->orderby('tm_year','DESC')
->get();
}
else
{
$year = date('Y');
}
return view('timesheet::report.projectReport', compact('checkproj' ,'proj', 'month', 'year'));
// dd($year);
return view('timesheet::report.projectReport', compact('checkproj' ,'proj', 'month', 'year', 'checkyear'));
}
public function generateprojectreport(Request $request)
......@@ -172,7 +186,7 @@ class ReportController extends Controller
->orderby('roleid')
->groupby('name')
->get();
// dd($pteam);
$ptdetail = VwProject::where('pid', $request->project)
->where('MONTH', $request->month)
->where('year', $request->year)
......
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