- $main::lxdebug->enter_sub();
-
- my ($numberformat, $places, @indices) = @_;
-
- my $form = $main::form;
- my %myconfig = %main::myconfig;
-
- return $main::lxdebug->leave_sub()
- if (!$numberformat || ($numberformat eq $myconfig{"numberformat"}));
-
- foreach my $idx (@indices) {
- if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) {
- for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) {
- $form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->parse_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i]);
- }
- }
-
- next unless (defined($form->{$idx}));
-
- if (!ref($form->{$idx})) {
- $form->{$idx} = $form->parse_amount(\%myconfig, $form->{$idx});
-
- } elsif (ref($form->{$idx}) eq "ARRAY") {
- for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) {
- $form->{$idx}->[$i] =
- $form->parse_amount(\%myconfig, $form->{$idx}->[$i]);
- }
- }
- }
-
- my $saved_numberformat = $myconfig{"numberformat"};
- $myconfig{"numberformat"} = $numberformat;
-
- foreach my $idx (@indices) {
- if ($form->{TEMPLATE_ARRAYS} && (ref($form->{TEMPLATE_ARRAYS}->{$idx}) eq "ARRAY")) {
- for (my $i = 0; $i < scalar(@{$form->{TEMPLATE_ARRAYS}->{$idx}}); $i++) {
- $form->{TEMPLATE_ARRAYS}->{$idx}->[$i] = $form->format_amount(\%myconfig, $form->{TEMPLATE_ARRAYS}->{$idx}->[$i], $places);
- }
- }
-
- next unless (defined($form->{$idx}));
-
- if (!ref($form->{$idx})) {
- $form->{$idx} = $form->format_amount(\%myconfig, $form->{$idx}, $places);
-
- } elsif (ref($form->{$idx}) eq "ARRAY") {
- for (my $i = 0; $i < scalar(@{$form->{$idx}}); $i++) {
- $form->{$idx}->[$i] =
- $form->format_amount(\%myconfig, $form->{$idx}->[$i], $places);
- }
- }
- }
-
- $myconfig{"numberformat"} = $saved_numberformat;
-
- $main::lxdebug->leave_sub();