mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44:06 -08:00
Merge pull request #9953 from uberbrady/fix_bootstrap_sum_formatter
Fixed ch17133 - Fixed sum total calculation on Bootstrap Table pages -
This commit is contained in:
commit
f5112b47cd
|
@ -595,11 +595,23 @@
|
|||
}
|
||||
}
|
||||
|
||||
function cleanFloat(number) {
|
||||
if ("{{$snipeSettings->digit_separator}}" == "1.234,56") {
|
||||
// yank periods, change commas to periods
|
||||
periodless = number.toString().replace("\.","");
|
||||
decimalfixed = periodless.replace(",",".");
|
||||
} else {
|
||||
// yank commas, that's it.
|
||||
decimalfixed = number.toString().replace(",","");
|
||||
}
|
||||
return parseFloat(decimalfixed);
|
||||
}
|
||||
|
||||
function sumFormatter(data) {
|
||||
if (Array.isArray(data)) {
|
||||
var field = this.field;
|
||||
var total_sum = data.reduce(function(sum, row) {
|
||||
return (sum) + (parseFloat(row[field]) || 0);
|
||||
return (sum) + (cleanFloat(row[field]) || 0);
|
||||
}, 0);
|
||||
return numberWithCommas(total_sum.toFixed(2));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue