diff --git a/app/Http/Controllers/StatementController.php b/app/Http/Controllers/StatementController.php index 84e7eb2..e2aabf7 100644 --- a/app/Http/Controllers/StatementController.php +++ b/app/Http/Controllers/StatementController.php @@ -51,12 +51,6 @@ public function index(Request $request) } } - foreach ($costsByCostType as $cost) { - if ($cost->elster_id == 31) { - $cost->total_net = $afaSum; - } - } - //substract afa expenses from net, as they need to be calculated extra $expNetSum = $costsByCostType->sum('total_net') - $afaThisYear; $expTaxSum = $costsByCostType->sum('total_tax'); @@ -70,6 +64,7 @@ public function index(Request $request) 'costs' => $costsByCostType, 'travelAllowanceTotal' => $expTravel, + 'afaSum' => $afaSum, 'expTaxSum' => $expTaxSum, 'expNetSum' => $expNetSum, 'expTotal' => $expTotal, diff --git a/resources/views/statement.blade.php b/resources/views/statement.blade.php index e7dce82..a61ee64 100644 --- a/resources/views/statement.blade.php +++ b/resources/views/statement.blade.php @@ -48,7 +48,29 @@ class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight prin

Ausgaben

+ + {{ $costs->count() }} + + @if ($costs->count() == 0) + + 31 + Absetzung für Abnutzung + {{Number::currency($afaSum, in: 'EUR', locale: 'de')}} + + @endif @foreach ($costs as $cost) + @if ($cost->elster_id == 31) + @continue + @endif + @if ($cost->elster_id > 31) + @once + + 31 + Absetzung für Abnutzung + {{Number::currency($afaSum, in: 'EUR', locale: 'de')}} + + @endonce + @endif {{$cost->elster_id}} {{$cost->full_name}}