diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php new file mode 100644 index 0000000..c4285ed --- /dev/null +++ b/app/Http/Controllers/ReportsController.php @@ -0,0 +1,76 @@ +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() + { + // + } +} diff --git a/resources/views/projects/.index.blade.php.swo b/resources/views/projects/.index.blade.php.swo new file mode 100644 index 0000000..daea056 Binary files /dev/null and b/resources/views/projects/.index.blade.php.swo differ diff --git a/resources/views/projects/index.blade.php b/resources/views/projects/index.blade.php index fdd1970..335ef0d 100644 --- a/resources/views/projects/index.blade.php +++ b/resources/views/projects/index.blade.php @@ -28,8 +28,27 @@ {{ formatDate($project->end_date) }}
- - + + + + + + + + +
@@ -52,8 +71,27 @@ {{ formatDate($project->end_date) }}
- - + + + + + + + + +
@@ -76,8 +114,27 @@ {{ formatDate($project->end_date) }}
- - + + + + + + + + +
diff --git a/resources/views/reports/project.blade.php b/resources/views/reports/project.blade.php new file mode 100644 index 0000000..de65d4e --- /dev/null +++ b/resources/views/reports/project.blade.php @@ -0,0 +1,58 @@ +@extends('layout.master') + +@section('title', 'Projektbericht ' . $project->name) + +@section('subnav') + Zurück +@endsection + +@section('content') +

@yield('title')

+ + + + + + + + + @foreach($projectBookings as $subBooking) + + + + + + + + @endforeach + + + + + + + + + + + + + + +
DatumBuchungstextPerson / FirmaAusgang (S)Eingang (H)
{{ formatDate($subBooking->date()) }}{{ $subBooking->reference }}{{ $subBooking->personOrCompany() }} + @if($subBooking->ioType()->factor < 0) + {!! formatAmount($subBooking->signedAmount()) !!} + @endif + + @if($subBooking->ioType()->factor > 0) + {!! formatAmount($subBooking->signedAmount()) !!} + @endif +
Abschluss + {!! formatAmount(- $expeditures) !!} + + {!! formatAmount($incomes) !!} +
Saldo + {!! formatAmount($incomes - $expeditures) !!} + +
+@endsection diff --git a/routes/web.php b/routes/web.php index 5e887a2..bf95fec 100644 --- a/routes/web.php +++ b/routes/web.php @@ -29,6 +29,7 @@ Route::middleware(['auth'])->group(function() { /************************************************************************** * BOOKINGS * **************************************************************************/ + Route::get('/bookings', function() { return redirect('bookings/year-' . date('Y')); }); Route::get('/bookings/year-{year}', 'BookingsController@index'); 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}/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...