Koha/koha-tmpl/intranet-tmpl/prog/en/includes/format_price.inc
Jonathan Druart f37bb4ed49 Bug 12987: Update table footer with the visible rows
This patch is the preparation step for others.

On acqui/acqui-home.pl and admin/aqbudgets.pl, it will be possible to
see the totals in the footer updated with the filtered rows.

Test plan:
This cannot be tested alone, you have to apply it with others (see the
"Blocked" bug reports).

Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2014-11-11 09:46:21 -03:00

27 lines
1.2 KiB
C++

[% USE Koha %]
<script type="text/javascript">
[%# This should use the Format template plugin, but not pushed yet %]
[% IF Koha.Preference("CurrencyFormat") == 'FR' %]
var default_value = {
thousands_sep: ' ',
decimal_point: ',',
decimal_digits: 2
};
[% ELSE %]
var default_value = {
thousands_sep: ',',
decimal_point: '.',
decimal_digits: 2
};
[% END %]
Number.prototype.format_price = function( value, params ) {
params = params == undefined ? {} : params;
var thousands_sep = params.thousands_sep == undefined ? default_value.thousands_sep : params.thousands_sep,
decimal_point = params.decimal_point == undefined ? default_value.decimal_point : params.decimal_point,
//symbol = params.symbol == undefined ? '$' : params.symbol, // Not implemented yet
decimal_digits = params.decimal_digits == undefined ? default_value.decimal_digits : params.decimal_digits;
var re = '\\d(?=(\\d{' + 3 + '})+' + '\\D' + ')', value = this.toFixed(decimal_digits);
return value.replace('.', decimal_point).replace(new RegExp(re, 'g'), '$&' + thousands_sep);
}
</script>