瀏覽代碼

Merge branch 'chemi_branch' of SML/pos-boutique into master

Jose Miguel Ledon 7 年之前
父節點
當前提交
74dcc79e94

+ 1 - 0
app/controllers/pre_sales_controller.rb

@@ -123,6 +123,7 @@ class PreSalesController < ApplicationController
         @pre_sale.open_cash_register_id = params[:open_cash_register_id]
         @pre_sale.product_id = @product.id
         @pre_sale.sale_type = params[:sale_type]
+        @pre_sale.quantity = 1
 
         #precio unitario
         @pre_sale.unit_price = @pre_sale.product.get_price_sale(OpenCashRegister.find(@pre_sale.open_cash_register_id).pointsale.id)

+ 2 - 2
app/views/available_products/_form_stock_printable.html.erb

@@ -40,9 +40,9 @@
     endChar: [13], // be sure the scan is complete if key 13 (enter) is detected
     avgTimeByChar: 40, // it's not a barcode if a character takes longer than 40ms
     onComplete: function(barcode, qty){
-      $('input[type=search]').val(code);
+      $('input[type=search]').val(barcode);
       $('#pointsale_stock input').unbind();
-      $('#pointsale_stock').dataTable().fnFilter(code);
+      $('#pointsale_stock').dataTable().fnFilter(barcode);
     }
   });
 

+ 8 - 6
app/views/products/_form.html.erb

@@ -314,12 +314,14 @@
   });
 
 	<% if @product.barcode.blank? %>
-		$('#product_barcode').codeScanner({
-			maxEntryTime: 100, // milliseconds
-			minEntryChars: 7,  // characters
-			onScan: function ($element, code) {
-				$('#product_barcode').val(code);
-				validateBarcode(code);
+		$(document).scannerDetection({
+			timeBeforeScanTest: 200, // wait for the next character for upto 200ms
+			startChar: [120], // Prefix character for the cabled scanner (OPL6845R)
+			endChar: [13], // be sure the scan is complete if key 13 (enter) is detected
+			avgTimeByChar: 40, // it's not a barcode if a character takes longer than 40ms
+			onComplete: function(barcode, qty){
+				$('#product_barcode').val(barcode);
+				validateBarcode(barcode);
 			}
 		});
 	<% end %>

+ 8 - 6
app/views/products/_form_remote.html.erb

@@ -329,12 +329,14 @@
 		$('.fileinput').fileinput();
 
 		<% if @product.barcode.blank? %>
-			$('#product_barcode').codeScanner({
-				maxEntryTime: 100, // milliseconds
-				minEntryChars: 7,  // characters
-				onScan: function ($element, code) {
-					$('#product_barcode').val(code);
-					validateBarcode(code);
+			$(document).scannerDetection({
+				timeBeforeScanTest: 200, // wait for the next character for upto 200ms
+				startChar: [120], // Prefix character for the cabled scanner (OPL6845R)
+				endChar: [13], // be sure the scan is complete if key 13 (enter) is detected
+				avgTimeByChar: 40, // it's not a barcode if a character takes longer than 40ms
+				onComplete: function(barcode, qty){
+					$('#product_barcode').val(barcode);
+					validateBarcode(barcode);
 				}
 			});
 		<% end %>

+ 1 - 1
app/views/sales/_form.html.erb

@@ -247,7 +247,7 @@
 			<div class="row">
 				<div class="col-md-9">
 					<button type="button" class="btn green" onclick="addSale()" id="save_sale">Guardar venta</button>
-					<%= link_to 'Cancelar', sales_path(:filter => @filter, :current_page => @current_page), {:class=>"btn default"} %>
+					<button type="button" class="btn default" onclick="deletePreSales()" id="save_sale">Cancelar</button>
 				</div>
 			</div>
 		</div>