+sub void_cust_bill_pkg_detail {
+ my( $self, $reprocess_cdrs ) = @_;
+
+ my $from_cust_bill_pkg_detail =
+ 'FROM cust_bill_pkg_detail WHERE billpkgnum = ?';
+ my $where_detailnum =
+ "WHERE detailnum IN ( SELECT detailnum $from_cust_bill_pkg_detail )";
+
+ if ( $reprocess_cdrs ) {
+ #well, technically this could have been on other invoices / termination
+ # partners... separate flag?
+ $self->scalar_sql(
+ "DELETE FROM cdr_termination
+ WHERE acctid IN ( SELECT acctid FROM cdr $where_detailnum )
+ ",
+ $self->billpkgnum
+ );
+ }
+
+ my $setstatus = $reprocess_cdrs ? ', freesidestatus = NULL' : '';
+ $self->scalar_sql(
+ "UPDATE cdr SET detailnum = NULL $setstatus $where_detailnum",
+ $self->billpkgnum
+ );
+
+ $self->scalar_sql("INSERT INTO cust_bill_pkg_detail_void
+ SELECT * $from_cust_bill_pkg_detail",
+ $self->billpkgnum
+ );
+
+ $self->scalar_sql("DELETE $from_cust_bill_pkg_detail", $self->billpkgnum);
+
+}
+