Added routes for reports. Added project reports.
This commit is contained in:
@@ -0,0 +1,76 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Project;
|
||||||
|
use App\SubBooking;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
|
class ReportsController extends Controller
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Display the port of a project.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function project(Project $project)
|
||||||
|
{
|
||||||
|
$id = $project->id;
|
||||||
|
|
||||||
|
$projectBookings =
|
||||||
|
SubBooking::select('id', 'account_type_id', 'reference', 'amount',
|
||||||
|
'booking_id')
|
||||||
|
->whereHas('project', function($query) use ($id) {
|
||||||
|
return $query->whereId($id);
|
||||||
|
})
|
||||||
|
->with('accountType:id,name,account_class_id',
|
||||||
|
'accountType.accountClass:id,io_type_id,name,scope_id',
|
||||||
|
'accountType.accountClass.scope:id,name',
|
||||||
|
'accountType.accountClass.ioType:id,name,factor',
|
||||||
|
'booking:id,date,person_or_company')
|
||||||
|
->get()
|
||||||
|
->sortBy('booking.date');
|
||||||
|
|
||||||
|
$incomes = $projectBookings
|
||||||
|
->where('accountType.accountClass.ioType.factor', '>', 0)
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
$expeditures = $projectBookings
|
||||||
|
->where('accountType.accountClass.ioType.factor', '<', 0)
|
||||||
|
->sum('amount');
|
||||||
|
|
||||||
|
return view('reports.project', compact('project', 'projectBookings',
|
||||||
|
'incomes', 'expeditures'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the monthly balances during a year.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function balances($year)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display the bookings sorted by scopes.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function scopes($type, $year)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a list of all open targets.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Http\Response
|
||||||
|
*/
|
||||||
|
public function targets()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -28,8 +28,27 @@
|
|||||||
<td>{{ formatDate($project->end_date) }}</td>
|
<td>{{ formatDate($project->end_date) }}</td>
|
||||||
<td width="1">
|
<td width="1">
|
||||||
<div class="btn-group" role="group" aria-label="Basic example">
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
<a href='/projects/{{ $project->id }}/edit' class="btn btn-success"><i class="fas fa-edit"></i></a>
|
<a href='/projects/{{ $project->id }}/edit'
|
||||||
<a href='/projects/{{ $project->id }}/delete' class="btn btn-danger"><i class="fas fa-trash"></i></a>
|
class="btn btn-success"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Bearbeiten">
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a href='/reports/projects/{{ $project->id }}'
|
||||||
|
class="btn btn-warning"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Bericht">
|
||||||
|
<i class="fas fa-chart-line"></i>
|
||||||
|
</a>
|
||||||
|
<a href='/projects/{{ $project->id }}/delete'
|
||||||
|
class="btn btn-danger"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Löschen">
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -52,8 +71,27 @@
|
|||||||
<td>{{ formatDate($project->end_date) }}</td>
|
<td>{{ formatDate($project->end_date) }}</td>
|
||||||
<td width="1">
|
<td width="1">
|
||||||
<div class="btn-group" role="group" aria-label="Basic example">
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
<a href='/projects/{{ $project->id }}/edit' class="btn btn-success"><i class="fas fa-edit"></i></a>
|
<a href='/projects/{{ $project->id }}/edit'
|
||||||
<a href='/projects/{{ $project->id }}/delete' class="btn btn-danger"><i class="fas fa-trash"></i></a>
|
class="btn btn-success"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Bearbeiten">
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a href='/reports/projects/{{ $project->id }}'
|
||||||
|
class="btn btn-warning"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Bericht">
|
||||||
|
<i class="fas fa-chart-line"></i>
|
||||||
|
</a>
|
||||||
|
<a href='/projects/{{ $project->id }}/delete'
|
||||||
|
class="btn btn-danger"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Löschen">
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -76,8 +114,27 @@
|
|||||||
<td>{{ formatDate($project->end_date) }}</td>
|
<td>{{ formatDate($project->end_date) }}</td>
|
||||||
<td width="1">
|
<td width="1">
|
||||||
<div class="btn-group" role="group" aria-label="Basic example">
|
<div class="btn-group" role="group" aria-label="Basic example">
|
||||||
<a href='/projects/{{ $project->id }}/edit' class="btn btn-success"><i class="fas fa-edit"></i></a>
|
<a href='/projects/{{ $project->id }}/edit'
|
||||||
<a href='/projects/{{ $project->id }}/delete' class="btn btn-danger"><i class="fas fa-trash"></i></a>
|
class="btn btn-success"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Bearbeiten">
|
||||||
|
<i class="fas fa-edit"></i>
|
||||||
|
</a>
|
||||||
|
<a href='/reports/projects/{{ $project->id }}'
|
||||||
|
class="btn btn-warning"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Bericht">
|
||||||
|
<i class="fas fa-chart-line"></i>
|
||||||
|
</a>
|
||||||
|
<a href='/projects/{{ $project->id }}/delete'
|
||||||
|
class="btn btn-danger"
|
||||||
|
data-toggle="tooltip"
|
||||||
|
data-placement="bottom"
|
||||||
|
title="Löschen">
|
||||||
|
<i class="fas fa-trash"></i>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
@extends('layout.master')
|
||||||
|
|
||||||
|
@section('title', 'Projektbericht ' . $project->name)
|
||||||
|
|
||||||
|
@section('subnav')
|
||||||
|
<a class='btn btn-outline-secondary' href='/projects'>Zurück</a>
|
||||||
|
@endsection
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<h2>@yield('title')</h2>
|
||||||
|
<table class='table table-striped table-bordered'>
|
||||||
|
<tr>
|
||||||
|
<th>Datum</th>
|
||||||
|
<th>Buchungstext</th>
|
||||||
|
<th>Person / Firma</th>
|
||||||
|
<th>Ausgang (S)</th>
|
||||||
|
<th>Eingang (H)</th>
|
||||||
|
</tr>
|
||||||
|
@foreach($projectBookings as $subBooking)
|
||||||
|
<tr>
|
||||||
|
<td>{{ formatDate($subBooking->date()) }}</td>
|
||||||
|
<td>{{ $subBooking->reference }}</td>
|
||||||
|
<td>{{ $subBooking->personOrCompany() }}</td>
|
||||||
|
<td>
|
||||||
|
@if($subBooking->ioType()->factor < 0)
|
||||||
|
{!! formatAmount($subBooking->signedAmount()) !!}
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if($subBooking->ioType()->factor > 0)
|
||||||
|
{!! formatAmount($subBooking->signedAmount()) !!}
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
<tr style='font-weight: bold'>
|
||||||
|
<td></td>
|
||||||
|
<td>Abschluss</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
{!! formatAmount(- $expeditures) !!}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{!! formatAmount($incomes) !!}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr style='font-weight: bold'>
|
||||||
|
<td></td>
|
||||||
|
<td>Saldo</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
{!! formatAmount($incomes - $expeditures) !!}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
@endsection
|
||||||
@@ -29,6 +29,7 @@ Route::middleware(['auth'])->group(function() {
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* BOOKINGS *
|
* BOOKINGS *
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
Route::get('/bookings', function() { return redirect('bookings/year-' . date('Y')); });
|
||||||
Route::get('/bookings/year-{year}', 'BookingsController@index');
|
Route::get('/bookings/year-{year}', 'BookingsController@index');
|
||||||
Route::post('/bookings', 'BookingsController@store');
|
Route::post('/bookings', 'BookingsController@store');
|
||||||
|
|
||||||
@@ -64,6 +65,14 @@ Route::middleware(['auth'])->group(function() {
|
|||||||
|
|
||||||
Route::get('/targets/{personTarget}/edit', 'PersonTargetsController@edit');
|
Route::get('/targets/{personTarget}/edit', 'PersonTargetsController@edit');
|
||||||
Route::get('/targets/{personTarget}/delete', 'PersonTargetsController@delete');
|
Route::get('/targets/{personTarget}/delete', 'PersonTargetsController@delete');
|
||||||
|
|
||||||
|
/**************************************************************************
|
||||||
|
* REPORTS *
|
||||||
|
**************************************************************************/
|
||||||
|
Route::get('/reports/projects/{project}', 'ReportsController@project');
|
||||||
|
Route::get('/reports/balances/{year}', 'ReportsController@balances');
|
||||||
|
Route::get('/reports/scopes/{type}/{year}', 'ReportsController@scopes');
|
||||||
|
Route::get('/reports/targets/', 'ReportsController@targets');
|
||||||
});
|
});
|
||||||
|
|
||||||
// Authentication Routes...
|
// Authentication Routes...
|
||||||
|
|||||||
Reference in New Issue
Block a user