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., 51 Franklin Street, Fifth Floor, Boston,
 
  30 #=====================================================================
 
  32 # this is the default code for the Check package
 
  34 #=====================================================================
 
  41   %{ $self->{numbername} } = (0      => 'Zero',
 
  73                               10**12 => 'Trillion',);
 
  78   my ($self, $amount) = @_;
 
  80   return $self->{numbername}{0} unless $amount;
 
  84   # split amount into chunks of 3
 
  85   my @num = reverse split //, $amount;
 
  93       push(@a, shift(@num));
 
  95     push(@numblock, join(" ", reverse @a));
 
 101     @num = split(//, $numblock[$i]);
 
 103     if ($numblock[$i] == 0) {
 
 108     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) {
 
 126       push(@textnumber, $self->format_ten($numblock[$i]));
 
 127     } elsif ($numblock[$i] > 0) {
 
 130       push(@textnumber, $self->{numbername}{ $numblock[$i] });
 
 133     # add thousand, million
 
 135       my $num = 10**($i * 3);
 
 136       push(@textnumber, $self->{numbername}{$num});
 
 143   join(' ', @textnumber);
 
 148   my ($self, $amount) = @_;
 
 151   my @num        = split(//, $amount);
 
 154     $textnumber = $self->{numbername}{ $num[0] * 10 };
 
 157     $textnumber = $self->{numbername}{$amount};
 
 161   $textnumber .= " " . $self->{numbername}{$amount} if $amount;