From 406563ed1b78806f09febe49fc37f0b9fb97e6b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Thu, 4 Sep 2014 09:07:29 +0200 Subject: [PATCH] =?utf8?q?SuSa=20-=20Summe=20per=20und=20Saldo=20auch=20be?= =?utf8?q?i=20abweichenden=20Gesch=C3=A4ftsjahr=20berechnen=20Falls=20man?= =?utf8?q?=20eine=20Monats-SuSa=20zieht=20werden=20die=20Salden=20korrekt?= =?utf8?q?=20berechnet,=20allerdings=20wurde=20nicht=20ein=20abweichendes?= =?utf8?q?=20Gesch=C3=A4ftsjahr=20ber=C3=BCcksichtigt.=20Jetzt=20wird=20da?= =?utf8?q?s=20Startdatum=20wie=20in=20der=20Bilanz=20genommen,=20dass=20is?= =?utf8?q?t=20schon=20mal=20besser,=20allerdings=20ist=20hier=20der=20Fall?= =?utf8?q?=20Startdatum=20=3D=3D=20closedto=20immer=20noch=20etwas=20unsch?= =?utf8?q?=C3=B6n,=20s.a.=20Kommentar=20in=20der=20Methode=20get=5Fbalance?= =?utf8?q?=5Fstartdate=5Fmethod?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/RP.pm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/SL/RP.pm b/SL/RP.pm index fd58de602..47d7db9ee 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -923,10 +923,13 @@ sub trial_balance { $sumwhere .= $glsumwhere . " AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL)"; # get all entries before fromdate, which are not yet fetched - # TODO dpt_where_without_arapgl and project + # TODO dpt_where_without_arapgl and project - project calculation seems bogus anyway + # TODO use fiscal_year_startdate for the whole trial balance + # anyway, if the last booking is in a deviating fiscal year, this already improves the query + my $fiscal_year_startdate = conv_dateq(get_balance_starting_date($form->{fromdate})); $fetch_accounts_before_from = qq|SELECT c.accno, c.description, c.category, SUM(ac.amount) AS amount FROM acc_trans ac JOIN chart c ON (c.id = ac.chart_id) WHERE 1 = 1 AND (ac.transdate <= $fromdate) - AND (ac.transdate >= (SELECT date_trunc('YEAR', | . $fromdate . qq|::date))) + AND (ac.transdate >= $fiscal_year_startdate) AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL) AND c.accno NOT IN (SELECT c.accno FROM acc_trans ac JOIN chart c ON (c.id = ac.chart_id) WHERE 1 = 1 AND (ac.transdate >= $fromdate) AND (ac.transdate <= $todate) AND (NOT ac.ob_transaction OR ac.ob_transaction IS NULL) AND (NOT ac.cb_transaction OR ac.cb_transaction IS NULL)) @@ -988,7 +991,7 @@ sub trial_balance { } $sth->finish; - if ($form->{method} ne "cash") { + if (!$form->{method} ne "cash") { $sth = prepare_execute_query($form, $dbh, $fetch_accounts_before_from); while ($ref = $sth->fetchrow_hashref("NAME_lc")) { $trb{ $ref->{accno} }{description} = $ref->{description}; -- 2.20.1