Clientes deudores

<%= link_to debtors_path(filter: @filter, current_page: @current_page), { class: "btn blue-hoki pull-right margin-bottom-10" } do %> Regresar <% end %>
<% if success %>

<%= success %>

<% elsif warning %>

<%= warning %>

<% end %>
Ventas al cliente <%= @customer.nick_name %>
<%= hidden_field_tag 'title_for_print' %>
<%= label_tag :begin_date, "Fecha", {:class=>"col-md-1 control-label"} do %> Desde <% end %>
<%= label_tag :end_date, "Fecha", {:class=>"col-md-1 control-label"} do %> Hasta <% end %>
<% if current_user.usertype == "A" || current_user.usertype == "SS" %> <% end %> <% @sales.each_with_index do |sale, key| %> > <% if current_user.usertype == "A" || current_user.usertype == "SS" %> <% end %> <% if sale.credit.present? %> <% else %> <% end %> <% end %>
# Código de ventaPunto de ventaVendedor Fecha Tipo Productos Status Total Abonado Restante Acciones
<%= sale.id %> <%= sale.sale_code %> <%= sale.get_pointsale.name %> <%= sale.user.first_name %> <%= l(sale.date_sale, :format => '%d/%m/%Y') %> <% if sale.saletype == "credit" && sale.credit_note.blank? %> Crédito <% elsif sale.saletype == "credit" && sale.credit_note.present? %> Crédito/vale <% else %> Contado <% end %> <%= sale.products.count %> <%= sale_status(sale) %> <%= number_to_currency(sale.total, precision: 2) %><%= number_to_currency(sale.credit.credit_payments.activos.sum(:quantity), precision: 2) %> <%= number_to_currency(sale.credit.rest, precision: 2) %> <%= link_to sale, { class: "btn btn-icon-only default", title: "Ver venta" } do %> <% end %> <% if can? :destroy, Sale %> <% daysToCancel = @pos_config.days_cancel_sale %> <% if (sale.date_sale + daysToCancel.days >= Date.today) && !sale.cancelled? %> <%= link_to sale , method: :delete, :class => "btn btn-icon-only btn-danger", :title=>"Cancelar venta", data: { confirm: '¿Está seguro que desea cancelar la venta?' } do %> <% end %> <% end %> <% end %>
<% @credits.each_with_index do |credit, key| %> <% abonos = credit.credit_payments.activos.order(:id) %> <% abonos.each_with_index do |abono, key| %> > <% credit.total -= abono.quantity %> <% end %> <% end %>
Folio Fecha Deuda Abono Restante Status Acciones
<%= credit.sale.sale_code %> <%= l(abono.date_payment, :format => '%d/%m/%Y') %> <%= number_to_currency(credit.total, precision: 2) %> <%= number_to_currency(abono.quantity, precision: 2) %> <%= number_to_currency(credit.rest, precision: 2) %> <% case abono.status %> <% when "cancelled"%> CANCELADO <% when "active"%> ACTIVO <% end %> <% if !abono.cancelled? && abono.cash_registers_move.present? && abono.cash_registers_move.open_cash_register.open? %> <%= link_to cash_move_delete_payment_path(:credit_payment_id => abono.id, :credit => credit.id) , method: :delete_credit_payment, :class => "btn btn-icon-only btn-danger", :title=>"Cancelar abono", data: { confirm: '¿Está seguro que desea cancelar el abono?' } do %> <% end %> <% end %>