summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2009-11-05 22:01:56 +0000
committerivan <ivan>2009-11-05 22:01:56 +0000
commit09c5b24b88f67409bf8f267d7c42593a3e4bfc7c (patch)
treef5e9f5cc19c9bbd4d4379dd1778e081695bd507e /httemplate
parent18968caa4eba37b6b036cfafaa637cf80c6467dc (diff)
improvements in time remaining report: correctly account for unpaid time for non-monthly customers, report in hours+minutes intead of using Time::Duration days/hours
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/search/svc_acct.cgi9
1 files changed, 6 insertions, 3 deletions
diff --git a/httemplate/search/svc_acct.cgi b/httemplate/search/svc_acct.cgi
index 232439997..7ddb3f000 100755
--- a/httemplate/search/svc_acct.cgi
+++ b/httemplate/search/svc_acct.cgi
@@ -39,7 +39,8 @@ sub timelast {
my $seconds = $sth->fetchrow_arrayref->[0];
- my $return = (($seconds < 0) ? '-' : '') . concise(duration($seconds));
+ #my $return = (($seconds < 0) ? '-' : '') . concise(duration($seconds));
+ my $return = (($seconds < 0) ? '-' : '') . format_time($seconds);
$return .= sprintf(' (%.2fx)', $seconds / $permonth ) if $permonth;
@@ -135,8 +136,10 @@ if ( $cgi->param('magic') =~ /^(all|unlinked)$/ ) {
return format_time($seconds) unless $timepermonth && $recur;
my $balance = $cust_pkg->cust_main->balance;
- my $months_unpaid = $balance / $recur;
- my $time_unpaid = $months_unpaid * $timepermonth;
+ my $periods_unpaid = $balance / $recur;
+ my $time_unpaid = $periods_unpaid * $timepermonth;
+ $time_unpaid *= $part_pkg->freq
+ if $part_pkg->freq =~ /^\d+$/ && $part_pkg->freq != 0;
format_time($seconds-$time_unpaid).
sprintf(' (%.2fx monthly)', ( $seconds-$time_unpaid ) / $timepermonth );
},