X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0882a28352cc7808db2474be2398fa1330bb8831..d4c5ff04f33e7fe29e079c4489c4126a7ea2493c:/SL/BackgroundJob/CreatePeriodicInvoices.pm diff --git a/SL/BackgroundJob/CreatePeriodicInvoices.pm b/SL/BackgroundJob/CreatePeriodicInvoices.pm index 52415f20e..f7b9100ad 100644 --- a/SL/BackgroundJob/CreatePeriodicInvoices.pm +++ b/SL/BackgroundJob/CreatePeriodicInvoices.pm @@ -224,10 +224,17 @@ sub _create_periodic_invoice { $invoice = SL::DB::Invoice->new_from($order); + my $tax_point = ($invoice->tax_point // $time_period_vars->{period_end_date}->[0])->clone; + + while ($tax_point < $period_start_date) { + $tax_point->add(months => $config->get_billing_period_length); + } + my $intnotes = $invoice->intnotes ? $invoice->intnotes . "\n\n" : ''; $intnotes .= "Automatisch am " . $invdate->to_lxoffice . " erzeugte Rechnung"; $invoice->assign_attributes(deliverydate => $period_start_date, + tax_point => $tax_point, intnotes => $intnotes, employee => $order->employee, # new_from sets employee to import user direct_debit => $config->direct_debit,