Inventory Adjustment: negative adjustment should always use current average item...
[fa-stable.git] / js / inserts.js
index 773fc8f4f7f1b8b8a37c82e20bbe1938cef19602..40337e7a94a68e7bc2df0c3fa0bfc02e36c289a2 100644 (file)
@@ -346,11 +346,18 @@ var inserts = {
                                return false;
                        }
        },
-    '.amount': function(e) {
-               if(e.onblur==undefined) {
+       '.amount': function(e) {
+               if (e.onblur == undefined) {
+                 e.setAttribute('_last_val', e.value);
                  e.onblur = function() {
                        var dec = this.getAttribute("dec");
-                       price_format(this.name, get_amount(this.name), dec);
+                       var val = this.getAttribute('_last_val');
+                       if (val != get_amount(this.name)) {
+                               this.setAttribute('_last_val', get_amount(this.name));
+                               price_format(this.name, get_amount(this.name), dec);
+                               if (e.className.match(/\bactive\b/))
+                                       JsHttpRequest.request('_'+this.name+'_changed', this.form);
+                       }
                  };
                }
        },