X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=sql-ledger%2Flocale%2Fee%2FNum2text;fp=sql-ledger%2Flocale%2Fee%2FNum2text;h=0000000000000000000000000000000000000000;hp=1e8975bc418b5f197db7c20faeead9cf011edf13;hb=86b1b489a4ed2f9bc0cba6cafeab0d6eca5584dc;hpb=948b8acdd4b9b3864342062d0c397a11f57c5700 diff --git a/sql-ledger/locale/ee/Num2text b/sql-ledger/locale/ee/Num2text deleted file mode 100644 index 1e8975bc4..000000000 --- a/sql-ledger/locale/ee/Num2text +++ /dev/null @@ -1,134 +0,0 @@ -#===================================================================== -# SQL-Ledger Accounting -# Copyright (C) 2003 -# -# Author: Dieter Simader -# Email: dsimader@sql-ledger.org -# Web: http://www.sql-ledger.org -# -# Contributors: Mario R. Pizzolanti -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -#====================================================================== -# -# written for check and receipt printing -# it returns a properly formatted text string -# for a number up to 10**9 - -sub init { - my $self = shift; - - %{ $self->{numbername} } = - (0 => 'null', - 1 => 'üks', - 2 => 'kaks', - 3 => 'kolm', - 4 => 'neli', - 5 => 'viis', - 6 => 'kuus', - 7 => 'seitse', - 8 => 'kaheksa', - 9 => 'üheksa', - 10 => 'kümme', - 10**2 => 'sada', - 10**3 => 'tuhat', - 10**6 => 'miljon', - 10**9 => 'miljard', - 10**12 => 'biljon' - ); - -} - - -sub num2text { - my ($self, $amount) = @_; - - return $self->{numbername}{0} unless $amount; - - my @textnumber = (); - - # split amount into chunks of 3 - my @num = reverse split //, abs($amount); - my @numblock = (); - my ($i, $appendit); - my @a = (); - - while (@num) { - @a = (); - for (1 .. 3) { - push @a, shift @num; - } - push @numblock, join / /, reverse @a; - } - - while (@numblock) { - - $i = $#numblock; - @num = split //, $numblock[$i]; - - $numblock[$i] *= 1; - - $appendit = "it"; - - if ($numblock[$i] == 0) { - pop @numblock; - next; - } - - if ($numblock[$i] > 99) { - # the one from hundreds - push @textnumber, "$self->{numbername}{$num[0]}$self->{numbername}{10**2}"; - - # reduce numblock - $numblock[$i] -= $num[0] * 100; - } - - if ($numblock[$i] > 19) { - # 20 - 99 - push @textnumber, "$self->{numbername}{$num[1]}kümmend"; - @num = split //, $numblock[$i]; - push @textnumber, $self->{numbername}{$num[1]} if $num[1] > 0; - - } elsif ($numblock[$i] > 10) { - # 11 - 19 - push @textnumber, "$self->{numbername}{$num[1]}teist"; - - } elsif ($numblock[$i] > 1) { - # ones - push @textnumber, $self->{numbername}{$numblock[$i]}; - - } elsif ($numblock[$i] == 1) { - push @textnumber, $self->{numbername}{$num[0]}; - $appendit = ""; - - } - - # add thousand, million - if ($i) { - $amount = 10**($i * 3); - $appendit = ($i == 1) ? "" : $appendit; - push @textnumber, "$self->{numbername}{$amount}$appendit"; - } - - pop @numblock; - - } - - join ' ', @textnumber; - -} - - -1; -