Implemented detailed account view.
This commit is contained in:
@@ -154,7 +154,34 @@ class ReportsController extends Controller
|
||||
return view('reports.scopes.compact', compact('scopes', 'year',
|
||||
'startBalance', 'endBalance'));
|
||||
} elseif ($type == 'detailed') {
|
||||
return view('reports.scopes.detailed');
|
||||
$yearFilter = function($query) use ($year) {
|
||||
$query->whereHas('booking', function($query) use ($year) {
|
||||
$query->whereYear('date', $year);
|
||||
});
|
||||
};
|
||||
|
||||
$scopes = Scope::select('id', 'name')
|
||||
->with([
|
||||
'accountClasses:id,io_type_id,scope_id,name',
|
||||
'accountClasses.ioType:id,factor',
|
||||
'accountClasses.accountTypes' => function($query) use ($year, $yearFilter) {
|
||||
return $query->select('id', 'account_class_id', 'name', 'number')
|
||||
->whereHas('subBookings', $yearFilter)
|
||||
->with(['subBookings' => $yearFilter,
|
||||
'subBookings.booking:id,person_or_company,date']);
|
||||
}
|
||||
])->get();
|
||||
|
||||
foreach ($scopes as $scope) {
|
||||
foreach ($scope->accountClasses as $accountClass) {
|
||||
$accountClass->amount =
|
||||
$accountClass->accountTypes->sum(function ($accountType) {
|
||||
return $accountType->subBookings->sum('amount');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return view('reports.scopes.detailed', compact('scopes', 'year'));
|
||||
} else {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
<a href='/reports/balances/{{ $year }}' class="btn btn-outline-warning">HS-Rechnung</a>
|
||||
<a href='/reports/scopes/compact/{{ $year }}' class="btn
|
||||
btn-outline-warning">Abrechnung</a>
|
||||
<a href='/reports/scopes/detailed/{{ $year }}' class="btn
|
||||
btn-outline-warning">Konten</a>
|
||||
</li>
|
||||
@endsection
|
||||
|
||||
@@ -42,7 +44,7 @@
|
||||
or $firstDate['Y'] == $year
|
||||
and $firstDate['m'] <= $month
|
||||
))
|
||||
<tr class='table-danger'>
|
||||
<tr style='color:#ff0000'>
|
||||
<th>{{ startOfMonth($year, $month) }}</th>
|
||||
<th>Saldo</th>
|
||||
<th></th>
|
||||
@@ -100,7 +102,7 @@
|
||||
</tr>
|
||||
@if (!$booking->isSimple())
|
||||
@foreach ($booking->subBookings as $subBooking)
|
||||
<tr class='table-secondary'>
|
||||
<tr style='font-style:italic'>
|
||||
<td></td>
|
||||
<td>{{ $subBooking->reference }}</td>
|
||||
<td></td>
|
||||
@@ -137,7 +139,7 @@
|
||||
or $firstDate['Y'] == $year
|
||||
and $firstDate['m'] <= $month
|
||||
))
|
||||
<tr class='table-primary'>
|
||||
<tr style='color:#000080'>
|
||||
<th>
|
||||
{{ endOfMonth($year, $month) }}
|
||||
</th>
|
||||
@@ -149,7 +151,7 @@
|
||||
<th></th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr class='table-danger'>
|
||||
<tr style='color:#ff0000'>
|
||||
<th>
|
||||
{{ endOfMonth($year, $month) }}
|
||||
</th>
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
@extends('layout.master')
|
||||
|
||||
@section('title', 'Buchungen nach Konten ' . $year)
|
||||
|
||||
@section('subnav')
|
||||
<a class='btn btn-outline-secondary' href='/bookings/year-{{ $year }}'>
|
||||
Zurück
|
||||
</a>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<h2>@yield('title')</h2>
|
||||
@foreach($scopes as $scope)
|
||||
<h3>{{ $scope->name }}</h3>
|
||||
@foreach($scope->accountClasses as $accountClass)
|
||||
<h4>{{ $accountClass->name }}</h4>
|
||||
<table class='table'>
|
||||
<tr style='color: #000080'>
|
||||
<th>Datum</th>
|
||||
<th>Position</th>
|
||||
<th>Person / Firma</th>
|
||||
<th>Betrag</th>
|
||||
</td>
|
||||
@foreach($accountClass->accountTypes as $accountType)
|
||||
<tr>
|
||||
<th colspan='4' style='color: #000080'>
|
||||
{{ $accountType->number . ' - ' . $accountType->name }}
|
||||
</th>
|
||||
</tr>
|
||||
@foreach($accountType->subBookings as $subBooking)
|
||||
<tr>
|
||||
<td>{{ formatDate($subBooking->date()) }}</td>
|
||||
<td>{{ $subBooking->reference }}</td>
|
||||
<td>{{ $subBooking->personOrCompany() }}</td>
|
||||
<td>{!! formatAmount($subBooking->amount) !!}</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
<tr>
|
||||
<th colspan='4' style='text-align: right; color:#ff0000'>
|
||||
{!! formatAmount($accountType->subBookings
|
||||
->sum('amount')) !!}
|
||||
</th>
|
||||
</tr>
|
||||
@endforeach
|
||||
</table>
|
||||
@endforeach
|
||||
@endforeach
|
||||
@endsection
|
||||
|
||||
Reference in New Issue
Block a user