diff options
author | Mark Wells <mark@freeside.biz> | 2015-09-10 16:27:43 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2015-09-10 16:27:51 -0700 |
commit | 9896275b96170e2a97e313e64c7aa5bfaf12a087 (patch) | |
tree | fe08862d6d8913aeae922df0539f4dec1243f19d /conf/invoice_html | |
parent | 8d76610b4329151076c7e2b81891406df36d18bb (diff) |
improve usage_class_summary with number of calls and total minutes, #37122
Diffstat (limited to 'conf/invoice_html')
-rw-r--r-- | conf/invoice_html | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/conf/invoice_html b/conf/invoice_html index dfd87c79b..e1af70703 100644 --- a/conf/invoice_html +++ b/conf/invoice_html @@ -176,15 +176,28 @@ $OUT .= $header; $columncount = scalar(my @array = split /<\/th><th/i, $header); } else { - $OUT .= '<th align="center"></th>'. - '<th align="left">' . emt('Description') . '</th>'. - ( $unitprices - ? '<th align="right">' . emt('Unit Price') . '</th>'. - '<th align="right">' . emt('Quantity') . '</th>' - : '' ). - '<th align="right">' . emt('Amount') . '</th>'; + my @headings = ( '', 'Description', 'Amount' ); + my @aligns = ( 'center', 'left', 'right' ); + if ( $unitprices ) { + splice @headings, 2, 0, 'Unit Price', 'Quantity'; + splice @aligns, 2, 0, 'right', 'right'; + } + if ( $section->{usage_section} ) { + @headings = ( '', 'Description', 'Calls', 'Duration', 'Amount' ); + @aligns = ( '', 'left', 'right', 'right', 'right' ); + $columncount = 5; + } + + while ( @headings ) { + my $heading = shift @headings; + $heading = emt($heading) if $heading; + my $align = shift @aligns; + $OUT .= ' + <th align="' . $align . '">' . $heading . '</th>'; + } } - $OUT .= '</tr>'; + + $OUT .= '</tr>'; my $lastref = 0; foreach my $line ( @@ -197,6 +210,17 @@ if ( $section->{description_generator} ) { $OUT .= '<tr class="invoice_desc' . &{$section->{description_generator}}($line); + } elsif ( $section->{usage_section} ) { + my $minutes = sprintf('%d', $line->{'duration'} / 60); + my $seconds = $line->{'duration'} % 60; + $OUT .= ' + <tr class="invoice_desc_more"> + <td></td> + <td align="left">' . $line->{'description'} . '</td> + <td align="right">' . $line->{'quantity'} . '</td> + <td align="right">' . $minutes . 'm ' . $seconds . 's' . '</td> + <td align="right">' . $line->{'amount'} . '</td> + </tr>'; } else { my $class = 'invoice_desc_more'; if ( ($line->{'ref'} || 0) ne $lastref ) { @@ -257,7 +281,7 @@ } $OUT .= '</tr>'; } - } + } # if !$section->{summarized} if ($section->{'posttotal'}) { $OUT .= '<tr><td align="right" colspan='. $columncount. '>'; $OUT .= |