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 @@
| Datum | +Buchungstext | +Person / Firma | +Ausgang (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) !!} + | ++ | +