our $DEBUG = 1;
+sub recur_temporality { 'preceding'; }
+
+sub price_info {
+ my $self = shift;
+ my $str = $self->SUPER::price_info;
+ $str .= " plus usage" if $str;
+ $str;
+}
+
sub calc_recur {
my $self = shift;
my($cust_pkg, $sdate, $details, $param ) = @_;
SELECT value FROM reportfields
WHERE rep_id = $rep_id
AND name = ?
- AND servciceid = ?
+ AND serviceid = ?
";
my $total = 0;
$max -= $inc;
next if $max < 0;
- my $amount = sprintf('%.2f', $self->option($self->_torrus_rate) * $max );
+ my $rate = $self->option($self->_torrus_rate);
+ my $amount = sprintf('%.2f', $rate * $max );
$total += $amount;
#add usage details to invoice
my $l = $self->_torrus_label;
- my $d = "Last month's usage for $serviceid: $max$l";
+ my $d = "Last month's usage for $serviceid: ". sprintf('%.2f',$max). $l;
$d .= " (". ($max+$inc). "$l - $inc$l included)" if $inc;
- $d .= ": $money_char$amount";
+ $d .= " @ $money_char$rate/$l: $money_char$amount";
push @$details, $d;