commit 30784a4dd84a21642387e9c0a7398a8045312963
Author: Bernd Bleßmann <bernd@kivitendo-premium.de>
Date:   Wed Nov 10 16:24:14 2021 +0100

    Anzahlungs-Rg.: Typ in Bericht anzeigen

diff --git a/SL/AR.pm b/SL/AR.pm
index 280184d7e..77c62d39c 100644
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -487,6 +487,7 @@ sub ar_transactions {
     qq|  a.shippingpoint, a.storno, a.storno_id, a.globalproject_id, | .
     qq|  a.marge_total, a.marge_percent, | .
     qq|  a.transaction_description, a.direct_debit, | .
+    qq|  a.type, | .
     qq|  pr.projectnumber AS globalprojectnumber, | .
     qq|  c.name, c.customernumber, c.country, c.ustid, b.description as customertype, | .
     qq|  c.id as customer_id, | .
diff --git a/SL/DB/Invoice.pm b/SL/DB/Invoice.pm
index 54f5483e8..7e7ff1c8d 100644
--- a/SL/DB/Invoice.pm
+++ b/SL/DB/Invoice.pm
@@ -539,6 +539,8 @@ sub invoice_type {
   my ($self) = @_;
 
   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';
   # 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;
@@ -559,6 +561,8 @@ sub displayable_type {
   return t8('Credit Note')                            if $self->invoice_type eq 'credit_note';
   return t8('Invoice') . "(" . t8('Storno') . ")"     if $self->invoice_type eq 'invoice_storno';
   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('Invoice');
 }
 
@@ -573,6 +577,8 @@ sub abbreviation {
   return t8('Credit note (one letter abbreviation)') if $self->invoice_type eq 'credit_note';
   return t8('Invoice (one letter abbreviation)') . "(" . t8('Storno (one letter abbreviation)') . ")" if $self->invoice_type eq 'invoice_storno';
   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('Invoice (one letter abbreviation)');
 }
 
diff --git a/bin/mozilla/ar.pl b/bin/mozilla/ar.pl
index b2a6602bb..b36d9210e 100644
--- a/bin/mozilla/ar.pl
+++ b/bin/mozilla/ar.pl
@@ -1206,12 +1206,20 @@ sub ar_transactions {
     my $is_storno  = $ar->{storno} &&  $ar->{storno_id};
     my $has_storno = $ar->{storno} && !$ar->{storno_id};
 
-    $ar->{type} =
-      $has_storno       ? $locale->text("Invoice with Storno (abbreviation)") :
-      $is_storno        ? $locale->text("Storno (one letter abbreviation)") :
-      $ar->{amount} < 0 ? $locale->text("Credit note (one letter abbreviation)") :
-      $ar->{invoice}    ? $locale->text("Invoice (one letter abbreviation)") :
-                          $locale->text("AR Transaction (abbreviation)");
+    if ($ar->{type} eq 'invoice_for_advance_payment') {
+      $ar->{type} =
+        $has_storno       ? $locale->text("Invoice for Advance Payment with Storno (abbreviation)") :
+        $is_storno        ? $locale->text("Storno (one letter abbreviation)") :
+                            $locale->text("Invoice for Advance Payment (one letter abbreviation)");
+
+    } else {
+      $ar->{type} =
+        $has_storno       ? $locale->text("Invoice with Storno (abbreviation)") :
+        $is_storno        ? $locale->text("Storno (one letter abbreviation)") :
+        $ar->{amount} < 0 ? $locale->text("Credit note (one letter abbreviation)") :
+        $ar->{invoice}    ? $locale->text("Invoice (one letter abbreviation)") :
+                            $locale->text("AR Transaction (abbreviation)");
+    }
 
     map { $ar->{$_} = $form->format_amount(\%myconfig, $ar->{$_}, 2) } qw(netamount tax amount paid due marge_total marge_percent);
 
diff --git a/locale/de/all b/locale/de/all
index 1cbbfd229..fcab59713 100755
--- a/locale/de/all
+++ b/locale/de/all
@@ -1876,6 +1876,8 @@ $self->{texts} = {
   'Invoice email and Contact Person' => 'E-Mail des Rechnungsempfängers und CC an Ansprechpartner',
   'Invoice email settings'      => 'E-Mail Rechnungsversand',
   'Invoice filter'              => 'Rechnungsfilter',
+  'Invoice for Advance Payment (one letter abbreviation)' => 'A',
+  'Invoice for Advance Payment with Storno (abbreviation)' => 'A(S)',
   'Invoice for fees'            => 'Rechnung über Gebühren',
   'Invoice has already been storno\'d!' => 'Diese Rechnung wurde bereits storniert.',
   'Invoice number'              => 'Rechnungsnummer',
diff --git a/locale/en/all b/locale/en/all
index 9df7a6e2e..5ee8737d6 100644
--- a/locale/en/all
+++ b/locale/en/all
@@ -1876,6 +1876,8 @@ $self->{texts} = {
   'Invoice email and Contact Person' => '',
   'Invoice email settings'      => '',
   'Invoice filter'              => '',
+  'Invoice for Advance Payment (one letter abbreviation)' => '',
+  'Invoice for Advance Payment with Storno (abbreviation)' => '',
   'Invoice for fees'            => '',
   'Invoice has already been storno\'d!' => '',
   'Invoice number'              => '',
