<tr>
  <td><%= l(sale.date_sale, :format => '%d/%m/%Y') %></td>
  <td><%= sale.sale_code %> </td>
  <td><%= @pointsale.present? ? @pointsale.name : sale.get_pointsale.name %> </td>
  <td><%= sale.seller.name %> </td>
  <td><%= sale.sales_details.sum(:quantity).round %> </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
    <% elsif sale.saletype == "reserved"%>
    Apartado
    <% end %>
  </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">PAGO PENDIENTE</span>
    <% end %>
  </td>
  <td><%= number_to_currency(sale.amount, precision: 2) %></td>
  <td><%= number_to_currency(sale.tax, precision: 2) %></td>
  <td><%= number_to_currency(sale.discount, precision: 2) %></td>
  <td><%= number_to_currency(sale.total, precision: 2) %></td>
</tr>
