[freeside-commits] freeside/FS/FS usage_class.pm, 1.6, 1.6.4.1 cust_bill.pm, 1.299.2.17, 1.299.2.18 Conf.pm, 1.397.2.30, 1.397.2.31

Erik Levinson levinse at wavetail.420.am
Sat Feb 19 08:21:26 PST 2011


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

Modified Files:
      Tag: FREESIDE_2_1_BRANCH
	usage_class.pm cust_bill.pm Conf.pm 
Log Message:
invoice customizations, RT11467

Index: Conf.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Conf.pm,v
retrieving revision 1.397.2.30
retrieving revision 1.397.2.31
diff -u -w -d -r1.397.2.30 -r1.397.2.31
--- Conf.pm	18 Feb 2011 18:51:40 -0000	1.397.2.30
+++ Conf.pm	19 Feb 2011 16:21:23 -0000	1.397.2.31
@@ -1263,6 +1263,27 @@
   },
 
   { 
+    'key'         => 'phone_usage_class_summary',
+    'section'     => 'invoicing',
+    'description' => 'Summarize usage per DID by usage class and display all CDRs together regardless of usage class. Only valid when svc_phone_sections is enabled.',
+    'type'        => 'checkbox',
+  },
+
+  { 
+    'key'         => 'phone_usage_class_summary',
+    'section'     => 'invoicing',
+    'description' => 'Summarize usage per DID by usage class and display all CDRs together regardless of usage class. Only valid when svc_phone_sections is enabled.',
+    'type'        => 'checkbox',
+  },
+
+  { 
+    'key'         => 'phone_usage_class_summary',
+    'section'     => 'invoicing',
+    'description' => 'Summarize usage per DID by usage class and display all CDRs together regardless of usage class. Only valid when svc_phone_sections is enabled.',
+    'type'        => 'checkbox',
+  },
+
+  { 
     'key'         => 'svc_phone_sections',
     'section'     => 'invoicing',
     'description' => 'Create a section for each svc_phone when enabled.  Only valid when invoice_sections is enabled.',

Index: usage_class.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/usage_class.pm,v
retrieving revision 1.6
retrieving revision 1.6.4.1
diff -u -w -d -r1.6 -r1.6.4.1
--- usage_class.pm	28 Jun 2010 04:11:47 -0000	1.6
+++ usage_class.pm	19 Feb 2011 16:21:23 -0000	1.6.4.1
@@ -182,6 +182,19 @@
     'width'  => [ qw( 4.3cm 1.4cm 2.5cm 2.5cm 1.4cm 1.6cm ) ],# don't like this
     'show'   => 0,
   },
+  'usage_4col' => { 
+    'label' => [ qw( col1 col2 col3 col4 ) ],
+    'fields' => [
+                  sub { ' ' },
+                  sub { ' ' },
+                  sub { ' ' },
+                  sub { ' ' },
+                ],
+    'align'  => [ qw( l l l l r r ) ],
+    'span'   => [ qw( 1 1 1 1 1 2 ) ],          
+    'width'  => [ qw( 4.3cm 1.4cm 2.5cm 2.5cm ) ],
+    'show'   => 0,
+  },
   'usage_7col' => { 
     'label' => [ qw( col1 col2 col3 col4 col5 col6 col7 ) ],
     'fields' => [

Index: cust_bill.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/cust_bill.pm,v
retrieving revision 1.299.2.17
retrieving revision 1.299.2.18
diff -u -w -d -r1.299.2.17 -r1.299.2.18
--- cust_bill.pm	16 Feb 2011 07:39:01 -0000	1.299.2.17
+++ cust_bill.pm	19 Feb 2011 16:21:23 -0000	1.299.2.18
@@ -2516,6 +2516,19 @@
 
   );
 
+  my $min_sdate = 999999999999;
+  my $max_edate = 0;
+  foreach my $cust_bill_pkg ( $self->cust_bill_pkg ) {
+    next unless $cust_bill_pkg->pkgnum > 0;
+    $min_sdate = $cust_bill_pkg->sdate if $cust_bill_pkg->sdate < $min_sdate;
+    $max_edate = $cust_bill_pkg->edate if $cust_bill_pkg->edate > $max_edate;
+  }
+
+  $invoice_data{'bill_period'} = '';
+  $invoice_data{'bill_period'} = time2str('%e %h', $min_sdate) 
+    . " to " . time2str('%e %h', $max_edate)
+    if ($max_edate != 0 && $min_sdate != 999999999999);
+
   $invoice_data{finance_section} = '';
   if ( $conf->config('finance_pkgclass') ) {
     my $pkg_class =
@@ -4144,6 +4157,73 @@
     }
   }
 
+  if($conf->exists('phone_usage_class_summary')) { 
+      # this only works with Latex
+      my @newlines;
+      my @newsections;
+      foreach my $section ( @sections ) {
+	if($section->{'post_total'}) {
+	    $section->{'description'} = 'Calls Summary: '.$section->{'phonenum'};
+	    $section->{'total_line_generator'} = sub { '' };
+	    $section->{'total_generator'} = sub { '' };
+	    $section->{'header_generator'} = sub { '' };
+	    $section->{'description_generator'} = '';
+	    push @newsections, $section;
+	    my %calls_detail = %$section;
+	    $calls_detail{'post_total'} = '';
+	    $calls_detail{'sort_weight'} = '';
+	    $calls_detail{'description_generator'} = sub { '' };
+	    $calls_detail{'header_generator'} = sub {
+		return ' & Date/Time & Called Number & Duration & Price'
+		    if $format eq 'latex';
+		'';
+	    };
+	    $calls_detail{'description'} = 'Calls Detail: '
+						    . $section->{'phonenum'};
+	    push @newsections, \%calls_detail;	
+	}
+      }
+      foreach my $newsection ( @newsections ) {
+	if($newsection->{'post_total'}) {
+	    foreach my $section ( @sections ) {
+		next unless ($section->{'phonenum'} eq $newsection->{'phonenum'} 
+				&& !$section->{'post_total'});
+		my $newdesc = $section->{'description'};
+		my $tn = $section->{'phonenum'};
+		$newdesc =~ s/$tn//g;
+		my $line = {  ext_description => [],
+			      pkgnum => '',
+			      ref => '',
+			      quantity => '',
+			      calls => $section->{'calls'},
+			      section => $newsection,
+			      duration => $section->{'duration'},
+			      description => $newdesc,
+			      amount => $section->{'amount'},
+			      product_code => 'N/A',
+			    };
+		push @newlines, $line;
+	    }
+	}
+      }
+      foreach my $newsection ( @newsections ) {
+	if(!$newsection->{'post_total'}) {
+	    foreach my $line ( @lines ) {
+		next unless (scalar(@{$line->{'ext_description'}}) &&
+			$line->{'section'}->{'phonenum'} eq $newsection->{'phonenum'}
+			    );
+		my @extdesc = @{$line->{'ext_description'}};
+		my $extdesc = $extdesc[0];
+		$extdesc =~ s/scriptsize/normalsize/g if $format eq 'latex';
+		$line->{'ext_description'} = [ $extdesc ];
+		$line->{'section'} = $newsection;
+		push @newlines, $line;
+	    }
+	}
+      }
+      return(\@newsections, \@newlines);
+  }
+
   return(\@sections, \@lines);
 
 }



More information about the freeside-commits mailing list