debtors.html.erb 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <!-- BEGIN CONTAINER -->
  2. <div class="page-container">
  3. <!-- BEGIN CONTENT -->
  4. <div class="page-content-wrapper">
  5. <!-- BEGIN CONTENT BODY -->
  6. <!-- BEGIN PAGE HEAD-->
  7. <div class="page-head">
  8. <div class="container-fluid">
  9. <!-- BEGIN PAGE TITLE -->
  10. <div class="page-title">
  11. <h1>Clientes deudores</h1>
  12. </div>
  13. <!-- END PAGE TITLE -->
  14. </div>
  15. </div>
  16. <!-- END PAGE HEAD-->
  17. <!-- BEGIN PAGE CONTENT BODY -->
  18. <div class="page-content">
  19. <div class="container-fluid">
  20. <!-- BEGIN PAGE BREADCRUMBS -->
  21. <ul class="page-breadcrumb breadcrumb">
  22. <%= render_breadcrumbs :tag => :li, :separator => ' <i class="fa fa-circle"></i> ' %>
  23. </ul>
  24. <!-- END PAGE BREADCRUMBS -->
  25. <!-- BEGIN PAGE CONTENT INNER -->
  26. <div class="page-content-inner">
  27. <div id="notice">
  28. <% if success %>
  29. <div class="alert alert-success">
  30. <p><%= success %></p>
  31. </div>
  32. <% elsif warning %>
  33. <div class="alert alert-warning">
  34. <p><%= warning %></p>
  35. </div>
  36. <% end %>
  37. </div>
  38. <div class="row">
  39. <div class="col-md-12">
  40. <div class="portlet light ">
  41. <div class="portlet-title">
  42. <div class="caption">
  43. <i class="fa fa-list "></i>
  44. <span class="caption-subject bold uppercase">Lista de clientes con ventas a crédito</span>
  45. </div>
  46. </div>
  47. <div class="portlet-body">
  48. <input type='hidden' name='filter' id='filter' value='<%= @filter %>' >
  49. <input type='hidden' name='current_page' id='current_page' value='<%= @current_page %>' >
  50. <table class="table table-striped table-bordered table-hover tableadvanced">
  51. <thead>
  52. <tr>
  53. <th>Cliente</th>
  54. <th>Límite de crédito</th>
  55. <th>Monto a pagar</th>
  56. <th>Fecha de última venta</th>
  57. <th>Fecha de último abono</th>
  58. <th>Status</th>
  59. <th width="15%">Acciones</th>
  60. </tr>
  61. </thead>
  62. <tbody>
  63. <% @customers.each_with_index do |customer, key| %>
  64. <% # customer.verify_credit %>
  65. <% payment = CreditPayment.where(:customer_id => customer.id, :status => 0).order("date_payment DESC").first %>
  66. <% credito = Credit.activos.where(:customer_id => customer.id).sum(:rest) %>
  67. <% sales = Sale.where("customer_id = #{customer.id} and status != 1 and status != 2 and saletype = 0").order("date_sale DESC") %>
  68. <% if sales.first.present? && sales.first.status != "2" && credito > 0 %>
  69. <tr>
  70. <td><%= customer.nick_name %> </td>
  71. <% if customer.status != "debtor" %>
  72. <td><span class="label label-sm label-success"> <i class="fa fa-check"></i> Crédito </span> <br> $ <%= customer.credit_limit %></td>
  73. <% else %>
  74. <td><span class="label label-sm label-danger"> <i class="fa fa-times"></i> Crédito expirado </span></td>
  75. <% end %>
  76. <td><%= number_to_currency(credito, precision: 2) %></td>
  77. <td><%= l(sales.first.date_sale, :format => '%d/%m/%Y') %></td>
  78. <td>
  79. <% if payment.present? %>
  80. <%= l(payment.date_payment, :format => '%d/%m/%Y') %>
  81. <% end %>
  82. </td>
  83. <td>
  84. <% if customer.status == "inactive" %>
  85. <i class='fa fa-times fa-2 font-red'></i>
  86. <% else %>
  87. <i class='fa fa-check fa-2 font-green'></i>
  88. <% end %>
  89. </td>
  90. <td>
  91. <%= link_to customer_sales_path(:customer_id => customer.id), {:class=>"btn btn-icon-only default filtros2", :title=>"Ver detalles de ventas"} do %>
  92. <i class="fa fa-search"></i>
  93. <% end %>
  94. <%= link_to new_cash_registers_move_path(:sale => sales.last.id, :customer => customer.id, format: 'js'), remote: true, data: { toggle: "modal", target: "#new" }, :class=>"btn btn-icon-only green-dark", :title=>"Abonar" do %><i class="fa fa-dollar"></i>
  95. <% end %>
  96. </td>
  97. </tr>
  98. <% end %>
  99. <% end %>
  100. </tbody>
  101. </table>
  102. </div>
  103. </div>
  104. </div>
  105. </div>
  106. </div>
  107. <!-- END PAGE CONTENT INNER -->
  108. </div>
  109. </div>
  110. <!-- END PAGE CONTENT BODY -->
  111. <!-- END CONTENT BODY -->
  112. </div>
  113. <!-- END CONTENT -->
  114. </div>
  115. <!-- END CONTAINER -->