--- /dev/null
+#=====================================================================\r
+# SQL-Ledger Accounting\r
+# Copyright (C) 2001\r
+#\r
+# Author: Dieter Simader\r
+# Email: dsimader@sql-ledger.org\r
+# Web: http://www.sql-ledger.org\r
+# Modified by: Medgyesi Aniko\r
+# **********************************\r
+# *#MEA1 * Hungarian version *\r
+# **********************************\r
+# Contributors:\r
+#\r
+# This program is free software; you can redistribute it and/or modify\r
+# it under the terms of the GNU General Public License as published by\r
+# the Free Software Foundation; either version 2 of the License, or\r
+# (at your option) any later version.\r
+#\r
+# This program is distributed in the hope that it will be useful,\r
+# but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+# GNU General Public License for more details.\r
+# You should have received a copy of the GNU General Public License\r
+# along with this program; if not, write to the Free Software\r
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.\r
+#=====================================================================\r
+#\r
+# this is the default code for the Check package\r
+#\r
+#=====================================================================\r
+\r
+sub init {\r
+ my $self = shift;\r
+#MEA1 English number ignored\r
+# %{ $self->{numbername} } =\r
+# (0 => 'Zero',\r
+# 1 => 'One',\r
+# 2 => 'Two',\r
+# 3 => 'Three',\r
+# 4 => 'Four',\r
+# 5 => 'Five',\r
+# 6 => 'Six',\r
+# 7 => 'Seven',\r
+# 8 => 'Eight',\r
+# 9 => 'Nine',\r
+# 10 => 'Ten',\r
+# 11 => 'Eleven',\r
+# 12 => 'Twelve',\r
+# 13 => 'Thirteen',\r
+# 14 => 'Fourteen',\r
+# 15 => 'Fifteen',\r
+# 16 => 'Sixteen',\r
+# 17 => 'Seventeen',\r
+# 18 => 'Eighteen',\r
+# 19 => 'Nineteen',\r
+# 20 => 'Twenty',\r
+# 30 => 'Thirty',\r
+# 40 => 'Forty',\r
+# 50 => 'Fifty',\r
+# 60 => 'Sixty',\r
+# 70 => 'Seventy',\r
+# 80 => 'Eighty',\r
+# 90 => 'Ninety',\r
+# 10**2 => 'Hundred',\r
+# 10**3 => 'Thousand',\r
+# 10**6 => 'Million',\r
+# 10**9 => 'Billion',\r
+# 10**12 => 'Trillion',\r
+# );\r
+#MEA1BEG Hungarian numbers\r
+ %{ $self->{numbername} } =\r
+ (0 => 'Nulla',\r
+ 1 => 'egy',\r
+ 2 => 'kettõ',\r
+ 3 => 'három',\r
+ 4 => 'négy',\r
+ 5 => 'öt',\r
+ 6 => 'hat',\r
+ 7 => 'hét',\r
+ 8 => 'nyolc',\r
+ 9 => 'kilenc',\r
+ 10 => 'tíz',\r
+ 11 => 'tizenegy',\r
+ 12 => 'tizenkettõ',\r
+ 13 => 'tizenhárom',\r
+ 14 => 'tizennégy',\r
+ 15 => 'tizenöt',\r
+ 16 => 'tizenhat',\r
+ 17 => 'tizenhét',\r
+ 18 => 'tizennyolc',\r
+ 19 => 'tizenkilenc',\r
+ 20 => 'húsz',\r
+ 21 => 'huszonegy',\r
+ 22 => 'huszonkettõ',\r
+ 23 => 'huszonhárom',\r
+ 24 => 'huszonnégy',\r
+ 25 => 'huszonöt',\r
+ 26 => 'huszonhat',\r
+ 27 => 'huszonhét',\r
+ 28 => 'huszonnyolc',\r
+ 29 => 'huszonkilenc',\r
+ 30 => 'harminc',\r
+ 40 => 'negyven',\r
+ 50 => 'ötven',\r
+ 60 => 'hatvan',\r
+ 70 => 'hetven',\r
+ 80 => 'nyolcvan',\r
+ 90 => 'kilencven',\r
+ 10**2 => 'száz',\r
+ 10**3 => 'ezer',\r
+ 10**6 => 'millió',\r
+ 10**9 => 'milliárd',\r
+ 10**12 => 'billió',\r
+ );\r
+#MEA1END\r
+\r
+}\r
+\r
+\r
+sub num2text {\r
+ my ($self, $amount) = @_;\r
+\r
+ return $self->{numbername}{0} unless $amount;\r
+\r
+ my @textnumber = ();\r
+\r
+ # split amount into chunks of 3\r
+ my @num = reverse split //, abs($amount);\r
+ my @numblock = ();\r
+ my @a;\r
+ my $i;\r
+#MEA1BEG\r
+ my $res;\r
+#MEA1END\r
+ while (@num) {\r
+ @a = ();\r
+ for (1 .. 3) {\r
+ push @a, shift @num;\r
+ }\r
+ push @numblock, join / /, reverse @a;\r
+ }\r
+ while (@numblock) {\r
+ $i = $#numblock;\r
+ @num = split //, $numblock[$i];\r
+\r
+ if ($numblock[$i] == 0) {\r
+ pop @numblock;\r
+ next;\r
+ }\r
+ if ($numblock[$i] > 99) {\r
+ push @textnumber, $self->{numbername}{$num[0]};\r
+\r
+ # add hundred designation\r
+ push @textnumber, $self->{numbername}{10**2};\r
+\r
+ # reduce numblock\r
+ $numblock[$i] -= $num[0] * 100;\r
+\r
+ }\r
+\r
+ $numblock[$i] *= 1;\r
+ if ($numblock[$i] > 9) {\r
+ # tens\r
+ push @textnumber, $self->format_ten($numblock[$i]);\r
+ } elsif ($numblock[$i] > 0) {\r
+ # ones\r
+ push @textnumber, $self->{numbername}{$numblock[$i]};\r
+ }\r
+\r
+ # add thousand, million\r
+ if ($i) {\r
+#MEA1BEG above 2000 need hyphen between treegroups\r
+# if ($numblock[$i] > 9) {\r
+# push @textnumber, $self->format_ten($numblock[$i]);\r
+# } elsif ($numblock[$i] > 0) {\r
+# push @textnumber, $self->{numbername}{$numblock[$i]};\r
+# }\r
+ if ($i==1 && $amount < 2000){\r
+\r
+ $num = 10**($i * 3);\r
+ push @textnumber, $self->{numbername}{$num};\r
+ } else {\r
+\r
+ $num = 10**($i * 3);\r
+ push @textnumber, $self->{numbername}{$num}."-";\r
+ }\r
+#MEA1END\r
+ }\r
+\r
+ pop @numblock;\r
+\r
+ }\r
+#MEA1BEG First charachter is uppercase\r
+# join '', @textnumber;\r
+ $res=ucfirst join '', @textnumber;\r
+#MEA1END\r
+#MEA1BEG remove last hyphen\r
+ $res=~s/(\-)$//;\r
+ return $res;\r
+#MEA1END\r
+\r
+\r
+}\r
+\r
+\r
+sub format_ten {\r
+ my ($self, $amount) = @_;\r
+\r
+ my $textnumber = "";\r
+ my @num = split //, $amount;\r
+#MEA1BEG above 30 not above 20\r
+# if ($amount > 30) {\r
+ if ($amount > 30) {\r
+#MEA1END\r
+ $textnumber = $self->{numbername}{$num[0]*10};\r
+ $amount = $num[1];\r
+ } else {\r
+ $textnumber = $self->{numbername}{$amount};\r
+ $amount = 0;\r
+ }\r
+\r
+ $textnumber .= "".$self->{numbername}{$amount} if $amount;\r
+\r
+ $textnumber;\r
+\r
+}\r
+\r
+\r
+1;\r
+\r
+\r
+\r