<% unless @purchases.nil? %>
  <div class="row">
    <div class="col-md-12">
      <div class="col-md-6 col-sm-3 col-xs-6 " >
        <div class="text-center well" id="container_total_prods" style="margin-bottom: 0px">
          <div class="font-grey-mint font-sm">Cantidad comprada</div>
          <div class="uppercase font-hg font-blue-sharp" id="total_prods"> <%= @total_quantity_purchases %></div>
        </div>
      </div>
    </div>
  </div>
  <br>
<% end %>
<div class="row">
  <div class="col-md-12">
    <table class="table table-striped table-bordered table-hover tableadvanced">
      <thead>
        <tr>
          <th>Folio compra</th>
          <th>Fecha</th>
          <th>Lugar</th>
          <th>Proveedor</th>
          <th>Cantidad</th>
          <th>Capturó</th>
        </tr>
      </thead>
      <tbody>
        <% @purchases.each_with_index do |purchase_detail, key| %>
          <tr>
            <td><%= purchase_detail.purchase.purchase_code %> </td>
            <td><%= l(purchase_detail.purchase.purchase_date, :format => '%d/%m/%Y') %></td>
            <% if purchase_detail.purchase.pointsale.present? %>
             <td><%= purchase_detail.purchase.pointsale.name %></td>
            <% else %>
              <td><%= purchase_detail.purchase.warehouse.name %></td>
            <% end %>
            <td><%= purchase_detail.purchase.supplier.nick_name %> </td>
            <td><%= purchase_detail.quantity %> </td>
            <td><%= purchase_detail.purchase.user.userid %> </td>
          </tr>
        <% end %>
      </tbody>
    </table>
  </div>
</div>
