[freeside-commits] freeside/FS/FS cust_statement.pm, 1.1, 1.2 Mason.pm, 1.15, 1.16

Ivan,,, ivan at wavetail.420.am
Thu Aug 20 02:47:07 PDT 2009


Update of /home/cvs/cvsroot/freeside/FS/FS
In directory wavetail.420.am:/tmp/cvs-serv25242/FS/FS

Modified Files:
	cust_statement.pm Mason.pm 
Log Message:
email statements, RT#4860

Index: cust_statement.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_statement.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_statement.pm	20 Aug 2009 04:03:34 -0000	1.1
+++ cust_statement.pm	20 Aug 2009 09:47:05 -0000	1.2
@@ -180,6 +180,18 @@
   @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<FS::cust_bill_pkg>) for all associated invoices.
@@ -221,20 +233,29 @@
 
 =item tax
 
-Returns the tax amount (see L<FS::cust_bill_pkg>) 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

Index: Mason.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Mason.pm,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- Mason.pm	9 Aug 2009 09:05:38 -0000	1.15
+++ Mason.pm	20 Aug 2009 09:47:05 -0000	1.16
@@ -197,6 +197,7 @@
   use FS::h_svc_phone;
   #use FS::h_phone_device;
   use FS::h_svc_www;
+  use FS::cust_statement;
   # Sammath Naur
 
   if ( %%%RT_ENABLED%%% ) {



More information about the freeside-commits mailing list