From 653ae9ea701b5c88f2ed720931c8e864a97aeaa4 Mon Sep 17 00:00:00 2001 From: Philip Reetz Date: Tue, 24 Jun 2008 19:04:34 +0000 Subject: [PATCH] Eingrenzung nach Datum bei offene Forderungen und Verbindlichkeiten --- SL/RP.pm | 7 +++++-- bin/mozilla/rp.pl | 26 ++++++++++++++++---------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/SL/RP.pm b/SL/RP.pm index 4d2dd4eb2..365d6e023 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -1303,6 +1303,9 @@ sub aging { $form->{todate} = $form->current_date($myconfig) unless ($form->{todate}); my $todate = conv_dateq($form->{todate}); + my $fromdate = conv_dateq($form->{fromdate}); + + my $fromwhere = ($form->{fromdate} ne "") ? " AND (transdate >= (date $fromdate)) " : ""; my $where = " 1 = 1 "; my ($name, $null); @@ -1338,7 +1341,7 @@ sub aging { AND (${arap}.storno IS FALSE) AND (${arap}.${ct}_id = ${ct}.id) AND (${ct}.id = ?) - AND (transdate <= (date $todate)) + AND (transdate <= (date $todate) $fromwhere ) ORDER BY ctid, transdate, invnumber |; @@ -1352,7 +1355,7 @@ sub aging { WHERE $where AND (a.${ct_id} = ct.id) AND ((a.paid != a.amount) OR ((a.datepaid > $todate) AND (datepaid is NOT NULL))) - AND (a.transdate <= $todate) + AND (a.transdate <= $todate $fromwhere) ORDER BY ct.name|; my $sth = prepare_execute_query($form, $dbh, $query); diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index a6308c693..7f5aa0d69 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -189,10 +189,10 @@ sub report { $value_2 = ""; $trigger_2 = "trigger2"; } elsif (($form->{report} eq "ar_aging") || ($form->{report} eq "ap_aging")) { - $name_1 = ""; - $id_1 = ""; - $value_1 = ""; - $trigger_1 = ""; + $name_1 = "fromdate"; + $id_1 = "fromdate"; + $value_1 = "$form->{fromdate}"; + $trigger_1 = "trigger1"; $name_2 = "todate"; $id_2 = "todate"; $value_2 = ""; @@ -788,10 +788,12 @@ $jsscript $vc - | . $locale->text('Bis') . qq| - - $button1 - $button1_2 + | . $locale->text('From') . qq|  + $button1 + $button1_2  + | . $locale->text('Bis') . qq|  + $button2 + $button2_2 @@ -1666,7 +1668,7 @@ sub create_aging_subtotal_row { sub aging { $lxdebug->enter_sub(); - print(STDERR "Bin in Aging\n"); + $auth->assert('general_ledger'); my $report = SL::ReportGenerator->new(\%myconfig, $form); @@ -1714,7 +1716,11 @@ sub aging { $form->{title} = sprintf($locale->text('Ap aging on %s'), $form->{todate}); } - push @options, $locale->text('for Period') . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1); + if ($form->{fromdate}) { + push @options, $locale->text('for Period') . " " . $locale->text('From') . " " .$locale->date(\%myconfig, $form->{fromdate}, 1) . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1); + } else { + push @options, $locale->text('for Period') . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1); + } my $attachment_basename = $form->{ct} eq 'customer' ? $locale->text('ar_aging_list') : $locale->text('ap_aging_list'); -- 2.20.1