[freeside-commits] freeside/httemplate/search/elements cust_main_dayranges.html, 1.2, 1.2.2.1
Mark Wells
mark at wavetail.420.am
Wed Mar 31 00:41:44 PDT 2010
- Previous message: [freeside-commits] freeside/httemplate/search report_receivables.html, 1.10, 1.11 report_receivables.cgi, 1.49, 1.50 report_unapplied_cust_pay.html, 1.3, 1.4 unapplied_cust_pay.html, 1.2, 1.3
- Next message: [freeside-commits] freeside/httemplate/search report_receivables.html, 1.10, 1.10.2.1 report_receivables.cgi, 1.49, 1.49.2.1 report_unapplied_cust_pay.html, 1.3, 1.3.2.1 unapplied_cust_pay.html, 1.2, 1.2.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/search/elements
In directory wavetail.420.am:/tmp/cvs-serv14824/elements
Modified Files:
Tag: FREESIDE_1_9_BRANCH
cust_main_dayranges.html
Log Message:
RT#7266: aging reports as of a past date
Index: cust_main_dayranges.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/search/elements/cust_main_dayranges.html,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -w -d -r1.2 -r1.2.2.1
--- cust_main_dayranges.html 9 Jul 2009 20:36:28 -0000 1.2
+++ cust_main_dayranges.html 31 Mar 2010 07:41:42 -0000 1.2.2.1
@@ -98,8 +98,14 @@
my $range_sub = delete($opt{'range_sub'}); #or die
+my $offset = 0;
+if($cgi->param('as_of')) {
+ $offset = int((time - str2time($cgi->param('as_of'))) / 86400);
+ $opt{'title'} .= ' ('.$cgi->param('as_of').')' if $offset > 0;
+}
+
#my $range_cols = join(',', map &{$range_sub}( @$_ ), @ranges );
-my $range_cols = join(',', map call_range_sub($range_sub, @$_ ), @$ranges );
+my $range_cols = join(',', map call_range_sub($range_sub, @$_, 'offset' => $offset ), @$ranges );
my $select_count_pkgs = FS::cust_main->select_count_pkgs_sql;
@@ -119,14 +125,14 @@
my @where = ();
unless ( $cgi->param('all_customers') ) {
-
+# Exclude entire cust_main records where the balance is >0
my $days = 0;
if ( $cgi->param('days') =~ /^\s*(\d+)\s*$/ ) {
$days = $1;
}
push @where,
- call_range_sub($range_sub, $days, 0, 'no_as'=>1). ' > 0'; # != 0';
+ call_range_sub($range_sub, $days + $offset, 0, 'no_as'=>1). ' > 0'; # != 0';
}
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
@@ -167,7 +173,7 @@
my $total_sql =
"SELECT ".
- join(',', map call_range_sub( $range_sub, @$_, 'sum'=>1 ), @$ranges).
+ join(',', map call_range_sub( $range_sub, @$_, 'offset' => $offset, 'sum'=>1 ), @$ranges).
" FROM cust_main $where";
my $total_sth = dbh->prepare($total_sql) or die dbh->errstr;
@@ -203,7 +209,7 @@
my $as = $opt{'no_as'} ? '' : " AS rangecol_${start}_$end";
- my $sql = &{$range_sub}( $start, $end ); #%opt?
+ my $sql = &{$range_sub}( $start, $end, $opt{'offset'} ); #%opt?
$sql = "SUM($sql)" if $opt{'sum'};
- Previous message: [freeside-commits] freeside/httemplate/search report_receivables.html, 1.10, 1.11 report_receivables.cgi, 1.49, 1.50 report_unapplied_cust_pay.html, 1.3, 1.4 unapplied_cust_pay.html, 1.2, 1.3
- Next message: [freeside-commits] freeside/httemplate/search report_receivables.html, 1.10, 1.10.2.1 report_receivables.cgi, 1.49, 1.49.2.1 report_unapplied_cust_pay.html, 1.3, 1.3.2.1 unapplied_cust_pay.html, 1.2, 1.2.2.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list