[freeside-commits] freeside/conf invoice_html,1.33,1.33.2.1

Jeff Finucane,420,, jeff at wavetail.420.am
Fri Nov 20 09:39:42 PST 2009


Update of /home/cvs/cvsroot/freeside/conf
In directory wavetail.420.am:/tmp/cvs-serv20142/conf

Modified Files:
      Tag: FREESIDE_1_9_BRANCH
	invoice_html 
Log Message:
invoice formatting: add sections for usage, add sections per svc_phone, add folding like line items into one #6592

Index: invoice_html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/conf/invoice_html,v
retrieving revision 1.33
retrieving revision 1.33.2.1
diff -u -d -r1.33 -r1.33.2.1
--- invoice_html	8 Oct 2009 01:15:06 -0000	1.33
+++ invoice_html	20 Nov 2009 17:39:40 -0000	1.33.2.1
@@ -114,15 +114,20 @@
 
           $OUT .=
             '<table class="invoice_longtable" CELLSPACING=0 WIDTH="100%">'.
-            '<tr>'.
-              '<th align="center">Ref</th>'.
-              '<th align="left">Description</th>'.
-              ( $unitprices 
-                  ? '<th align="left">Unit Price</th>'.
-                    '<th align="left">Quantity</th>'
-                  : ''
-                ).
-              '<th align="right">Amount</th>'.
+            '<tr>';
+
+          if ($section->{header_generator}) {
+            $OUT .= &{$section->{header_generator}}();
+          } else {
+            $OUT .=  '<th align="center">Ref</th>'.
+                     '<th align="left">Description</th>'.
+                        ( $unitprices 
+                          ? '<th align="left">Unit Price</th>'.
+                            '<th align="left">Quantity</th>'
+                          : ''
+                        ). 
+                      '<th align="right">Amount</th>';
+          }
             '</tr>';
 
           my $lastref = 0;
@@ -134,21 +139,24 @@
             @detail_items )
           {
             $OUT .=
-              '<tr class="invoice_desc'.
-                ( ($line->{'ref'} && $line->{'ref'} ne $lastref) ? '' : '_more' ).
-                '">'.
-                '<td align="center">'. 
-                ( $line->{'ref'} ne $lastref ? $line->{'ref'} : '' ). '</td>'.
-                '<td align="left">'. $line->{'description'}. '</td>'.
-                ( $unitprices 
-                    ? '<td align="left">'. $line->{'unit_amount'}. '</td>'.
-                      '<td align="left">'. $line->{'quantity'}. '</td>'
-                    : ''
-                ).
+              '<tr class="invoice_desc';
+            if ( $section->{description_generator} ) {
+              $OUT .= &{$section->{description_generator}}($line);
+            } else {
+              $OUT .=  ( ($line->{'ref'} && $line->{'ref'} ne $lastref) ? '' : '_more' ).
+                       '">'.
+                       '<td align="center">'. 
+                       ( $line->{'ref'} ne $lastref ? $line->{'ref'} : '' ). '</td>'.
+                       '<td align="left">'. $line->{'description'}. '</td>'.
+                       ( $unitprices 
+                           ? '<td align="left">'. $line->{'unit_amount'}. '</td>'.
+                             '<td align="left">'. $line->{'quantity'}. '</td>'
+                           : ''
+                       ).
 
-                '<td align="right">'. $line->{'amount'}. '</td>'.
-              '</tr>'
-            ;
+                       '<td align="right">'. $line->{'amount'}. '</td>';
+            }
+            $OUT .= '</tr>';
             $lastref = $line->{'ref'};
             if ( @{$line->{'ext_description'} } ) {
               $OUT .= '<tr class="invoice_extdesc"><td></td><td';
@@ -173,14 +181,17 @@
                         'border-bottom: 3px solid #000000;';
             $OUT .=
               '<tr class="invoice_totaldesc">'.
-                qq(<td style="$style">&nbsp;</td>).
-                qq(<td align="left" style="$style"). 
-                  ( $unitprices ? ' colspan=3>' : '>' ).
-                  $section->{'description'}. ' Total </td>'.
-                qq(<td align="right" style="$style">).
-                  $section->{'subtotal'}. '</td>'.
-              '</tr>'
-          ;
+              qq(<td style="$style">&nbsp;</td>);
+            if ($section->{total_generator}) {
+              $OUT .= &{$section->{total_generator}}($section);
+            } else {
+              $OUT .= qq(<td align="left" style="$style"). 
+                      ( $unitprices ? ' colspan=3>' : '>' ).
+                      $section->{'description'}. ' Total </td>'.
+                      qq(<td align="right" style="$style">).
+                      $section->{'subtotal'}. '</td>';
+            }
+            $OUT .= '</tr>';
           }
         } 
         if ($section->{'posttotal'}) {
@@ -203,15 +214,18 @@
           if ++$linenum == scalar(@total_items);
 
         $OUT .=
-          '<tr class="invoice_totaldesc">'.
-            qq(<td style="$style">&nbsp;</td>).
-            qq(<td align="left" style="$style").
-            ( $unitprices ? ' colspan=3>' : '>' ).
-              $line->{'total_item'}. '</td>'.
-            qq(<td align="right" style="$style">).
-              $line->{'total_amount'}. '</td>'.
-          '</tr>'
-        ;
+          '<tr class="invoice_totaldesc">';
+        if ($section->{total_line_generator}) {
+          $OUT .= &{$section->{total_line_generator}}($line);
+        } else {
+          $OUT .= qq(<td style="$style">&nbsp;</td>).
+                  qq(<td align="left" style="$style").
+                  ( $unitprices ? ' colspan=3>' : '>' ).
+                    $line->{'total_item'}. '</td>'.
+                  qq(<td align="right" style="$style">).
+                    $line->{'total_amount'}. '</td>';
+        }
+        $OUT .= '</tr>';
 
         $style='';
 



More information about the freeside-commits mailing list