id => 'discount_term',
options => [ '', @discount_term ],
labels => { '' => mt('1 month'),
- map { $_ => mt('[_1] months', $_) } @discount_term },
+ map { $_ => mt('[_1] months', sprintf('%.0f', $_)) }
+ @discount_term
+ },
curr_value => '',
onchange => $amount_id ? 'change_discount_term(this)' : '',
&>
</TR>
% }
-
<%init>
+
my %opt = @_;
my $custnum = $opt{'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;