summaryrefslogtreecommitdiff
path: root/httemplate/search/report_receivables.cgi
diff options
context:
space:
mode:
authormark <mark>2010-03-31 07:41:29 +0000
committermark <mark>2010-03-31 07:41:29 +0000
commit4ca83488cafd75e2612358672e0f416918d951cf (patch)
treee3127fad019e0e7dcf15cd90d805d5d0a78601e5 /httemplate/search/report_receivables.cgi
parent5f71517b3de709a86c89dbacc6247cd6e52f4c42 (diff)
RT#7266: aging reports as of a past date
Diffstat (limited to 'httemplate/search/report_receivables.cgi')
-rwxr-xr-xhttemplate/search/report_receivables.cgi13
1 files changed, 9 insertions, 4 deletions
diff --git a/httemplate/search/report_receivables.cgi b/httemplate/search/report_receivables.cgi
index 6df016134..53261849a 100755
--- a/httemplate/search/report_receivables.cgi
+++ b/httemplate/search/report_receivables.cgi
@@ -28,13 +28,18 @@ die "access denied"
# )
sub balance {
- my($start, $end) = @_; #, %opt ?
-
+ my($start, $end, $offset) = @_; #, %opt ?
#handle start and end ranges (86400 = 24h * 60m * 60s)
my $str2time = str2time_sql;
my $closing = str2time_sql_closing;
- $start = $start ? "( $str2time now() $closing - ".($start * 86400). ' )' : '';
- $end = $end ? "( $str2time now() $closing - ".($end * 86400). ' )' : '';
+
+ # $end == 0 means "+infinity", while $start == 0 really means 0
+ # so we should always include a start condition
+ $start = "( $str2time now() $closing - ". ($start + $offset) * 86400 . ' )';
+ # but only include an end condition if $end != 0
+ $end = $end ?
+ "( $str2time now() $closing - ". ($end + $offset) * 86400 . ' )'
+ : '';
#$opt{'unapplied_date'} = 1;