Kundenstatistik: Briefe
authorWerner Hahn <wh@futureworldsearch.net>
Mon, 10 Sep 2018 13:44:23 +0000 (15:44 +0200)
committerWerner Hahn <wh@futureworldsearch.net>
Mon, 10 Sep 2018 17:54:03 +0000 (19:54 +0200)
SL/Controller/CustomerVendorTurnover.pm
templates/webpages/customer_vendor_turnover/letter_statistic.html [new file with mode: 0644]

index d02fb76..e7aea0a 100644 (file)
@@ -370,6 +370,28 @@ SQL
   $self->render('customer_vendor_turnover/email_statistic', { layout => 0 }, emails => $emails);
 }
 
+sub action_get_letters {
+  my ($self) = @_;
+
+  return $self->render('generic/error', { layout => 0 }, label_error => "list_transactions needs a trans_id") unless $::form->{id};
+
+  my $cv = $::form->{id} || {};
+  my $letters;
+  my $type = $::form->{type};
+  if ( $::form->{db} eq 'customer' ) {
+    $letters = SL::DB::Manager::Letter->get_all(
+      query => [ customer_id => $cv, ],
+      sort_by => 'date DESC',
+    );
+  } else {
+    $letters = SL::DB::Manager::Letter->get_all(
+      query => [ vendor_id => $cv, ],
+      sort_by => 'date DESC',
+    );
+  }
+    $self->render('customer_vendor_turnover/letter_statistic', { layout => 0 }, letters => $letters);
+}
+
 sub _list_articles_by_invoice {
 }
 sub _list_count_articles_by_year {
diff --git a/templates/webpages/customer_vendor_turnover/letter_statistic.html b/templates/webpages/customer_vendor_turnover/letter_statistic.html
new file mode 100644 (file)
index 0000000..c320884
--- /dev/null
@@ -0,0 +1,46 @@
+[%- USE T8 %]
+[%- USE LxERP %]
+[%- USE L %]
+[%- USE HTML %]
+[%- USE Dumper %]
+
+<div id="invoice_statistic">
+  <table width="100%">
+    <tbody>
+      <tr>
+        <td class="listheading">[% 'Date' | $T8 %]</td>
+        <td class="listheading">[% 'Subject' | $T8 %]</td>
+        <td class="listheading">[% 'Letternumber' | $T8 %]</td>
+        <td class="listheading">[% 'Contact' | $T8 %]</td>
+        <td class="listheading">[% 'Author' | $T8 %]</td>
+      </tr>
+
+      [%- FOREACH row = letters %]
+      [% IF row.customer_id %]
+        [% SET is_sales = 1 %]
+      [% ELSE %]
+        [% SET is_sales = 0 %]
+      [% END %]
+      <tr class="listrow[% loop.count % 2 %]">
+        <td>[% row.date.to_kivitendo | html %]</td>
+        <td>
+          <a href="[% SELF.url_for(controller='controller.pl', action => 'Letter/edit', 'letter.id' => row.id, is_sales=is_sales, back_to => SELF.get_callback) %]">
+           [%- HTML.escape(row.subject) %]
+          </a>
+        </td>
+        <td>
+          <a href="[% SELF.url_for(controller='controller.pl', action => 'Letter/edit', 'letter.id' => row.id, is_sales=is_sales, back_to => SELF.get_callback) %]">
+          [% row.letternumber | html %]
+          </a>
+        </td>
+        <td>[% row.contact.cp_givenname %] [% row.contact.cp_name %]</td>
+        <td>[% row.employee.name %]</td>
+      </tr>
+      [% END %]
+    </tbody>
+  </table>
+
+
+    </tbody>
+  </table>
+</div>