<% reference_date = @filter_params[:filterdate] %> Verifica emolumenti
<%= daterange_name(reference_date) %>


Verifica funzioni attive ma senza emolumenti mensili in <%= daterange_name(reference_date) %>:
<% feedback_count = 0 %> <% emo_functions = EmoFunction.in_use.ordered_by_name %> <% emo_functions.each do |emo_function| %> <% if !EmoMonth.where(emo_function_id: emo_function.id).any? %> <% feedback_count += 1 %> <% end %> <% end %>
<%= link_to emo_function.format_for_formselect, emo_function_path(emo_function.id) %> <%= link_to "Non sono stati inseriti emolumenti in #{daterange_name(reference_date)} per questa funzione!", emo_months_path({filterperson_id: emo_function.person_id}) %>
<% if feedback_count == 0 %> Nessuna funzione attiva senza emolumenti mensili. <% end %>

Verifica emolumenti di <%= daterange_name(reference_date) %> con dati potenzialmente errati:
<% feedback_count = 0 %> <% emo_months = EmoMonth.search({filterdate: reference_date}) %> <% if @emo_months %> <% emo_months.each do |emo_month| %> <% feedback = "" %> <% if emo_month.monthly_hours > emo_month.emo_function.monthly_hours %> <% feedback += "Numero ore mensili maggiore di quello previsto dalla funzione." %> <% end %> <% if emo_month.monthly_hours <= 0 %> <% feedback += "Numero ore mensili nullo." %> <% end %> <% if feedback.length > 0 %> <% feedback_count += 1 %> <% end %> <% end %> <% end %>
<%= emo_month.emo_function.format_for_formselect %> <%= feedback %>
<% if feedback_count == 0 %> Nessuna riga con dati potenzialmente errati. <% end %>