X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FRP.pm;h=ef93e73bbe934b49bb75a784004c5dca66ad2179;hb=47577d1daa5da455e3883ed60c70875a6845233a;hp=ec3be269982ced347fa59ea9a9f49e66472b5f92;hpb=bfdc537fd1664812343a6c7ce690c716f8f6a580;p=kivitendo-erp.git diff --git a/SL/RP.pm b/SL/RP.pm index ec3be2699..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))) "; - $invwhere .= " AND (a.transdate >= $fromdate)"; - $glsaldowhere .= " 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 >= $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}); @@ -1097,7 +1099,7 @@ sub trial_balance { } - my ($debit, $credit, $saldo, $soll_saldo, $haben_saldo,$soll_kummuliert, $haben_kummuliert, $last_transaction); + my ($debit, $credit, $saldo, $soll_saldo, $haben_saldo, $soll_kumuliert, $haben_kumuliert, $last_transaction); foreach my $accno (sort keys %trb) { $ref = {}; @@ -1206,19 +1208,6 @@ sub trial_balance { $main::lxdebug->leave_sub(); } -sub get_storno { - $main::lxdebug->enter_sub(); - my ($self, $dbh, $form) = @_; - my $arap = $form->{arap} eq "ar" ? "ar" : "ap"; - my $query = qq|SELECT invnumber FROM $arap WHERE invnumber LIKE "Storno zu "|; - my $sth = $dbh->prepare($query); - while(my $ref = $sth->fetchrow_hashref()) { - $ref->{invnumer} =~ s/Storno zu //g; - $form->{storno}{$ref->{invnumber}} = 1; - } - $main::lxdebug->leave_sub(); -} - sub aging { $main::lxdebug->enter_sub();