RT# 79636 Location Summary Invoice Footer
authorMitch Jackson <mitch@freeside.biz>
Fri, 20 Apr 2018 01:11:41 +0000 (01:11 +0000)
committerMitch Jackson <mitch@freeside.biz>
Fri, 20 Apr 2018 01:11:41 +0000 (01:11 +0000)
FS/FS/Template_Mixin.pm
conf/invoice_html
conf/invoice_latex

index 9b35061..07252d0 100644 (file)
@@ -942,7 +942,9 @@ sub print_generic {
 
   my $unsquelched = $params{unsquelch_cdr} || $cust_main->squelch_cdr ne 'Y';
   my $multisection = $self->has_sections;
-  $invoice_data{'multisection'} = $multisection;
+  if ( $multisection ) {
+    $invoice_data{multisection} = $conf->config($tc.'sections_method') || 1;
+  }
   my $late_sections;
   my $extra_sections = [];
   my $extra_lines = ();
index 935c943..9e5a392 100644 (file)
   </table>
   <br><br>
 
+<%=
+
+  my @location_summary_sections =
+    grep {
+      ref $_->{location}
+      && $_->{locationnum}
+      && $_->{description}
+      && $_->{description} ne $finance_section
+    } @sections;
+
+  if ( $multisection eq 'location' && scalar(@location_summary_sections) > 1 ) {
+
+    $OUT .= '
+      <hr>
+      <table width="100%">
+        <tr>
+          <td>
+            <p class="allcaps">
+              <b>'.emt('Summary Of New Charges By Location').'</b>
+            <p>
+          </td>
+        </tr>
+      </table>
+
+      <table class="invoice_longtable" cellspacing="0" width="100%">
+      <thead>
+        <tr>
+          <th></th>
+          <th align="left">'.emt('Location').'</th>
+          <th align="right">'.emt('Amount').'</th>
+        </tr>
+      </thead>
+      <tbody>
+    ';
+
+    for my $section (@location_summary_sections) {
+      next unless $section->{description};
+      $OUT .= '
+        <tr class="invoice_desc_more">
+          <td></td>
+          <td>'.$section->{description}.'</td>
+          <td align="right">'. $section->{subtotal} .'</td>
+        </tr>
+      ';
+    }
+
+    $OUT .= '
+      <tr class="invoice_desc"><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
+      </tbody>
+      </table>
+      <br><br>
+    ';
+
+  }
+%>
+
 <%= length($summary)
       ? ''
       : ( $smallernotes
index a710cdd..6d4c536 100644 (file)
   }\r
 \r
 --@]\r
+[@--\r
+\r
+  my @location_summary_sections =\r
+    grep {\r
+      ref $_->{location}\r
+      && $_->{locationnum}\r
+      && $_->{description}\r
+      && $_->{description} ne $finance_section\r
+    } @sections;\r
+  if ( $multisection eq 'location' && scalar(@location_summary_sections) > 1 ) {\r
+\r
+$OUT .= '\r
+      \hline\r
+      \section*{}\r
+      \captionsetup{singlelinecheck=false,justification=raggedright,font={Large,sc,bf}}\r
+      \ifthenelse{\equal{\thepage}{1}}{\setlength{\LTextracouponspace}{\extracouponspace}}{\setlength{\LTextracouponspace}{0pt}}\r
+\r
+      \begin{longtable}{cllllllr}\r
+      \caption*{ '. emt('Summary of New Charges by Location') .' }\r
+      \\\\\r
+\r
+      \hline\r
+      \rule{0pt}{2.5ex}\r
+      \makebox[1.4cm]{} &\r
+      \multicolumn{6}{l}{\r
+        \truncate{13.0cm}{\textbf{'. emt('Location') .'}}\r
+      } &\r
+      \makebox[1.6cm][r]{\textbf{'. emt('Amount') .'}} \\\\\r
+      \hline\r
+\r
+      \endfirsthead\r
+      \multicolumn{7}{r}{\rule{0pt}{2.5ex}'. emt('Continued from previous page') .'}\r
+      \\\r
+      \FShead\r
+      \endhead\r
+      \multicolumn{7}{r}{\rule{0pt}{2.5ex}'. emt('Continued on next page...') .'}\r
+      \\\r
+      \endfoot\r
+      \hline\r
+      \endlastfoot\r
+      \hline\r
+    ';\r
+\r
+    for my $section (@location_summary_sections) {\r
+      $OUT.= '\r
+        \rule{0pt}{2.5ex}\r
+        \makebox[1.4cm]{} &\r
+        \multicolumn{6}{l}{\r
+          \truncate{12.0cm}{\textbf{'. $section->{description} .'}}\r
+        } &\r
+        \makebox[1.6cm][r]{\textbf{'. $section->{subtotal} .'}} \\\\\r
+      ';\r
+    }\r
+\r
+    $OUT .= '\end{longtable}';\r
+  }\r
+--@]\r
 \vfill\r
 \begin{minipage}[t]{\textwidth}\r
   [@-- length($summary)\r