commit 4c9ae7fe80ec4b8bebca3935ac6c3d2cca788fae
Author: Moritz Bunkus <m.bunkus@linet.de>
Date:   Fri Sep 25 10:34:06 2015 +0200

    SEPA: In Exportliste Anzahl Rechnungen & Summe der Beträge als Spalten anzeigen

diff --git a/SL/SEPA.pm b/SL/SEPA.pm
index cbea8417e..8e7306e31 100644
--- a/SL/SEPA.pm
+++ b/SL/SEPA.pm
@@ -364,6 +364,12 @@ sub list_exports {
 
   my $query =
     qq|SELECT se.id, se.employee_id, se.executed, se.closed, itime::date AS export_date,
+         (SELECT COUNT(*)
+          FROM sepa_export_items sei
+          WHERE (sei.sepa_export_id = se.id)) AS num_invoices,
+         (SELECT SUM(sei.amount)
+          FROM sepa_export_items sei
+          WHERE (sei.sepa_export_id = se.id)) AS sum_amounts,
          e.name AS employee
        FROM sepa_export se
        LEFT JOIN (
diff --git a/bin/mozilla/sepa.pl b/bin/mozilla/sepa.pl
index f2170ae89..ac018e258 100755
--- a/bin/mozilla/sepa.pl
+++ b/bin/mozilla/sepa.pl
@@ -234,9 +234,12 @@ sub bank_transfer_list {
     'employee'    => { 'text' => $locale->text('Employee'), },
     'executed'    => { 'text' => $locale->text('Executed'), },
     'closed'      => { 'text' => $locale->text('Closed'), },
+    num_invoices  => { 'text' => $locale->text('Number of invoices'), },
+    sum_amounts   => { 'text' => $locale->text('Sum of all amounts'), },
   );
 
-  my @columns = qw(selected id export_date employee executed closed);
+  my @columns = qw(selected id export_date employee executed closed invoices netamount);
+  my %column_alignment = map { ($_ => 'right') } qw(num_invoices sum_amounts);
 
   foreach my $name (qw(id export_date employee executed closed)) {
     my $sortdir                 = $form->{sort} eq $name ? 1 - $form->{sortdir} : $form->{sortdir};
@@ -246,6 +249,7 @@ sub bank_transfer_list {
   $column_defs{selected}->{visible} = $open_available                                ? 'HTML' : 0;
   $column_defs{executed}->{visible} = $form->{l_executed} && $form->{l_not_executed} ? 1 : 0;
   $column_defs{closed}->{visible}   = $form->{l_closed}   && $form->{l_open}         ? 1 : 0;
+  $column_defs{$_}->{align}         = $column_alignment{$_} for keys %column_alignment;
 
   my @options = ();
   push @options, ($vc eq 'customer' ? $::locale->text('Customer') : $locale->text('Vendor')) . ' : ' . $form->{f_vc} if ($form->{f_vc});
@@ -278,12 +282,14 @@ sub bank_transfer_list {
   my $edit_url = build_std_url('action=bank_transfer_edit', 'callback');
 
   foreach my $export (@{ $exports }) {
-    my $row = { map { $_ => { 'data' => $export->{$_} } } keys %{ $export } };
+    my $row = { map { $_ => { 'data' => $export->{$_}, 'align' => $column_alignment{$_} } } keys %{ $export } };
 
     map { $row->{$_}->{data} = $export->{$_} ? $locale->text('yes') : $locale->text('no') } qw(executed closed);
 
     $row->{id}->{link} = $edit_url . '&id=' . E($export->{id}) . '&vc=' . E($vc);
 
+    $row->{$_}->{data} = $::form->format_amount(\%::myconfig, $row->{$_}->{data}, 2) for qw(sum_amounts);
+
     if (!$export->{closed}) {
       $row->{selected}->{raw_data} =
           $cgi->hidden(-name => "exports[+].id", -value => $export->{id})
diff --git a/locale/de/all b/locale/de/all
index d2884bd62..ac3f2a791 100755
--- a/locale/de/all
+++ b/locale/de/all
@@ -1771,6 +1771,7 @@ $self->{texts} = {
   'Number of columns of custom variables in form details (second row)' => 'Anzahl der Spalten für benutzerdef. Variablen in den Formulardetails (zweite Positionszeile)',
   'Number of copies'            => 'Anzahl Kopien',
   'Number of entries changed: #1' => 'Anzahl geänderter Einträge: #1',
+  'Number of invoices'          => 'Anzahl Rechnungen',
   'Number of invoices created:' => 'Anzahl erstellter Rechnungen:',
   'Number of invoices printed:' => 'Anzahl gedruckter Rechnungen:',
   'Number of invoices to create' => 'Anzahl zu erstellender Rechnungen',
@@ -2510,6 +2511,7 @@ $self->{texts} = {
   'Sum for'                     => 'Summe für',
   'Sum for #1'                  => 'Summe für #1',
   'Sum for section'             => 'Summe für Abschnitt',
+  'Sum of all amounts'          => 'Summe aller Beträge',
   'Sum open amount'             => 'Summierter offener Betrag',
   'Sum per'                     => 'Summe per',
   'Summen- und Saldenliste'     => 'Summen- und Saldenliste',
