[freeside-commits] freeside/FS/FS/Report/Table Monthly.pm,1.5,1.6

Ivan,,, ivan at wavetail.420.am
Tue May 2 04:59:33 PDT 2006


Update of /home/cvs/cvsroot/freeside/FS/FS/Report/Table
In directory wavetail:/tmp/cvs-serv1082/FS/FS/Report/Table

Modified Files:
	Monthly.pm 
Log Message:
add a "pre-report" page to this report/graph as requested by lewis/wtxs, also add 12mo total option

Index: Monthly.pm
===================================================================
RCS file: /home/cvs/cvsroot/freeside/FS/FS/Report/Table/Monthly.pm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Monthly.pm	3 Mar 2006 15:02:33 -0000	1.5
+++ Monthly.pm	2 May 2006 11:59:31 -0000	1.6
@@ -156,6 +156,47 @@
   );
 }
 
+#these should be auto-generated
+sub invoiced_12mo {
+  my( $self, $speriod, $eperiod, $agentnum ) = @_;
+  $speriod = $self->_subtract_11mo($speriod);
+  $self->invoiced($speriod, $eperiod, $agentnum);
+}
+
+sub netsales_12mo {
+  my( $self, $speriod, $eperiod, $agentnum ) = @_;
+  $speriod = $self->_subtract_11mo($speriod);
+  $self->netsales($speriod, $eperiod, $agentnum);
+}
+
+sub receipts_12mo {
+  my( $self, $speriod, $eperiod, $agentnum ) = @_;
+  $speriod = $self->_subtract_11mo($speriod);
+  $self->receipts($speriod, $eperiod, $agentnum);
+}
+
+sub payments_12mo {
+  my( $self, $speriod, $eperiod, $agentnum ) = @_;
+  $speriod = $self->_subtract_11mo($speriod);
+  $self->payments($speriod, $eperiod, $agentnum);
+}
+
+sub credits_12mo {
+  my( $self, $speriod, $eperiod, $agentnum ) = @_;
+  $speriod = $self->_subtract_11mo($speriod);
+  $self->credits($speriod, $eperiod, $agentnum);
+}
+
+#not being too bad with the false laziness
+use Time::Local qw(timelocal);
+sub _subtract_11mo {
+  my($self, $time) = @_;
+  my ($sec,$min,$hour,$mday,$mon,$year) = (localtime($time) )[0,1,2,3,4,5];
+  $mon -= 11;
+  if ( $mon < 0 ) { $mon+=12; $year--; }
+  timelocal($sec,$min,$hour,$mday,$mon,$year);
+}
+
 # NEEDS TO BE AGENTNUM-capable
 sub canceled { #active
   my( $self, $speriod, $eperiod, $agentnum ) = @_;



More information about the freeside-commits mailing list