summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2010-06-11 21:18:11 +0000
committermark <mark>2010-06-11 21:18:11 +0000
commit5e99c8bf1671bcfdf3597f8bbdaf49621141d237 (patch)
tree73e204aebb00bc384a9860c9e5c7be0e3ea811e1
parent17399ceae6086eff5a248910d40f34d811377b26 (diff)
RT#7266: continue fixing aging reports
-rw-r--r--FS/FS/cust_main.pm6
-rw-r--r--FS/FS/cust_pay.pm2
-rw-r--r--FS/FS/cust_refund.pm2
-rw-r--r--httemplate/search/elements/cust_main_dayranges.html2
-rwxr-xr-xhttemplate/search/unapplied_cust_pay.html3
5 files changed, 9 insertions, 6 deletions
diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm
index 0e04df3bc..de398743a 100644
--- a/FS/FS/cust_main.pm
+++ b/FS/FS/cust_main.pm
@@ -8301,9 +8301,11 @@ Available options are:
=cut
sub unapplied_payments_date_sql {
- my( $class, $start, $end, ) = @_;
+ my( $class, $start, $end, %opt ) = @_;
+
+ my $cutoff = $opt{'cutoff'};
- my $unapp_pay = FS::cust_pay->unapplied_sql;
+ my $unapp_pay = FS::cust_pay->unapplied_sql($cutoff);
my $pay_where = $class->_money_table_where( 'cust_pay', $start, $end,
'unapplied_date'=>1 );
diff --git a/FS/FS/cust_pay.pm b/FS/FS/cust_pay.pm
index f9185cc4b..a78cb5de0 100644
--- a/FS/FS/cust_pay.pm
+++ b/FS/FS/cust_pay.pm
@@ -657,7 +657,7 @@ Returns an SQL fragment to retreive the unapplied amount.
=cut
sub unapplied_sql {
- my ($class, $start, $end) = shift;
+ my ($class, $start, $end) = @_;
my $bill_start = $start ? "AND cust_bill_pay._date <= $start" : '';
my $bill_end = $end ? "AND cust_bill_pay._date > $end" : '';
my $refund_start = $start ? "AND cust_pay_refund._date <= $start" : '';
diff --git a/FS/FS/cust_refund.pm b/FS/FS/cust_refund.pm
index 894d19086..044d16cb0 100644
--- a/FS/FS/cust_refund.pm
+++ b/FS/FS/cust_refund.pm
@@ -321,7 +321,7 @@ Returns an SQL fragment to retreive the unapplied amount.
=cut
sub unapplied_sql {
- my ($class, $start, $end) = shift;
+ my ($class, $start, $end) = @_;
my $credit_start = $start ? "AND cust_credit_refund._date <= $start" : '';
my $credit_end = $end ? "AND cust_credit_refund._date > $end" : '';
my $pay_start = $start ? "AND cust_pay_refund._date <= $start" : '';
diff --git a/httemplate/search/elements/cust_main_dayranges.html b/httemplate/search/elements/cust_main_dayranges.html
index 476f138e9..aa133883b 100644
--- a/httemplate/search/elements/cust_main_dayranges.html
+++ b/httemplate/search/elements/cust_main_dayranges.html
@@ -145,7 +145,7 @@ unless ( $cgi->param('all_customers') ) {
}
push @where,
- call_range_sub($range_sub, $days + $offset, 0, 'no_as'=>1). ' > 0'; # != 0';
+ call_range_sub($range_sub, $days, 0, 'offset' => $offset, 'no_as'=>1). ' > 0'; # != 0';
}
if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
diff --git a/httemplate/search/unapplied_cust_pay.html b/httemplate/search/unapplied_cust_pay.html
index 73361c00b..161c6509e 100755
--- a/httemplate/search/unapplied_cust_pay.html
+++ b/httemplate/search/unapplied_cust_pay.html
@@ -23,7 +23,8 @@ sub unapplied_payments {
"( $str2time now() $closing - ".($end + $offset) * 86400 . ' )'
: '';
- FS::cust_main->unapplied_payments_date_sql( $start, $end );
+ FS::cust_main->unapplied_payments_date_sql( $start, $end,
+ 'cutoff' => "( $str2time now() $closing - ".$offset * 86400 . ')' );
}