<tr id="sale_<%=sale.id%>">
  <td><%= sale.id %></td>
  <td><%= sale.sale_code %> </td>     
  <td><%= sale.customer.nick_name %> </td>
  <td><%= sale.seller.name %> </td>
  <td><%= l(sale.date_sale, :format => '%d/%m/%Y') %></td>
  <td>
    <% if sale.saletype == "credit" && sale.credit_note.blank? %>
    Crédito
    <% elsif sale.saletype == "credit" && sale.credit_note.present? %>
    Crédito/vale
    <% elsif sale.saletype == "cash" %>
    Contado
    <% else %>
    Apartado
    <% end %>
  </td>
  <td><%= sale.products.count %></td>
  <td>
    <% case sale.status %>
    <% when "paid"%>
      <span class="label label-success"> PAGADA </span>
    <% when "cancelled"%>
      <span class="label label-danger"> CANCELADO </span>
    <% when "parcial"%>                     
      <span class="label label-warning"> ABONADA </span> 
    <% when "notpaid"%>                     
      <span class="label label-default"> PENDIENTE PAGO </span>                             
    <% end %>
  </td>
  <td><%= number_to_currency(sale.total, precision: 2) %></td>
</tr>