X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=js%2Fpayalloc.js;h=a711e603cb40daf97dcc8924cefb339c5714eabd;hb=a9f8bc40287ef12f16ad863d4acb1af3d18643b6;hp=7bdd991483cac7f689082799c4ae30785006cbf8;hpb=74eabb5769f01203484f13b9736c8a56011b48f4;p=fa-stable.git diff --git a/js/payalloc.js b/js/payalloc.js index 7bdd9914..a711e603 100644 --- a/js/payalloc.js +++ b/js/payalloc.js @@ -14,8 +14,12 @@ function focus_alloc(i) { } function blur_alloc(i) { - var change = get_amount(i.name); - price_format(i.name, change, user.pdec); + var change = get_amount(i.name); + + if (i.name != 'amount' && i.name != 'charge' && i.name != 'discount') + change = Math.min(change, get_amount('maxval'+i.name.substr(6), 1)) + + price_format(i.name, change, user.pdec); if (i.name != 'amount' && i.name != 'charge') { if (change<0) change = 0; change = change-i.getAttribute('_last'); @@ -52,12 +56,20 @@ function allocate_none(doc) { var allocations = { '.amount': function(e) { - e.onblur = function() { - blur_alloc(this); + if(e.name == 'allocated_amount' || e.name == 'bank_amount') + { + e.onblur = function() { + var dec = this.getAttribute("dec"); + price_format(this.name, get_amount(this.name), dec); }; - e.onfocus = function() { - focus_alloc(this); - }; + } else { + e.onblur = function() { + blur_alloc(this); + }; + e.onfocus = function() { + focus_alloc(this); + }; + } } }