event refactor, landing on HEAD!
[freeside.git] / httemplate / graph / cust_bill_pkg.cgi
index cb82255..4070069 100644 (file)
@@ -1,5 +1,26 @@
-<%
+<% include('elements/monthly.html',
+                'title'        => $title. 'Sales Report (Gross)',
+                'graph_type'   => 'Mountain',
+                'items'        => \@items,
+                'params'       => \@params,
+                'labels'       => \@labels,
+                'graph_labels' => \@labels,
+                'colors'       => \@colors,
+                'links'        => \@links,
+                'remove_empty' => 1,
+                'bottom_total' => 1,
+                'bottom_link'  => "$link;",
+                'start_month'  => $smonth,
+                'start_year'   => $syear,
+                'end_month'    => $emonth,
+                'end_year'     => $eyear,
+                'agentnum'     => $agentnum,
+             )
+%>
+<%init>
 
+die "access denied"
+  unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
 
 #find first month
 my $syear = $cgi->param('start_year'); # || 1899+$curyear;
@@ -18,6 +39,7 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
 }
 my $title = $sel_agent ? $sel_agent->agent.' ' : '';
 
+#false lazinessish w/search/cust_pkg.cgi
 my $classnum = 0;
 my @pkg_class = ();
 if ( $cgi->param('classnum') =~ /^(\d*)$/ ) {
@@ -34,6 +56,7 @@ if ( $cgi->param('classnum') =~ /^(\d*)$/ ) {
     push @pkg_class, '(empty class)';
   }
 }
+#eslaf
 
 my $hue = 0;
 #my $hue_increment = 170;
@@ -95,22 +118,4 @@ foreach my $agent ( $sel_agent || qsearch('agent', { 'disabled' => '' } ) ) {
 #use Data::Dumper;
 #warn Dumper(\@items);
 
-%><%= include('elements/monthly.html',
-                'title'        => $title. 'Sales Report (Gross)',
-                'graph_type'   => 'Mountain',
-                'items'        => \@items,
-                'params'       => \@params,
-                'labels'       => \@labels,
-                'graph_labels' => \@labels,
-                'colors'       => \@colors,
-                'links'        => \@links,
-                'remove_empty' => 1,
-                'bottom_total' => 1,
-                'bottom_link'  => "$link;",
-                'start_month'  => $smonth,
-                'start_year'   => $syear,
-                'end_month'    => $emonth,
-                'end_year'     => $eyear,
-                'agentnum'     => $agentnum,
-             )
-%>
+</%init>