+
' if $notfirst;
$OUT .=
''.
' '.
@@ -78,87 +97,108 @@
''. uc(substr($section->{'pretotal'},1)).
''.
' '.
- ' | ';
- }
- $OUT .= '';
- if ($section->{'description'}) {
- $OUT .=
- ' '. uc(substr($section->{'description'},0,1)).
- ''. uc(substr($section->{'description'},1)).
- ''.
- ' ';
- }else{
- $OUT .=
- ' CHARGES'.
- ' ';
+ ' | ';
}
- $OUT .= ' ';
+ unless ($section->{'summarized'}) {
+ $OUT .= ' | ' if ( $notfirst || $section->{'pretotal'} && !$summary );
+ $OUT .= '';
+ if ($section->{'description'}) {
+ $OUT .=
+ ' '. uc(substr($section->{'description'},0,1)).
+ ''. uc(substr($section->{'description'},1)).
+ ''.
+ ' ';
+ }else{
+ $OUT .=
+ ' CHARGES'.
+ ' ';
+ }
+ $OUT .= ' | ';
- $OUT .=
- ''.
- ''.
- 'Ref | '.
- 'Description | '.
- <%= ( $unitprices
- ? 'Unit Price | '.
- 'Quantity | '
- : ''
- )
- %>
- 'Amount | '.
- ' ';
-
- foreach my $line (
- grep { ( scalar(@sections) > 1
- ? $section->{'description'} eq $_->{'section'}->{'description'}
- : 1
- ) }
- @detail_items )
- {
$OUT .=
- ''.
- ''. $line->{'ref'}. ' | '.
- ''. $line->{'description'}. ' | '.
- ( $unitprices
- ? ''. $line->{'unit_amount'}. ' | '.
- ''. $line->{'quantity'}. ' | '
- : ''
- ).
-
- ''. $line->{'amount'}. ' | '.
- ' '
- ;
- if ( @{$line->{'ext_description'} } ) {
- $OUT .= ' | ' : '>';
- $OUT .= '';
- foreach my $ext_desc ( @{$line->{'ext_description'} } ) {
- $OUT .=
- ''.
- '- '. $ext_desc. ' | '.
- ' '
+ ''.
+ '';
+
+ if ($section->{header_generator}) {
+ $OUT .= &{$section->{header_generator}}();
+ } else {
+ $OUT .= 'Ref | '.
+ 'Description | '.
+ ( $unitprices
+ ? 'Unit Price | '.
+ 'Quantity | '
+ : ''
+ ).
+ 'Amount | ';
+ }
+ $OUT .= ' ';
+
+ my $lastref = 0;
+ foreach my $line (
+ grep { ( scalar(@sections) > 1
+ ? $section->{'description'} eq $_->{'section'}->{'description'}
+ : 1
+ ) }
+ @detail_items )
+ {
+ $OUT .=
+ ''.
+ ''.
+ ( $line->{'ref'} ne $lastref ? $line->{'ref'} : '' ). ' | '.
+ ''. $line->{'description'}. ' | '.
+ ( $unitprices
+ ? ''. $line->{'unit_amount'}. ' | '.
+ ''. $line->{'quantity'}. ' | '
+ : ''
+ ).
+
+ ''. $line->{'amount'}. ' | ';
+ }
+ $OUT .= ' ';
+ $lastref = $line->{'ref'};
+ if ( @{$line->{'ext_description'} } ) {
+ $OUT .= ' | ' : '>';
+ $OUT .= '';
+ foreach my $ext_desc ( @{$line->{'ext_description'} } ) {
+ $OUT .=
+ ''.
+ '/i ? '' : 'colspan=99' ). '>'.
+ ' '. $ext_desc.
+ ' | '.
+ ' '
+ }
+ $OUT .= ' | | ';
}
- $OUT .= ' | ';
}
- }
- if (scalar(@sections) > 1) {
- my $style = 'border-top: 3px solid #000000;'.
- 'border-bottom: 3px solid #000000;';
- $OUT .=
- ''.
- qq( | ).
- qq().
- $section->{'description'}. ' Total | '.
- qq().
- $section->{'subtotal'}. ' | '.
- ' '
- ;
- }
-
+ if ($section->{'description'} || $multisection) {
+ my $style = 'border-top: 3px solid #000000;'.
+ 'border-bottom: 3px solid #000000;';
+ $OUT .=
+ ''.
+ qq( | );
+ if ($section->{total_generator}) {
+ $OUT .= &{$section->{total_generator}}($section);
+ } else {
+ $OUT .= qq(' : '>' ).
+ $section->{'description'}. ' Total | '.
+ qq().
+ $section->{'subtotal'}. ' | ';
+ }
+ $OUT .= ' ';
+ }
+ }
if ($section->{'posttotal'}) {
- $OUT .= '';
+ $OUT .= ' | ';
$OUT .=
' '. $section->{'posttotal'}.
''.
@@ -166,6 +206,8 @@
$OUT .= ' | ';
}
+ $notfirst++;
+
}
my $style = 'border-top: 3px solid #000000;';
@@ -174,18 +216,21 @@
foreach my $line ( @total_items ) {
$style .= 'border-bottom: 3px solid #000000;'
- if ++$linenum == scalar(@total_items);
+ if ++$linenum == scalar(@total_items) - ( $balance_due_below_line ? 1 : 0 );
$OUT .=
- ''.
- qq( | ).
- qq(' : '>' ).
- $line->{'total_item'}. ' | '.
- qq().
- $line->{'total_amount'}. ' | '.
- ' '
- ;
+ '';
+ if ($section->{total_line_generator}) {
+ $OUT .= &{$section->{total_line_generator}}($line);
+ } else {
+ $OUT .= qq( | ).
+ qq(' : '>' ).
+ $line->{'total_item'}. ' | '.
+ qq().
+ $line->{'total_amount'}. ' | ';
+ }
+ $OUT .= ' ';
$style='';
@@ -195,9 +240,15 @@
-<%= $notes %>
+<%= length($summary)
+ ? ''
+ : ( $smallernotes
+ ? ''.$notes.''
+ : $notes
+ )
+%>
- <%= $footer %>
+ ><%= $footer %>
|
|