X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=a195e5de8d180c5078ea97e04756e9b24d3cad3d;hb=0cabf7d128df2d7286edc9697e311027eb94c596;hp=df9711cfd04b602833d4b1864d6bf41705a1b8b8;hpb=e60646b3956c63646261e4f96341cf6cef477466;p=freeside.git diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index df9711cfd..a195e5de8 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -2862,44 +2862,55 @@ sub _items_total { my @items; my ($pr_total) = $self->previous; + my ($previous_charges_desc, $new_charges_desc, $new_charges_amount); + if ( $conf->exists('previous_balance-exclude_from_total') ) { + # can we do some caching on this stuff? it's going to change infrequently + # in production + $previous_charges_desc = $self->mt( + $conf->config('previous_balance-text') || 'Previous Balance' + ); + # then return separate lines for previous balance and total new charges if ( $pr_total ) { push @items, - { total_item => $self->mt('Previous Balance'), + { total_item => $previous_charges_desc, total_amount => sprintf('%.2f',$pr_total) }; } - my $new_charges_desc = $self->mt( - $conf->config('previous_balance-exclude_from_total') + $new_charges_desc = $self->mt( + $conf->config('previous_balance-text-total_new_charges') || 'Total New Charges' - ); # localize 'Total New Charges' or whatever's in the config - - if ( $conf->exists('invoice_show_prior_due_date') ) { - # then the due date should be shown with Total New Charges, - # and should NOT be shown with the Balance Due message. - if ( $self->due_date ) { - # localize the "Please pay by" message and the date itself - # (grammar issues with this, yeah) - $new_charges_desc .= ' - ' . $self->mt('Please pay by') . ' ' . - $self->due_date2str('short'); - } elsif ( $self->terms ) { - # phrases like "due on receipt" should be localized - $new_charges_desc .= ' - ' . $self->mt($self->terms); - } - } + ); - push @items, - { total_item => $self->mt($new_charges_desc), - total_amount => $self->charged - }; + $new_charges_amount = $self->charged; } else { - push @items, - { total_item => $self->mt('Total Charges'), - total_amount => sprintf('%.2f',$self->charged + $pr_total) - }; + + $new_charges_desc = $self->mt('Total Charges'); + $new_charges_amount = sprintf('%.2f',$self->charged + $pr_total); + + } + + if ( $conf->exists('invoice_show_prior_due_date') ) { + # then the due date should be shown with Total New Charges, + # and should NOT be shown with the Balance Due message. + if ( $self->due_date ) { + # localize the "Please pay by" message and the date itself + # (grammar issues with this, yeah) + $new_charges_desc .= ' - ' . $self->mt('Please pay by') . ' ' . + $self->due_date2str('short'); + } elsif ( $self->terms ) { + # phrases like "due on receipt" should be localized + $new_charges_desc .= ' - ' . $self->mt($self->terms); + } } + + push @items, + { total_item => $new_charges_desc, + total_amount => $new_charges_amount, + }; + @items; }