+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 ];
+}
+