mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
First attempt at #142. Needs a lot of work still.
This commit is contained in:
@@ -32,23 +32,6 @@ var colourSet = [
|
||||
|
||||
];
|
||||
|
||||
// Settings object that controls default parameters for library methods:
|
||||
accounting.settings = {
|
||||
currency: {
|
||||
symbol: currencySymbol, // default currency symbol is '$'
|
||||
format: "%s %v", // controls output: %s = symbol, %v = value/number (can be object: see below)
|
||||
decimal: mon_decimal_point, // decimal point separator
|
||||
thousand: mon_thousands_sep, // thousands separator
|
||||
precision: frac_digits // decimal places
|
||||
},
|
||||
number: {
|
||||
precision: 0, // default precision on numbers is 0
|
||||
thousand: ",",
|
||||
decimal: "."
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var fillColors = [];
|
||||
var strokePointHighColors = [];
|
||||
|
||||
|
@@ -98,3 +98,18 @@ function currencySelect(e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Settings object that controls default parameters for library methods:
|
||||
accounting.settings = {
|
||||
currency: {
|
||||
symbol: currencySymbol, // default currency symbol is '$'
|
||||
format: "%s %v", // controls output: %s = symbol, %v = value/number (can be object: see below)
|
||||
decimal: mon_decimal_point, // decimal point separator
|
||||
thousand: mon_thousands_sep, // thousands separator
|
||||
precision: frac_digits // decimal places
|
||||
},
|
||||
number: {
|
||||
precision: 0, // default precision on numbers is 0
|
||||
thousand: ",",
|
||||
decimal: "."
|
||||
}
|
||||
};
|
||||
|
49
public/js/ff/split/journal/from-store.js
Normal file
49
public/js/ff/split/journal/from-store.js
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* from-store.js
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
/* globals globalSum */
|
||||
|
||||
$(function () {
|
||||
"use strict";
|
||||
$('.btn-do-split').click(cloneRow);
|
||||
$('input[name="amount[]"]').on('input', calculateSum)
|
||||
});
|
||||
|
||||
function cloneRow() {
|
||||
"use strict";
|
||||
var source = $('.initial-row').clone();
|
||||
var count = $('.split-table tbody tr').length + 1;
|
||||
source.removeClass('initial-row');
|
||||
source.find('.count').text('#' + count);
|
||||
source.find('input[name="amount[]"]').val("").on('input', calculateSum);
|
||||
|
||||
$('.split-table tbody').append(source);
|
||||
|
||||
calculateSum();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function calculateSum() {
|
||||
"use strict";
|
||||
var sum = 0;
|
||||
var set = $('input[name="amount[]"]');
|
||||
for (var i = 0; i < set.length; i++) {
|
||||
var current = $(set[i]);
|
||||
sum += (current.val() == "" ? 0 : parseFloat(current.val()));
|
||||
|
||||
}
|
||||
console.log("Sum is now " + sum);
|
||||
$('.amount-warning').remove();
|
||||
if (sum != originalSum) {
|
||||
console.log(sum + ' does not match ' + originalSum);
|
||||
var holder = $('#amount_holder');
|
||||
var par = holder.find('p.form-control-static');
|
||||
var amount = $('<span>').text(' (' + accounting.formatMoney(sum) + ')').addClass('text-danger amount-warning').appendTo(par);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user