+ my ($numberformat, $places, @indices) = @_;
+
+ return $lxdebug->leave_sub()
+ if (!$numberformat || ($numberformat eq $myconfig{"numberformat"}));
+
+ foreach my $idx (@indices) {
+ 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) {
+ 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;
+
+ $lxdebug->leave_sub();
+}
+
+# -------------------------------------------------------------------------
+
+sub show_history {
+ $lxdebug->enter_sub();
+ my $dbh = $form->dbconnect(\%myconfig);
+ my ($sort, $sortby) = split(/\-\-/, $form->{order});
+ $sort =~ s/.*\.(.*)/$1/;
+
+ $form->{title} = $locale->text("History");
+ $form->header();
+ print $form->parse_html_template( "common/show_history", {
+ "DATEN" => $form->get_history($dbh,$form->{input_name},"",$form->{order}),
+ "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"),
+ uc($sort) => 1,
+ uc($sort)."BY" => $sortby
+ } );
+
+ $dbh->disconnect();
+ $lxdebug->leave_sub();
+}
+
+# -------------------------------------------------------------------------
+
+sub call_sub {
+ $lxdebug->enter_sub();
+
+ my $name = shift;
+
+ if (!$name) {
+ $form->error($locale->text("Trying to call a sub without a name"));
+ }
+
+ $name =~ s/[^a-zA-Z0-9_]//g;
+
+ if (!defined(&{ $name })) {
+ $form->error(sprintf($locale->text("Attempt to call an undefined sub named '%s'"), $name));
+ }
+
+ &{ $name }(@_);
+
+ $lxdebug->leave_sub();
+}
+
+# -------------------------------------------------------------------------
+
+sub show_vc_details {
+ $lxdebug->enter_sub();
+
+ $form->{vc} = $form->{vc} eq "customer" ? "customer" : "vendor";
+ $form->isblank("vc_id",
+ $form->{vc} eq "customer" ?
+ $locale->text("No customer has been selected yet.") :
+ $locale->text("No vendor has been selected yet."));
+
+ Common->get_vc_details(\%myconfig, $form, $form->{vc}, $form->{vc_id});
+
+ $form->{title} = $form->{vc} eq "customer" ?
+ $locale->text("Customer details") : $locale->text("Vendor details");