diff options
author | Mark Wells <mark@freeside.biz> | 2013-09-25 17:11:18 -0700 |
---|---|---|
committer | Mark Wells <mark@freeside.biz> | 2013-09-25 17:11:18 -0700 |
commit | d647477e5f8fa8b988b42379847f5367d440f936 (patch) | |
tree | 5b775366feabe2a5cd4ea6adad2e33a656f4f56a /FS/FS/Template_Mixin.pm | |
parent | 0d81877c6ae8ea9732065f5400ff37a7458587ed (diff) |
optionally display payments/credits on invoice based on date received, #24850
Diffstat (limited to 'FS/FS/Template_Mixin.pm')
-rw-r--r-- | FS/FS/Template_Mixin.pm | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/FS/FS/Template_Mixin.pm b/FS/FS/Template_Mixin.pm index db3885443..f55fc664c 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 @@ -1167,7 +1156,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,['','-----------']; |