added the tax method
authorjeff <jeff>
Fri, 3 Aug 2001 20:34:28 +0000 (20:34 +0000)
committerjeff <jeff>
Fri, 3 Aug 2001 20:34:28 +0000 (20:34 +0000)
FS/FS/cust_bill.pm

index 8480cea..4ffb8e2 100644 (file)
@@ -64,6 +64,8 @@ FS::cust_bill - Object methods for cust_bill records
 
   @cust_pay_objects = $cust_bill->cust_pay;
 
+  $tax_amount = $record->tax;
+
   @lines = $cust_bill->print_text;
   @lines = $cust_bill->print_text $time;
 
@@ -231,6 +233,21 @@ sub cust_pay {
   ;
 }
 
+=item tax
+
+Returns the tax amount (see L<FS::cust_bill_pkg>) for this invoice.
+
+=cut
+
+sub tax {
+  my $self = shift;
+  my $total = 0;
+  my @taxlines = qsearch( 'cust_bill_pkg', { 'invnum' => $self->invnum ,
+                                             'pkgnum' => 0 } );
+  foreach (@taxlines) { $total += $_->setup; }
+  $total;
+}
+
 =item owed
 
 Returns the amount owed (still outstanding) on this invoice, which is charged
@@ -424,7 +441,7 @@ sub print_text {
 
 =head1 VERSION
 
-$Id: cust_bill.pm,v 1.7 2001-04-09 23:05:15 ivan Exp $
+$Id: cust_bill.pm,v 1.8 2001-08-03 20:34:28 jeff Exp $
 
 =head1 BUGS