[freeside-commits] freeside/conf invoice_html, 1.8, 1.9 invoice_latex, 1.13, 1.14
Jeff Finucane,420,,
jeff at wavetail.420.am
Fri Feb 29 09:57:41 PST 2008
Update of /home/cvs/cvsroot/freeside/conf
In directory wavetail.420.am:/tmp/cvs-serv4728/conf
Modified Files:
invoice_html invoice_latex
Log Message:
refactor print_*; invoice sections by package class; could still stand some more refactoring
Index: invoice_latex
===================================================================
RCS file: /home/cvs/cvsroot/freeside/conf/invoice_latex,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- invoice_latex 20 Apr 2007 21:40:56 -0000 1.13
+++ invoice_latex 29 Feb 2008 17:57:38 -0000 1.14
@@ -187,58 +187,74 @@
\end{minipage}}
\vspace{1.5cm}
%
-\section*{\textsc{Charges}}
-\begin{longtable}{clr}
-\hline
-\rule{0pt}{2.5ex}
-\makebox[1.4cm]{\textbf{Ref}} &
-\makebox[12.8cm][l]{\textbf{Description}} &
-\makebox[2.5cm][r]{\textbf{Amount}} \\
-\hline
-\endfirsthead
-\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\
-\hline
-\rule{0pt}{2.5ex}
-\makebox[1.4cm]{\textbf{Ref}} &
-\makebox[12.8cm][l]{\textbf{Description}} &
-\makebox[2.5cm][r]{\textbf{Amount}} \\
-\hline
-\endhead
-\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\
-\endfoot
-\hline
[@--
+ foreach my $section ( @sections ) {
+ $OUT .= '\section*{\textsc{';
+ $OUT .= ($section->{'description'}) ? $section->{'description'} : 'Charges';
+ $OUT .= '}}\begin{longtable}{clr}';
+ $OUT .= '\hline';
+ $OUT .= '\rule{0pt}{2.5ex}';
+ $OUT .= '\makebox[1.4cm]{\textbf{Ref}} & ';
+ $OUT .= '\makebox[12.8cm][l]{\textbf{Description}} & ';
+ $OUT .= '\makebox[2.5cm][r]{\textbf{Amount}} \\\\';
+ $OUT .= '\hline';
+ $OUT .= '\endfirsthead';
+ $OUT .= '\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued from previous page}\\\\';
+ $OUT .= '\hline';
+ $OUT .= '\rule{0pt}{2.5ex}';
+ $OUT .= '\makebox[1.4cm]{\textbf{Ref}} & ';
+ $OUT .= '\makebox[12.8cm][l]{\textbf{Description}} & ';
+ $OUT .= '\makebox[2.5cm][r]{\textbf{Amount}} \\\\';
+ $OUT .= '\hline';
+ $OUT .= '\endhead';
+ $OUT .= '\multicolumn{3}{r}{\rule{0pt}{2.5ex}Continued on next page...}\\\\';
+ $OUT .= '\endfoot';
+ $OUT .= '\hline';
- foreach my $line (@total_items) {
- $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' .
- '{' . $line->{'total_amount'} . '}' . "\n";
- }
+ if (scalar(@sections) > 1) {
+ $OUT .= '\FStotaldesc{' . $section->{'description'} . ' Total}' .
+ '{' . $section->{'subtotal'} . '}' . "\n";
+ }
---@]
-\hline
-\endlastfoot
-[@--
+ if ($section == $sections[$#sections]) {
+ foreach my $line (@total_items) {
+ $OUT .= '\FStotaldesc{' . $line->{'total_item'} . '}' .
+ '{' . $line->{'total_amount'} . '}' . "\n";
+ }
+ }
- foreach my $line (@detail_items) {
- my $ext_description = $line->{'ext_description'};
+ $OUT .= '\hline';
+ $OUT .= '\endlastfoot';
- # Don't break-up small packages.
- my $rowbreak = @$ext_description < 5 ? '*' : '';
+ foreach my $line (
+ grep { ( scalar( @sections ) > 1
+ ? $section->{'description'} eq $_->{'section'}->{'description'}
+ : 1
+ ) }
+ @detail_items )
+ {
+ my $ext_description = $line->{'ext_description'};
+
+ # Don't break-up small packages.
+ my $rowbreak = @$ext_description < 5 ? '*' : '';
+
+ $OUT .= "\\hline\n";
+ $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' .
+ '{' . $line->{'amount'} . "}${rowbreak}\n";
- $OUT .= "\\hline\n";
- $OUT .= '\FSdesc{' . $line->{'ref'} . '}{' . $line->{'description'} . '}' .
- '{' . $line->{'amount'} . "}${rowbreak}\n";
+ foreach my $ext_desc (@$ext_description) {
+ $ext_desc = substr($ext_desc, 0, 80) . '...'
+ if (length($ext_desc) > 80);
+ $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n";
+ }
- foreach my $ext_desc (@$ext_description) {
- $ext_desc = substr($ext_desc, 0, 80) . '...'
- if (length($ext_desc) > 80);
- $OUT .= '\FSextdesc{' . $ext_desc . '}' . "${rowbreak}\n";
}
+ $OUT .= '\end{longtable}';
+
}
--@]
-\end{longtable}
\vfill
[@-- $notes --@]
\end{document}
Index: invoice_html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/conf/invoice_html,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- invoice_html 14 Oct 2007 23:14:56 -0000 1.8
+++ invoice_html 29 Feb 2008 17:57:37 -0000 1.9
@@ -68,31 +68,67 @@
</table>
- <p><b><font size="+1">C</font><font size="+0">HARGES</font></b>
- <p>
- <table class="invoice_longtable" CELLSPACING=0 WIDTH="100%">
- <tr>
- <th align="center">Ref</th>
- <th align="left">Description</th>
- <th align="right">Amount</th>
- </tr>
- <%=
+ <%=
+ foreach my $section ( @sections ) {
+ $OUT .= '<table><tr><td>';
+ if ($section->{'description'}) {
+ $OUT .=
+ '<p><b><font size="+1">'. uc(substr($section->{'description'},0,1)).
+ '</font><font size="+0">'. uc(substr($section->{'description'},1)).
+ '</font></b>'.
+ '<p>';
+ }else{
+ $OUT .=
+ '<p><b><font size="+1">C</font><font size="+0">HARGES</font></b>'.
+ '<p>';
+ }
+ $OUT .= '</td></tr></table>';
- foreach my $line ( @detail_items ) {
$OUT .=
- '<tr class="invoice_desc">'.
- '<td align="center">'. $line->{'ref'}. '</td>'.
- '<td align="left">'. $line->{'description'}. '</td>'.
- '<td align="right">'. $line->{'amount'}. '</td>'.
- '</tr>'
- ;
- foreach my $ext_desc ( @{$line->{'ext_description'} } ) {
+ '<table class="invoice_longtable" CELLSPACING=0 WIDTH="100%">'.
+ '<tr>'.
+ '<th align="center">Ref</th>'.
+ '<th align="left">Description</th>'.
+ '<th align="right">Amount</th>'.
+ '</tr>';
+
+ foreach my $line (
+ grep { ( scalar(@sections) > 1
+ ? $section->{'description'} eq $_->{'section'}->{'description'}
+ : 1
+ ) }
+ @detail_items )
+ {
$OUT .=
- '<tr class="invoice_extdesc">'.
- '<td></td>'.
- '<td align="left">- '. $ext_desc. '</td>'.
- '<td></td>'.
+ '<tr class="invoice_desc">'.
+ '<td align="center">'. $line->{'ref'}. '</td>'.
+ '<td align="left">'. $line->{'description'}. '</td>'.
+ '<td align="right">'. $line->{'amount'}. '</td>'.
'</tr>'
+ ;
+ foreach my $ext_desc ( @{$line->{'ext_description'} } ) {
+ $OUT .=
+ '<tr class="invoice_extdesc">'.
+ '<td></td>'.
+ '<td align="left">- '. $ext_desc. '</td>'.
+ '<td></td>'.
+ '</tr>'
+ }
+ }
+
+
+ if (scalar(@sections) > 1) {
+ my $style = 'border-top: 3px solid #000000;'.
+ 'border-bottom: 3px solid #000000;';
+ $OUT .=
+ '<tr class="invoice_totaldesc">'.
+ qq(<td style="$style"> </td>).
+ qq(<td align="left" style="$style">).
+ $section->{'description'}. ' Total </td>'.
+ qq(<td align="right" style="$style">).
+ $section->{'subtotal'}. '</td>'.
+ '</tr>'
+ ;
}
}
More information about the freeside-commits
mailing list