X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_bill.pm;h=9d250eba375aa0419958c850dc3c033fa5c6a269;hp=0ba6cdfed7be6cd5a9e3e85f88279affa259c335;hb=c15077a092c6b194923b72d9baaa50573c1ececb;hpb=f6036d1338eb1df0fa5c58d358e52d770a7e0330 diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 0ba6cdfed..9d250eba3 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -245,6 +245,7 @@ sub delete { cust_pay_batch cust_bill_pay_batch cust_bill_pkg + cust_bill_batch )) { foreach my $linked ( $self->$table() ) { @@ -733,6 +734,17 @@ sub cust_credit_bill_pkg { } +=item cust_bill_batch + +Returns all invoice batch records (L) for this invoice. + +=cut + +sub cust_bill_batch { + my $self = shift; + qsearch('cust_bill_batch', { 'invnum' => $self->invnum }); +} + =item tax Returns the tax amount (see L) for this invoice. @@ -2891,8 +2903,7 @@ sub print_generic { push @detail_items, { 'description' => $didsummary_desc, 'ext_description' => [ $didsummary, $minutes ], - } - if !$multisection; + }; } foreach my $section (@sections, @$late_sections) { @@ -4563,23 +4574,10 @@ sub _items_cust_bill_pkg { foreach my $cust_bill_pkg ( @$cust_bill_pkgs ) { - warn "$me _items_cust_bill_pkg considering cust_bill_pkg $cust_bill_pkg\n" + warn "$me _items_cust_bill_pkg considering cust_bill_pkg ". + $cust_bill_pkg->billpkgnum. ", pkgnum ". $cust_bill_pkg->pkgnum. "\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 ) { - $_->{amount} = sprintf( "%.2f", $_->{amount} ), - $_->{amount} =~ s/^\-0\.00$/0.00/; - $_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ), - push @b, { %$_ } - unless ( $_->{amount} == 0 && !$discount_show_always ); - $_ = undef; - } - } - foreach my $display ( grep { defined($section) ? $_->section eq $section : 1 @@ -4658,9 +4656,13 @@ sub _items_cust_bill_pkg { } - if ( ( $cust_bill_pkg->recur != 0 || $cust_bill_pkg->setup == 0 || - ($discount_show_always && $cust_bill_pkg->recur == 0) ) && - ( !$type || $type eq 'R' || $type eq 'U' ) + if ( ( !$type || $type eq 'R' || $type eq 'U' ) + && ( + $cust_bill_pkg->recur != 0 + || $cust_bill_pkg->setup == 0 + || $discount_show_always + || $cust_bill_pkg->recur_show_zero + ) ) { @@ -4805,21 +4807,38 @@ sub _items_cust_bill_pkg { } + $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 ) { + $_->{amount} = sprintf( "%.2f", $_->{amount} ), + $_->{amount} =~ s/^\-0\.00$/0.00/; + $_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ), + push @b, { %$_ } + if $_->{amount} != 0 + || $discount_show_always + || $cust_bill_pkg->recur_show_zero; + $_ = undef; + } + } + } + #foreach ( $s, $r, ($opt{skip_usage} ? () : $u ) ) { + # if ( $_ ) { + # $_->{amount} = sprintf( "%.2f", $_->{amount} ), + # $_->{amount} =~ s/^\-0\.00$/0.00/; + # $_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ), + # push @b, { %$_ } + # if $_->{amount} != 0 + # || $discount_show_always + # } + #} + 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} ), - $_->{amount} =~ s/^\-0\.00$/0.00/; - $_->{unit_amount} = sprintf( "%.2f", $_->{unit_amount} ), - push @b, { %$_ } - unless ( $_->{amount} == 0 && !$discount_show_always ); - } - } - @b; }