From 0a0656c7d5656ad1eb1d59c04b47e92a4c876531 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 6 May 2009 10:32:10 +0000 Subject: [PATCH] =?utf8?q?Wird=20bei=20der=20Summen-/Saldenliste=20der=20"?= =?utf8?q?freie=20Zeitraum"=20ausgew=C3=A4hlt,=20dann=20werden=20das=20Sta?= =?utf8?q?rt-=20und=20Enddatum=20als=20das=20Datum=20der=20fr=C3=BChesten/?= =?utf8?q?sp=C3=A4testen=20Buchung=20in=20acc=5Ftrans=20gesetzt,=20sofern?= =?utf8?q?=20der=20Benutzer=20nichts=20angegeben=20hatte.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/RP.pm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/SL/RP.pm b/SL/RP.pm index ad8be971d..87b2ade92 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -669,6 +669,19 @@ sub trial_balance { } if ($options{beginning_balances}) { + foreach my $prefix (qw(from to)) { + next if ($form->{"${prefix}date"}); + + my $min_max = $prefix eq 'from' ? 'min' : 'max'; + $query = qq|SELECT ${min_max}(transdate) + FROM acc_trans ac + $dpt_join + WHERE (1 = 1) + $dpt_where + $project|; + ($form->{"${prefix}date"}) = selectfirst_array_query($form, $dbh, $query); + } + # get beginning balances $query = qq|SELECT c.accno, c.category, SUM(ac.amount) AS amount, c.description @@ -680,7 +693,7 @@ sub trial_balance { $project GROUP BY c.accno, c.category, c.description |; - $sth = prepare_execute_query($form, $dbh, $query, $form->{fromdate}); + $sth = prepare_execute_query($form, $dbh, $query, $form->{fromtdate}); while (my $ref = $sth->fetchrow_hashref("NAME_lc")) { -- 2.20.1