1 /**********************************************************************
2 Copyright (C) FrontAccounting, LLC.
3 Released under the terms of the GNU Affero General Public License,
4 AGPL, as published by the Free Software Foundation, either version
5 3 of the License, or (at your option) any later version.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 See the License here <http://www.gnu.org/licenses/agpl-3.0.html>.
10 ***********************************************************************/
11 function focus_budget(i) {
13 i.setAttribute('_last', get_amount(i.name));
16 function blur_budget(i) {
17 var amount = get_amount(i.name);
18 var total = get_amount('Total', 1);
20 if(amount<0) amount = 0;
21 price_format(i.name, amount, 0);
22 price_format('Total', total+amount-i.getAttribute('_last'), 0, 1, 1);
27 '.amount': function(e) {
28 e.onblur = function() {
31 e.onfocus = function() {
37 Behaviour.register(budget_calc);