Compare commits

11 Commits
21 changed files with 676 additions and 157 deletions
+54 -42
View File
@@ -24,48 +24,15 @@ class BookingsController extends Controller
*/ */
public function index($year) public function index($year)
{ {
$bookings = Booking::with('subBookings.accountType.accountClass.ioType', $cashbook = $this->getCashbook($year);
'subBookings.project')
->whereYear('date', '=', $year)
->orderBy('date')
->get()
->groupBy( function ($item) {
return Carbon::parse($item->date)->format('n');
});
$sums = array(); return view('bookings.index', $cashbook);
}
$startBalance = SubBooking::balanceAt($year - 1 . '-12-31');
$sums[0]['balance'] = $startBalance;
$expeditures = SubBooking::expedituresInInterval($year . '-01-01', $year . '-12-31', true); public function report($year) {
$cashbook = $this->getCashbook($year);
$incomes = SubBooking::incomesInInterval($year . '-01-01', $year . '-12-31', true);
// Create an array with the following properties: return view('bookings.print', $cashbook);
// 'balance' - The account balance at the last day of a month
// 'expeditures' - the sum of all expeditures in this month
// 'incomes' - the sum of all incomes in this month plus the account
// balance of the previous month
for ($month = 1; $month <= 12; $month++) {
$currExpeditures = $expeditures->where('month', '=', $month)->first()->expeditures;
$currIncomes = $expeditures->where('month', '<', $month)->sum('expeditures')
+ $incomes->where('month', '<=', $month)->sum('incomes')
+ $startBalance;
$currBalance = $currExpeditures + $currIncomes;
$sums[$month]['expeditures'] = $currExpeditures;
$sums[$month]['incomes'] = $currIncomes;
$sums[$month]['balance'] = $currBalance;
}
$firstDateString = Carbon::parse(Booking::firstDate());
$firstDate['Y'] = $firstDateString->format('Y');
$firstDate['m'] = $firstDateString->format('m');
return view('bookings.index', compact('bookings', 'year', 'sums', 'firstDate'));
} }
/** /**
@@ -285,7 +252,7 @@ class BookingsController extends Controller
// ... and create a list of the open targets to show it in the form as // ... and create a list of the open targets to show it in the form as
// dropdown menu. // dropdown menu.
$openTargetsArray = []; $openTargetsArray = [];
foreach ($openTargets as $personTargets) { foreach ($openTargets as $personTargets) {
foreach ($personTargets as $personTarget) { foreach ($personTargets as $personTarget) {
$person = $personTarget->person; $person = $personTarget->person;
@@ -306,7 +273,7 @@ class BookingsController extends Controller
foreach ($projects as $project) { foreach ($projects as $project) {
$timeOfProject = ''; $timeOfProject = '';
if ($project->start_date <= today() and $project->end_date >= today()) { if ($project->start_date <= today() and $project->end_date >= today()) {
$timeOfProject = 'Laufende Projekte'; $timeOfProject = 'Laufende Projekte';
} elseif ($project->start_date > today()) { } elseif ($project->start_date > today()) {
@@ -314,7 +281,7 @@ class BookingsController extends Controller
} else { } else {
$timeOfProject = 'Vergangene Projekte'; $timeOfProject = 'Vergangene Projekte';
} }
$projectsArray['Vergangene Projekte'][$project->id] = $project->name; $projectsArray['Vergangene Projekte'][$project->id] = $project->name;
} }
@@ -346,4 +313,49 @@ class BookingsController extends Controller
return compact('openTargetsArray', 'projectsArray', 'accountTypeArray'); return compact('openTargetsArray', 'projectsArray', 'accountTypeArray');
} }
private function getCashbook($year) {
$bookings = Booking::with('subBookings.accountType.accountClass.ioType',
'subBookings.project')
->whereYear('date', '=', $year)
->orderBy('date')
->get()
->groupBy( function ($item) {
return Carbon::parse($item->date)->format('n');
});
$sums = array();
$startBalance = SubBooking::balanceAt($year - 1 . '-12-31');
$sums[0]['balance'] = $startBalance;
$expeditures = SubBooking::expedituresInInterval($year . '-01-01', $year . '-12-31', true);
$incomes = SubBooking::incomesInInterval($year . '-01-01', $year . '-12-31', true);
// Create an array with the following properties:
// 'balance' - The account balance at the last day of a month
// 'expeditures' - the sum of all expeditures in this month
// 'incomes' - the sum of all incomes in this month plus the account
// balance of the previous month
for ($month = 1; $month <= 12; $month++) {
$currExpeditures = $expeditures->where('month', '=', $month)->first()->expeditures;
$currIncomes = $expeditures->where('month', '<', $month)->sum('expeditures')
+ $incomes->where('month', '<=', $month)->sum('incomes')
+ $startBalance;
$currBalance = $currExpeditures + $currIncomes;
$sums[$month]['expeditures'] = $currExpeditures;
$sums[$month]['incomes'] = $currIncomes;
$sums[$month]['balance'] = $currBalance;
}
$firstDateString = Carbon::parse(Booking::firstDate());
$firstDate['Y'] = $firstDateString->format('Y');
$firstDate['m'] = $firstDateString->format('m');
return compact('bookings', 'year', 'sums', 'firstDate');
}
} }
@@ -118,6 +118,13 @@ class PeopleController extends Controller
// Show the delete dialog for a given person // Show the delete dialog for a given person
public function delete(Person $person) public function delete(Person $person)
{ {
$person->load('targets:id,person_id,io_type_id,amount',
'targets.ioType:id,factor',
'targets.actuals:id,person_target_id,account_type_id,amount',
'targets.actuals.accountType:id,account_class_id',
'targets.actuals.accountType.accountClass:id,io_type_id',
'targets.actuals.accountType.accountClass.ioType:id,factor');
return view('people.delete', compact('person')); return view('people.delete', compact('person'));
} }
+100 -1
View File
@@ -154,7 +154,106 @@ class ReportsController extends Controller
return view('reports.scopes.compact', compact('scopes', 'year', return view('reports.scopes.compact', compact('scopes', 'year',
'startBalance', 'endBalance')); 'startBalance', 'endBalance'));
} elseif ($type == 'detailed') { } 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);
}
}
public function printScopes($type, $year)
{
if ($type == 'compact') {
$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]);
}
])->get();
foreach ($scopes as $scope) {
foreach ($scope->accountClasses as $accountClass) {
$accountClass->amount =
$accountClass->accountTypes->sum(function ($accountType) {
return $accountType->subBookings->sum('amount');
});
}
$scope->balance = $scope->accountClasses->sum(function ($accountClass) {
return $accountClass->amount * $accountClass->ioType->factor;
});
}
$startBalance = SubBooking::balanceAt(lastDayOfYear($year - 1));
$endBalance = $startBalance + $scopes->sum('balance');
return view('reports.scopes.compact_print', compact('scopes', 'year',
'startBalance', 'endBalance'));
} elseif ($type == '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_print', compact('scopes', 'year'));
} else { } else {
abort(404); abort(404);
} }
+4
View File
@@ -2,6 +2,7 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use App\CustomValidator; use App\CustomValidator;
use Validator; use Validator;
@@ -18,6 +19,9 @@ class AppServiceProvider extends ServiceProvider
Validator::resolver(function ($translator, $data, $rules, $messages) { Validator::resolver(function ($translator, $data, $rules, $messages) {
return new CustomValidator($translator, $data, $rules, $messages); return new CustomValidator($translator, $data, $rules, $messages);
}); });
// Set default string length in order to run on older versions of MySQL
Schema::defaultStringLength(191);
} }
/** /**
+38 -26
View File
@@ -3,41 +3,53 @@
@section('title', 'Buchung löschen') @section('title', 'Buchung löschen')
@section('subnav') @section('subnav')
<a href='{{ url()->previous() }}'>Zurück</a> <a href='{{ url()->previous() }}' class='btn btn-outline-secondary'>Zurück</a>
@endsection @endsection
@section('content') @section('content')
<h2>@yield('title')</h2> <h2>@yield('title')</h2>
<form action='/bookings/{{ $booking->id }}' method='post'> <form action='/bookings/{{ $booking->id }}' method='post' class='mt-4 text-center'>
{{ method_field('delete') }} {{ method_field('delete') }}
{{ csrf_field() }} {{ csrf_field() }}
<p>Soll folgende Buchung und alle ihre Teilbuchungen wirklich gelöscht <div class='alert alert-danger'>
werden?</p> <p>
Soll folgende Buchung und alle ihre Teilbuchungen wirklich
gelöscht werden?
</p>
<table border='1'> <table class='table'>
<tr>
<th>Datum</th>
<th>Positionen</th>
<th>Person / Firma</th>
<th>Betrag</th>
</tr>
<tr>
<td>{{ $booking->date }}</td>
<td>{{ $booking->reference }}</td>
<td>{{ $booking->person_or_company }}</td>
<td align='right'>{{ formatAmount($booking->signedAmount(), true, true) }}</td>
</tr>
@foreach($booking->subBookings as $subBooking)
<tr> <tr>
<td></td> <th>Datum</th>
<td>{{ $subBooking->reference }}</td> <th>Positionen</th>
<td></td> <th>Person / Firma</th>
<td align='right'>{{ formatAmount($subBooking->signedAmount(), true, true) }}</td> <th>Betrag</th>
</tr> </tr>
@endforeach <tr>
</table> <td>{{ formatDate($booking->date) }}</td>
<td>{{ $booking->reference }}</td>
<td>{{ $booking->person_or_company }}</td>
<td align='right'>
{{
formatAmount($booking->signedAmount(), true, true)
}}
</td>
</tr>
@foreach($booking->subBookings as $subBooking)
<tr>
<td></td>
<td>{{ $subBooking->reference }}</td>
<td></td>
<td align='right'>
{{
formatAmount($subBooking->signedAmount(), true, true)
}}
</td>
</tr>
@endforeach
</table>
<button type="submit" id="submit">Ja</button> <button class='btn btn-primary' type="submit" id="submit">Ja</button>
<a href="{{ url()->previous() }}" class="btn btn-outline-secondary">Nein</a>
</div>
</form> </form>
@endsection @endsection
+45 -35
View File
@@ -8,6 +8,8 @@
<a href='/reports/balances/{{ $year }}' class="btn btn-outline-warning">HS-Rechnung</a> <a href='/reports/balances/{{ $year }}' class="btn btn-outline-warning">HS-Rechnung</a>
<a href='/reports/scopes/compact/{{ $year }}' class="btn <a href='/reports/scopes/compact/{{ $year }}' class="btn
btn-outline-warning">Abrechnung</a> btn-outline-warning">Abrechnung</a>
<a href='/reports/scopes/detailed/{{ $year }}' class="btn
btn-outline-warning">Konten</a>
</li> </li>
@endsection @endsection
@@ -21,8 +23,8 @@
{{ $year + 1 }} <i class="fas fa-chevron-right"></i> {{ $year + 1 }} <i class="fas fa-chevron-right"></i>
</a> </a>
</div> </div>
<table class='table table-striped table-bordered'> <table class='table table-bordered table-hover'>
<tr> <tr class='table-secondary'>
<th>Datum</th> <th>Datum</th>
<th>Positionen</th> <th>Positionen</th>
<th>Person / Firma</th> <th>Person / Firma</th>
@@ -30,7 +32,7 @@
<th>Eingang (H)</th> <th>Eingang (H)</th>
<th>Konto</th> <th>Konto</th>
<th>Projekt</th> <th>Projekt</th>
<th></th> <th>Aktionen</th>
</tr> </tr>
@for ($month = 1; $month <= 12; $month++) @for ($month = 1; $month <= 12; $month++)
@if (( @if ((
@@ -42,15 +44,15 @@
or $firstDate['Y'] == $year or $firstDate['Y'] == $year
and $firstDate['m'] <= $month and $firstDate['m'] <= $month
)) ))
<tr style='color: red; font-weight: bold'> <tr style='color:#ff0000'>
<td>{{ startOfMonth($year, $month) }}</td> <th>{{ startOfMonth($year, $month) }}</th>
<td>Saldo</td> <th>Saldo</th>
<td></td> <th></th>
<td></td> <th></th>
<td>{!! formatAmount($sums[$month - 1]['balance']) !!}</td> <th>{!! formatAmount($sums[$month - 1]['balance']) !!}</th>
<td></td> <th></th>
<td></td> <th></th>
<td></td> <th></th>
</tr> </tr>
@endif @endif
@if (isset($bookings[$month])) @if (isset($bookings[$month]))
@@ -81,10 +83,18 @@
</td> </td>
<td> <td>
<div class='btn-group' role='group' aria-label='Basic example'> <div class='btn-group' role='group' aria-label='Basic example'>
<a href='/bookings/{{ $booking->id }}/edit' class='btn btn-success'> <a href='/bookings/{{ $booking->id }}/edit'
class='btn btn-success'
data-toggle='tooltip'
data-placement='bottom'
title='Bearbeiten'>
<i class='fas fa-edit'></i> <i class='fas fa-edit'></i>
</a> </a>
<a href='/bookings/{{ $booking->id }}/delete' class='btn btn-danger'> <a href='/bookings/{{ $booking->id }}/delete'
class='btn btn-danger'
data-toggle='tooltip'
data-placement='bottom'
title='Löschen'>
<i class="fas fa-trash"></i> <i class="fas fa-trash"></i>
</a> </a>
</div> </div>
@@ -92,7 +102,7 @@
</tr> </tr>
@if (!$booking->isSimple()) @if (!$booking->isSimple())
@foreach ($booking->subBookings as $subBooking) @foreach ($booking->subBookings as $subBooking)
<tr> <tr style='font-style:italic'>
<td></td> <td></td>
<td>{{ $subBooking->reference }}</td> <td>{{ $subBooking->reference }}</td>
<td></td> <td></td>
@@ -129,29 +139,29 @@
or $firstDate['Y'] == $year or $firstDate['Y'] == $year
and $firstDate['m'] <= $month and $firstDate['m'] <= $month
)) ))
<tr style='color: #000080; font-weight: bold'> <tr style='color:#000080'>
<td> <th>
{{ endOfMonth($year, $month) }} {{ endOfMonth($year, $month) }}
</td> </th>
<td>Monatsabschluss</td> <th>Monatsabschluss</th>
<td></td> <th></th>
<td>{!! formatAmount($sums[$month]['expeditures']) !!}</td> <th>{!! formatAmount($sums[$month]['expeditures']) !!}</th>
<td>{!! formatAmount($sums[$month]['incomes']) !!}</td> <th>{!! formatAmount($sums[$month]['incomes']) !!}</th>
<td></td> <th></th>
<td></td> <th></th>
<td></td> <th></th>
</tr> </tr>
<tr style='color: red; font-weight: bold'> <tr style='color:#ff0000'>
<td> <th>
{{ endOfMonth($year, $month) }} {{ endOfMonth($year, $month) }}
</td> </th>
<td>Saldo</td> <th>Saldo</th>
<td></td> <th></th>
<td>{!! formatAmount($sums[$month]['balance']) !!}</td> <th>{!! formatAmount($sums[$month]['balance']) !!}</th>
<td></td> <th></th>
<td></td> <th></th>
<td></td> <th></th>
<td></td> <th></th>
</tr> </tr>
<tr> <tr>
@for ($i = 0; $i < 8; $i++) @for ($i = 0; $i < 8; $i++)
+114
View File
@@ -0,0 +1,114 @@
@extends('layout.print')
@section('title', 'Kassenbuch ' . $year)
@section('content')
@for ($month = 1; $month <= 12; $month++)
<table class='table table-sm table-bordered' style='page-break-after: always'>
<thead>
<tr>
<th>Datum</th>
<th>Positionen</th>
<th>Person / Firma</th>
<th style='width:2.6cm'>Ausgang</th>
<th style='width:2.6cm'>Eingang</th>
<th>Konto</th>
</tr>
</thead>
@if ((
date('Y') > $year
or (date('Y') == $year
and date('m') >= $month)
) and (
$firstDate['Y'] < $year
or $firstDate['Y'] == $year
and $firstDate['m'] <= $month
))
<tr style='color:#ff0000'>
<th>{{ startOfMonth($year, $month) }}</th>
<th>Saldo</th>
<th></th>
<th></th>
<th>{!! formatAmount($sums[$month - 1]['balance']) !!}</th>
<th></th>
</tr>
@endif
@if (isset($bookings[$month]))
@foreach($bookings[$month] as $booking)
<tr>
<td>{{ formatDate($booking->date) }}</td>
<td>{{ $booking->reference }}</td>
<td>{{ $booking->person_or_company }}</td>
<td align='right'>
@if ($booking->signedAmount() < 0)
{!! formatAmount($booking->signedAmount()) !!}
@endif
</td>
<td align='right'>
@if ($booking->signedAmount() >= 0)
{!! formatAmount($booking->signedAmount()) !!}
@endif
</td>
<td>
@if ($booking->isSimple())
{{ $booking->accountType()->number }}
@endif
</td>
</tr>
@if (!$booking->isSimple())
@foreach ($booking->subBookings as $subBooking)
<tr style='font-style:italic'>
<td></td>
<td>{{ $subBooking->reference }}</td>
<td></td>
<td align='right'>
@if ($subBooking->signedAmount() < 0)
{!! formatAmount($subBooking->signedAmount()) !!}
@endif
</td>
<td align='right'>
@if ($subBooking->signedAmount() >= 0)
{!! formatAmount($subBooking->signedAmount()) !!}
@endif
</td>
<td>
{{ $subBooking->accountType->number }}
</td>
</tr>
@endforeach
@endif
@endforeach
@endif
@if ((
date('Y') > $year
or (date('Y') == $year
and date('m') >= $month)
) and (
$firstDate['Y'] < $year
or $firstDate['Y'] == $year
and $firstDate['m'] <= $month
))
<tr style='color:#000080'>
<th>
{{ endOfMonth($year, $month) }}
</th>
<th>Monatsabschluss</th>
<th></th>
<th>{!! formatAmount($sums[$month]['expeditures']) !!}</th>
<th>{!! formatAmount($sums[$month]['incomes']) !!}</th>
<th></th>
</tr>
<tr style='color:#ff0000'>
<th>
{{ endOfMonth($year, $month) }}
</th>
<th>Saldo</th>
<th></th>
<th>{!! formatAmount($sums[$month]['balance']) !!}</th>
<th></th>
<th></th>
</tr>
@endif
</table>
@endfor
@endsection
+24 -4
View File
@@ -2,13 +2,17 @@
@section('subnav') @section('subnav')
<li class="nav-item"> <li class="nav-item">
<a href="{{ url()->previous() }}" class="btn btn-outline-primary">Zurück</a> <a href="{{ url()->previous() }}" class="btn btn-outline-secondary">Zurück</a>
</li> </li>
@endsection @endsection
@section('content') @section('content')
<h1>@yield('title')</h1> <h1>@yield('title')</h1>
<form action="/people/@if (!is_null($person->id)) {{ $person->id }} @endif" method='post'> @if (is_null($person->id))
<form action='/people' method='post'>
@else
<form action='/people/{{ $person->id }}' method='post'>
@endif
@if (!is_null($person->id)) @if (!is_null($person->id))
{{ method_field('patch') }} {{ method_field('patch') }}
@endif @endif
@@ -125,8 +129,24 @@
{{-- Create empty input field for a new member state record. --}} {{-- Create empty input field for a new member state record. --}}
@if (!$person->isMember()) @if (!$person->isMember())
<tr> <tr>
<td>{{ Form::date('memberState[0][joining_date]') }}</td> <td>
<td>{{ Form::date('memberState[0][leaving_date]') }}</td> {{
Form::date(
'memberState[0][joining_date]',
null,
['class' => 'form-control']
)
}}
</td>
<td>
{{
Form::date(
'memberState[0][leaving_date]',
null,
['class' => 'form-control']
)
}}
</td>
</tr> </tr>
@endif @endif
</table> </table>
@@ -8,7 +8,11 @@
@section('content') @section('content')
<h1>@yield('title')</h1> <h1>@yield('title')</h1>
<form action="/targets/@if (!is_null($personTarget->id)) {{ $personTarget->id }} @endif" method='post'> @if (is_null($personTarget->id))
<form action='/targets' method='post'>
@else
<form action='/targets/{{ $personTarget->id }}' method='post'>
@endif
@if (!is_null($personTarget->id)) @if (!is_null($personTarget->id))
{{ method_field('patch') }} {{ method_field('patch') }}
@endif @endif
@@ -1,12 +1,16 @@
@extends('layout.master') @extends('layout.master')
@section('subnav') @section('subnav')
<a href='{{ url()->previous() }}'>Zurück</a> <a href='{{ url()->previous() }}' class='btn btn-outline-secondary'>Zurück</a>
@endsection @endsection
@section('content') @section('content')
<h3>@yield('title')</h3> <h3>@yield('title')</h3>
<form action="/projects/@if (!is_null($project->id)) {{ $project->id }} @endif" method='post'> @if (is_null($project->id))
<form action='/projects' method='post'>
@else
<form action='/projects/{{$project->id}}' method='post'>
@endif
@if (!is_null($project->id)) @if (!is_null($project->id))
{{ method_field('patch') }} {{ method_field('patch') }}
@endif @endif
-2
View File
@@ -68,7 +68,5 @@
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip()
}); });
</script> </script>
</body> </body>
</html> </html>
+19
View File
@@ -0,0 +1,19 @@
<html>
<head>
<title>Twäng! e. V. - @yield('title')</title>
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO"
crossorigin="anonymous">
<style>
body {
position: relative;
}
</style>
</head>
<body>
@yield('content')
</body>
</html>
+3 -2
View File
@@ -4,7 +4,7 @@
@section('subnav') @section('subnav')
<li class="nav-item"> <li class="nav-item">
<a href="{{ url()->previous() }}" class="btn btn-outline-primary">Zurück</a> <a href="{{ url()->previous() }}" class="btn btn-outline-secondary">Zurück</a>
</li> </li>
@endsection @endsection
@@ -15,7 +15,8 @@
@if ($person->isEven()) @if ($person->isEven())
<div class="alert alert-danger"> <div class="alert alert-danger">
<p>Soll <b>{{ $person->fullName() }}</b> wirklich gelöscht werden?</p> <p>Soll <b>{{ $person->fullName() }}</b> wirklich gelöscht werden?</p>
<button type="submit" id="submit">Ja</button> <button class='btn btn-primary' type="submit" id="submit">Ja</button>
<a href="{{ url()->previous() }}" class="btn btn-outline-secondary">Nein</a>
</div> </div>
@else @else
<div class="alert alert-warning"> <div class="alert alert-warning">
+21 -18
View File
@@ -3,32 +3,35 @@
@section('title', 'Zahlungsverflichtung löschen') @section('title', 'Zahlungsverflichtung löschen')
@section('subnav') @section('subnav')
<a href='{{ url()->previous() }}'>Zurück</a> <a href='{{ url()->previous() }}' class='btn btn-outline-secondary'>Zurück</a>
@endsection @endsection
@section('content') @section('content')
<h2>@yield('title')</h2> <h2>@yield('title')</h2>
<form action='/targets/{{ $personTarget->id }}' method='post'> <form action='/targets/{{ $personTarget->id }}' method='post' class='mt-4 text-center'>
{{ method_field('delete') }} {{ method_field('delete') }}
{{ csrf_field() }} {{ csrf_field() }}
<p>Soll folgende Zahlungsverpflichtung wirklich gelöscht werden?</p> <div class='alert alert-danger'>
<p>Soll folgende Zahlungsverpflichtung wirklich gelöscht werden?</p>
<table border='1'> <table class='table'>
<tr> <tr>
<th>Datum</th> <th>Datum</th>
<th>Position</th> <th>Position</th>
<th>Person / Firma</th> <th>Person / Firma</th>
<th>Betrag</th> <th>Betrag</th>
</tr> </tr>
<tr> <tr>
<td>{{ formatDate($personTarget->date) }}</td> <td>{{ formatDate($personTarget->date) }}</td>
<td>{{ $personTarget->reference }}</td> <td>{{ $personTarget->reference }}</td>
<td>{{ $personTarget->person->fullName() }}</td> <td>{{ $personTarget->person->fullName() }}</td>
<td>{{ $personTarget->signedAmount() }}</td> <td>{!! formatAmount($personTarget->signedAmount()) !!}</td>
</tr> </tr>
</table> </table>
<button type="submit" id="submit">Ja</button> <button class='btn btn-primary' type="submit" id="submit">Ja</button>
<a href="{{ url()->previous() }}" class="btn btn-outline-secondary">Nein</a>
</div>
</form> </form>
@endsection @endsection
+33 -7
View File
@@ -3,7 +3,9 @@
@section('title', 'Forderungen und Verbindlichkeiten') @section('title', 'Forderungen und Verbindlichkeiten')
@section('subnav') @section('subnav')
<a href='/targets/create' class='btn btn-outline-success'>Neue Forderung / Verbindlichkeit</a> <li class='nav-item'>
<a href='/targets/create' class='btn btn-outline-success'>Neue Forderung / Verbindlichkeit</a>
</li>
@endsection @endsection
@section('content') @section('content')
@@ -17,7 +19,7 @@
<th>Soll</th> <th>Soll</th>
<th>Ist</th> <th>Ist</th>
<th>Differenz</th> <th>Differenz</th>
<th>Aktion</th> <th>Aktionen</th>
</tr> </tr>
<tr> <tr>
<th></th> <th></th>
@@ -37,9 +39,21 @@
<td>{!! formatAmount($personTarget->actualsSum()) !!}</td> <td>{!! formatAmount($personTarget->actualsSum()) !!}</td>
<td>{!! formatAmount($personTarget->difference()) !!}</td> <td>{!! formatAmount($personTarget->difference()) !!}</td>
<td> <td>
<div class="btn-group" role="group" aria-label="Basic example"> <div class="btn-group" role="group">
<a href='/targets/{{ $personTarget->id }}/edit' class="btn btn-success"><i class="fas fa-edit"></i></a> <a href='/targets/{{ $personTarget->id }}/edit'
<a href='/targets/{{ $personTarget->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='/targets/{{ $personTarget->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>
@@ -75,8 +89,20 @@
<td>{!! formatAmount($personTarget->difference()) !!}</td> <td>{!! formatAmount($personTarget->difference()) !!}</td>
<td> <td>
<div class="btn-group" role="group" aria-label="Basic example"> <div class="btn-group" role="group" aria-label="Basic example">
<a href='/targets/{{ $personTarget->id }}/edit' class="btn btn-success"><i class="fas fa-edit"></i></a> <a href='/targets/{{ $personTarget->id }}/edit'
<a href='/targets/{{ $personTarget->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='/targets/{{ $personTarget->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>
+10 -5
View File
@@ -3,16 +3,21 @@
@section('title', 'Projekt löschen') @section('title', 'Projekt löschen')
@section('subnav') @section('subnav')
<a href='{{ url()->previous() }}'>Zurück</a> <a href='{{ url()->previous() }}' class='btn btn-outline-secondary'>Zurück</a>
@endsection @endsection
@section('content') @section('content')
<form action='/projects/{{ $project->id }}' method='post'> <form action='/projects/{{ $project->id }}' method='post' class='mt-4 text-center'>
{{ method_field('delete') }} {{ method_field('delete') }}
{{ csrf_field() }} {{ csrf_field() }}
<p>Soll das Projekt "<b>{{ $project->name }}</b>" wirklich gelöscht <div class='alert alert-danger'>
werden?</p> <p>
<button type="submit" id="submit">Ja</button> Soll das Projekt <b>{{ $project->name }}</b> wirklich
gelöscht werden?
</p>
<button class='btn btn-primary' type="submit" id="submit">Ja</button>
<a href="{{ url()->previous() }}" class="btn btn-outline-secondary">Nein</a>
</div>
</form> </form>
@endsection @endsection
+1 -1
View File
@@ -69,7 +69,7 @@
<td>{{ $project->name }}</td> <td>{{ $project->name }}</td>
<td>{{ formatDate($project->start_date) }}</td> <td>{{ formatDate($project->start_date) }}</td>
<td>{{ formatDate($project->end_date) }}</td> <td>{{ formatDate($project->end_date) }}</td>
<td width="1"> <td>
<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' <a href='/projects/{{ $project->id }}/edit'
class="btn btn-success" class="btn btn-success"
@@ -0,0 +1,88 @@
@extends('layout.print')
@section('title', 'Abrechnung ' . $year)
@section('content')
<table class='table table-sm table-borderless'>
<tr>
<td>
<b>Kontostand am 1. 1. {{ $year }}</b>
</td>
<td>
<b>{!! formatAmount($startBalance) !!}</b>
</td>
</tr>
<tr><td colspan='2'></td></tr>
@foreach($scopes as $scope)
<tr>
<td colspan='2'><b>{{ $scope->name }}</b></td>
</tr>
@foreach($scope->accountClasses as $accountClass)
<tr>
<td colspan='2' style='text-indent: 2em;'>
<u>{{ $accountClass->name }}</u>
</td>
</tr>
@foreach($accountClass->accountTypes as $accountType)
<tr>
<td style='text-indent: 4em;'>
{{$accountType->number}} - {{$accountType->name}}
</td>
<td>
{!! formatAmount($accountType->subBookings->sum('amount')) !!}
</td>
</tr>
@endforeach
<tr><td colspan='2'></td></tr>
@endforeach
<tr>
<td colspan='2' style='text-indent: 2em;'>
<u>GESAMT</u>
</td>
<tr>
@foreach($scope->accountClasses as $accountClass)
<tr>
<td style='text-indent: 4em;'>
{{ $accountClass->name }}
</td>
<td>
{!! formatAmount($accountClass->amount) !!}
</td>
</tr>
@endforeach
<tr>
<td style='text-indent: 4em;'>
Saldo {{ $scope->name }}
</td>
<td>{!! formatAmount($scope->balance) !!}</td>
</tr>
<tr><td colspan='2'></td></tr>
@endforeach
<tr>
<td colspan='2'>
<b>Übersicht</b>
</td>
<tr>
@foreach($scopes as $scope)
<tr>
<td style='text-indent: 4em;'>
Saldo {{ $scope->name }}
</td>
<td>{!! formatAmount($scope->balance) !!}</td>
</tr>
@endforeach
<tr>
<td style='text-indent: 4em;'>Gesamtsaldo</td>
<td>{!! formatAmount($scopes->sum('balance')) !!}</td>
</tr>
<tr><td colspan='2'></td></tr>
<tr>
<td>
<b>Kontostand am 31. 12. {{ $year }}</b>
</td>
<td>
<b>{!! formatAmount($endBalance) !!}</b>
</td>
</tr>
</table>
@endsection
@@ -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
@@ -0,0 +1,43 @@
@extends('layout.print')
@section('title', 'Buchungen nach Konten ' . $year)
@section('content')
@foreach($scopes as $scope)
@foreach($scope->accountClasses as $accountClass)
<h5>{{ $scope->name }}</h5>
<b>{{ $accountClass->name }}</b>
<table class='table table-sm table-borderless' style='page-break-after: always'>
<thead>
<tr>
<th>Datum</th>
<th>Position</th>
<th>Person / Firma</th>
<th>Betrag</th>
</td>
</thead>
@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
+13 -11
View File
@@ -19,52 +19,53 @@ Route::middleware(['auth'])->group(function() {
**************************************************************************/ **************************************************************************/
Route::get('/people', 'PeopleController@index'); Route::get('/people', 'PeopleController@index');
Route::post('/people', 'PeopleController@store'); Route::post('/people', 'PeopleController@store');
Route::get('/people/create', 'PeopleController@create'); Route::get('/people/create', 'PeopleController@create');
Route::get('/people/{person}', 'PeopleController@show'); Route::get('/people/{person}', 'PeopleController@show');
Route::patch('/people/{person}', 'PeopleController@update'); Route::patch('/people/{person}', 'PeopleController@update');
Route::delete('/people/{person}', 'PeopleController@destroy'); Route::delete('/people/{person}', 'PeopleController@destroy');
Route::get('/people/{person}/edit', 'PeopleController@edit'); Route::get('/people/{person}/edit', 'PeopleController@edit');
Route::get('/people/{person}/delete', 'PeopleController@delete'); Route::get('/people/{person}/delete', 'PeopleController@delete');
/************************************************************************** /**************************************************************************
* BOOKINGS * * BOOKINGS *
**************************************************************************/ **************************************************************************/
Route::redirect('/bookings', 'bookings/year-' . date('Y')); Route::redirect('/bookings', 'bookings/year-' . date('Y'));
Route::get('/bookings/year-{year}', 'BookingsController@index'); Route::get('/bookings/year-{year}', 'BookingsController@index');
Route::get('/bookings/year-{year}/print', 'BookingsController@report');
Route::post('/bookings', 'BookingsController@store'); Route::post('/bookings', 'BookingsController@store');
Route::get('/bookings/create', 'BookingsController@create'); Route::get('/bookings/create', 'BookingsController@create');
Route::patch('/bookings/{booking}', 'BookingsController@update'); Route::patch('/bookings/{booking}', 'BookingsController@update');
Route::delete('/bookings/{booking}', 'BookingsController@destroy'); Route::delete('/bookings/{booking}', 'BookingsController@destroy');
Route::get('/bookings/{booking}/edit', 'BookingsController@edit'); Route::get('/bookings/{booking}/edit', 'BookingsController@edit');
Route::get('/bookings/{booking}/delete', 'BookingsController@delete'); Route::get('/bookings/{booking}/delete', 'BookingsController@delete');
/************************************************************************** /**************************************************************************
* PROJECTS * * PROJECTS *
**************************************************************************/ **************************************************************************/
Route::get('/projects', 'ProjectsController@index'); Route::get('/projects', 'ProjectsController@index');
Route::post('/projects', 'ProjectsController@store'); Route::post('/projects', 'ProjectsController@store');
Route::get('/projects/create', 'ProjectsController@create'); Route::get('/projects/create', 'ProjectsController@create');
Route::patch('/projects/{project}', 'ProjectsController@update'); Route::patch('/projects/{project}', 'ProjectsController@update');
Route::delete('/projects/{project}', 'ProjectsController@destroy'); Route::delete('/projects/{project}', 'ProjectsController@destroy');
Route::get('/projects/{project}/edit', 'ProjectsController@edit'); Route::get('/projects/{project}/edit', 'ProjectsController@edit');
Route::get('/projects/{project}/delete', 'ProjectsController@delete'); Route::get('/projects/{project}/delete', 'ProjectsController@delete');
/************************************************************************** /**************************************************************************
* PERSON TARGETS * * PERSON TARGETS *
**************************************************************************/ **************************************************************************/
Route::get('/targets', 'PersonTargetsController@index'); Route::get('/targets', 'PersonTargetsController@index');
Route::post('/targets', 'PersonTargetsController@store'); Route::post('/targets', 'PersonTargetsController@store');
Route::get('/targets/create', 'PersonTargetsController@create'); Route::get('/targets/create', 'PersonTargetsController@create');
Route::patch('/targets/{personTarget}', 'PersonTargetsController@update'); Route::patch('/targets/{personTarget}', 'PersonTargetsController@update');
Route::delete('/targets/{personTarget}', 'PersonTargetsController@destroy'); Route::delete('/targets/{personTarget}', 'PersonTargetsController@destroy');
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');
@@ -74,6 +75,7 @@ Route::middleware(['auth'])->group(function() {
Route::get('/reports/projects/{project}', 'ReportsController@project'); Route::get('/reports/projects/{project}', 'ReportsController@project');
Route::get('/reports/balances/{year}', 'ReportsController@balances'); Route::get('/reports/balances/{year}', 'ReportsController@balances');
Route::get('/reports/scopes/{type}/{year}', 'ReportsController@scopes'); Route::get('/reports/scopes/{type}/{year}', 'ReportsController@scopes');
Route::get('/reports/scopes/{type}/{year}/print', 'ReportsController@printScopes');
Route::get('/reports/targets/', 'ReportsController@targets'); Route::get('/reports/targets/', 'ReportsController@targets');
}); });