directory assistance (flat per-call) billing RT#3114
authorjeff <jeff>
Wed, 13 Feb 2008 23:42:00 +0000 (23:42 +0000)
committerjeff <jeff>
Wed, 13 Feb 2008 23:42:00 +0000 (23:42 +0000)
FS/FS/part_pkg/voip_cdr.pm
FS/FS/rate_detail.pm
httemplate/edit/rate_region.cgi

index 2341fd0..7cf1779 100644 (file)
@@ -261,9 +261,13 @@ sub calc_recur {
       
           my $granularity = $rate_detail->sec_granularity;
           my $seconds = $cdr->billsec; # |ength($cdr->billsec) ? $cdr->billsec : $cdr->duration;
-          $seconds += $granularity - ( $seconds % $granularity );
+          $seconds += $granularity - ( $seconds % $granularity )
+            if $granularity; # 0 is per call
           my $minutes = sprintf("%.1f", $seconds / 60);
           $minutes =~ s/\.0$// if $granularity == 60;
+
+          # per call rather than per minute
+          $minutes = 1 unless $granularity;
       
           $included_min{$regionnum} -= $minutes;
       
@@ -280,7 +284,7 @@ sub calc_recur {
           @call_details = (
             #time2str("%Y %b %d - %r", $cdr->calldate_unix ),
             time2str("%c", $cdr->calldate_unix),  #XXX this should probably be a config option dropdown so they can select US vs- rest of world dates or whatnot
-            $minutes.'m',
+            $granularity ? $minutes.'m' : $minutes.' call',
             '$'.$charge,
             $pretty_destnum,
             $rate_region->regionname,
index 7f8c89e..ad41b40 100644 (file)
@@ -46,7 +46,7 @@ inherits from FS::Record.  The following fields are currently supported:
 
 =item min_charge - charge per minute
 
-=item sec_granularity - granularity in seconds, i.e. 6 or 60
+=item sec_granularity - granularity in seconds, i.e. 6 or 60; 0 for per-call
 
 =back
 
index 9dfcb37..04f285f 100644 (file)
       Rate plan
     </TH>
     <TH CLASS="grid" BGCOLOR="#cccccc">
-      <FONT SIZE=-1>Included<BR>minutes</FONT>
+      <FONT SIZE=-1>Included<BR>minutes/calls</FONT>
     </TH>
     <TH CLASS="grid" BGCOLOR="#cccccc">
-      <FONT SIZE=-1>Charge per<BR>minute</FONT>
+      <FONT SIZE=-1>Charge per<BR>minute/call</FONT>
     </TH>
     <TH CLASS="grid" BGCOLOR="#cccccc">
       <FONT SIZE=-1>Granularity</FONT>
     </TD>
 
     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
-      <INPUT TYPE="text" SIZE=5 NAME="min_included<%$n%>" VALUE="<% $cgi->param("min_included$n") || $rate_detail->min_included |h %>">
+      <INPUT TYPE="text" SIZE=9 NAME="min_included<%$n%>" VALUE="<% $cgi->param("min_included$n") || $rate_detail->min_included |h %>">
     </TD>
 
     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
-      $<INPUT TYPE="text" SIZE=4 NAME="min_charge<%$n%>" VALUE="<% sprintf('%.2f', $cgi->param("min_charge$n") || $rate_detail->min_charge ) %>">
+      $<INPUT TYPE="text" SIZE=6 NAME="min_charge<%$n%>" VALUE="<% sprintf('%.2f', $cgi->param("min_charge$n") || $rate_detail->min_charge ) %>">
     </TD>
 
     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
@@ -137,6 +137,7 @@ tie my %granularity, 'Tie::IxHash',
   '6'  => '6 second',
   '30' => '30 second', # '1/2 minute',
   '60' => 'minute',
+  '0'  => 'call',
 ;
 
 my @rate_prefix = $rate_region->rate_prefix;