Проверьте остатки оборудования на руках:

<% for employee in @employees do %>

<%= employee.login%>

    <% for material in employee.materials.select{|i| ["Wi-Fi роутеры", "IPTV Приставки", "Powerline", "Wi-Fi адаптеры", "Wi-Fi точки доступа", "Кабель", "Кабель-канал", "Коммутаторы", "Телефония"].include? i[:group]} do %>
  1. <%= label_tag 'material', material[:name] %> <% write_off = @report.done_materials.select{|i| i.employee_id.to_i == employee.id.to_i && i.material_id.to_s == material[:id].to_s}.sum{|i| i.count.to_i} %> <%= material[:count].to_i - write_off %> шт.
  2. <% end %>
<% end %>
<% if @problems == true %> <%= button_to_function "Далее", "$(this).attr('disabled','disabled'); $('#window2').modal('hide'); $('#new_problems').modal('show')"%> <% else %> <%= button_to_function "Сохранить", "$(this).attr('disabled','disabled'); $('form:first').submit();"%> <% end %> <%= button_to_function "Отмена", "$('#window2').modal('hide');"%>