projects
/
freeside.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix TeleAPI import (what kind of crack was Christopher smoking that he couldn't fix...
[freeside.git]
/
FS
/
FS
/
part_pkg
/
torrus_Common.pm
diff --git
a/FS/FS/part_pkg/torrus_Common.pm
b/FS/FS/part_pkg/torrus_Common.pm
index
672fa86
..
b32deab
100644
(file)
--- a/
FS/FS/part_pkg/torrus_Common.pm
+++ b/
FS/FS/part_pkg/torrus_Common.pm
@@
-7,6
+7,15
@@
our %info = ( 'disabled' => 1 ); #torrus_Common not a usable price plan directly
our $DEBUG = 1;
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 ) = @_;
sub calc_recur {
my $self = shift;
my($cust_pkg, $sdate, $details, $param ) = @_;
@@
-53,7
+62,7
@@
sub calc_usage {
SELECT value FROM reportfields
WHERE rep_id = $rep_id
AND name = ?
SELECT value FROM reportfields
WHERE rep_id = $rep_id
AND name = ?
- AND serv
c
iceid = ?
+ AND serviceid = ?
";
my $total = 0;
";
my $total = 0;
@@
-74,14
+83,15
@@
sub calc_usage {
$max -= $inc;
next if $max < 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;
$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 .= " (". ($max+$inc). "$l - $inc$l included)" if $inc;
- $d .= ": $money_char$amount";
+ $d .= "
@ $money_char$rate/$l
: $money_char$amount";
push @$details, $d;
push @$details, $d;