utilities_report.html.erb 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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>Reporte de utilidades por periodo </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. <div class="search-page search-content-3">
  26. <div class="row">
  27. <div class="col-md-12">
  28. <%= form_tag(utilities_report_path, method: :get, remote: true) do |f| %>
  29. <div class="search-filter bordered">
  30. <!-- <h4 class=" uppercase form-section"> Búsqueda de producto </h4> <hr> -->
  31. <div class="form-group">
  32. <div class="row">
  33. <div class="col-md-3 col-sm-4">
  34. <div class="search-label uppercase">Punto de venta</div>
  35. <div class="col-md-12">
  36. <%= select_tag "pointsale", options_from_collection_for_select(Pointsale.vigentes, :id, :name), include_blank: "Todos", class: "form-control input-medium" %>
  37. </div>
  38. </div>
  39. <div class="col-md-3 col-sm-4">
  40. <div class="search-label uppercase"> Del </div>
  41. <div class="col-md-6">
  42. <div class="input-group input-medium date date-picker" data-date-format="dd/mm/yyyy">
  43. <%= text_field_tag "start_date", l(Date.today.beginning_of_month, format: '%d/%m/%Y'), class: "form-control" %>
  44. <span class="input-group-addon">
  45. <span class="glyphicon glyphicon-calendar"></span>
  46. </span>
  47. </div>
  48. </div>
  49. </div>
  50. <div class="col-md-3 col-sm-4">
  51. <div class="search-label uppercase"> Al </div>
  52. <div class="col-md-6">
  53. <div class="input-group input-medium date date-picker" data-date-format="dd/mm/yyyy">
  54. <%= text_field_tag "end_date", l(Date.today.end_of_month, format: '%d/%m/%Y'), class: "form-control" %>
  55. <span class="input-group-addon">
  56. <span class="glyphicon glyphicon-calendar"></span>
  57. </span>
  58. </div>
  59. </div>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="form-group">
  64. <div class="row">
  65. <div class="col-md-3 col-sm-4">
  66. <!-- categoria -->
  67. <div class="search-label uppercase">Línea</div>
  68. <div class="col-md-12">
  69. <div class="select2-bootstrap-prepend">
  70. <%= select_tag "category", options_from_collection_for_select(Category.activos_padre, :id, :category), include_blank: "Todas", class: "form-control select2-allow-clear-todas", onchange: 'getSubCategories($(this).val());'%>
  71. </div>
  72. </div>
  73. </div>
  74. <div class="col-md-3 col-sm-4">
  75. <!-- sub- categoria -->
  76. <div class="search-label uppercase">Sublínea</div>
  77. <div class="col-md-12">
  78. <div class="select2-bootstrap-prepend">
  79. <%= collection_select("", :subcategory, ({}), :id, :category, options = { include_blank: "Todas" }, html_options = { class: 'form-control select2-allow-clear-todas input-medium' }) %>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="col-md-3 col-sm-4" style="margin-top: 20px">
  84. <%= submit_tag 'Filtrar', { class: "btn green bold btn-block", style: 'margin:0px' } %>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <% end %>
  90. </div>
  91. </div>
  92. </div>
  93. <!-- BEGIN PAGE CONTENT INNER -->
  94. <div class="page-content-inner">
  95. <div class="portlet light">
  96. <div class="portlet-title">
  97. <div class="caption">
  98. <span class="caption-subject font-blue-dark bold uppercase">Ventas e ingresos</span>
  99. </div>
  100. </div>
  101. <div class="portlet-body form" id="sales_content">
  102. <div class="product_track_search">
  103. <div class="row">
  104. <div class="col-md-12">
  105. <div class="note note-success hidden" id="note_info">
  106. <h4 class="block">Detalle de utilidades del periodo: <strong><span id="start_date_display"></span></strong> al <strong><span id="end_date_display"></span></strong></h4>
  107. </div>
  108. <div class="col-xs-offset-1 col-xs-5">
  109. <div class="text-center well" id="container_total_prods" style="margin-bottom: 0px">
  110. <div class="font-grey-mint font-sm">NÚMERO DE VENTAS</div>
  111. <div class="uppercase font-hg font-blue-sharp" id="sales_quantity">0</div>
  112. </div>
  113. </div>
  114. <div class="col-xs-offset-1 col-xs-5">
  115. <div class="text-center well" id="container_total_prods" style="margin-bottom: 0px">
  116. <div class="font-grey-mint font-sm">PRODUCTOS VENDIDOS</div>
  117. <div class="uppercase font-hg font-blue-sharp" id="prods_total">0</div>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. <div class="row" style="margin-top: 20px">
  123. <div class="col-md-12">
  124. <div class="col-xs-offset-1 col-xs-5">
  125. <div class="text-center well" id="container_total_prods" style="margin-bottom: 0px">
  126. <div class="font-grey-mint font-sm">TOTAL UTILIDAD</div>
  127. <div class="uppercase font-hg font-green" id="total_utility">0</div>
  128. </div>
  129. </div>
  130. </div>
  131. </div>
  132. <br>
  133. <div class="row">
  134. <div class="col-md-12">
  135. <h4 class="form-section">Desglose de ventas</h4>
  136. <table class="table table-striped table-bordered table-hover tableadvanced" id="utility_report_table">
  137. <thead>
  138. <tr>
  139. <th>Fecha</th>
  140. <th>Folio</th>
  141. <th>Punto<br>de<br>venta</th>
  142. <th>Productos</th>
  143. <th>Tipo</th>
  144. <th>Status</th>
  145. <th>Subtotal</th>
  146. <th>IVA</th>
  147. <th>Descto.</th>
  148. <th>Total</th>
  149. <th>Costo<br>total</th>
  150. <th>Utilidad</th>
  151. </tr>
  152. </thead>
  153. <tbody>
  154. </tbody>
  155. </table>
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. <!-- END PAGE CONTENT INNER -->
  163. </div>
  164. </div>
  165. <!-- END PAGE CONTENT BODY -->
  166. <!-- END CONTENT BODY -->
  167. </div>
  168. <!-- END CONTENT -->
  169. </div>
  170. <script>
  171. function getSubCategories(value) {
  172. $('#_subcategory').html('');
  173. $('#_subcategory').select2("destroy").select2({
  174. placeholder: 'Seleccione',
  175. "language": {
  176. "noResults": function(){
  177. return "No se encontraron coincidencias";
  178. }
  179. }
  180. });
  181. $('#_subcategory').select2('val', null);
  182. if(value) {
  183. $.ajax({
  184. type: "get",
  185. url: '/getcategories/' + value,
  186. dataType: 'json',
  187. success: function(data) {
  188. if(data.length > 0) {
  189. $('#_subcategory').append('<option></option>')
  190. for(i in data) {
  191. $('#_subcategory').append("<option value='" + data[i].id + "'>" + data[i].category + "</option>")
  192. }
  193. $('#_subcategory').select2({
  194. allowClear: true,
  195. placeholder: 'Todas',
  196. "language": {
  197. "noResults": function(){
  198. return "No se encontraron coincidencias";
  199. }
  200. }
  201. });
  202. }
  203. }
  204. });
  205. }
  206. }
  207. </script>