<% for month in @months do %> <% month = ("01."+month.to_s).to_date%> <% beznal_for_month = all_beznal.select{|i| i.r_month.to_i == month.month.to_i && i.r_year.to_i == month.year.to_i}[0]%> <% if beznal_for_month%> <% end %> <% end %>
Месяц Оформлено (шт.) Оформлено (руб.) Не оплачено (шт.) Не оплачено (руб.) Оплачено (шт.) Оплачено (руб.) Отказались платить (шт.) Отказались платить (руб.) Процент оплаченных Процент от общей суммы
<%= Russian::strftime(month, "%B %Y") %> <%= link_to all_count = beznal_for_month.r_count, {:controller => dep, :action => :index, :filter_month => month.month, :filter_year => month.year, :money_type => 10}, :target => '_blank' %> <%= all_sum = beznal_for_month.r_total_sum_get_money.to_f %> <%= link_to all_count.to_i - beznal_for_month.r_count_2.to_i, {:controller => dep, :action => :index, :filter_month => month.month, :filter_year => month.year, :money_type => 10, :get_money_status => '1'}, :target => '_blank' %> <%= all_sum.to_f - beznal_for_month.r_sum_2.to_f%> <%= link_to beznal_for_month.r_count_2.to_i, {:controller => dep, :action => :index, :filter_month => month.month, :filter_year => month.year, :money_type => 10, :get_money_status => '2'}, :target => '_blank' %> <%= beznal_for_month.r_sum_2.to_f%> <%= link_to beznal_for_month.r_count_3.to_i, {:controller => dep, :action => :index, :filter_month => month.month, :filter_year => month.year, :money_type => 10, :get_money_status => '3'}, :target => '_blank' %> <%= beznal_for_month.r_sum_3.to_f%> <%= ((100*beznal_for_month.r_count_2.to_f/beznal_for_month.r_count.to_f)).to_i %> <%= ((100*beznal_for_month.r_sum_2.to_f/beznal_for_month.r_total_sum_get_money.to_f) if beznal_for_month.r_total_sum_get_money.to_f > 0).to_i%>
Оформлено безнальных з/н в кол-ве <%= all_beznal.sum{|i| i.r_count.to_i} %> штук на общую сумму <%= all_beznal.sum{|i| i.r_total_sum_get_money.to_f} %> руб.
Получено денег по з/н в кол-ве <%= all_beznal.sum{|i| i.r_count_2.to_i} %> штук на общую сумму <%= all_beznal.sum{|i| i.r_sum_2.to_f} %> руб.
Что составляет <%= ((100*all_beznal.sum{|i| i.r_count_2.to_i}/all_beznal.sum{|i| i.r_count.to_i}) if all_beznal.sum{|i| i.r_count.to_i} > 0).to_i %> % от кол-ва з/н и <%= ((100*all_beznal.sum{|i| i.r_sum_2.to_f}/all_beznal.sum{|i| i.r_total_sum_get_money.to_f}) if all_beznal.sum{|i| i.r_total_sum_get_money.to_f} > 0).to_i %> % от кол-ва денег.