Browse Source

add fahrtkosten pro jahr

main
Christoph Marzell 1 month ago
parent
commit
03f9a6ad78
  1. 6
      app/controllers/entries_controller.rb
  2. 11
      app/views/entries/index.html.erb

6
app/controllers/entries_controller.rb

@ -30,6 +30,12 @@ class EntriesController < ApplicationController
end end
end end
@total_kilometer_costs_by_year = current_user.entries
.group_by { |e| e.date.year }
.transform_values do |entries|
entries.sum(&:kilometer_pauschale)
end
# Voraussichtliches Ende je Kombination basierend auf weekly_target_matrix # Voraussichtliches Ende je Kombination basierend auf weekly_target_matrix
@estimated_end_by_typ_art = {} @estimated_end_by_typ_art = {}
@remaining_minutes_matrix.each do |typ, arts| @remaining_minutes_matrix.each do |typ, arts|

11
app/views/entries/index.html.erb

@ -6,10 +6,15 @@
<!-- 🔢 Zusammenfassung --> <!-- 🔢 Zusammenfassung -->
<div class="mb-3"> <div class="mb-3">
<h5>🚗 Fahrtkosten (Kilometergeld)</h5>
<% @total_kilometer_costs_by_year.each do |year, sum| %>
<p><strong><%= year %>:</strong> <%= number_to_currency(sum, unit: "€", separator: ",", delimiter: ".", precision: 2) %></p>
<% end %>
<p><strong>Gesamtzeit:</strong> <%= @total_minutes / 60 %> h <%= @total_minutes % 60 %> min</p> <p><strong>Gesamtzeit:</strong> <%= @total_minutes / 60 %> h <%= @total_minutes % 60 %> min</p>
<p><strong>Fahrtkosten gesamt:</strong>
<%= number_to_currency(@total_kilometer_pauschale, unit: "€", separator: ",", delimiter: ".") %>
</p>
<hr> <hr>

Loading…
Cancel
Save