+# This equates svc_phone records; perhaps svc_phone should have a field
+# to indicate it represents a line
+sub calc_units {
+ my($self, $cust_pkg ) = @_;
+ scalar(grep { $_->part_svc->svcdb eq 'svc_phone' } $cust_pkg->cust_svc);
+}
+
+sub append_cust_bill_pkgs {
+ my $self = shift;
+ my($cust_pkg, $sdate, $details, $param ) = @_;
+ return []
+ unless $self->option('separate_usage', 'Hush!');
+
+ my @details = ();
+ my $charges = $self->calc_usage($cust_pkg, $sdate, \@details, $param);
+
+ my $cust_bill_pkg = new FS::cust_bill_pkg {
+ 'pkgnum' => $cust_pkg->pkgnum,
+ 'setup' => 0,
+ 'unitsetup' => 0,
+ 'recur' => sprintf( "%.2f", $charges), # hmmm
+ 'unitrecur' => 0,
+ 'quantity' => $cust_pkg->quantity,
+ 'sdate' => $$sdate,
+ 'edate' => $cust_pkg->bill, # already fiddled
+ 'itemdesc' => 'Usage charges', # configurable?
+ 'details' => \@details,
+ };
+
+ return [ $cust_bill_pkg ];
+}
+