From b5f6ad523e77cde586c8612742d429e951bd5e6f Mon Sep 17 00:00:00 2001 From: Lukas Halbritter Date: Sun, 27 Jan 2019 10:24:21 +0100 Subject: [PATCH] Added routes for reports. Added project reports. --- app/Http/Controllers/ReportsController.php | 76 ++++++++++++++++++ resources/views/projects/.index.blade.php.swo | Bin 0 -> 24576 bytes resources/views/projects/index.blade.php | 69 ++++++++++++++-- resources/views/reports/project.blade.php | 58 +++++++++++++ routes/web.php | 9 +++ 5 files changed, 206 insertions(+), 6 deletions(-) create mode 100644 app/Http/Controllers/ReportsController.php create mode 100644 resources/views/projects/.index.blade.php.swo create mode 100644 resources/views/reports/project.blade.php 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 0000000000000000000000000000000000000000..daea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L7$3K_BsA4c$;uc1GF+((? zGuyq@ZW|3l z@0c-`QxbBHl?v{|>>6I;UeLJE8fC0-erBtEDHxFgj7Zcjuav|2ayGWAr{|%VK?*elEANc3x-2Vvp5)6UeK<2p>&_)W70;B*b zKnjooqyQ;E3XlS%04YEUTnh@+&+)IE6X#0TE$9C`;p5&ZC;piK2l4%%W1hbgtOpC^ zoF9AxAN~;F;4Ux`9EA`6BjAC@K^I7ZSzsLa3qJj$;1%!!*akGP3Uq*3U^4g{KK{Mn zeIUSMa2EdlAHfc=9LxZ}!N>nG*a239PVguE`d@&Tzy{C>&ce6{wL z4}t8jhkkDaJzxn~049S&@aOLbd%*KxBUl2agA4HMp8`YR4e$h*3x0)<|7%bH(!XD9 z;N!2Xyw!e2D@WusyT+YnfsdTr`Q*-z%mBIb(~%g}-@>)<>XXs;I?r5HkOGUc)qL|^ za}OTe=V``&$}#5$Uo>cX^q3e$Tt}la8b@?VmFfhojRIISEW&i(N%$H@%yqy0p^cQgA{Qujq2C&p$54a8cbC~}h0dh@X zJJ<|zU=El9e!%>H7g!4xf#aCxzYQ$V1*U=HnCB0HL9hzU1}8Dk-wy`CTCfD1!94#U zcok@1DHsQ2yEP!=`e`EtNC8rS6d(miff@yr*llcc-{4)DvAstYTXEGpDx;ZoUtG;2 zy}>rd!6S{vX*AyGhuCO-GVJ|@k>1m6RLB^Ar?j?2YfFLAm2bDw3#8>2Qk%Sw5J*(c NcctG=xT-IZ{sSm2lB@s# literal 0 HcmV?d00001 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...