Anzahlungs-Rg.: eigener Typ for Schlussrechnung (final_invoice (F))
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 6 Dec 2021 14:49:12 +0000 (15:49 +0100)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Feb 2022 12:54:08 +0000 (13:54 +0100)
13 files changed:
SL/Controller/PriceSource.pm
SL/DB/Invoice.pm
SL/Form.pm
SL/Helper/PrintOptions.pm
SL/IC.pm
SL/IS.pm
SL/TransNumber.pm
bin/mozilla/ar.pl
bin/mozilla/io.pl
bin/mozilla/is.pl
locale/de/all
locale/en/all
templates/print/marei/final_invoice.tex [new symlink]

index ba2d74e..c0c113c 100644 (file)
@@ -84,6 +84,7 @@ sub _make_record_item {
     request_quotation       => 'OrderItem',
     invoice                 => 'InvoiceItem',
     invoice_for_advance_payment => 'InvoiceItem',
+    final_invoice           => 'InvoiceItem',
     purchase_invoice        => 'InvoiceItem',
     credit_note             => 'InvoiceItem',
     purchase_delivery_order => 'DeliveryOrderItem',
index 7e7ff1c..45259a0 100644 (file)
@@ -541,6 +541,7 @@ sub invoice_type {
   return 'ar_transaction'     if !$self->invoice;
   return 'invoice_for_advance_payment_storno' if $self->type eq 'invoice_for_advance_payment' && $self->amount < 0 &&  $self->storno;
   return 'invoice_for_advance_payment'        if $self->type eq 'invoice_for_advance_payment';
+  return 'final_invoice'                      if $self->type eq 'final_invoice';
   # stornoed credit_notes are still credit notes and not invoices
   return 'credit_note'        if $self->type eq 'credit_note' && $self->amount < 0;
   return 'invoice_storno'     if $self->type ne 'credit_note' && $self->amount < 0 &&  $self->storno;
@@ -563,6 +564,7 @@ sub displayable_type {
   return t8('Credit Note') . "(" . t8('Storno') . ")" if $self->invoice_type eq 'credit_note_storno';
   return t8('Invoice for Advance Payment')            if $self->invoice_type eq 'invoice_for_advance_payment';
   return t8('Invoice for Advance Payment') . "(" . t8('Storno') . ")" if $self->invoice_type eq 'invoice_for_advance_payment_storno';
+  return t8('Final Invoice')                          if $self->invoice_type eq 'final_invoice';
   return t8('Invoice');
 }
 
@@ -579,6 +581,7 @@ sub abbreviation {
   return t8('Credit note (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")"  if $self->invoice_type eq 'credit_note_storno';
   return t8('Invoice for Advance Payment (one letter abbreviation)')  if $self->invoice_type eq 'invoice_for_advance_payment';
   return t8('Invoice for Advance Payment with Storno (abbreviation)') if $self->invoice_type eq 'invoice_for_advance_payment_storno';
+  return t8('Final Invoice (one letter abbreviation)')                if $self->invoice_type eq 'final_invoice';
   return t8('Invoice (one letter abbreviation)');
 }
 
index 6a7f285..d6be257 100644 (file)
@@ -1090,6 +1090,7 @@ sub get_formname_translation {
     invoice                 => $main::locale->text('Invoice'),
     invoice_copy            => $main::locale->text('Invoice Copy'),
     invoice_for_advance_payment => $main::locale->text('Invoice for Advance Payment'),
+    final_invoice           => $main::locale->text('Final Invoice'),
     pick_list               => $main::locale->text('Pick List'),
     proforma                => $main::locale->text('Proforma Invoice'),
     purchase_order          => $main::locale->text('Purchase Order'),
@@ -1132,7 +1133,7 @@ sub get_number_prefix_for_type {
   my ($self) = @_;
 
   my $prefix =
-      (first { $self->{type} eq $_ } qw(invoice invoice_for_advance_payment credit_note)) ? 'inv'
+      (first { $self->{type} eq $_ } qw(invoice invoice_for_advance_payment final_invoice credit_note)) ? 'inv'
     : ($self->{type} =~ /_quotation$/)                        ? 'quo'
     : ($self->{type} =~ /_delivery_order$/)                   ? 'do'
     : ($self->{type} =~ /letter/)                             ? 'letter'
@@ -1171,7 +1172,7 @@ sub generate_attachment_filename {
   my $attachment_filename = $main::locale->unquote_special_chars('HTML', $self->get_formname_translation());
   my $prefix              = $self->get_number_prefix_for_type();
 
-  if ($self->{preview} && (first { $self->{type} eq $_ } qw(invoice invoice_for_advance_payment credit_note))) {
+  if ($self->{preview} && (first { $self->{type} eq $_ } qw(invoice invoice_for_advance_payment final_invoice credit_note))) {
     $attachment_filename .= ' (' . $recipient_locale->text('Preview') . ')' . $self->get_extension_for_format();
 
   } elsif ($attachment_filename && $self->{"${prefix}number"}) {
@@ -2946,6 +2947,7 @@ sub save_status {
 # $main::locale->text('UNIMPORT')
 # $main::locale->text('invoice')
 # $main::locale->text('invoice_for_advance_payment')
+# $main::locale->text('final_invoice')
 # $main::locale->text('proforma')
 # $main::locale->text('sales_order')
 # $main::locale->text('pick_list')
index 614760c..2b07ee7 100644 (file)
@@ -72,6 +72,9 @@ sub get_print_options {
     ($form->{type} eq 'invoice_for_advance_payment') ? (
       opthash("invoice_for_advance_payment", $form->{PD}{invoice_for_advance_payment},      $locale->text('Invoice for Advance Payment')),
     ) : undef,
+    ($form->{type} eq 'final_invoice') ? (
+      opthash("final_invoice", $form->{PD}{final_invoice},             $locale->text('Final Invoice')),
+    ) : undef,
     ($form->{type} =~ /_delivery_order$/) ? (
       opthash($form->{type},         $form->{PD}{$form->{type}},       $locale->text('Delivery Order')),
       opthash('pick_list',           $form->{PD}{pick_list},           $locale->text('Pick List')),
index e0c8dcf..2a94607 100644 (file)
--- a/SL/IC.pm
+++ b/SL/IC.pm
@@ -736,7 +736,7 @@ sub retrieve_accounts {
 
   # transdate madness.
   my $transdate = "";
-  if ( (any {$form->{type} eq $_} qw(invoice credit_note invoice_for_advance_payment)) or ($form->{script} eq 'ir.pl') ) {
+  if ( (any {$form->{type} eq $_} qw(invoice credit_note invoice_for_advance_payment final_invoice)) or ($form->{script} eq 'ir.pl') ) {
     # use deliverydate for sales and purchase invoice, if it exists
     # also use deliverydate for credit notes
     $transdate = $form->{tax_point} || $form->{deliverydate} || $form->{invdate};
index 1340fcb..1b8534e 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -1061,8 +1061,7 @@ SQL
   # entsprechend auch beim Bestimmen des Steuerschlüssels in Taxkey.pm berücksichtigen
   my $taxdate = $form->{tax_point} ||$form->{deliverydate} || $form->{invdate};
 
-  # better type? maybe define Invoice->invoice_type
-  if (!$already_booked && $form->{type} ne 'invoice_for_advance_payment') {
+  if (!$already_booked && $form->{type} eq 'final_invoice') {
     my $invoices_for_advance_payment = $self->_get_invoices_for_advance_payment($form->{convert_from_ar_ids} || $form->{id});
     if (scalar @$invoices_for_advance_payment > 0) {
       # reverse booking for invoices for advance payment
index e299e2c..25646da 100644 (file)
@@ -15,7 +15,7 @@ use Rose::Object::MakeMethods::Generic
  scalar => [ qw(type id number save dbh dbh_provided business_id) ],
 );
 
-my @SUPPORTED_TYPES = qw(invoice invoice_for_advance_payment credit_note customer vendor sales_delivery_order purchase_delivery_order sales_order purchase_order sales_quotation request_quotation part service assembly assortment letter);
+my @SUPPORTED_TYPES = qw(invoice invoice_for_advance_payment final_invoice credit_note customer vendor sales_delivery_order purchase_delivery_order sales_order purchase_order sales_quotation request_quotation part service assembly assortment letter);
 
 sub new {
   my $class = shift;
@@ -37,7 +37,7 @@ sub _get_filters {
   my $type    = $self->type;
   my %filters = ( where => '' );
 
-  if (any { $_ eq $type } qw(invoice invoice_for_advance_payment credit_note)) {
+  if (any { $_ eq $type } qw(invoice invoice_for_advance_payment final_invoice credit_note)) {
     $filters{trans_number}  = "invnumber";
     $filters{numberfield}   = $type eq 'credit_note' ? "cnnumber" : "invnumber";
     $filters{table}         = "ar";
index b36d921..0ed071e 100644 (file)
@@ -1212,6 +1212,9 @@ sub ar_transactions {
         $is_storno        ? $locale->text("Storno (one letter abbreviation)") :
                             $locale->text("Invoice for Advance Payment (one letter abbreviation)");
 
+    } elsif ($ar->{type} eq 'final_invoice') {
+      $ar->{type} = t8('Final Invoice (one letter abbreviation)');
+
     } else {
       $ar->{type} =
         $has_storno       ? $locale->text("Invoice with Storno (abbreviation)") :
index ca43b49..2f0fb95 100644 (file)
@@ -1210,6 +1210,10 @@ sub print_form {
     $form->{label} = $locale->text('Invoice for Advance Payment');
   }
 
+  if ($form->{formname} eq "final_invoice") {
+    $form->{label} = $locale->text('Final Invoice');
+  }
+
   if ($form->{formname} eq 'sales_order') {
     $inv                  = "ord";
     $due                  = "req";
@@ -1307,7 +1311,7 @@ sub print_form {
   }
 
   $form->{TEMPLATE_DRIVER_OPTIONS} = { };
-  if (any { $form->{type} eq $_ } qw(sales_quotation sales_order sales_delivery_order invoice invoice_for_advance_payment request_quotation purchase_order purchase_delivery_order credit_note)) {
+  if (any { $form->{type} eq $_ } qw(sales_quotation sales_order sales_delivery_order invoice invoice_for_advance_payment final_invoice request_quotation purchase_order purchase_delivery_order credit_note)) {
     $form->{TEMPLATE_DRIVER_OPTIONS}->{variable_content_types} = $form->get_variable_content_types();
   }
 
@@ -1891,6 +1895,7 @@ sub _make_record_item {
     request_quotation       => 'OrderItem',
     invoice                 => 'InvoiceItem',
     invoice_for_advance_payment => 'InvoiceItem',
+    final_invoice           => 'InvoiceItem',
     credit_note             => 'InvoiceItem',
     purchase_invoice        => 'InvoiceItem',
     purchase_delivery_order => 'DeliveryOrderItem',
index 837bde7..e04139f 100644 (file)
@@ -95,6 +95,9 @@ sub add {
   } elsif ($form->{type} eq "invoice_for_advance_payment") {
     $form->{title} = $locale->text('Add Invoice for Advance Payment');
 
+  } elsif ($form->{type} eq "final_invoice") {
+    $form->{title} = $locale->text('Final Invoice');
+
   } else {
     $form->{title} = $locale->text('Add Sales Invoice');
 
@@ -143,6 +146,9 @@ sub edit {
     $form->{title} = $locale->text('Edit Invoice for Advance Payment');
     $form->{title} = $locale->text('Edit Storno Invoice for Advance Payment') if $form->{storno};
 
+  } elsif ($form->{type} eq "final_invoice") {
+    $form->{title} = $locale->text('Edit Final Invoice');
+
   } else {
     $form->{title} = $locale->text('Edit Sales Invoice');
     $form->{title} = $locale->text('Edit Storno Invoice')     if $form->{storno};
@@ -253,6 +259,10 @@ sub prepare_invoice {
     $form->{type}     = "invoice_for_advance_payment";
     $form->{formname} = "invoice_for_advance_payment";
 
+  } elsif ($form->{type} eq "final_invoice") {
+    $form->{type}     = "final_invoice";
+    $form->{formname} = "final_invoice";
+
   } elsif ($form->{formname} eq "proforma" ) {
     $form->{type}     = "invoice";
 
@@ -1214,7 +1224,7 @@ sub final_invoice {
 
   $form->{convert_from_ar_ids} = $form->{id};
   $form->{id}                  = '';
-  $form->{type}                = 'invoice';
+  $form->{type}                = 'final_invoice';
   $form->{title}               = t8('Edit Final Invoice');
   $form->{paidaccounts}        = 1;
   $form->{invdate}             = $form->current_date(\%myconfig);
index 87fa2e0..5fcd70b 100755 (executable)
@@ -1558,6 +1558,7 @@ $self->{texts} = {
   'Filter parts'                => 'Artikel filtern',
   'Filter record template'      => 'Filter für Buchungsvorlagen',
   'Final Invoice'               => 'Schlussrechnung',
+  'Final Invoice (one letter abbreviation)' => 'F',
   'Financial Controlling'       => 'Finanzcontrolling',
   'Financial Controlling Report' => 'Finanzcontrollingbericht',
   'Financial Overview'          => 'Finanzübersicht',
@@ -4424,6 +4425,7 @@ $self->{texts} = {
   'filename'                    => 'Dateiname',
   'filename has not uploadable characters ' => 'Bitte Dateinamen ändern. Er hat für den Upload nicht verwendbare Sonderzeichen ',
   'filesize too big: '          => 'Datei zu groß: ',
+  'final_invoice'               => 'Schlussrechnung',
   'flat-rate position'          => 'Pauschalposition',
   'follow_up_list'              => 'wiedervorlageliste',
   'for'                         => 'für',
index 247252a..6e6d61b 100644 (file)
@@ -1558,6 +1558,7 @@ $self->{texts} = {
   'Filter parts'                => '',
   'Filter record template'      => '',
   'Final Invoice'               => '',
+  'Final Invoice (one letter abbreviation)' => '',
   'Financial Controlling'       => '',
   'Financial Controlling Report' => '',
   'Financial Overview'          => '',
@@ -4420,6 +4421,7 @@ $self->{texts} = {
   'filename'                    => '',
   'filename has not uploadable characters ' => '',
   'filesize too big: '          => '',
+  'final_invoice'               => '',
   'flat-rate position'          => '',
   'follow_up_list'              => '',
   'for'                         => '',
diff --git a/templates/print/marei/final_invoice.tex b/templates/print/marei/final_invoice.tex
new file mode 120000 (symlink)
index 0000000..b6a6ad8
--- /dev/null
@@ -0,0 +1 @@
+invoice.tex
\ No newline at end of file