+ my @variable;
+
+ foreach my $item (split m/;/, $variable_string) {
+ next unless $item =~ m/^ \s* (\w+) \s* = \s* (\w+) \s* (\w+) \s* $/x;
+ push @variable, {
+ description => $1,
+ name => $2,
+ unit => $3,
+ };
+ }
+
+ my @header_sort = qw(variable value unit);
+ my %header_title = (
+ variable => $locale->text("Variable"),
+ value => $locale->text("Value"),
+ unit => $locale->text("Unit"),
+ );
+ my @header = map +{
+ column_title => $header_title{$_},
+ column => $_,
+ }, @header_sort;
+
+ $form->{formel} = $formel;
+ $form->{title} = $locale->text("Please enter values");
+ $form->header(no_layout => 1);
+ print $form->parse_html_template("generic/calculate_qty", { "HEADER" => \@header,
+ "VARIABLES" => \@variable, });
+
+ $main::lxdebug->leave_sub();
+}
+
+# -------------------------------------------------------------------------
+
+sub H {
+ return $main::locale->quote_special_chars('HTML', $_[0]);
+}
+
+sub Q {
+ return $main::locale->quote_special_chars('URL@HTML', $_[0]);
+}
+
+sub E {
+ return $main::form->escape($_[0]);
+}
+
+sub NTI {
+ my ($element) = @_;
+
+ $element =~ s/tabindex\s*=\s*"\d+"//;
+ return $element;
+}
+
+sub format_dates {
+ return $::form->format_dates(@_);
+}
+
+sub reformat_numbers {
+ return $::form->reformat_numbers(@_);
+}
+
+# -------------------------------------------------------------------------
+
+sub show_history {
+ $main::lxdebug->enter_sub();
+
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
+
+ my $dbh = $form->dbconnect(\%myconfig);
+ my ($sort, $sortby) = split(/\-\-/, $form->{order});
+ $sort =~ s/.*\.(.*)/$1/;
+
+ $form->{title} = $locale->text("History");
+ $form->header(no_layout => 1);
+
+ my $callback = build_std_url(qw(action longdescription trans_id_type input_name));
+ my $restriction;
+ if ( $form->{trans_id_type} eq 'glid' ) {
+ $restriction = "AND ( snumbers LIKE 'invnumber%' OR what_done LIKE '%Buchungsnummer%' OR snumbers LIKE 'gltransaction%' ) ";
+ } elsif ( $form->{trans_id_type} eq 'id' ) {
+ $restriction = " AND ( snumbers NOT LIKE 'invnumber_%' AND snumbers NOT LIKE 'gltransaction%' AND (what_done NOT LIKE '%Buchungsnummer%' OR what_done IS null))";
+ } else {
+ $restriction = '';
+ };
+
+ print $form->parse_html_template( "common/show_history", {
+ "DATEN" => $form->get_history($dbh,$form->{input_name},$restriction,$form->{order}),
+ "SUCCESS" => ($form->get_history($dbh,$form->{input_name}) ne "0"),
+ uc($sort) => 1,
+ uc($sort)."BY" => $sortby,
+ callback => $callback,
+ } );
+
+ $dbh->disconnect();
+ $main::lxdebug->leave_sub();
+}
+
+# -------------------------------------------------------------------------