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 #=====================================================================
 
  40   %{ $self->{numbername} } = (0      => 'Zero',
 
  72                               10**12 => 'Trillion',);
 
  77   my ($self, $amount) = @_;
 
  79   return $self->{numbername}{0} unless $amount;
 
  83   # split amount into chunks of 3
 
  84   my @num = reverse split //, $amount;
 
  92       push(@a, shift(@num));
 
  94     push(@numblock, join(" ", reverse @a));
 
 100     @num = split(//, $numblock[$i]);
 
 102     if ($numblock[$i] == 0) {
 
 107     if ($numblock[$i] > 99) {
 
 109       # the one from hundreds
 
 110       push(@textnumber, $self->{numbername}{ $num[0] });
 
 112       # add hundred designation
 
 113       push(@textnumber, $self->{numbername}{ 10**2 });
 
 116       $numblock[$i] -= $num[0] * 100;
 
 122     if ($numblock[$i] > 9) {
 
 125       push(@textnumber, $self->format_ten($numblock[$i]));
 
 126     } elsif ($numblock[$i] > 0) {
 
 129       push(@textnumber, $self->{numbername}{ $numblock[$i] });
 
 132     # add thousand, million
 
 134       my $num = 10**($i * 3);
 
 135       push(@textnumber, $self->{numbername}{$num});
 
 142   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;