Commit b949217a by Azhan Hannan

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

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