Commit e22cc6fb by hannan

changes in report summary

parent d22c846f
...@@ -24,8 +24,9 @@ ...@@ -24,8 +24,9 @@
<thead> <thead>
<tr> <tr>
<th colspan="5"></th> <th colspan="5"></th>
<th colspan="{{count($chargeproject)}}" class="center aligned">Chargeable</th> <th colspan="{{count($chargeproject)+2}}" class="center aligned">Chargeable</th>
<th colspan="2"></th> <th colspan="{{count($overhead)+3}}" class="center aligned">Non-Chargeable</th>
<th rowspan="2" class="center aligned">Total (Working Days)</th>
</tr> </tr>
<tr> <tr>
<th>No</th> <th>No</th>
...@@ -40,13 +41,15 @@ ...@@ -40,13 +41,15 @@
@endforeach @endforeach
<th>Total Hours</th> <th>Total Hours</th>
<th>Total Days</th> <th>Total Days</th>
<th class="center aligned">Project</th>
@foreach($overhead as $key => $value)
<th>{{data_get($value,'o_overhead_desc')}}</th>
@endforeach
<th>Total Hours</th>
<th>Total Days</th>
</tr> </tr>
</thead> </thead>
<?php $totaldays = $totalalldays = 0; ?>
<?php
// dd(count($staffs->where('deptID', 1)));
?>
@foreach($staffs as $key => $staff) @foreach($staffs as $key => $staff)
<tbody> <tbody>
<tr> <tr>
...@@ -55,23 +58,55 @@ ...@@ -55,23 +58,55 @@
<td>{{data_get($staff,'staffid')}}</td> <td>{{data_get($staff,'staffid')}}</td>
<td>{{data_get($staff,'name')}}</td> <td>{{data_get($staff,'name')}}</td>
<td></td> <td></td>
<?php $total = 0; ?> <?php $totalc = 0; ?>
@foreach($chargeproject as $key => $chargeable) @foreach($chargeproject as $key => $chargeable)
<td> <td>
@foreach($ringkasan as $key => $value) @foreach($ringkasan as $key => $value)
@if(data_get($value,'staffid') == data_get($staff,'staffid') && data_get($chargeable,'id') == data_get($value,'c_pid')) @if(data_get($value,'staffid') == data_get($staff,'staffid') && data_get($chargeable,'id') == data_get($value,'c_pid'))
{{data_get($value,'total_c_hours')}} {{data_get($value,'total_c_hours')}}
<?php $total += data_get($value,'total_c_hours'); ?> <?php $totalc += data_get($value,'total_c_hours'); ?>
@endif @endif
@endforeach @endforeach
</td> </td>
@endforeach @endforeach
<td class="center aligned">{{$total}}</td> <td class="center aligned">{{$totalc}}</td>
<td class="center aligned">{{number_format($total/8, 1, '.', '')}}</td> <td class="center aligned">{{number_format($totalc/8, 1, '.', '')}}</td>
<td class="center aligned">
<?php $totalnc = 0; ?>
@foreach($projectnc as $key => $project)
@if(data_get($project,'staffid') == data_get($staff,'staffid'))
{{data_get($project,'nonchargehours')}}
<?php $totalnc += data_get($project,'nonchargehours'); ?>
@endif
@endforeach
</td>
@foreach($overhead as $key => $value)
<td>
@foreach($ovhours as $key => $hours)
@if(data_get($staff,'staffid') == data_get($hours,'staffid') && data_get($value,'id') == data_get($hours,'oid'))
{{data_get($hours,'hours')}}
<?php $totalnc += data_get($hours,'hours'); ?>
@endif
@endforeach
</td>
@endforeach
<td class="center aligned">{{$totalnc}}</td>
<td class="center aligned">{{number_format($totalnc/8, 1, '.', '')}}</td>
<?php $totaldays = number_format($totalc/8, 1, '.', '') + number_format($totalnc/8, 1, '.', ''); ?>
<td>{{$totaldays}}</td>
</tr> </tr>
</tbody> </tbody>
<?php $totalalldays += $totaldays; ?>
@endforeach @endforeach
<tfoot>
<tr>
<th colspan="5" class="center aligned">
<strong>Total</strong>
</th>
<th colspan="{{count($chargeproject)+2+count($overhead)+3}}"></th>
<th><strong>{{$totalalldays}}</strong></th>
</tr>
</tfoot>
</table> </table>
</div> </div>
</div> </div>
......
...@@ -472,7 +472,7 @@ class FormController extends Controller ...@@ -472,7 +472,7 @@ class FormController extends Controller
$task = new Project; $task = new Project;
$task->p_project_description = $request->nonChargeableProject; $task->p_project_description = $request->nonChargeableProject;
$task->pt_project_type = $nonchargeable; $task->p_project_type = $nonchargeable;
$task->p_project_sts = $request->status; $task->p_project_sts = $request->status;
$task->updated_by = $user->u_staffID; $task->updated_by = $user->u_staffID;
$task->save(); $task->save();
......
...@@ -24,6 +24,8 @@ use Portal\Timesheet\Model\VwNonChargeable; ...@@ -24,6 +24,8 @@ use Portal\Timesheet\Model\VwNonChargeable;
use Portal\Timesheet\Model\VwStaff; use Portal\Timesheet\Model\VwStaff;
use Portal\Timesheet\Model\VwOverhead; use Portal\Timesheet\Model\VwOverhead;
use Portal\Timesheet\Model\VwProject; use Portal\Timesheet\Model\VwProject;
use Portal\Timesheet\Model\VwNonchargeSummary;
use Portal\Timesheet\Model\VwOverheadSummary;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use File; use File;
...@@ -61,12 +63,25 @@ class ReportController extends Controller ...@@ -61,12 +63,25 @@ class ReportController extends Controller
->where('year', $request->year) ->where('year', $request->year)
->get(); ->get();
$projectnc = VwNonchargeSummary::where('month', $request->month)
->where('year', $request->year)
->get();
$overhead = Overhead::where('o_overhead_sts', 1)->get();
// dd($overhead);
$ovhours = VwOverheadSummary::where('month', $request->month)
->where('year', $request->year)
->get();
// dd($ovhours);
$chargeproject = VwChargeable::all(); $chargeproject = VwChargeable::all();
$nonchargeproject = VwNonChargeable::all(); $nonchargeproject = VwNonChargeable::all();
$staffs = VwStaff::orderby('deptID') $staffs = VwStaff::orderby('deptID')
->where('deptID','!=', 8) ->where('deptID','!=', 8)
->get(); ->get();
// dd($nonchargeproject);
$year = date('Y'); $year = date('Y');
if ($request->year) { if ($request->year) {
...@@ -75,7 +90,7 @@ class ReportController extends Controller ...@@ -75,7 +90,7 @@ class ReportController extends Controller
$month = date('F', mktime(0,0,0,$request->month, 1, date('Y'))); $month = date('F', mktime(0,0,0,$request->month, 1, date('Y')));
return view('timesheet::report.ringkasan', compact('month', 'year','ringkasan', 'chargeproject', 'nonchargeproject', 'staffs')); return view('timesheet::report.ringkasan', compact('month', 'year','ringkasan', 'chargeproject', 'nonchargeproject', 'staffs', 'projectnc', 'overhead', 'ovhours'));
} }
public function projectreport() public function projectreport()
...@@ -150,6 +165,7 @@ class ReportController extends Controller ...@@ -150,6 +165,7 @@ class ReportController extends Controller
->where('year', $request->year) ->where('year', $request->year)
->get(); ->get();
$overhead = VwOverhead::where('deptid', $request->dept) $overhead = VwOverhead::where('deptid', $request->dept)
->where('month', $request->month) ->where('month', $request->month)
->where('year', $request->year) ->where('year', $request->year)
......
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwNonchargeSummary extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_noncharge_summary';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwOverheadSummary extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_overhead_hours_summary';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
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