1 #=====================================================================
4 # Based on SQL-Ledger Version 2.1.9
5 # Web http://www.lx-office.org
7 #=====================================================================
8 # SQL-Ledger Accounting
11 # Author: Dieter Simader
12 # Email: dsimader@sql-ledger.org
13 # Web: http://www.sql-ledger.org
17 # This program is free software; you can redistribute it and/or modify
18 # it under the terms of the GNU General Public License as published by
19 # the Free Software Foundation; either version 2 of the License, or
20 # (at your option) any later version.
22 # This program is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU General Public License for more details.
26 # You should have received a copy of the GNU General Public License
27 # along with this program; if not, write to the Free Software
28 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 #=====================================================================
31 # this is the default code for the Check package
33 #=====================================================================
39 %{ $self->{numbername} } =
79 my ($self, $amount) = @_;
81 return $self->{numbername}{0} unless $amount;
85 # split amount into chunks of 3
86 my @num = reverse split //, $amount;
96 push @numblock, join / /, reverse @a;
102 @num = split //, $numblock[$i];
104 if ($numblock[$i] == 0) {
109 if ($numblock[$i] > 99) {
110 # the one from hundreds
111 push @textnumber, $self->{numbername}{$num[0]};
113 # add hundred designation
114 push @textnumber, $self->{numbername}{10**2};
117 $numblock[$i] -= $num[0] * 100;
123 if ($numblock[$i] > 9) {
125 push @textnumber, $self->format_ten($numblock[$i]);
126 } elsif ($numblock[$i] > 0) {
128 push @textnumber, $self->{numbername}{$numblock[$i]};
131 # add thousand, million
134 push @textnumber, $self->{numbername}{$num};
141 join ' ', @textnumber;
147 my ($self, $amount) = @_;
150 my @num = split //, $amount;
153 $textnumber = $self->{numbername}{$num[0]*10};
156 $textnumber = $self->{numbername}{$amount};
160 $textnumber .= " ".$self->{numbername}{$amount} if $amount;