Commit ea6d844d by hannan

changes in project report

parent 398b0d85
@extends('ui::layouts.app')
@section('content')
<div class="ui segment">
<a class="ui green left ribbon label">Report by Department</a>
<br><br>
<form class="ui form" action="{{ route('timesheet::report.generatedeptreport') }}" method="POST">
{{csrf_field()}}
<div class="five wide field">
<label>Department</label>
<select name="dept" class="ui fluid dropdown" required="required">
@foreach($dept as $key => $value)
<option value="{{data_get($value,'id')}}">{{data_get($value,'code')}} | {{data_get($value,'description')}}</option>
@endforeach
</select>
</div>
<div class="two fields">
<div class="three wide field">
<label>Year</label>
<select name="year" class="ui fluid dropdown" required="required">
@foreach($year as $key => $value)
<option value="{{ data_get($value,'tm_year') }}">{{ data_get($value,'tm_year') }}</option>
@endforeach
</select>
</div>
<div class="three wide field">
<label>Month</label>
<select name="month" class="ui fluid dropdown" required="required">
@foreach($month as $key => $value)
<option value="{{ $key+1 }}">{{ $value }}</option>
@endforeach
</select>
</div>
</div>
<button class="ui olive button" type="submit">Generate Report</button>
</form>
</div>
@endsection
\ No newline at end of file
...@@ -14,22 +14,48 @@ ...@@ -14,22 +14,48 @@
<table class="ui unstackable celled table"> <table class="ui unstackable celled table">
<thead> <thead>
<tr> <tr>
<th>TIMESHEET {{$month}} {{$year}} by Project</th> <th colspan="4">TIMESHEET {{$month}} {{$year}} by Project</th>
</tr> </tr>
<tr> <tr>
<th>Project: </th> <th colspan="4">Project: {{data_get($pdetail,'pname')}}</th>
<th></th> </tr>
</thead>
</table>
<table class="ui unstackable celled table">
<thead>
<tr>
<th style="width: 45%">staff name</th>
<th style="width: 25%" class="center aligned">role</th>
<th style="width: 15%" class="center aligned">total hours</th>
<th style="width: 15%" class="center aligned">total days</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php $totalhours = $totaldays = 0; ?>
@foreach($pteam as $key => $team)
<tr> <tr>
<td>aiaya</td> <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>
</tr> </tr>
<?php
$totalhours += data_get($team,'hours');
$totaldays += number_format(data_get($team,'hours')/8, 1, '.', '');
?>
@endforeach
</tbody> </tbody>
<tfoot class="full-width">
<tr>
<th style="width: 40%"><strong>Total</strong></th>
<th style="width: 30%"></th>
<th style="width: 15%" class="center aligned"><strong>{{$totalhours}}</strong></th>
<th style="width: 15%" class="center aligned"><strong>{{$totaldays}}</strong></th>
</tr>
</tfoot>
</table> </table>
</div> </div>
</div> </div>
</div> </div>
@endsection @endsection
......
...@@ -22,6 +22,7 @@ use Portal\Timesheet\Model\VwRingkasanLaporan; ...@@ -22,6 +22,7 @@ use Portal\Timesheet\Model\VwRingkasanLaporan;
use Portal\Timesheet\Model\VwChargeable; use Portal\Timesheet\Model\VwChargeable;
use Portal\Timesheet\Model\VwNonChargeable; use Portal\Timesheet\Model\VwNonChargeable;
use Portal\Timesheet\Model\VwStaff; use Portal\Timesheet\Model\VwStaff;
use Portal\Timesheet\Model\VwProject;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input; use Illuminate\Support\Facades\Input;
use File; use File;
...@@ -58,9 +59,12 @@ class ReportController extends Controller ...@@ -58,9 +59,12 @@ class ReportController extends Controller
$ringkasan = VwRingkasanLaporan::where('month', $request->month) $ringkasan = VwRingkasanLaporan::where('month', $request->month)
->where('year', $request->year) ->where('year', $request->year)
->get(); ->get();
$chargeproject = VwChargeable::all(); $chargeproject = VwChargeable::all();
$nonchargeproject = VwNonChargeable::all(); $nonchargeproject = VwNonChargeable::all();
$staffs = VwStaff::orderby('deptID')->get(); $staffs = VwStaff::orderby('deptID')
->where('deptID','!=', 8)
->get();
// dd($nonchargeproject); // dd($nonchargeproject);
$year = date('Y'); $year = date('Y');
...@@ -94,8 +98,42 @@ class ReportController extends Controller ...@@ -94,8 +98,42 @@ class ReportController extends Controller
public function generateprojectreport(Request $request) public function generateprojectreport(Request $request)
{ {
$pdetail = VwProject::where('pid', $request->project)->first();
$pteam = VwProject::where('pid', $request->project)->orderby('roleid')->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.project', compact('month', 'year', 'pteam', 'pdetail'));
}
public function deptreport()
{
$dept = Department::all()
->except([8]);
$month = [];
for ($m=1; $m<=12; $m++) {
$month[] = date('F', mktime(0,0,0,$m, 1, date('Y')));
}
$year = Ts_master::select('tm_year')
->distinct('tm_year')
->orderby('tm_year','DESC')
->get();
return view('timesheet::report.deptReport', compact('month', 'year', 'dept'));
}
public function generatedeptreport(Request $request)
{
dd($request); dd($request);
return view('timesheet::report.project'); return view('timesheet::report.department');
} }
} }
\ No newline at end of file
<?php
namespace Portal\Timesheet\Model;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class VwProject extends Model
{
use Notifiable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'vw_project_report';
/**
* undocumented function
*
* @return void
* @author
**/
public function info()
{
}
}
...@@ -100,11 +100,11 @@ class ServiceProvider extends BaseServiceProvider ...@@ -100,11 +100,11 @@ class ServiceProvider extends BaseServiceProvider
->data('icon', 'file alternate outline icon') ->data('icon', 'file alternate outline icon')
->active('pengurusan/*') ->active('pengurusan/*')
->data('permission', Permission::laporan); ->data('permission', Permission::laporan);
$laporan->add(__('Report by Project')) $laporan->add(__('Report by Project'), route('timesheet::report.projectReport'))
->data('icon', 'file alternate outline icon') ->data('icon', 'file alternate outline icon')
->active('pengurusan/*') ->active('pengurusan/*')
->data('permission', Permission::laporan); ->data('permission', Permission::laporan);
$laporan->add(__('Report by Department'), route('timesheet::report.projectReport')) $laporan->add(__('Report by Department'), route('timesheet::report.deptreport'))
->data('icon', 'file alternate outline icon') ->data('icon', 'file alternate outline icon')
->active('pengurusan/*') ->active('pengurusan/*')
->data('permission', Permission::laporan); ->data('permission', Permission::laporan);
......
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