X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FBackgroundJob%2FCreatePeriodicInvoices.pm;h=f7b9100ad93a24b4e4004286e31c4e4c8c0ada83;hb=1baea8cb6d9de284e35c8dc981c7a9559e9e9888;hp=52415f20e2f19832cb9a1055c27b5158511fffc2;hpb=142ea3bff784ba29bd87de5615bb4f2aec8c977f;p=kivitendo-erp.git 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,