+ my $callback = "$form->{script}?action=cov_selection_internal&";
+ map({ $callback .= "$_=" . $form->escape($form->{$_}) . "&" }
+ (qw(name input_name input_id is_vendor allow_both), grep({ /^[fl]_/ } keys %$form)));
+
+ my @header_sort = qw(name address contact);
+ my %header_title = ( "name" => $locale->text("Name"),
+ "address" => $locale->text("Address"),
+ "contact" => $locale->text("Contact"),
+ );
+
+ my @header =
+ map(+{ "column_title" => $header_title{$_},
+ "column" => $_,
+ "callback" => $callback . "order_by=${_}&order_dir=" . ($order_by eq $_ ? 1 - $order_dir : $order_dir),
+ },
+ @header_sort);
+
+ foreach my $cov (@{ $covs }) {
+ $cov->{address} = "$cov->{street}, $cov->{zipcode} $cov->{city}";
+ $cov->{address} =~ s{^,}{}x;
+ $cov->{address} =~ s{\ +}{\ }gx;
+
+ $cov->{contact} = join " ", map { $cov->{$_} } qw(cp_gender cp_title cp_givenname cp_name);
+ $cov->{contact} =~ s{\ +}{\ }gx;
+ }
+
+ $form->{"title"} = $form->{is_vendor} ? $locale->text("Select a vendor") : $locale->text("Select a customer");
+ $form->header();
+ print($form->parse_html_template("generic/cov_selection", { "HEADER" => \@header,
+ "COVS" => $covs,
+ "onload" => $onload }));
+
+ $main::lxdebug->leave_sub();
+}
+
+
+# Functions to call add routines beneath different reports
+
+sub sales_invoice {
+ $main::lxdebug->enter_sub();
+
+ print $::form->redirect_header('is.pl?action=add&type=invoice');
+
+ $main::lxdebug->leave_sub();
+}
+
+sub ar_transaction {
+ $main::lxdebug->enter_sub();
+
+ print $::form->redirect_header('ar.pl?action=add');
+
+ $main::lxdebug->leave_sub();
+}
+
+sub vendor_invoice {
+ $main::lxdebug->enter_sub();
+
+ print $::form->redirect_header('ir.pl?action=add&type=invoice');
+
+ $main::lxdebug->leave_sub();
+}
+
+sub ap_transaction {
+ $main::lxdebug->enter_sub();
+
+ print $::form->redirect_header('ap.pl?action=add');
+
+ $main::lxdebug->leave_sub();
+}
+
+sub gl_transaction {
+ $main::lxdebug->enter_sub();
+
+ print $::form->redirect_header('gl.pl?action=add');
+
+ $main::lxdebug->leave_sub();
+}