Cliente

<%= link_to customers_path(:filter => @filter, :current_page => @current_page), {:class=>"fr-space btn blue-hoki "} do %> Regresar <% end %> <%= link_to edit_customer_path(@customer), {:class=>"btn btn-primary "} do %> Modificar <% end %>
Información general
<%= @customer.nick_name %>
<%= @customer.email %>
<% if @customer.notes != '' %>
<%= @customer.notes %>
<% end %>
<% if @customer.credit %> Crédito activo <% else %> No se le otorgó crédito <% end %>
<% if @customer.credit %>
$ <%= @customer.credit_limit %>
<%= @customer.time_limit %> <% if @customer.time_limit > 1 %> días <% else %> día <% end %>
<% end %>
<% if @customer.status == 'active' %> Activo <% else %> Inactivo <% end %>
<% if !@customer.billing_information.nil? %>
Información facturación
<%= @customer.billing_information.name %>
<%= @customer.billing_information.rfc %>
<%= @customer.billing_information.address_complete %>
<% end %> <% if !@customer.contact.nil? %>
Información contacto
<%= @customer.contact.name %> <%= @customer.contact.last_name %>
<%= @customer.contact.phone %>
<%= @customer.contact.email %>
<% end %>
Historial del cliente <%= @customer.nick_name %>
<% @sales.each_with_index do |sale, key| %> > <% credito = Credit.where(:sale_id => sale.id).first %> <% if credito.present? %> <% abonos = CreditPayment.where(:credit_id => credito.id, :status => 0).sum(:quantity) %> <% if abonos.present? %> <% end %> <% else %> <% end %> <% end %>
# Folio Punto de venta Vendedor Fecha Tipo Productos Status Total Abonado Restante Acciones
<%= key +1 %> <%= sale.sale_code %> <%= sale.get_pointsale.name %> <%= sale.seller.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 <% elsif sale.saletype == "reserved" %> Apartado <% else %> Contado <% end %> <%= sale.products.count %> <% case sale.status %> <% when "paid"%> PAGADA <% when "cancelled"%> CANCELADO <% when "parcial"%> ABONADA <% when "notpaid"%> PENDIENTE PAGO <% end %> <%= number_to_currency(sale.total, precision: 2) %><%= number_to_currency(abonos, precision: 2) %><%= number_to_currency(credito.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: '¿Esta seguro que desea cancelar la venta?'} do %> <% end %> <% end %> <% end %>
<% @credit.each_with_index do |credit, key| %> <% abonos = CreditPayment.where(:credit_id => credit.id) %> <% abonos.each_with_index do |abono, key| %> > <% end %> <% end %>
Folio Fecha Deuda Abono Restante Status Acciones
<%= credit.sale.sale_code %> <%= abono.date_payment %> <%= 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? %> <%= 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: '¿Esta seguro que desea cancelar el abono?'} do %> <% end %> <% end %>