From 20d7ca3a3e37b9748eed3f7ef362f04c757420ba Mon Sep 17 00:00:00 2001 From: jeff Date: Fri, 8 Aug 2008 18:13:05 +0000 Subject: cdrs can be in separate invoice section, after total, summarized inline, with hints for page breaks --- FS/FS/cust_bill_pkg.pm | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'FS/FS/cust_bill_pkg.pm') diff --git a/FS/FS/cust_bill_pkg.pm b/FS/FS/cust_bill_pkg.pm index 638e707..b3b8ea5 100644 --- a/FS/FS/cust_bill_pkg.pm +++ b/FS/FS/cust_bill_pkg.pm @@ -57,6 +57,24 @@ supported: =item itemdesc - Line item description (overrides normal package description) +=item section - Invoice section (overrides normal package section) + +=duplicate - Indicates this item appears elsewhere on the invoice + (and should not be retaxed or reincluded in totals) + +=post_total - A hint that this item should appear after invoice totals + +=cut + +sub section { + my ( $self, $value ) = @_; + if ( defined($value) ) { + $self->setfield('section', $value); + } else { + $self->getfield('section') || $self->part_pkg->categoryname; + } +} + =item quantity - If not set, defaults to 1 =item unitsetup - If not set, defaults to setup @@ -174,6 +192,9 @@ sub check { || $self->ut_numbern('sdate') || $self->ut_numbern('edate') || $self->ut_textn('itemdesc') + || $self->ut_textn('section') + || $self->ut_enum('duplicate', [ '', 'Y' ]) + || $self->ut_enum('post_total', [ '', 'Y' ]) ; return $error if $error; @@ -382,7 +403,7 @@ line item. sub units { my $self = shift; - $self->part_pkg->calc_units($self->cust_pkg); + $self->pkgnum ? $self->part_pkg->calc_units($self->cust_pkg) : 0; # 1? } =item quantity @@ -425,6 +446,18 @@ sub unitrecur { : $self->getfield('unitrecur'); } +=item separate_cdr + +Returns true if this line item represents a cdr line item in its own section. + +=cut + +# lame, but works for now +sub separate_cdr { + my( $self ) = shift; + $self->pkgnum && $self->section ne $self->part_pkg->categoryname; +} + =back =head1 BUGS -- cgit v1.1