From 33ddf79cc8c6a43ed1661a1f04002d62cdf264eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Mon, 23 Aug 2021 10:02:34 +0200 Subject: [PATCH] =?utf8?q?F=C3=BCr=20#485=20Offene=20Forderungen=20zum=20S?= =?utf8?q?tichtag=20mit=20aktuellem=20Status?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Liefert den aktuell offenen Betrag zum aktuell letztem Zahlungsdatum --- SL/RP.pm | 2 +- bin/mozilla/rp.pl | 24 +++++++++++++++++------- locale/de/all | 2 ++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/SL/RP.pm b/SL/RP.pm index 70549a2c8..80e83d569 100644 --- a/SL/RP.pm +++ b/SL/RP.pm @@ -1298,7 +1298,7 @@ sub aging { phone as customerphone, fax as customerfax, ${ct}number, "invnumber", "transdate", (amount - COALESCE((SELECT sum(amount)*$ml FROM acc_trans WHERE chart_link ilike '%paid%' AND acc_trans.trans_id=${arap}.id AND acc_trans.transdate <= (date $todate)),0)) as "open", "amount", - "duedate", invoice, ${arap}.id, date_part('days', now() - duedate) as overduedays, datepaid, + "duedate", invoice, ${arap}.id, date_part('days', now() - duedate) as overduedays, datepaid, (amount - paid) as current_open, (SELECT $buysell FROM exchangerate WHERE (${arap}.currency_id = exchangerate.currency_id) diff --git a/bin/mozilla/rp.pl b/bin/mozilla/rp.pl index 13545f2ad..8aef5788f 100644 --- a/bin/mozilla/rp.pl +++ b/bin/mozilla/rp.pl @@ -1006,7 +1006,7 @@ sub aging { my $report = SL::ReportGenerator->new(\%myconfig, $form); - my @columns = qw(statement ct invnumber transdate duedate amount open datepaid); + my @columns = qw(statement ct invnumber transdate duedate amount open datepaid current_open); my %column_defs = ( 'statement' => { raw_header_data => SL::Presenter::Tag::checkbox_tag("checkall", checkall => '[name^=statement_]'), 'visible' => $form->{ct} eq 'customer' ? 'HTML' : 0, align => "center" }, 'ct' => { 'text' => $form->{ct} eq 'customer' ? $locale->text('Customer') : $locale->text('Vendor'), }, @@ -1015,11 +1015,12 @@ sub aging { 'duedate' => { 'text' => $locale->text('Due'), }, 'amount' => { 'text' => $locale->text('Amount'), }, 'open' => { 'text' => $locale->text('Open'), }, - 'datepaid' => { 'text' => $locale->text('Date Paid'), visible => ($form->{reporttype} eq 'custom') }, + 'datepaid' => { 'text' => $locale->text('Date of Last Payment'), visible => ($form->{reporttype} eq 'custom') }, + 'current_open' => { 'text' => $locale->text('Open Amount at Last Payment Date'), visible => ($form->{reporttype} eq 'custom') }, ); my %column_alignment = ('statement' => 'center', - map { $_ => 'right' } qw(open amount)); + map { $_ => 'right' } qw(open amount current_open datepaid)); $report->set_options('std_column_visibility' => 1); $report->set_columns(%column_defs); @@ -1048,10 +1049,19 @@ sub aging { $form->{title} = sprintf($locale->text('Ap aging on %s'), $form->{todate}); } - 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); + if ($form->{reporttype} eq 'free') { + 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); + } + } elsif ($form->{reporttype} eq 'custom') { + push @options, $locale->text('Reference day') . " " . $locale->date(\%myconfig, $form->{fordate}, 1); } else { - push @options, $locale->text('for Period') . " " . $locale->text('Bis') . " " . $locale->date(\%myconfig, $form->{todate}, 1); + die "Unknown reporttype for aging"; } $attachment_basename = $form->{ct} eq 'customer' ? $locale->text('ar_aging_list') : $locale->text('ap_aging_list'); @@ -1066,7 +1076,7 @@ sub aging { my $previous_ctid = 0; my $row_idx = 0; - my @periods = qw(open amount); + my @periods = qw(open amount current_open); my %subtotals = map { $_ => 0 } @periods; my %totals = map { $_ => 0 } @periods; diff --git a/locale/de/all b/locale/de/all index 33317d1d3..798357837 100755 --- a/locale/de/all +++ b/locale/de/all @@ -949,6 +949,7 @@ $self->{texts} = { 'Date Paid' => 'Zahlungsdatum', 'Date and timestamp variables: If the default value equals \'NOW\' then the current date/current timestamp will be used. Otherwise the default value is copied as-is.' => 'Datums- und Uhrzeitvariablen: Wenn der Standardwert \'NOW\' ist, so wird das aktuelle Datum/die aktuelle Uhrzeit eingefügt. Andernfalls wird der Standardwert so wie er ist benutzt.', 'Date missing!' => 'Datum fehlt!', + 'Date of Last Payment' => 'Letzter Zahlungseingang', 'Date the payment is due in full' => 'Das Datum, bis die Rechnung in voller Höhe bezahlt werden muss', 'Date the payment is due with discount' => 'Das Datum, bis die Rechnung unter Abzug von Skonto bezahlt werden kann', 'Datev export encoding' => 'DATEV-Export Kodierung', @@ -2286,6 +2287,7 @@ $self->{texts} = { 'Oops. No valid action found to dispatch. Please report this case to the kivitendo team.' => 'Ups. Es wurde keine gültige Funktion zum Aufrufen gefunden. Bitte berichten Sie diesen Fall den kivitendo-Entwicklern.', 'Open' => 'Offen', 'Open Amount' => 'Offener Betrag', + 'Open Amount at Last Payment Date' => 'Offener Betrag zum letzten Zahlungseingang', 'Open Items' => 'Offene Posten', 'Open Orders' => 'Offene Aufträge', 'Open a further kivitendo window or tab' => 'Weiteres kivitendo-Fenster/-Tab öffnen', -- 2.20.1