1 #=====================================================================
2 # SQL-Ledger Accounting
5 # Author: Dieter Simader
6 # Email: dsimader@sql-ledger.org
7 # Web: http://www.sql-ledger.org
9 # Contributors: Bruno Leveque <bruno.leveque@net6d.com>
11 # This program is free software; you can redistribute it and/or modify
12 # it under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2 of the License, or
14 # (at your option) any later version.
16 # This program is distributed in the hope that it will be useful,
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #=====================================================================
25 # this is the french code for printing numbers in text
27 #=====================================================================
33 %{ $self->{numbername} } =
61 90 => 'Quatre-vingt-dix',
73 my ($self, $amount) = @_;
75 return $self->{numbername}{0} unless $amount;
79 # split amount into chunks of 3
80 my @num = reverse split //, abs($amount);
90 push @numblock, join / /, reverse @a;
98 @num = split //, $numblock[$i];
100 if ($numblock[$i] == 0) {
105 if ($numblock[$i] > 99) {
108 # the one from hundreds
111 push @textnumber, $self->{numbername}{$num[0]};
115 $numblock[$i] -= $num[0] * 100;
117 # add hundred designation
119 if($numblock[$i] > 0) {
120 push @textnumber, $self->{numbername}{10**2};
122 push @textnumber, "$self->{numbername}{10**2}s";
125 push @textnumber, $self->{numbername}{10**2};
132 if ($numblock[$i] > 9) {
134 push @textnumber, $self->format_ten($numblock[$i]);
135 } elsif ($numblock[$i] > 0) {
139 push @textnumber, $self->{numbername}{$numblock[$i]};
143 push @textnumber, $self->{numbername}{$numblock[$i]};
147 # add thousand, million
151 push @textnumber, $self->{numbername}{$num};
152 } elsif ($numblock[$i] > 1) {
153 push @textnumber, "$self->{numbername}{$num}s";
155 push @textnumber, "$self->{numbername}{$num}";
163 join ' ', @textnumber;
169 my ($self, $amount) = @_;
172 my @num = split //, $amount;
177 $textnumber = $self->{numbername}{$num[0]*10};
179 $textnumber = "$self->{numbername}{$num[0]*10}s";
182 $textnumber = $self->{numbername}{$num[0]*10};
186 $textnumber = "$self->{numbername}{$amount}I";
190 $textnumber .= " ".$self->{numbername}{$amount} if $amount;