<tr class=<%= (sale.cancelled? ? 'danger' : '') %>>
	<td><%= sale.id %></td>
	<td><%= sale.sale_code %> </td>
	<% if current_user.usertype == 'A' %>
		<td> <%= sale.get_pointsale.name %> </td>
	<% end %>
	<td><%= sale.customer.nick_name %> </td>
	<td><%= sale.seller.name %> </td>
	<td><%= l(sale.date_sale, :format => '%d/%B/%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 %>
			<!-- Cuando sea apartado, mostrar la fecha de vencimiento -->
			<%= l(sale.date_sale + @pos_config.days_cancel_reserved.days, :format => '%d/%B/%Y') %>
		<% 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>
	<% if sale.reserved?%>
		<td><%= number_to_currency(sale.reserve_debt, precision: 2) %></td>
	<% end %>
	<td class="text-center">
		<%= link_to sale, {:class=>"btn btn-icon-only default", :title=>"Ver venta"} do %>
			<i class="fa fa-search"></i>
		<% end %>

		<%= link_to print_receipt_path(sale.id, format: 'pdf'), {:class=>"btn btn-icon-only default", :target => "blank"} do %>
			<i class="fa fa-print"></i>
		<% end %>  

	    <% if current_user.usertype != 'A' %>
	      <% if sale.can_be_cancelled? %>
	        <%= link_to sale , method: :delete, :class => "btn btn-icon-only btn-danger", :title=>"Cancelar venta", data: { confirm: '¿Esta seguro que desea cancelar la venta?'}   do %> <i class="fa fa-ban"></i><% end %>
	      <% end %>
	    <% end %>
  </td>
</tr>