Javascript for bank reconciliation page.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 15 Jan 2009 14:59:15 +0000 (14:59 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Thu, 15 Jan 2009 14:59:15 +0000 (14:59 +0000)
js/reconcile.js [new file with mode: 0644]

diff --git a/js/reconcile.js b/js/reconcile.js
new file mode 100644 (file)
index 0000000..badeaa0
--- /dev/null
@@ -0,0 +1,28 @@
+function focus_amount(i) {
+    save_focus(i);
+       i.setAttribute('_last', get_amount(i.name));
+}
+
+function blur_amount(i) {
+       var change = get_amount(i.name);
+
+       price_format(i.name, change, user.pdec);
+       change = change-i.getAttribute('_last');
+       if (i.name=='beg_balance')
+               change = -change;
+
+       price_format('difference', get_amount('difference',1,1)+change, user.pdec);
+}
+
+var balances = {
+       '.amount': function(e) {
+               e.onblur = function() {
+                       blur_amount(this);
+                 };
+               e.onfocus = function() {
+                       focus_amount(this);
+               };
+       }
+}
+
+Behaviour.register(balances);