<%= SrgPnCostcenter.label %>
<%= view_table_open %>
<%= view_table_head_open %>
<%= view_table_row_open %>
<%= view_table_head_cell_span 2 %>
<%= view_table_head_cell (SrgPnCostcenter.human_attribute_name(:attivo)) %>
<%= view_table_head_cell (SrgPnCostcenter.human_attribute_name(:srg_pn_fund_id)) %>
<%= view_table_head_cell (SrgPnCostcenter.human_attribute_name(:srg_pn_costcenter_id)) %>
<%= view_table_head_cell (SrgPnCostcenter.human_attribute_name(:gruppo)) %>
<%= view_table_head_cell (SrgPnCostcenter.human_attribute_name(:note)) %>
<%= view_table_head_cell ('Prima nota') %>
<%= view_table_head_cell (raw("Esegui
giroconto") ) %>
<%= view_table_head_cell (SrgPnCostcenter.human_attribute_name(:giroconto_default_srg_pn_costcenter_id)) %>
<%= view_table_row_close %>
<%= view_table_head_close %>
<%= view_table_body_open %>
<% @srg_pn_costcenters.each do |srg_pn_costcenter| %>
<% centro_importo = SrgPn.where(srg_pn_fund_id: srg_pn_costcenter.srg_pn_fund_id).where(srg_pn_costcenter_id: srg_pn_costcenter.id).sum(:importo) %>
<%= view_table_row_open %>
<%= view_table_cell ( iconbutton_view srg_pn_costcenter, '') %>
<%= view_table_cell ( iconbutton_edit edit_srg_pn_costcenter_path(srg_pn_costcenter), '') %>
<%#= view_table_cell ( iconbutton_delete srg_pn_costcenter, '') %>
<%= view_table_cell ( check_box_tag :attivo, :attivo, srg_pn_costcenter.attivo, disabled: true) %>
<% if srg_pn_costcenter.attivo %>
<%= view_table_cell ( link_to(srg_pn_costcenter.srg_pn_fund.cassa, srg_pn_fund_path(srg_pn_costcenter.srg_pn_fund_id)) ) %>
<%= view_table_cell ( srg_pn_costcenter.centro ) %>
<%= view_table_cell ( srg_pn_costcenter.gruppo ) %>
<%= view_table_cell ( srg_pn_costcenter.note ) %>
<% else %>
<%= view_table_cell ( link_to(raw("#{srg_pn_costcenter.srg_pn_fund.cassa}
"), srg_pn_fund_path(srg_pn_costcenter.srg_pn_fund_id))) %>
<%= view_table_cell ( raw("#{srg_pn_costcenter.centro}
") ) %>
<%= view_table_cell ( raw("#{srg_pn_costcenter.gruppo}
") ) %>
<%= view_table_cell ( raw("#{srg_pn_costcenter.note}
") ) %>
<% end %>
<%= view_table_cell_right ( money_format(centro_importo) ) %>
<% if centro_importo.is_zero? %>
<%= view_table_cell ( '' ) %>
<% else %>
<%= view_table_cell_tooltip 'Giroconto di questo centro', ( iconbutton_to(movement_transfer_srg_pns_path, icon('exchange-alt'), 'btn-info btn-xs', nil, @filter_params.merge(id: srg_pn_costcenter.id, is_srg_pn_costcenter: true) ) ) %>
<% end %>
<%= view_table_cell ( srg_pn_costcenter.giroconto_default_srg_pn_costcenter_id.present? ? srg_pn_costcenter.giroconto_default_srg_pn_costcenter.centro : nil ) %>
<%= view_table_row_close %>
<% end %>
<%= view_table_body_close %>
<%= view_table_close %>
<%= iconbutton_new new_srg_pn_costcenter_path %>