X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=FS%2FFS%2FTemplate_Mixin.pm;h=356de5bed959f0f86178ceb7f0f6605ca21eb726;hb=c64ff892b9067f7aa719e78b20379d3274907946;hp=db3885443e131d2cb2cb29183916034e9810f4fd;hpb=89eff2af607109c7e8f3afd779622ce17a419d13;p=freeside.git diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index db3885443..356de5bed 100644 --- a/FS/FS/Template_Mixin.pm +++ b/FS/FS/Template_Mixin.pm @@ -608,23 +608,12 @@ sub print_generic { # summary formats $invoice_data{'last_bill'} = {}; - # returns the last unpaid bill, not the last bill - #my $last_bill = $pr_cust_bill[-1]; - if ( $self->custnum && $self->invnum ) { - # THIS returns the customer's last bill before this one - my $last_bill = qsearchs({ - 'table' => 'cust_bill', - 'hashref' => { 'custnum' => $self->custnum, - 'invnum' => { op => '<', value => $self->invnum }, - }, - 'order_by' => ' ORDER BY invnum DESC LIMIT 1' - }); - if ( $last_bill ) { + if ( $self->previous_bill ) { + my $last_bill = $self->previous_bill; $invoice_data{'last_bill'} = { '_date' => $last_bill->_date, #unformatted - # all we need for now }; my (@payments, @credits); # for formats that itemize previous payments @@ -766,6 +755,7 @@ sub print_generic { my $taxtotal = 0; my $tax_section = { 'description' => $self->mt('Taxes, Surcharges, and Fees'), 'subtotal' => $taxtotal, # adjusted below + 'tax_section' => 1, }; my $tax_weight = _pkg_category($tax_section->{description}) ? _pkg_category($tax_section->{description})->weight @@ -1167,7 +1157,7 @@ sub print_generic { $adjust_section->{'pretotal'} = $self->mt('New charges total').' '. $other_money_char. sprintf('%.2f', $self->charged ); } - }else{ + } else { push @total_items, $total; } push @buf,['','-----------'];