Commit 045b5422 by Azhan Hannan

changes

parent 6bda12c8
@if($staffs) @if($staffs)
@foreach($staffs as $key => $staff) @foreach($staffs as $key => $staff)
<div class="item" data-value="{{ data_get($staff,'id') }}" data-text="{{ data_get($staff,'fullname') }}"> <div class="item" data-value="{{ data_get($staff,'id') }}" data-text="{{ data_get($staff,'name') }}">
{{ data_get($staff,'fullname') }} {{ data_get($staff,'name') }}
</div> </div>
@endforeach @endforeach
@else @else
......
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
<div class="default text">Staff Name</div> <div class="default text">Staff Name</div>
<div class="menu" id="divstaff" name="divstaff"> <div class="menu" id="divstaff" name="divstaff">
@foreach($staffs as $key => $staff) @foreach($staffs as $key => $staff)
<div class="item" data-value="{{data_get($staff,'id')}}" data-text="{{data_get($staff,'fullname')}}"> <!-- <div class="item" data-value="{{data_get($staff,'id')}}" data-text="{{data_get($staff,'fullname')}}">
{{data_get($staff,'fullname')}} {{data_get($staff,'fullname')}}
</div> </div> -->
@endforeach @endforeach
</div> </div>
</div> </div>
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<?php <?php
// $chargeproject = $project->where('ptype', 1); // $chargeproject = $project->where('ptype', 1);
$chargeproject = $project->where('ptype', 1); $chargeproject = $project->where('ptype', 1);
dd($chargeproject); // dd($chargeproject);
$chargehours = $chargedays = 0; $chargehours = $chargedays = 0;
?> ?>
...@@ -64,8 +64,8 @@ ...@@ -64,8 +64,8 @@
<td style="width: 5%" class="center aligned">C</td> <td style="width: 5%" class="center aligned">C</td>
<td style="width: 15%" class="center aligned">{{data_get($chargeable,'pcode')}}</td> <td style="width: 15%" class="center aligned">{{data_get($chargeable,'pcode')}}</td>
<td style="width: 25%">{{data_get($chargeable,'pname')}}</td> <td style="width: 25%">{{data_get($chargeable,'pname')}}</td>
<td style="width: 10%" class="center aligned">{{data_get($chargeable,'hours')}}</td> <td style="width: 10%" class="center aligned">{{ number_format(data_get($chargeable,'hours'), '1', '.', '') }}</td>
<td style="width: 10%" class="center aligned">{{number_format(data_get($chargeable,'hours')/8, '1', '.', '')}}</td> <td style="width: 10%" class="center aligned">{{ number_format(data_get($chargeable,'hours')/8, '1', '.', '') }}</td>
</tr> </tr>
<?php <?php
$chargehours += data_get($chargeable,'hours'); $chargehours += data_get($chargeable,'hours');
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
<td style="width: 5%" class="center aligned">NC</td> <td style="width: 5%" class="center aligned">NC</td>
<td style="width: 15%" class="center aligned"></td> <td style="width: 15%" class="center aligned"></td>
<td style="width: 25%">{{data_get($value,'pname')}}</td> <td style="width: 25%">{{data_get($value,'pname')}}</td>
<td style="width: 10%" class="center aligned">{{data_get($value,'hours')}}</td> <td style="width: 10%" class="center aligned">{{ number_format(data_get($value,'hours'), '1', '.', '') }}</td>
<td style="width: 10%" class="center aligned">{{number_format(data_get($value,'hours')/8, '1', '.', '')}}</td> <td style="width: 10%" class="center aligned">{{ number_format(data_get($value,'hours')/8, '1', '.', '') }}</td>
</tr> </tr>
<?php <?php
$overheadhours += data_get($value,'hours'); $overheadhours += data_get($value,'hours');
...@@ -102,8 +102,8 @@ ...@@ -102,8 +102,8 @@
<tr> <tr>
<td colspan="3"></td> <td colspan="3"></td>
<td style="width: 25%" class="center aligned">Total</td> <td style="width: 25%" class="center aligned">Total</td>
<td style="width: 10%" class="center aligned">{{$staffhours}}</td> <td style="width: 10%" class="center aligned">{{ number_format($staffhours, '1', '.', '') }}</td>
<td style="width: 10%" class="center aligned">{{$staffdays}}</td> <td style="width: 10%" class="center aligned">{{ number_format($staffdays, '1', '.', '') }}</td>
</tr> </tr>
</tbody> </tbody>
...@@ -116,8 +116,8 @@ ...@@ -116,8 +116,8 @@
<tr> <tr>
<th colspan="3"><strong>Total</strong></th> <th colspan="3"><strong>Total</strong></th>
<th style="width: 25%" class="center aligned"></th> <th style="width: 25%" class="center aligned"></th>
<th style="width: 10%" class="center aligned"><strong>{{$totalhours}}</strong></th> <th style="width: 10%" class="center aligned"><strong>{{ number_format($totalhours, '1', '.', '') }}</strong></th>
<th style="width: 10%" class="center aligned"><strong>{{$totaldays}}</strong></th> <th style="width: 10%" class="center aligned"><strong>{{ number_format($totaldays, '1', '.', '') }}</strong></th>
</tr> </tr>
</tfoot> </tfoot>
</table> </table>
......
...@@ -28,9 +28,9 @@ ...@@ -28,9 +28,9 @@
<table class="ui unstackable celled table" style="width: 100%"> <table class="ui unstackable celled table" style="width: 100%">
<thead> <thead>
<tr> <tr>
<th colspan="5"></th> <th colspan="4"></th>
<th colspan="{{count($chargeproject)+2}}" class="center aligned">Chargeable</th> <th colspan="{{count($chargeproject)+2}}" class="center aligned">Chargeable</th>
<th colspan="{{count($overhead)+2}}" class="center aligned">Non-Chargeable</th> <th colspan="{{count($overhead)+2}}" class="center aligned">Overhead</th>
<th rowspan="2" class="center aligned">Total (Working Days)</th> <th rowspan="2" class="center aligned">Total (Working Days)</th>
</tr> </tr>
<tr> <tr>
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
<th>Department</th> <th>Department</th>
<th>Staff Id</th> <th>Staff Id</th>
<th>Staff Name</th> <th>Staff Name</th>
<th>Position</th>
@foreach($chargeproject as $key => $chargeable) @foreach($chargeproject as $key => $chargeable)
<th> <th>
{{data_get($chargeable, 'p_project_code')}} {{data_get($chargeable, 'p_project_code')}}
...@@ -62,7 +61,6 @@ ...@@ -62,7 +61,6 @@
<td>{{data_get($staff,'deptCode')}}</td> <td>{{data_get($staff,'deptCode')}}</td>
<td>{{data_get($staff,'staffid')}}</td> <td>{{data_get($staff,'staffid')}}</td>
<td class="single line">{{data_get($staff,'name')}}</td> <td class="single line">{{data_get($staff,'name')}}</td>
<td></td>
<?php $totalc = 0; ?> <?php $totalc = 0; ?>
@foreach($chargeproject as $key => $chargeable) @foreach($chargeproject as $key => $chargeable)
<td> <td>
...@@ -112,7 +110,7 @@ ...@@ -112,7 +110,7 @@
<tfoot> <tfoot>
<tr> <tr>
<th colspan="5" class="center aligned"> <th colspan="4" class="center aligned">
<strong>Total</strong> <strong>Total</strong>
</th> </th>
<?php $tch = 0; ?> <?php $tch = 0; ?>
......
...@@ -368,11 +368,14 @@ class MaintenanceController extends Controller ...@@ -368,11 +368,14 @@ class MaintenanceController extends Controller
foreach ($departments as $key => $value) foreach ($departments as $key => $value)
{ {
$staffs = Staff_info::where('fk_lkp_department', $value->id) $staffs = Users::with('toStaffInfo')
->where('status','ACTIVE')
->get(); ->get();
// dd($value->id); // dd($staffs);
// dd(data_get($staffs,'toUser'));
} }
$roles = Role::where('status', 1) $roles = Role::where('status', 1)
->get(); ->get();
...@@ -645,9 +648,10 @@ class MaintenanceController extends Controller ...@@ -645,9 +648,10 @@ class MaintenanceController extends Controller
public function loadstaff($dept) public function loadstaff($dept)
{ {
$staffs = Staff_info::where('fk_lkp_department',$dept) $staffs = Users::where('status','ACTIVE')
->where('status', 1) ->whereHas('toStaffInfo', function($q) use ($dept){
->get(); $q->where('fk_lkp_department', $dept);
})->get();
return view('timesheet::ajax.senaraistaff', compact('staffs')); return view('timesheet::ajax.senaraistaff', compact('staffs'));
} }
......
...@@ -84,7 +84,7 @@ class ReportController extends Controller ...@@ -84,7 +84,7 @@ class ReportController extends Controller
->get(); ->get();
// dd($ovhours); // dd($ovhours);
$chargeproject = VwChargeable::all(); $chargeproject = VwChargeable::where('deleted_at', null)->get();
// dd($chargeproject); // dd($chargeproject);
if ($request->dept == 'all') { if ($request->dept == 'all') {
$staffs = VwStaff::orderby('deptID') $staffs = VwStaff::orderby('deptID')
...@@ -254,6 +254,7 @@ class ReportController extends Controller ...@@ -254,6 +254,7 @@ class ReportController extends Controller
->where('month', $request->month) ->where('month', $request->month)
->where('year', $request->year) ->where('year', $request->year)
->get(); ->get();
// dd($overhead);
$year = date('Y'); $year = date('Y');
if ($request->year) { if ($request->year) {
......
...@@ -20,7 +20,7 @@ class Staff_info extends Model ...@@ -20,7 +20,7 @@ class Staff_info extends Model
public function toUser() public function toUser()
{ {
return $this->hasOne('Portal\Timesheet\Model\Users', 'u_staffID', 'staff_id'); return $this->hasOne('Portal\Timesheet\Model\Users', 'u_staffID', 'staff_id')->where('status','ACTIVE');
} }
public function deptname() public function deptname()
......
...@@ -28,5 +28,10 @@ class Users extends Model ...@@ -28,5 +28,10 @@ class Users extends Model
} }
public function toStaffInfo()
{
return $this->hasOne('Portal\Timesheet\Model\Staff_info', 'staff_id', 'u_staffID');
}
} }
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