<% content_for :head do %> <%= stylesheet_link_tag "filters" , :media => "all"%> <% end %>

Зарплата диспетчеров

<% form_tag '/ams/managers_wage/', :method => :get do -%> Месяц: <%= select_tag(:filter_month, options_for_select(Report.months, @date.month.to_i)) -%> Год: <%= select_tag(:filter_year, options_for_select((2010..Date.today.year).to_a, @date.year.to_i)) -%> АМС/МАМС: <%= select_tag(:filter_weld, options_for_select([["АМС", 0], ["Модернизация АМС", 1]].insert(0, ['--- Все ---', 17]), if params[:filter_weld] then params[:filter_weld].to_i else 17 end)) %> <%= button_to "Фильтр" -%> <% end -%>
<% @managers.map{|i| i.employee_nic}.uniq.each do |m|%> <% sum2 = 0%> <% days = @managers.select{|i| i.employee_nic == m } %> <% all_reps = @reports.select{|r| days.map{|d| d.shift_date}.include?(r.date.to_date)} %> <% days.each do |zp|%> <% end %> <% all_reps.flatten!%> <% end %>
Сотрудник Дата Кол-во отчетов Кол-во мастеров З/п мастеров З/п диспетчеров
class="left"><%=m %>
<%= Russian::strftime(zp.shift_date, "%d %B %Y")%> [<%= @schedule.type_of_day(zp.shift_date.day) %>]
<% reports = all_reps.select{|i| i.date.to_date == zp.shift_date} %>
<%= link_to (reports.size), ams_index_path(:filter_day => zp.shift_date.to_date.day, :filter_month => zp.shift_date.to_date.month, :filter_year => zp.shift_date.to_date.year), :target => '_blank' %> <%= reports.map{|i| i.done_employees}.flatten.map{|i| i.empl_id}.uniq.size%> <%= n reports.map{|i| i.sum.to_f}.sum%> <%= n reports.map{|i| i.disp_wage.to_f}.sum%>
ИТОГО:<%=link_to all_reps.count, ams_index_path(:manager => days.first.employee_id, :filter_month => days.first.shift_date.to_date.month, :filter_year => days.first.shift_date.to_date.year, :filter_worktype => ((@cats.nil? || @cats.size > 1) ? "" : @cats.first)), :target => '_blank' %><% ac_w = all_reps.select{|i| i.total_sum_works.to_f > 0}.count %><% ac_m = all_reps.select{|i| i.total_sum_materials.to_f > 0}.count %> <%= n all_reps.map{|i| i.done_employees}.flatten.map{|i| i.empl_id}.uniq.size%> <%= n all_reps.map{|i| i.sum.to_f}.sum%> <%= n all_reps.map{|i| i.disp_wage.to_f}.sum%>