|
Lines 79-85
sub round {
Link Here
|
| 79 |
|
79 |
|
| 80 |
sub _format_params { |
80 |
sub _format_params { |
| 81 |
my ( $self, $params ) = @_; |
81 |
my ( $self, $params ) = @_; |
| 82 |
my $with_symbol = $params->{with_symbol} || 0; |
82 |
my $with_symbol = $params->{with_symbol}; |
| 83 |
my $p_cs_precedes = $params->{p_cs_precedes}; |
83 |
my $p_cs_precedes = $params->{p_cs_precedes}; |
| 84 |
my $p_sep_by_space = $params->{p_sep_by_space}; |
84 |
my $p_sep_by_space = $params->{p_sep_by_space}; |
| 85 |
my $currency = GetCurrency(); |
85 |
my $currency = GetCurrency(); |
|
Lines 92-112
sub _format_params {
Link Here
|
| 92 |
mon_decimal_point => '.' |
92 |
mon_decimal_point => '.' |
| 93 |
); |
93 |
); |
| 94 |
|
94 |
|
| 95 |
if ( $currency_format eq 'FR' ) { |
95 |
if ( $currency_format =~ m/(_LEAD)/ ) { |
| 96 |
# FIXME This test should be done for all currencies |
96 |
$p_cs_precedes = 1 unless ( defined $p_cs_precedes ); |
| 97 |
$int_curr_symbol = $currency->{symbol} if $with_symbol; |
97 |
} |
| 98 |
%format_params = ( |
98 |
|
| 99 |
decimal_fill => '2', |
99 |
if ( $currency_format =~ m/(_TRAIL)/ ) { |
| 100 |
decimal_point => ',', |
100 |
$p_cs_precedes = 0 unless ( defined $p_cs_precedes ); |
| 101 |
int_curr_symbol => $int_curr_symbol, |
101 |
} |
| 102 |
mon_thousands_sep => ' ', |
102 |
|
| 103 |
thousands_sep => ' ', |
103 |
$format_params{'p_cs_precedes'} = $p_cs_precedes |
| 104 |
mon_decimal_point => ',' |
104 |
if ( defined $p_cs_precedes ); |
| 105 |
); |
105 |
|
|
|
106 |
if ( $currency_format =~ m/(_SPACE)/ ) { |
| 107 |
$p_sep_by_space = 1 unless ( $p_sep_by_space ); |
| 108 |
} |
| 109 |
else { |
| 110 |
$p_sep_by_space = 0 unless ( $p_sep_by_space ); |
| 111 |
} |
| 112 |
|
| 113 |
$format_params{'p_sep_by_space'} = $p_sep_by_space; |
| 114 |
|
| 115 |
if ( $currency_format =~ m/(SYMB)/ ) { |
| 116 |
$with_symbol = 1 unless ( defined $with_symbol ); |
| 117 |
} |
| 118 |
|
| 119 |
$format_params{'int_curr_symbol'} = $currency->{symbol} |
| 120 |
if ( $with_symbol ); |
| 121 |
|
| 122 |
# $format_params{'int_curr_symbol'} = "xxxxxxxxxxxxxx"; |
| 123 |
|
| 124 |
# TODO Add more currency formats (Syspref CurrencyFormat) |
| 125 |
|
| 126 |
# syspref FR: 360 000,00 |
| 127 |
if ( $currency_format =~ m/(^FR)/ ) { |
| 128 |
$format_params{'decimal_fill'} = '2'; |
| 129 |
$format_params{'decimal_point'} = ','; |
| 130 |
$format_params{'mon_decimal_point'} = ','; |
| 131 |
$format_params{'thousands_sep'} = ' '; |
| 132 |
$format_params{'mon_thousands_sep'} = ' '; |
| 133 |
} |
| 134 |
|
| 135 |
# syspref US: 360,000.00 |
| 136 |
if ( $currency_format =~ m/(^US)/ ) { |
| 137 |
$format_params{'decimal_fill'} = '2'; |
| 138 |
$format_params{'decimal_point'} = '.'; |
| 139 |
$format_params{'mon_decimal_point'} = '.'; |
| 140 |
$format_params{'thousands_sep'} = ','; |
| 141 |
$format_params{'mon_thousands_sep'} = ','; |
| 142 |
} |
| 143 |
|
| 144 |
# syspref CH: 360'000.00 |
| 145 |
if ( $currency_format =~ m/(^CH)/ ) { |
| 146 |
$format_params{'decimal_fill'} = '2'; |
| 147 |
$format_params{'decimal_point'} = '.'; |
| 148 |
$format_params{'mon_decimal_point'} = '.'; |
| 149 |
$format_params{'thousands_sep'} = '\''; |
| 150 |
$format_params{'mon_thousands_sep'} = '\''; |
| 106 |
} |
151 |
} |
| 107 |
|
152 |
|
| 108 |
$format_params{p_cs_precedes} = $p_cs_precedes if defined $p_cs_precedes; |
|
|
| 109 |
$format_params{p_sep_by_space} = ( $int_curr_symbol and defined $p_sep_by_space ) ? $p_sep_by_space : 0; |
| 110 |
|
153 |
|
| 111 |
return \%format_params; |
154 |
return \%format_params; |
| 112 |
} |
155 |
} |