Commit 045b5422 by Azhan Hannan

changes

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