Commit 9e777547 by Azhan Hannan

report ringkasan & report project changes

parent 933f0e6d
<table> <table class="ui unstackable celled table">
<thead> <thead>
<tr> <tr>
<th>Project </th> <th style="width: 10%">Project </th>
<th>:</th> <th style="width: 1%">:</th>
<th colspan="3"> {{data_get($pdetail,'pcode')}} - {{data_get($pdetail,'pname')}}</th> <th colspan="2"> {{data_get($pdetail,'pcode')}} - {{data_get($pdetail,'pname')}}</th>
</tr> </tr>
<tr> <tr>
<th> Month/Year</th> <th style="width: 10%"> Month/Year</th>
<th>:</th> <th style="width: 1%">:</th>
<th colspan="3"> {{$month}} {{$year}}</th> <th colspan="2"> {{$month}} {{$year}}</th>
</tr> </tr>
</thead> </thead>
</table> </table>
<table>
<thead> <table class="ui unstackable celled table">
<tr> <thead>
<th>Staff Name</th> <tr>
<th>Role</th> <th style="width: 10%" class="center aligned" rowspan="2">role</th>
<th>Total Hours</th> <th style="width: 10%" class="center aligned" rowspan="2">allocation</th>
<th>Total Days</th> <th style="width: 10%" class="center aligned" rowspan="2">total accumulate</th>
</tr> <th style="width: 15%" class="center aligned" rowspan="2">staff name</th>
</thead> <th style="width: 20%" class="center aligned" colspan="2">Mandays</th>
<tbody> <th style="width: 10%" class="center aligned" rowspan="2">balance</th>
<?php $totalhours = $totaldays = 0; ?> </tr>
@foreach($pteam as $key => $team) <tr>
<tr> <th style="width: 15%" class="center aligned">total hours</th>
<td>{{data_get($team,'name')}}</td> <th style="width: 15%" class="center aligned">total days</th>
<td>{{data_get($team,'role')}}</td> </tr>
<td> </thead>
<?php $sumhours = 0; ?> <tbody>
@foreach($ptdetail as $key => $hours) <?php
@if(data_get($hours,'staffid') == data_get($team,'staffid')) $pteam = [];
<?php $sumhours += data_get($hours,'hours'); ?> ?>
<?php $totalhours += data_get($hours,'hours'); ?> @foreach($roles as $key => $role)
@endif <?php
@endforeach $pteam = $pteams->where('role_id', data_get($role,'pm_roles'));
@if($sumhours == 0) ?>
@else <tr>
{{$sumhours}} <td rowspan="{{count($pteam)+1}}">{{data_get($role,'role.role')}}</td>
@endif <td rowspan="{{count($pteam)+1}}">{{data_get($role,'pm_hours')}} Hours <br> {{data_get($role,'pm_days')}} Days
</td> </td>
<td> <td rowspan="{{count($pteam)+1}}">
<?php $sumdays = 0; ?> <?php
@foreach($ptdetail as $key => $hours) $accumulatehours = 0;
@if(data_get($hours,'staffid') == data_get($team,'staffid')) $staffaccumulateshours = $accumulates->where('tp_roles', data_get($role,'pm_roles'));
<!-- {{number_format(data_get($hours,'hours')/8, 1, '.', '')}} --> foreach ($staffaccumulateshours as $key => $accumulateshours) {
<?php $sumdays += number_format(data_get($hours,'hours')/8, 1, '.', ''); ?> $accumulatehours += data_get($accumulateshours,'tp_hours');
<?php $totaldays += number_format(data_get($hours,'hours')/8, 1, '.', ''); ?> }
@endif ?>
@endforeach {{ number_format($accumulatehours, 1, '.', '') }} Hours <br>
@if($sumdays == 0) {{ number_format($accumulatehours/8, 1, '.', '') }} Days
@else </td>
{{$sumdays}} </tr>
@endif <?php $count = 0; ?>
</td> @foreach($pteam as $key => $team)
</tr> <tr>
@endforeach <td>{{data_get($team,'pt_team')}}</td>
</tbody> <td class="center aligned">
<tfoot> <?php
<tr> $currhour = 0;
<th><strong>Total</strong></th> $currmonthhours = $currentmonthhours->where('staffid', data_get($team,'pt_staff_id'));
<th></th> foreach ($currmonthhours as $key => $hours) {
<th><strong>{{$totalhours}} / {{data_get($pdetail,'mandays.p_total_hours')}}</strong></th> $currhour = data_get($hours,'tp_hours');
<th><strong>{{$totaldays}} / {{data_get($pdetail,'mandays.p_total_days')}}</strong></th> }
</tr> ?>
</tfoot> {{ number_format($currhour, '1', '.', '') }} Hours
</td>
<td class="center aligned">
{{ number_format($currhour/8, '1', '.', '') }} Days
</td>
@if($count == 0)
<td rowspan="{{count($pteam)}}" class="center aligned">
<?php
$balancehours = data_get($role,'pm_hours') - $accumulatehours;
?>
{{ number_format($balancehours, '1', '.', '') }} Hours <br>
{{ number_format($balancehours/8, '1', '.', '') }} Days
</td>
@else
@endif
<?php
$count++;
?>
</tr>
@endforeach
@endforeach
</tbody>
</table> </table>
\ No newline at end of file
<table class="ui unstackable celled table">
<thead>
<tr>
<th></th>
<th style="width: 10%"> Month/Year</th>
<th style="width: 1%">:</th>
<th style="width: 89%"> {{ $month}} {{ $year }}</th>
</tr>
</thead>
</table>
<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> @if(count($chargeprojects) > 0)
<th colspan="{{count($overhead)+3}}" class="center aligned">Non-Chargeable</th> <th colspan="{{count($chargeprojects)+2}}" class="center aligned">Chargeable</th>
<th rowspan="2" class="center aligned">Total (Working Days)</th> @endif
</tr> <th colspan="{{count($overhead)+2}}" class="center aligned">Overhead</th>
<tr> <th rowspan="2" class="center aligned">Total (Working Days)</th>
<th>No</th> </tr>
<th>Department</th> <tr>
<th>Staff Id</th> <th>No</th>
<th>Staff Name</th> <th>Department</th>
<th>Position</th> <th>Staff Id</th>
@foreach($chargeproject as $key => $chargeable) <th>Staff Name</th>
<th> @if(count($chargeprojects) > 0)
{{data_get($chargeable, 'p_project_code')}} @foreach($chargeprojects as $key => $chargeable)
</th> <th>
@endforeach {{data_get($chargeable, 'project.p_project_code')}}
<th>Total Hours</th> </th>
<th>Total Days</th> @endforeach
<th class="center aligned">Project</th> <th>Total Hours</th>
@foreach($overhead as $key => $value) <th>Total Days</th>
<th>{{data_get($value,'o_overhead_desc')}}</th> @endif
@endforeach @foreach($overhead as $key => $value)
<th>Total Hours</th> <th class="center aligned">
<th>Total Days</th> {{ data_get($value,'o_overhead_desc') }}
</tr> </th>
</thead>
<?php $totaldays = $totalalldays = 0; ?>
@foreach($staffs as $key => $staff)
<tbody>
<tr>
<td>{{$key+1}}</td>
<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>
<?php $monthly_hours = 0; ?>
@foreach($ringkasan as $key => $value)
@if(data_get($value,'staffid') == data_get($staff,'staffid') && data_get($chargeable,'id') == data_get($value,'c_pid'))
<!-- {{data_get($value,'total_c_hours')}} -->
<?php $monthly_hours += data_get($value,'total_c_hours'); ?>
<?php $totalc += data_get($value,'total_c_hours'); ?>
@endif
@endforeach @endforeach
@if($monthly_hours == 0) <th>Total Hours</th>
@else <th>Total Days</th>
{{$monthly_hours}} </tr>
@endif </thead>
</td>
@endforeach <?php $totaldays = $totalalldays = 0; ?>
<td class="center aligned">{{$totalc}}</td> @foreach($staffs as $key => $staff)
<td class="center aligned">{{number_format($totalc/8, 1, '.', '')}}</td> <tbody>
<?php $totalnc = 0; ?> <tr>
@foreach($overhead as $key => $value) <td>{{$key+1}}</td>
<td> <td>{{data_get($staff,'deptCode')}}</td>
<?php $monthly_hours = 0; ?> <td>{{data_get($staff,'staffid')}}</td>
@foreach($ovhours as $key => $hours) <td class="single line">{{data_get($staff,'name')}}</td>
@if(data_get($staff,'staffid') == data_get($hours,'staffid') && data_get($value,'id') == data_get($hours,'oid')) <?php
<!-- {{data_get($hours,'hours')}} --> $totalc = 0;
<?php $monthly_hours += data_get($hours,'hours') ?> $chargehour = $chargehours->where('staffid', data_get($staff,'staffid'));
<?php $totalnc += data_get($hours,'hours'); ?> ?>
@endif @if(count($chargeprojects) > 0)
@endforeach @foreach($chargeprojects as $key => $chargeable)
@if($monthly_hours == 0) <td class="center aligned">
@else <?php
{{$monthly_hours}} $monthly_hours = 0;
@endif $projecthour = $chargehour->where('td_project', data_get($chargeable,'td_project'));
</td> ?>
@endforeach
<td class="center aligned">{{$totalnc}}</td> @foreach($projecthour as $key => $value)
<td class="center aligned">{{number_format($totalnc/8, 1, '.', '')}}</td> <?php
<?php $totaldays = number_format($totalc/8, 1, '.', '') + number_format($totalnc/8, 1, '.', ''); ?> $monthly_hours += data_get($value,'tp_hours');
<td>{{$totaldays}}</td> $totalc += data_get($value,'tp_hours');
</tr> ?>
</tbody> @endforeach
<?php $totalalldays += $totaldays; ?> @if($monthly_hours == 0)
@endforeach @else
<tfoot> {{ number_format($monthly_hours, '1', '.', '') }}
<tr> @endif
<th colspan="5" class="center aligned"> </td>
<strong>Total</strong> @endforeach
</th> <td class="center aligned">{{ number_format($totalc, '1', '.', '') }}</td>
<th colspan="{{count($chargeproject)+2+count($overhead)+3}}"></th> <td class="center aligned">{{ number_format($totalc/8, 1, '.', '') }}</td>
<th><strong>{{$totalalldays}}</strong></th> @endif
</tr>
</tfoot> <?php $totalnc = 0; ?>
@foreach($overhead as $key => $value)
<td class="center aligned">
<?php $monthly_hours = 0; ?>
@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 $monthly_hours += data_get($hours,'hours') ?>
<!-- <?php $totalnc += data_get($hours,'hours'); ?> -->
@endif
@endforeach
@if($monthly_hours == 0)
@else
{{ number_format($monthly_hours, '1', '.', '') }}
@endif
</td>
@endforeach
<td class="center aligned">{{ number_format($totalnc, '1', '.', '') }}</td>
<td class="center aligned">{{ number_format($totalnc/8, 1, '.', '') }}</td>
<?php $totaldays = number_format($totalc/8, 1, '.', '') + number_format($totalnc/8, 1, '.', ''); ?>
<td class="center aligned">{{ number_format($totaldays, '1', '.', '') }}</td>
</tr>
</tbody>
<?php $totalalldays += $totaldays; ?>
@endforeach
<tfoot>
<tr>
<th colspan="4" class="center aligned">
<strong>Total</strong>
</th>
<?php $tch = 0; ?>
@if(count($chargeprojects) > 0)
@foreach($chargeprojects as $key => $value)
<?php
$projecthours = $chargehours->where('td_project', data_get($value,'td_project'));
$monthly_hours = 0;
?>
<th class="center aligned">
@foreach($projecthours as $key => $project)
<?php
$monthly_hours += data_get($project,'tp_hours');
?>
@endforeach
{{ number_format($monthly_hours, '1', '.', '') }}
</th>
<?php $tch += $monthly_hours; ?>
@endforeach
<th class="text-center">{{ number_format($tch, '1', '.', '') }}</th>
<th class="text-center">{{ number_format($tch/8, 1, '.', '') }}</th>
@endif
<?php $totaloverhead = 0; ?>
@foreach($overhead as $key => $value)
<?php
$monthly_ov = 0;
$oid = data_get($value,'id');
$ov = $ovhours->where('oid', $oid);
foreach ($ov as $key => $val) {
$monthly_ov += data_get($val,'hours');
}
?>
<th class="center aligned">{{ number_format($monthly_ov, '1', '.', '') }}</th>
<?php $totaloverhead += $monthly_ov; ?>
@endforeach
<th class="text-center">{{ number_format($totaloverhead, '1', '.', '') }}</th>
<th class="text-center">{{ number_format($totaloverhead/8, 1, '.', '') }}</th>
<th class="center aligned"><strong>{{ number_format($totalalldays, '1', '.', '') }}</strong></th>
</tr>
</tfoot>
</table> </table>
\ No newline at end of file
...@@ -6,8 +6,7 @@ ...@@ -6,8 +6,7 @@
<div class="ui purple left ribbon label"> <div class="ui purple left ribbon label">
Report Summary Report Summary
</div> </div>
<button class="floated center aligned ui violet compact labeled icon button" onclick="window.location.href='{{ route('timesheet::export.exportsummary', ['month'=> $intmonth, 'year'=> $year, 'dept'=> $dept]) }}';">
<button class="floated center aligned ui violet compact labeled icon button" onclick="window.location.href='{{ route('timesheet::export.exportsummary', ['month'=> $intmonth, 'year'=> $year]) }}';">
<i class="file excel outline icon"></i> <i class="file excel outline icon"></i>
Export to Excel Export to Excel
</button> </button>
......
...@@ -52,9 +52,9 @@ class ExportController extends Controller ...@@ -52,9 +52,9 @@ class ExportController extends Controller
return (new RingkasanExport( return (new RingkasanExport(
[ [
'dept' => $request->dept,
'month' => $request->month, 'month' => $request->month,
'year' => $request->year 'year' => $request->year
]))->download('Report Summary '.$month.' '.$year.'.xlsx'); ]))->download('Report Summary '.$month.' '.$year.'.xlsx');
...@@ -62,8 +62,6 @@ class ExportController extends Controller ...@@ -62,8 +62,6 @@ class ExportController extends Controller
public function exportproject(Request $request) public function exportproject(Request $request)
{ {
// dd($request);
$month = date('F', mktime(0,0,0,$request->month, 1, date('Y'))); $month = date('F', mktime(0,0,0,$request->month, 1, date('Y')));
$year = strval($request->year); $year = strval($request->year);
$pdetail = VwProject::where('pid', $request->pid) $pdetail = VwProject::where('pid', $request->pid)
......
...@@ -65,6 +65,8 @@ class ReportController extends Controller ...@@ -65,6 +65,8 @@ class ReportController extends Controller
public function generateRingkasan(Request $request) public function generateRingkasan(Request $request)
{ {
// dd($request);
$dept = $request->dept;
$ringkasan = VwRingkasanLaporan::where('month', $request->month) $ringkasan = VwRingkasanLaporan::where('month', $request->month)
->where('year', $request->year) ->where('year', $request->year)
->where('status', 4) ->where('status', 4)
...@@ -135,7 +137,7 @@ class ReportController extends Controller ...@@ -135,7 +137,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('intmonth','month', 'year','ringkasan', 'chargeproject', 'staffs', 'overhead', 'ovhours', 'chargeprojects', 'chargehours')); return view('timesheet::report.ringkasan', compact('intmonth','month', 'year','ringkasan', 'chargeproject', 'staffs', 'overhead', 'ovhours', 'chargeprojects', 'chargehours', 'dept'));
} }
public function projectreport() public function projectreport()
...@@ -293,6 +295,7 @@ class ReportController extends Controller ...@@ -293,6 +295,7 @@ class ReportController extends Controller
->where('tp_month', '<=', $request->month) ->where('tp_month', '<=', $request->month)
->orderby('tp_month', 'ASC') ->orderby('tp_month', 'ASC')
->get(); ->get();
$currentmonthhours = Tproject::where('td_project', $pid) $currentmonthhours = Tproject::where('td_project', $pid)
->where('tp_year', $request->year) ->where('tp_year', $request->year)
->where('tp_month', $request->month) ->where('tp_month', $request->month)
......
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