sub _items_cust_bill_pkg {
my $self = shift;
- my $cust_bill_pkg = shift;
+ my $cust_bill_pkgs = shift;
my %opt = @_;
my $format = $opt{format} || '';
my @b = ();
my ($s, $r, $u) = ( undef, undef, undef );
- foreach my $cust_bill_pkg ( @$cust_bill_pkg )
+ foreach my $cust_bill_pkg ( @$cust_bill_pkgs )
{
- #eating cpu and memory?
- #$discount_show_always = ($cust_bill_pkg->cust_bill_pkg_discount
- # && $conf->exists('discount-show-always'));
+ warn "$me _items_cust_bill_pkg considering cust_bill_pkg $cust_bill_pkg\n"
+ if $DEBUG > 1;
+
+ $discount_show_always = ($cust_bill_pkg->cust_bill_pkg_discount
+ && $conf->exists('discount-show-always'));
foreach ( $s, $r, ($opt{skip_usage} ? () : $u ) ) {
if ( $_ && !$cust_bill_pkg->hidden ) {
)
{
+ warn "$me _items_cust_bill_pkg considering display item $display\n"
+ if $DEBUG > 1;
+
my $type = $display->type;
my $desc = $cust_bill_pkg->desc;
if ( $cust_bill_pkg->pkgnum > 0 ) {
+ warn "$me _items_cust_bill_pkg cust_bill_pkg is non-tax\n"
+ if $DEBUG > 1;
+
my $cust_pkg = $cust_bill_pkg->cust_pkg;
if ( $cust_bill_pkg->setup != 0 && (!$type || $type eq 'S') ) {
+ warn "$me _items_cust_bill_pkg adding setup\n"
+ if $DEBUG > 1;
+
my $description = $desc;
$description .= ' Setup' if $cust_bill_pkg->recur != 0;
)
{
+ warn "$me _items_cust_bill_pkg adding recur/usage\n"
+ if $DEBUG > 1;
+
my $is_summary = $display->summary;
my $description = ($is_summary && $type && $type eq 'U')
? "Usage charges" : $desc;
- unless ( $conf->exists('disable_line_item_date_ranges') ) {
- $description .= " (" . time2str($date_format, $cust_bill_pkg->sdate).
- " - ". time2str($date_format, $cust_bill_pkg->edate). ")";
- }
+ $description .= " (" . time2str($date_format, $cust_bill_pkg->sdate).
+ " - ". time2str($date_format, $cust_bill_pkg->edate).
+ ")"
+ unless $conf->exists('disable_line_item_date_ranges');
my @d = ();
|| $is_summary && $type && $type eq 'U' )
{
+ warn "$me _items_cust_bill_pkg adding service details\n"
+ if $DEBUG > 1;
+
push @d, map &{$escape_function}($_),
$cust_pkg->h_labels_short(@dates, 'I')
#$cust_bill_pkg->edate,
#$cust_bill_pkg->sdate)
unless $cust_bill_pkg->pkgpart_override; #don't redisplay services
+ warn "$me _items_cust_bill_pkg done adding service details\n"
+ if $DEBUG > 1;
+
if ( $multilocation ) {
my $loc = $cust_pkg->location_label;
$loc = substr($loc, 0, 50). '...'
}
+ warn "$me _items_cust_bill_pkg adding details\n"
+ if $DEBUG > 1;
+
push @d, $cust_bill_pkg->details(%details_opt)
unless ($is_summary || $type && $type eq 'R');
+
+ warn "$me _items_cust_bill_pkg calculating amount\n"
+ if $DEBUG > 1;
my $amount = 0;
if (!$type) {
if ( !$type || $type eq 'R' ) {
+ warn "$me _items_cust_bill_pkg adding recur\n"
+ if $DEBUG > 1;
+
if ( $cust_bill_pkg->hidden ) {
$r->{amount} += $amount;
$r->{unit_amount} += $cust_bill_pkg->unitrecur;
} else { # $type eq 'U'
+ warn "$me _items_cust_bill_pkg adding usage\n"
+ if $DEBUG > 1;
+
if ( $cust_bill_pkg->hidden ) {
$u->{amount} += $amount;
$u->{unit_amount} += $cust_bill_pkg->unitrecur;
} else { #pkgnum tax or one-shot line item (??)
+ warn "$me _items_cust_bill_pkg cust_bill_pkg is tax\n"
+ if $DEBUG > 1;
+
if ( $cust_bill_pkg->setup != 0 ) {
push @b, {
'description' => $desc,
}
+ warn "$me _items_cust_bill_pkg done considering cust_bill_pkgs\n"
+ if $DEBUG > 1;
+
foreach ( $s, $r, ($opt{skip_usage} ? () : $u ) ) {
if ( $_ ) {
$_->{amount} = sprintf( "%.2f", $_->{amount} ),