From 29e70d36170f13f034474b9f5a831f727980a62f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Tue, 11 May 2021 11:46:55 +0200 Subject: [PATCH] =?utf8?q?Idee=20f=C3=BCr=20redmine=20#117?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit SuSa->Auswahl freier Zeitraum. Fiscal Year anstatt date_trunc für bessere Auswertungen bei abweichendem Wirtschaftsjahr --- SL/RP.pm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/SL/RP.pm b/SL/RP.pm index a41c2a8f6..ef93e73bb 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -832,14 +832,16 @@ sub trial_balance { if ($form->{fromdate} || $form->{todate}) { if ($form->{fromdate}) { $fromdate = conv_dateq($form->{fromdate}); + my $fiscal_year_startdate = conv_dateq($self->get_balance_starting_date($form->{fromdate})); + # my $date_trunc = "(select date_trunc('year', date $fromdate))"; $tofrom .= " AND (ac.transdate >= $fromdate)"; $subwhere .= " AND (ac.transdate >= $fromdate)"; - $sumsubwhere .= " AND (ac.transdate >= (select date_trunc('year', date $fromdate))) "; - $saldosubwhere .= " AND (ac.transdate >= (select date_trunc('year', date $fromdate))) "; + $sumsubwhere .= " AND (ac.transdate >= $fiscal_year_startdate) "; + $saldosubwhere .= " AND (ac.transdate >= $fiscal_year_startdate) "; $invwhere .= " AND (a.transdate >= $fromdate)"; - $glsaldowhere .= " AND (ac.transdate >= (select date_trunc('year', date $fromdate))) "; + $glsaldowhere .= " AND (ac.transdate >= $fiscal_year_startdate) "; $glwhere = " AND (ac.transdate >= $fromdate)"; - $glsumwhere = " AND (ac.transdate >= (select date_trunc('year', date $fromdate))) "; + $glsumwhere = " AND (ac.transdate >= $fiscal_year_startdate) "; } if ($form->{todate}) { $todate = conv_dateq($form->{todate}); -- 2.20.1