diff options
Diffstat (limited to 'httemplate/elements')
| -rw-r--r-- | httemplate/elements/tr-select-discount_term.html | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/httemplate/elements/tr-select-discount_term.html b/httemplate/elements/tr-select-discount_term.html index d4218f848..171c1037a 100644 --- a/httemplate/elements/tr-select-discount_term.html +++ b/httemplate/elements/tr-select-discount_term.html @@ -34,8 +34,8 @@ function change_discount_term(what) { </TR> % } - <%init> + my %opt = @_; my $custnum = $opt{'custnum'}; @@ -45,7 +45,10 @@ my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) my @discount_term = (); my %discounted_total = (); + +#this is inefficient for many years worth of invoices my $last_bill = ($cust_main->cust_bill)[-1]; + if ( $last_bill ) { # if not, there are no discounts possible my %plans = $last_bill->discount_plans; @discount_term = sort { $a <=> $b } keys %plans; |
