<% if @fp_nilRangeStart %> <% datestart = Date.today.beginning_of_year %> <% else %> <% datestart = @fp_valueRangeStart %> <% end %> <% if @fp_nilRangeEnd %> <% dateend = Date.today.end_of_year %> <% else %> <% dateend = @fp_valueRangeEnd %> <% end %> <% use_date_range = true and !@fp_nilRangeStart %> <% if use_date_range %> Estratto conto
Dal <%= datestart.to_dmy %> al <%= dateend.to_dmy %>
<% else %> Estratto conto del <%= Date.today.year %>
Al <%= Date.today.to_dmy %>
<% end %> <% query = SrgPn.search(@filter_params) %> <% if !@fp_nilSrgpnCostcenter %> <% centro = @fp_valueSrgpnCostcenter %> <% query = query.where(srg_pn_costcenter_id: centro.id) %> per Centro di Costo '<%= centro.centro %>'
<% end %> <% if !@fp_nilSrgpnFund %> <% cassa = @fp_valueSrgpnFund %> <% query = query.where(srg_pn_fund_id: cassa.id) %> per Cassa '<%= cassa.cassa %>'
<% end %> <% if !@fp_nilSrgcrb %> <% crb = @fp_valueSrgcrb %> <% query = query.where(srg_crb_id: crb.id) %> per CRB '<%= crb.format_for_formselect %>'
<% end %> <% if !@fp_nilHouse %> <% house = @fp_valueHouse %> <% query = query.where(house: house.id) %> per Nucleo '<%= house.descrizione %>'
<% end %> <% debuginfo = false %> <% if debuginfo %> <% end %> <% totale = 0 %> <% current_date = nil %> <% counter = 0 %> <% subtotale = 0 %> <% subcounter = 0 %> <% voci = query.ordered_by_date %> <% voci.each do |voce| %> <% totale += voce.importo if voce.importo.present? %> <% if voce.data.present? %> <% if use_date_range %> <% voce_included = (datestart..dateend).include?(voce.data) %> <% else %> <% voce_included = voce.data.year >= (Date.today.year-1) %> <% end %> <% if voce_included %> <% counter += 1 %> <% if current_date.nil? %> <% else %> <% if current_date == voce.data %> <% if debuginfo %> <% end %> <% else %> <% if debuginfo %> <% end %> <% subcounter = 0 %> <% subtotale = 0 %> <% end %> <% end %> <% current_date = voce.data %> <% subcounter += 1 %> <% subtotale += voce.importo if voce.importo.present? %> <% end %> <% end %> <% end %> <% if current_date.nil? %> <% else %> <% if debuginfo %> <% end %> <% end %> <% if debuginfo %> <% end %>
data competenza nucleo descrizione CdC/Cassa/Crb importo saldoinfo giorno
<%= voce.data.to_dmy %>
 <%= "quantità: #{subcounter}, subtotale: #{money_format(subtotale)}" %>
<%= voce.data.to_dmy %><%= voce.competenza.present? ? daterange_name(voce.competenza) : nil %> <%= voce.house_id.present? ? voce.house.format_for_formselect : nil %> <%= voce.descrizione %> <%= "#{voce.srg_pn_costcenter_id.present? ? voce.srg_pn_costcenter.centro : ''}/#{voce.srg_pn_fund_id.present? ? voce.srg_pn_fund.cassa : ''}/#{voce.srg_crb_id.present? ? voce.srg_crb.cod : ''}" %> <%= money_format(voce.importo) %> <%= money_format(totale) %><%= "quantità: #{subcounter}, subtotale: #{money_format(subtotale)}" %>
totale <%= money_format(totale) %> quantità: <%= counter %>