clean up last commit
authorMark Wells <mark@freeside.biz>
Fri, 5 Sep 2014 21:59:38 +0000 (14:59 -0700)
committerMark Wells <mark@freeside.biz>
Fri, 5 Sep 2014 21:59:38 +0000 (14:59 -0700)
httemplate/elements/menu.html
httemplate/graph/signupdate.cgi

index 61cdd74..7e329cf 100644 (file)
@@ -113,9 +113,8 @@ tie my %report_customers, 'Tie::IxHash';
 $report_customers{'List customers'} = [ \%report_customers_lists, 'List customers' ]
   if $curuser->access_right('List all customers');
 $report_customers{'Zip code distribution'}     = [ $fsurl. 'search/report_cust_main-zip.html', 'Zip codes by number of customers' ];
-$report_customers{'Customer signup report'}    = [ $fsurl. 'graph/report_cust_signup.html',    'New customer signups by date' ];
-$report_customers{'Signup date report'}        = [ $fsurl. 'graph/report_signupdate.html',     'Signup date report (by date of signup)' ];
-$report_customers{'Advanced customer reports'} = [ $fsurl. 'search/report_cust_main.html',     'by status, signup date, agent, etc.' ]
+$report_customers{'Customer signup report'}       = [ $fsurl. 'graph/report_cust_signup.html', 'New customer signups by date' ],
+$report_customers{'Advanced customer reports'} = [ $fsurl. 'search/report_cust_main.html', 'by status, signup date, agent, etc.' ]
   if $curuser->access_right('Advanced customer search');
 
 tie my %report_invoices_open, 'Tie::IxHash',
index 23e4596..5b70758 100644 (file)
@@ -32,23 +32,22 @@ my @count = (0) x 24;
 my %where;
 $where{'agentnum'} = $agentnum if $agentnum;
 $where{'usernum'}   = $usernum if $usernum;
-
-my $sdate = DateTime->new(
-    year       => $cgi->param('start_year'),
-    month      => $cgi->param('start_month'),
-)->epoch();
-
-my $edate = DateTime->new(
-    year       => $cgi->param('end_year'),
-    month      => ($cgi->param('end_month') % 12 + 1) # first day of the next month
-)->epoch();
-
-my $where .= " AND signupdate >= $sdate ".
-             " AND signupdate <= $edate ";
+my $sdate = $cgi->param('start_year').
+            '-'.
+            $cgi->param('start_month').
+            '-01';
+my $edate = ($cgi->param('end_year') + 
+               ($cgi->param('end_month')==12)).
+            '-'.
+            ($cgi->param('end_month') % 12 + 1).
+            '-01'; # first day of the next month
+
+my $sql = "AND signupdate >= ".str2time($sdate).
+          " AND signupdate < ".str2time($edate);
 
 foreach my $cust (qsearch({ table   => 'cust_main', 
                             hashref => \%where,
-                            extra_sql => $where } )) {
+                            extra_sql => $sql } )) {
   next if !$cust->signupdate;
   my $hour = time2str('%H',$cust->signupdate);
   $count[$hour]++;