<% content_for :head do %> <%= stylesheet_link_tag "filters" , :media => "all"%> <%= javascript_include_tag "table2CSV"%> <% end %>
<% form_tag "/soft/stats_materials", :method => :get do -%> Сотрудник: <%= select_tag(:filter_empl, options_for_select(Division.soft.employees.collect{ |c| [c.login, c.id]}.sort.insert(0, ['--- Все ---', ""]), params[:filter_empl].to_i)) %> Тип работ: <%= select_tag(:filter_worktype, options_for_select((Category.soft.collect{ |c| ["Софт: "+c.name, c.id]}+Category.private.collect{ |c| ["ЧИ: "+c.name, c.id]}).sort.insert(0, ['--- Все ---', ""]), params[:filter_worktype].to_i)) %> Материал: <%= select_tag(:filter_material, options_for_select(@materials.collect{ |c| [c.material_name, c.m_id]}.sort.insert(0, ['--- Все ---', ""]), params[:filter_material])) %>
Тип установки: <%= check_box_tag "filter_inst_types[]", 1, checked = (params[:filter_inst_types].to_a.include? "1") %><%= label_tag "filter_inst_types", "Установка"%> <%= check_box_tag "filter_inst_types[]", 2, checked = (params[:filter_inst_types].to_a.include? "2") %><%= label_tag "filter_inst_types", "Аренда"%> <%= check_box_tag "filter_inst_types[]", 3, checked = (params[:filter_inst_types].to_a.include? "3") %><%= label_tag "filter_inst_types", "Продажа"%> <%= check_box_tag "filter_inst_types[]", 7, checked = (params[:filter_inst_types].to_a.include? "7") %><%= label_tag "filter_inst_types", "Продажа, списание со счёта"%> <%= check_box_tag "filter_inst_types[]", 8, checked = (params[:filter_inst_types].to_a.include? "8") %><%= label_tag "filter_inst_types", "Продажа на К+"%> <%= check_box_tag "filter_inst_types[]", 4, checked = (params[:filter_inst_types].to_a.include? "4") %><%= label_tag "filter_inst_types", "Снято с объекта сети"%> <%#= check_box_tag "filter_inst_types[]", 6, checked = (params[:filter_inst_types].to_a.include? "6") %><%#= label_tag "filter_inst_types", "Замена"%>
<%= label_tag 'Дата с:' %><%= calendar_field_tag 'date_from', Russian::strftime(@date_from), { :class => 'plaintext', :size=> 9 }, {} %> <%= label_tag 'Дата по:' %><%= calendar_field_tag 'date_to', Russian::strftime(@date_to), { :class => 'plaintext', :size=> 9 }, {} %> <%= select_tag 'department', options_for_select([["Все подразделения", "0"], ["Софтгруппа", "soft"], ["Частные инсталляторы", "private"]], params[:department])%>
<%= button_to "Фильтр" %> <% end %>

Установленое/снятое оборудование по отчетам.

<% i=0 %> <% for report in @reports do%> <% end %>
# Подразделение Дата Логин Тип работ Материалы Количество Себестоимость Сумма Состав группы
<%=i+=1%> <%=report.department%> <%=report.date.to_date.strftime("%d-%m-%Y")%> <%=link_to report.name, edit_soft_path(report.id)%> <%=report.category_name %> <% for m in report.done_materials do %>
  • <%= m.pay_type_name + ": "+m.material_name+(m.bonus_sale.to_i > 0 ? " бонус "+ m.bonus_sale.to_s : "" ) -%><% end -%>
  • <% for m in report.done_materials do %>

    <%= m.count.to_i.abs -%>

    <% end -%>
    <% for m in report.done_materials do %>

    <%= m.count.to_i.abs * m.purchase_price.to_f -%>

    <% end -%>
    <% for m in report.done_materials do %>

    <%= m.count.to_i.abs * m.price.to_f -%>

    <% end -%>
    <% for emp in report.done_employees do %>
  • <%= emp.empl_name%> <% end %>
  • Всего:

    <%=n @reports.map{|r| r.done_materials.map{|d| d.count.to_i.abs}.sum}.sum %> <%=n @reports.map{|r| r.done_materials.map{|d| d.count.to_i.abs * d.purchase_price.to_f}.sum}.sum %> <%=n @reports.map{|r| r.done_materials.map{|d| d.count.to_i.abs* d.price.to_f}.sum}.sum %>