From: Janusz Dobrowolski Date: Mon, 23 Jun 2008 20:59:39 +0000 (+0000) Subject: Improved clientside allocation routines. X-Git-Tag: v2.4.2~19^2~1980 X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=commitdiff_plain;h=61a418c058efb9680d54f05059ada1b557d4500e;p=fa-stable.git Improved clientside allocation routines. --- diff --git a/js/allocate.js b/js/allocate.js index 077af675..c550a298 100644 --- a/js/allocate.js +++ b/js/allocate.js @@ -1,28 +1,56 @@ +function focus_alloc(i) { + save_focus(i); + i.setAttribute('_last', get_amount(i.name)); +} + +function blur_alloc(i) { + var change = get_amount(i.name); + price_format(i.name, change, user.pdec); + if(change<0) change = 0; + change = change-i.getAttribute('_last'); + var total = get_amount('total_allocated', 1)+change; + var left = get_amount('left_to_allocate', 1)-change; + + price_format('left_to_allocate', left, user.pdec, 1, 1); + price_format('total_allocated', total, user.pdec, 1, 1); +} + function allocate_all(doc) { var amount = get_amount('amount'+doc); var unallocated = get_amount('un_allocated'+doc); var total = get_amount('total_allocated', 1); var left = get_amount('left_to_allocate', 1); - - if(unallocated