From: Moritz Bunkus Date: Tue, 10 Nov 2020 10:38:12 +0000 (+0100) Subject: Leistungsdatum: wiederkehrende Rechnungen X-Git-Tag: kivitendo-mebil_0.1-0~9^2~577^2~6 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=1baea8cb6d9de284e35c8dc981c7a9559e9e9888;p=kivitendo-erp.git Leistungsdatum: wiederkehrende Rechnungen --- 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, diff --git a/SL/DB/Helper/FlattenToForm.pm b/SL/DB/Helper/FlattenToForm.pm index 7c001af88..5ba2f3d57 100644 --- a/SL/DB/Helper/FlattenToForm.pm +++ b/SL/DB/Helper/FlattenToForm.pm @@ -15,7 +15,7 @@ sub flatten_to_form { _copy($self, $form, '', '', 0, qw(id type taxzone_id ordnumber quonumber invnumber donumber cusordnumber taxincluded shippingpoint shipvia notes intnotes cp_id employee_id salesman_id closed department_id language_id payment_id delivery_customer_id delivery_vendor_id shipto_id proforma globalproject_id delivered transaction_description container_type accepted_by_customer invoice storno storno_id dunning_config_id - orddate quodate reqdate gldate duedate deliverydate datepaid transdate delivery_term_id)); + orddate quodate reqdate gldate duedate deliverydate datepaid transdate tax_point delivery_term_id)); $form->{currency} = $form->{curr} = $self->currency_id ? $self->currency->name || '' : ''; if ( $vc eq 'customer' ) { diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm index 0a6079885..23847553d 100644 --- a/SL/DB/Invoice.pm +++ b/SL/DB/Invoice.pm @@ -156,7 +156,7 @@ sub new_from { my (@columns, @item_columns, $item_parent_id_column, $item_parent_column); if (ref($source) eq 'SL::DB::Order') { - @columns = qw(quonumber delivery_customer_id delivery_vendor_id); + @columns = qw(quonumber delivery_customer_id delivery_vendor_id tax_point); @item_columns = qw(subtotal); $item_parent_id_column = 'trans_id';