Skip to content

Commit

Permalink
Fix bug in statement view
Browse files Browse the repository at this point in the history
  • Loading branch information
xam-ps committed Dec 24, 2023
1 parent b5f70d9 commit 738e033
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
7 changes: 1 addition & 6 deletions app/Http/Controllers/StatementController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -70,6 +64,7 @@ public function index(Request $request)

'costs' => $costsByCostType,
'travelAllowanceTotal' => $expTravel,
'afaSum' => $afaSum,
'expTaxSum' => $expTaxSum,
'expNetSum' => $expNetSum,
'expTotal' => $expTotal,
Expand Down
22 changes: 22 additions & 0 deletions resources/views/statement.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,29 @@ class="font-semibold text-xl text-gray-800 dark:text-gray-200 leading-tight prin
<h2>Ausgaben</h2>
</td>
</tr>
<tr>
<td>{{ $costs->count() }}</td>
</tr>
@if ($costs->count() == 0)
<tr>
<td>31</td>
<td>Absetzung für Abnutzung</td>
<td>{{Number::currency($afaSum, in: 'EUR', locale: 'de')}}</td>
</tr>
@endif
@foreach ($costs as $cost)
@if ($cost->elster_id == 31)
@continue
@endif
@if ($cost->elster_id > 31)
@once
<tr>
<td>31</td>
<td>Absetzung für Abnutzung</td>
<td>{{Number::currency($afaSum, in: 'EUR', locale: 'de')}}</td>
</tr>
@endonce
@endif
<tr>
<td>{{$cost->elster_id}}</td>
<td>{{$cost->full_name}}</td>
Expand Down

0 comments on commit 738e033

Please sign in to comment.