فهرست منبع

[Issue #1] Removed price column from warehouse stock

Jacqueline Maldonado 7 سال پیش
والد
کامیت
192cae05e3
2فایلهای تغییر یافته به همراه32 افزوده شده و 33 حذف شده
  1. 6 5
      app/datatables/stock_by_pointsale_datatable.rb
  2. 26 28
      app/views/available_products/_form_stock_printable.html.erb

+ 6 - 5
app/datatables/stock_by_pointsale_datatable.rb

@@ -34,16 +34,17 @@ class StockByPointsaleDatatable
           "<h3> $#{get_price_sale(available.product)} </h3>"
         ].compact
       else
-        [
+        arr = [
           (image_tag img),
           get_display_name(available.product),
           (category.parent_id.zero? ? category.category : category.parent.category),
           (category.parent_id != 0 ? category.category : ' '),
           available.stock_min.round,
           available.stock_max.round,
-          available.stock.round,
-          "<h3> $#{get_price_sale(available.product)} </h3>"
-        ].compact
+          available.stock.round
+        ]
+        arr += get_price_sale(available.product) unless @current_user.usertype == "S"
+        arr.compact
       end
     end
   end
@@ -58,7 +59,7 @@ class StockByPointsaleDatatable
 
   def get_price_sale(product)
     location_id = params[:location][2, params[:location].length] unless params[:location].blank?
-    product.get_price_sale(location_id) unless current_user.usertype == "S"
+    "<h3> $#{product.get_price_sale(location_id)} </h3>"
   end
 
   def stock

+ 26 - 28
app/views/available_products/_form_stock_printable.html.erb

@@ -13,7 +13,9 @@
               <th>Stock máximo</th>
             <% end %>
             <th>Existencia</th>
-            <th>Precio</th>
+            <% if current_user.usertype != "S" %>
+              <th>Precio</th>
+            <% end %>
           </tr>
         </thead>
         <tbody>
@@ -33,9 +35,9 @@
   });
 
   $('body').barcodeListener().on('barcode.valid', function(e, code) {
-      $('input[type=search]').val(code);
-      $('#pointsale_stock input').unbind();
-      $('#pointsale_stock').dataTable().fnFilter(code);
+    $('input[type=search]').val(code);
+    $('#pointsale_stock input').unbind();
+    $('#pointsale_stock').dataTable().fnFilter(code);
   });
 
   $('#category, #sub_category, #pointsale').on('change', function(e) {
@@ -45,26 +47,25 @@
   });
 
   function getSub_categories() {
-      $('#sub_category').attr('disabled', true);
-      category =  $('#category').val() ? $('#category').val() : 0;
-      $.ajax({
-        type: "get",
-        url:  '/getcategories/' + category,
-        dataType: 'json',
-        success: function(data) {
-          $('#sub_category').html('');
-          for (var i = 0; i < data.length; i++) {
-            $('#sub_category').append($('<option>', {
-                value: data[i].id,
-                text : data[i].category
-            }));
-
-          }
-          $('#sub_category').select2({ allowClear: true, placeholder: 'Todas'});
-          $('#sub_category').attr('disabled', false);
-          $('#sub_category').select2('val', null);
+    $('#sub_category').attr('disabled', true);
+    category =  $('#category').val() ? $('#category').val() : 0;
+    $.ajax({
+      type: "get",
+      url:  '/getcategories/' + category,
+      dataType: 'json',
+      success: function(data) {
+        $('#sub_category').html('');
+        for (var i = 0; i < data.length; i++) {
+          $('#sub_category').append($('<option>', {
+            value: data[i].id,
+            text : data[i].category
+          }));
         }
-      });
+        $('#sub_category').select2({ allowClear: true, placeholder: 'Todas'});
+        $('#sub_category').attr('disabled', false);
+        $('#sub_category').select2('val', null);
+      }
+    });
   }
 
   function getTotalProducts() {
@@ -76,8 +77,8 @@
     if (sub_category) { uri += '&sub_category=' + sub_category; }
 
     App.blockUI({
-         target: $("#container_total_prods"),
-         animate: true
+      target: $("#container_total_prods"),
+      animate: true
     });
 
     $.ajax({
@@ -123,6 +124,3 @@
     });
   }
 </script>
-
-
-