% if params[EmoMonthsHelper::EseguiVersamento].present? %>
<% tipoDiIncasso = EmoMonthsHelper::EseguiVersamento %>
<% result = SrgPn.registraMovimento(current_user, params, @filter_params, tipoDiIncasso) %>
<%= render partial: 'shared/show_result_registramovimento', locals: {result: result, tipoDiIncasso: tipoDiIncasso} %>
<% params.delete(tipoDiIncasso) %>
<% end %>
<% if params[EmoMonthsHelper::EseguiScalo].present? %>
<% tipoDiIncasso = EmoMonthsHelper::EseguiScalo %>
<% result = SrgPn.registraMovimento(current_user, params, @filter_params, tipoDiIncasso) %>
<%= render partial: 'shared/show_result_registramovimento', locals: {result: result, tipoDiIncasso: tipoDiIncasso} %>
<% params.delete(tipoDiIncasso) %>
<% end %>
<% @emo_month.reload %>
Dati del mese:
<%= form_tag(emo_month_path(@emo_month), method: :get, remote: true) do %>
<% srg_qec_fund_code = @emo_month.emo_function.emo_fund.srg_qec_fund.codice %>
<%= hidden_field_tag :competenza, @emo_month.competenza %>
<%= hidden_field_tag EmoMonthsHelper::DataIncasso_ParamsKey, Date.today %>
<% if @emo_month.emo_function_id? %>
<%= hidden_field_tag :person_id, @emo_month.emo_function.person_id %>
<% end %>
<%= edit_table_open %>
<%= edit_table_row (EmoMonth.human_attribute_name(:competenza) ),(daterange_name(@emo_month.competenza)) %>
<%= edit_table_row (EmoFunction.human_attribute_name(:person_id)),(@emo_month.emo_function.person_id.present? ? link_to( @emo_month.emo_function.person.dh_person_name, person_path(@emo_month.emo_function.person_id) ) : nil) %>
<%= edit_table_row (EmoMonth.human_attribute_name(:emo_function_id) ),(@emo_month.emo_function_id.present? ? link_to(@emo_month.emo_function.format_for_formselect, emo_function_path(@emo_month.emo_function_id) ) : nil) %>
<%= edit_table_row (EmoMonth.human_attribute_name(:ore_effettive) ), (@emo_month.ore_effettive).to_s+notetext(' ore non incluse nel calcolo') %>
<%= edit_table_row (EmoMonth.human_attribute_name(:ore_bp) ), (@emo_month.ore_bp).to_s+notetext(' ore non incluse nel calcolo') %>
<%= edit_table_row (EmoMonth.human_attribute_name(:monthly_hours) ), (@emo_month.monthly_hours) %>
<%= edit_table_row (EmoMonth.human_attribute_name(:rimborsi_vari) ), (money_format(@emo_month.rimborsi_vari)) %>
<%= edit_table_row (EmoMonth.human_attribute_name(:rimborso_bp) ), (money_format(@emo_month.rimborso_bp)) %>
<%= edit_table_row (EmoMonth.human_attribute_name(:rimborso_km) ), (@emo_month.rimborso_km) %>
<%= edit_table_row (EmoMonth.human_attribute_name(:totalemese_importo)), (money_format(@emo_month.totalemese_importo)) %>
<%= edit_table_row (EmoMonth.human_attribute_name(:busta_paga) ), (money_format(@emo_month.busta_paga)) %>
<% scali_legacy = @emo_month.get_scali_legacy %>
<% if scali_legacy.length > 0 %>
<%= edit_table_row_open %>
<%= edit_table_cell_label '' %>
<%= edit_table_cell_value_open %>
Altri scali presenti nelle Emissioni (* al momento non usati nel calcolo di questo emolumento, visualizzato solo a titolo di informazione):
<% scali_legacy.each do |scalo_legacy| %>
<%= link_to("Emissione #{daterange_name(scalo_legacy.data)}: #{money_format(scalo_legacy.importo)}", srg_adac_path(scalo_legacy.id) ) %>
<% end %>
<%= edit_table_cell_value_close %>
<%= edit_table_row_close %>
<% end %>
<%= edit_table_row (EmoMonth.human_attribute_name('compenso_importo') ), (money_format(@emo_month.compenso_importo)) %>
<%#= edit_table_row (EmoMonth.human_attribute_name('Compenso') ),
( (tag.div(id: "field_compenso") do money_format(@emo_month.compenso_importo).to_s end) +
iconbutton_submit(icon('bolt'), 'btn-success btn-xs', "Calcola", EmoMonthsHelper::CalcolaCompenso, 'OK')
#iconbutton_to(emo_month_path(@emo_month), icon('bolt'), 'btn-success btn-xs', 'Calcola', nil, true )
) %>
<%= edit_table_row (EmoMonth.human_attribute_name('note') ),(text_area_tag :note, @emo_month.note, cols: 40, rows: 10, disabled: true) %>
<% versato = @emo_month.get_versamento_importo %>
<% versamenti = @emo_month.get_versamenti %>
<% if versamenti.length > 0 %>
<%= edit_table_row ('Versato'), (money_format(versato) ) %>
<%= edit_table_row_open %>
<%= edit_table_cell_label '' %>
<%= edit_table_cell_value_open %>
Elenco versamenti:
<% versamenti.each do |versamento| %>
<%= link_to("#{versamento.data.to_dmy}: #{money_format(-versamento.importo)}", srg_pn_path(versamento.id) ) %>
<% end %>
<%= edit_table_cell_value_close %>
<%= edit_table_row_close %>
<% end %>
<% scalato = @emo_month.get_scalo_importo %>
<% scali = @emo_month.get_scali %>
<% if scali.length > 0 %>
<%= edit_table_row ('Scalato'), (money_format(-scalato) ) %>
<%= edit_table_row_open %>
<%= edit_table_cell_label '' %>
<%= edit_table_cell_value_open %>
Elenco scali:
<% scali.each do |scalo| %>
<%= link_to("Emissione #{daterange_name(scalo.data)}: #{money_format(scalo.importo)}", srg_adac_path(scalo.id) ) %>
<% end %>
<%= edit_table_cell_value_close %>
<%= edit_table_row_close %>
<% end%>
<% if @emo_month.importo_dapagare.is_zero? %>
<%= edit_table_row ('Da versare/scalare'), (money_format(0.0) + @emo_month.get_status_icon(@emo_month.status_pagamenti) ) %>
<% else %>
<%= edit_table_row ('Da versare/scalare'), ( text_field_tag(srg_qec_fund_code, money_format(@emo_month.importo_dapagare) ) + @emo_month.get_status_icon(@emo_month.status_pagamenti) ) %>
<%= edit_table_row ('Data versamento'),
(
date_input_tag(EmoMonthsHelper::DataIncasso_ParamsKey, Date.today, false) +
iconbutton_submit(icon('wallet'), 'btn-success btn-xs', "Esegui versamento", EmoMonthsHelper::EseguiVersamento, srg_qec_fund_code)
) %>
<% currentperiod = daterange_current() %>
<% list_of_months = [] %>
<% 3.downto(-2) do |m| %>
<% list_of_months << [ daterange_name(currentperiod.next_month(m)) + ((m==0) ? ' *':''), currentperiod.next_month(m)] %>
<% end %>
<%= edit_table_row ('Competenza dello scalo'),
(
select_tag(:target_competenza_scalo, options_for_select(list_of_months, daterange_current() ) ) +
iconbutton_submit(icon('exchange-alt'), 'btn-success btn-xs', "Esegui scalo", EmoMonthsHelper::EseguiScalo, srg_qec_fund_code)
) %>
<% end %>
<%= edit_table_close %>
<% end %>
<%= iconbutton_edit edit_emo_month_path(@emo_month) %>
<% if @emo_month.can_destroy? %>
<%= iconbutton_delete(@emo_month) %>
<% end %>
<%= show_record_info(@emo_month) %>