From 54444528588043e961e098ebd013dc553329b852 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 23 Sep 2014 17:30:09 +0200 Subject: [PATCH] =?utf8?q?Finanz=C3=BCbersicht:=20wied.=20Rechnungen=20f?= =?utf8?q?=C3=BCr=20ganzes=20Jahr=20auf=20einmal=20ber=C3=BCcksichtigen?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/Controller/FinancialOverview.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/SL/Controller/FinancialOverview.pm b/SL/Controller/FinancialOverview.pm index 6d3fc10ab..cd153d23f 100644 --- a/SL/Controller/FinancialOverview.pm +++ b/SL/Controller/FinancialOverview.pm @@ -145,13 +145,11 @@ sub calculate_periodic_invoices { sub calculate_one_periodic_invoice { my ($self, %params) = @_; - my @dates = $params{config}->calculate_invoice_dates(start_date => $params{start_date}, end_date => $params{end_date}, past_dates => 1); - my $first_date = $dates[0]; + return if $params{config}->start_date > $params{end_date}; - return if !$first_date; - - my $net = $params{config}->order->netamount * scalar(@dates); - my $sord = $self->data->{sales_orders}; + my $first_date = $params{config}->start_date->clone->set_year($self->year); + my $net = $params{config}->order->netamount * (12 / $params{config}->get_period_length); + my $sord = $self->data->{sales_orders}; $sord->{months }->[ $first_date->month - 1 ] += $net; $sord->{quarters}->[ $first_date->quarter - 1 ] += $net; -- 2.20.1