X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fbrowse%2Fpart_referral.cgi;h=581e01bb6c6f082b4b11f67a132bc8bc507cfeaa;hb=6cf964d0dc008621fb30fd2da28e2c44f29c6364;hp=3f59abcf58ed9e00905fa7142f4f56445e05313b;hpb=7c67ed5982f05a562c30e45938a9fa164cbeb7cb;p=freeside.git diff --git a/httemplate/browse/part_referral.cgi b/httemplate/browse/part_referral.cgi index 3f59abcf5..581e01bb6 100755 --- a/httemplate/browse/part_referral.cgi +++ b/httemplate/browse/part_referral.cgi @@ -10,31 +10,46 @@ Where a customer heard about your service. Tracked for informational purposes. <% my $today = timelocal(0, 0, 0, (localtime(time))[3..5] ); - my %past; - tie %past, 'Tie::IxHash', + my %after; + tie %after, 'Tie::IxHash', 'Today' => 0, + 'Yesterday' => 86400, # 60sec * 60min * 24hrs 'Past week' => 518400, # 60sec * 60min * 24hrs * 6days 'Past 30 days' => 2505600, # 60sec * 60min * 24hrs * 29days - 'Past 60 days' => 5097600, # 60sec * 60min * 24hrs * 29days - 'Past 90 days' => 7689600, # 60sec * 60min * 24hrs * 29days + 'Past 60 days' => 5097600, # 60sec * 60min * 24hrs * 59days + 'Past 90 days' => 7689600, # 60sec * 60min * 24hrs * 89days 'Past 6 months' => 15724800, # 60sec * 60min * 24hrs * 182days 'Past year' => 31486000, # 60sec * 60min * 24hrs * 364days 'Total' => $today, ; + my %before = ( + 'Today' => 86400, # 60sec * 60min * 24hrs + 'Yesterday' => 0, + 'Past week' => 86400, # 60sec * 60min * 24hrs + 'Past 30 days' => 86400, # 60sec * 60min * 24hrs + 'Past 60 days' => 86400, # 60sec * 60min * 24hrs + 'Past 90 days' => 86400, # 60sec * 60min * 24hrs + 'Past 6 months' => 86400, # 60sec * 60min * 24hrs + 'Past year' => 86400, # 60sec * 60min * 24hrs + 'Total' => 86400, # 60sec * 60min * 24hrs + ); - my $sth = dbh->prepare("SELECT COUNT(*) FROM h_cust_main - WHERE history_action = 'insert' - AND refnum = ? - AND history_date > ? ") + my $statement = "SELECT COUNT(*) FROM h_cust_main + WHERE history_action = 'insert' + AND refnum = ? + AND history_date >= ? + AND history_date < ? + "; + my $sth = dbh->prepare($statement) or die dbh->errstr; %> <%= table() %>