Commit 8f64b8d5 by hannan

changes in report department

parent ea6d844d
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<div class="ui purple left ribbon label">
Report by Department
</div>
<br>
<br>
<div class="ui styled fluid accordion">
<div class="title">
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 10%">Department </th>
<th style="width: 1%">:</th>
<th colspan="3"> {{data_get($dept,'description')}} </th>
</tr>
<tr>
<th style="width: 10%"> Month/Year</th>
<th style="width: 1%">:</th>
<th colspan="3"> {{$month}} {{$year}}</th>
</tr>
</thead>
</table>
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 35%">staff</th>
<th style="width: 5%"></th>
<th style="width: 15%" class="center aligned">project code / task</th>
<th style="width: 25%" class="center aligned">description</th>
<th style="width: 10%" class="center aligned">total hours</th>
<th style="width: 10%" class="center aligned">total days</th>
</tr>
</thead>
<?php $totalhours = $totaldays = $staffhours = $staffdays = 0; ?>
@foreach($staffs as $key => $staff)
<tbody>
<tr>
<td colspan="6">{{data_get($staff,'name')}}</td>
</tr>
<?php
$chargeproject = $project->where('ptype', 1);
$chargehours = $chargedays = 0;
?>
@foreach($chargeproject as $key => $chargeable)
@if(data_get($chargeable,'staffid') == data_get($staff,'staffid'))
<tr>
<td style="width: 35%"></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: 25%" class="center aligned">{{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>
</tr>
<?php
$chargehours += data_get($chargeable,'hours');
$chargedays += number_format(data_get($chargeable,'hours')/8, '1', '.', '');
?>
@endif
@endforeach
<?php
$nonchargeproject = $project->where('ptype', 2);
$nonchargehours = $nonchargedays = 0;
?>
@foreach($nonchargeproject as $key => $nonchargeable)
@if(data_get($nonchargeable,'staffid') == data_get($staff,'staffid'))
<tr>
<td style="width: 35%"></td>
<td style="width: 5%" class="center aligned">NC</td>
<td style="width: 15%" class="center aligned">{{data_get($nonchargeable,'pcode')}}</td>
<td style="width: 25%" class="center aligned">{{data_get($nonchargeable,'pname')}}</td>
<td style="width: 10%" class="center aligned">{{data_get($nonchargeable,'hours')}}</td>
<td style="width: 10%" class="center aligned">{{number_format(data_get($nonchargeable,'hours')/8, '1', '.', '')}}</td>
</tr>
<?php
$nonchargehours += data_get($nonchargeable,'hours');
$nonchargedays += number_format(data_get($nonchargeable,'hours')/8, '1', '.', '');
?>
@endif
@endforeach
<?php
$overheadhours = $overheaddays = 0;
?>
@foreach($overhead as $key => $value)
@if(data_get($value,'staffid') == data_get($staff,'staffid'))
<tr>
<td style="width: 35%"></td>
<td style="width: 5%" class="center aligned">NC</td>
<td style="width: 15%" class="center aligned"></td>
<td style="width: 25%" class="center aligned">{{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>
</tr>
<?php
$overheadhours += data_get($value,'hours');
$overheaddays += number_format(data_get($value,'hours')/8, '1', '.', '');
?>
@endif
@endforeach
<?php
$staffhours = $chargehours+$nonchargehours+$overheadhours;
$staffdays = $chargedays+$nonchargedays+$overheaddays;
?>
<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>
</tr>
</tbody>
<?php
$totalhours += $staffhours;
$totaldays += $staffdays;
?>
@endforeach
<tfoot class="full-width">
<tr>
<th colspan="3"><strong>Total hours by department</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>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
@endsection
@push('script')
@endpush
\ No newline at end of file
......@@ -14,10 +14,14 @@
<table class="ui unstackable celled table">
<thead>
<tr>
<th colspan="4">TIMESHEET {{$month}} {{$year}} by Project</th>
<th style="width: 10%">Project </th>
<th style="width: 1%">:</th>
<th colspan="3"> {{data_get($pdetail,'pcode')}} - {{data_get($pdetail,'pname')}}</th>
</tr>
<tr>
<th colspan="4">Project: {{data_get($pdetail,'pname')}}</th>
<th style="width: 10%"> Month/Year</th>
<th style="width: 1%">:</th>
<th colspan="3"> {{$month}} {{$year}}</th>
</tr>
</thead>
</table>
......@@ -36,13 +40,23 @@
<tr>
<td style="width: 40%">{{data_get($team,'name')}}</td>
<td style="width: 30%" class="center aligned">{{data_get($team,'role')}}</td>
<td style="width: 15%" class="center aligned">{{data_get($team,'hours')}}</td>
<td style="width: 15%" class="center aligned">{{number_format(data_get($team,'hours')/8, 1, '.', '')}}</td>
<td style="width: 15%" class="center aligned">
@foreach($ptdetail as $key => $hours)
@if(data_get($hours,'staffid') == data_get($team,'staffid'))
{{data_get($hours,'hours')}}
<?php $totalhours += data_get($hours,'hours'); ?>
@endif
@endforeach
</td>
<td style="width: 15%" class="center aligned">
@foreach($ptdetail as $key => $hours)
@if(data_get($hours,'staffid') == data_get($team,'staffid'))
{{number_format(data_get($hours,'hours')/8, 1, '.', '')}}
<?php $totaldays += number_format(data_get($hours,'hours')/8, 1, '.', ''); ?>
@endif
@endforeach
</td>
</tr>
<?php
$totalhours += data_get($team,'hours');
$totaldays += number_format(data_get($team,'hours')/8, 1, '.', '');
?>
@endforeach
</tbody>
<tfoot class="full-width">
......
......@@ -14,8 +14,14 @@
<table class="ui unstackable celled table">
<thead>
<tr>
<th colspan="{{count($chargeproject)+7}}"><b>TIMESHEET {{strtoupper($month)}} {{$year}}</b></th>
<th style="width: 10%"> Month/Year</th>
<th style="width: 1%">:</th>
<th> {{$month}} {{$year}}</th>
</tr>
</thead>
</table>
<table class="ui unstackable celled table">
<thead>
<tr>
<th colspan="5"></th>
<th colspan="{{count($chargeproject)}}" class="center aligned">Chargeable</th>
......
......@@ -22,6 +22,7 @@ use Portal\Timesheet\Model\VwRingkasanLaporan;
use Portal\Timesheet\Model\VwChargeable;
use Portal\Timesheet\Model\VwNonChargeable;
use Portal\Timesheet\Model\VwStaff;
use Portal\Timesheet\Model\VwOverhead;
use Portal\Timesheet\Model\VwProject;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
......@@ -98,8 +99,18 @@ class ReportController extends Controller
public function generateprojectreport(Request $request)
{
$pdetail = VwProject::where('pid', $request->project)->first();
$pteam = VwProject::where('pid', $request->project)->orderby('roleid')->get();
$pdetail = VwProject::where('pid', $request->project)
->first();
$pteam = VwProject::where('pid', $request->project)
->orderby('roleid')
->get();
$ptdetail = VwProject::where('pid', $request->project)
->where('MONTH', $request->month)
->where('year', $request->year)
->orderby('roleid')
->get();
$year = date('Y');
if ($request->year) {
......@@ -108,7 +119,7 @@ class ReportController extends Controller
$month = date('F', mktime(0,0,0,$request->month, 1, date('Y')));
return view('timesheet::report.project', compact('month', 'year', 'pteam', 'pdetail'));
return view('timesheet::report.project', compact('month', 'year', 'pteam', 'pdetail', 'ptdetail'));
}
public function deptreport()
......@@ -132,8 +143,25 @@ class ReportController extends Controller
public function generatedeptreport(Request $request)
{
dd($request);
$dept = Department::where('id', $request->dept)->first();
$staffs = VwStaff::where('deptID', $request->dept)->get();
$project = VwProject::where('deptid', $request->dept)
->where('month', $request->month)
->where('year', $request->year)
->get();
$overhead = VwOverhead::where('deptid', $request->dept)
->where('month', $request->month)
->where('year', $request->year)
->get();
$year = date('Y');
if ($request->year) {
$year = $request->year;
}
$month = date('F', mktime(0,0,0,$request->month, 1, date('Y')));
return view('timesheet::report.department');
return view('timesheet::report.department', compact('year', 'month', 'dept', 'staffs', 'project', 'overhead'));
}
}
\ No newline at end of file
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwOverhead extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_report_overhead';
/**
* 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