$main::lxdebug->leave_sub();
}
+sub get_transdate {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ # connect to database
+ my $dbh = $form->dbconnect($myconfig);
+
+ my $query =
+ "SELECT COALESCE(" .
+ " (SELECT transdate FROM gl WHERE id = " .
+ " (SELECT MAX(id) FROM gl) LIMIT 1), " .
+ " current_date)";
+ ($form->{transdate}) = $dbh->selectrow_array($query);
+
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
1;
$main::lxdebug->leave_sub();
}
+sub get_transdate {
+ $main::lxdebug->enter_sub();
+
+ my ($self, $myconfig, $form) = @_;
+
+ # connect to database
+ my $dbh = $form->dbconnect($myconfig);
+
+ my $query =
+ "SELECT COALESCE(" .
+ " (SELECT transdate FROM gl WHERE id = " .
+ " (SELECT MAX(id) FROM gl) LIMIT 1), " .
+ " current_date)";
+ ($form->{transdate}) = $dbh->selectrow_array($query);
+
+ $dbh->disconnect;
+
+ $main::lxdebug->leave_sub();
+}
+
1;
$sth->finish;
} else {
- $query = "SELECT current_date AS transdate, closedto, revtrans
- FROM defaults";
- $sth = $dbh->prepare($query);
- $sth->execute || $form->dberror($query);
-
- ($form->{transdate}, $form->{closedto}, $form->{revtrans}) =
- $sth->fetchrow_array;
+ $query = "SELECT closedto, revtrans FROM defaults";
+ ($form->{closedto}, $form->{revtrans}) = $dbh->selectrow_array($query);
+ $query =
+ "SELECT COALESCE(" .
+ " (SELECT transdate FROM gl WHERE id = " .
+ " (SELECT MAX(id) FROM gl) LIMIT 1), " .
+ " current_date)";
+ ($form->{transdate}) = $dbh->selectrow_array($query);
# get tax description
$query = qq| SELECT * FROM tax t order by t.taxkey|;
unless $form->{callback};
&create_links;
+ AP->get_transdate(\%myconfig, $form);
&display_form;
$lxdebug->leave_sub();
unless $form->{callback};
&create_links;
+ AR->get_transdate(\%myconfig, $form);
&display_form;
$lxdebug->leave_sub();