X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=FS%2FFS%2Fcust_statement.pm;h=83dd5c1be663528b4a4dc437b42447ba5dc096ec;hp=cd3e7cec8ec91e43c5a0428619400900c4b53484;hb=ad7f49821d40ffd099a45acc32ba91e0e211aede;hpb=5c35f5323f1cdcf7eabe6632d0352ea417d3047e diff --git a/FS/FS/cust_statement.pm b/FS/FS/cust_statement.pm index cd3e7cec8..83dd5c1be 100644 --- a/FS/FS/cust_statement.pm +++ b/FS/FS/cust_statement.pm @@ -180,6 +180,18 @@ sub _aggregate { @agg; } +sub _total { + my( $self, $method ) = ( shift, shift ); + + my $total = 0; + + foreach my $cust_bill ( $self->cust_bill ) { + $total += $cust_bill->$method( @_ ); + } + + $total; +} + =item cust_bill_pkg Returns the line items (see L) for all associated invoices. @@ -221,20 +233,29 @@ sub cust_bill_pkg_pkgnum { shift->_aggregate('cust_bill_pkg_pkgnum', @_); } =item tax -Returns the tax amount (see L) for this invoice. +Returns the total tax amount for all assoicated invoices.0 =cut -sub tax { - my $self = shift; +=item charged - my $total = 0; +Returns the total amount charged for all associated invoices. - foreach my $cust_bill ( $self->cust_bill ) { - $total += $cust_bill->tax; - } +=cut - $total; +=item owed + +Returns the total amount owed for all associated invoices. + +=cut + +sub tax { shift->_total('tax', @_); } +sub charged { shift->_total('charged', @_); } +sub owed { shift->_total('owed', @_); } + +#don't show previous info +sub previous { + ( 0 ); # 0, empty list } =back