Scheda <%= EmoMonth.label %> <%= Person.label(1) %>
<% if current_person.present? && current_competenza.is_valid_date? %> <%= current_person.full_person_name %>
<%= daterange_name(current_competenza) %>

<% emo_functions = EmoFunction.search({filterperson_id: current_person.id, filterdate: current_competenza}) %> <% if emo_functions %> <% emo_month_totals = EmoMonth.new %> <% emo_functions.each do |emo_function| %> <% emo_month = EmoMonth.search({filteremofunction_id: emo_function.id, filterdate: current_competenza}).take %> <% if emo_month.blank? %> <% emo_month = EmoMonth.new %> <% end %> <% emo_month_totals[:ore_effettive] += emo_month[:ore_effettive] %> <% emo_month_totals[:ore_bp] += emo_month[:ore_bp] %> <% emo_month_totals[:monthly_hours] += emo_month[:monthly_hours] %> <% emo_month_totals[:rimborsi_vari] += emo_month[:rimborsi_vari] %> <% emo_month_totals[:rimborso_bp] += emo_month[:rimborso_bp] %> <% emo_month_totals[:rimborso_km] += emo_month[:rimborso_km] %> <% emo_month_totals[:busta_paga] += emo_month[:busta_paga] %> <% emo_month_totals[:totalemese_importo] += emo_month[:totalemese_importo] %> <% emo_month_totals[:compenso_importo] += emo_month[:compenso_importo] %> <% emo_month_totals[:importo_versato] += emo_month[:importo_versato] %> <% emo_month_totals[:importo_scalato] += emo_month[:importo_scalato] %> <% emo_month_totals[:importo_dapagare] += emo_month[:importo_dapagare] %> <% end %>
<%= EmoMonth.human_attribute_name(:emo_sector_id) %> <%= EmoMonth.human_attribute_name(:emo_function_id) %> <%= EmoMonth.human_attribute_name(:ore_effettive) %> <%= EmoMonth.human_attribute_name(:ore_bp) %> <%= EmoMonth.human_attribute_name(:monthly_hours) %> <%= EmoMonth.human_attribute_name(:rimborsi_vari).gsub('/'," / ") %> <%= EmoMonth.human_attribute_name(:rimborso_bp) %> <%= EmoMonth.human_attribute_name(:rimborso_km) %> <%= EmoMonth.human_attribute_name(:busta_paga).gsub('/'," / ") %> <%= EmoMonth.human_attribute_name(:totalemese_importo) %> <%= EmoMonth.human_attribute_name(:compenso_importo) %> <%= EmoMonth.human_attribute_name(:importo_versato) %> <%= EmoMonth.human_attribute_name(:importo_scalato) %> <%= EmoMonth.human_attribute_name(:importo_dapagare).gsub('/'," / ") %>
<%= notetext(emo_function.emo_sector.descrizione) %> <%= notetext(emo_function.descrizione) %><%= money_format_zero(emo_month[:ore_effettive]) %> <%= money_format_zero(emo_month[:ore_bp]) %> <%= money_format_zero(emo_month[:monthly_hours]) %> <%= money_format_zero(emo_month[:rimborsi_vari]) %> <%= money_format_zero(emo_month[:rimborso_bp]) %> <%= money_format_zero(emo_month[:rimborso_km]) %> <%= money_format_zero(emo_month[:busta_paga]) %> <%= money_format_zero(emo_month[:totalemese_importo]) %> <%= money_format_zero(emo_month[:compenso_importo]) %> <%= money_format_zero(emo_month[:importo_versato]) %> <%= money_format_zero(emo_month[:importo_scalato]) %> <%= money_format_zero(emo_month[:importo_dapagare]) %>
totali: <%= money_format_zero(emo_month_totals[:ore_effettive]) %> <%= money_format_zero(emo_month_totals[:ore_bp]) %> <%= money_format_zero(emo_month_totals[:monthly_hours]) %> <%= money_format_zero(emo_month_totals[:rimborsi_vari]) %> <%= money_format_zero(emo_month_totals[:rimborso_bp]) %> <%= money_format_zero(emo_month_totals[:rimborso_km]) %> <%= money_format_zero(emo_month_totals[:busta_paga]) %> <%= money_format_zero(emo_month_totals[:totalemese_importo]) %> <%= money_format_zero(emo_month_totals[:compenso_importo]) %> <%= money_format_zero(emo_month_totals[:importo_versato]) %> <%= money_format_zero(emo_month_totals[:importo_scalato]) %> <%= money_format_zero(emo_month_totals[:importo_dapagare]) %>
<% else %> Non ci sono funzioni assegnate a questa persona. <% end %> <% end %>