link new tax report to cust_credit_bill_pkg for credits, RT#12332
[freeside.git] / httemplate / search / report_svc_acct.html
index f5a0ff9..c7fac46 100755 (executable)
@@ -1,17 +1,30 @@
-<% include('/elements/header.html', 'Account Report' ) %>
+<% include('/elements/header.html', $title ) %>
 
 <FORM ACTION="svc_acct.cgi" METHOD="GET">
 <INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
+<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
 
   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
 
     <TR>
-      <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
+      <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
     </TR>
+
+% unless ( $custnum ) {
     <% include( '/elements/tr-select-agent.html',
-                   ($cgi->param('agentnum') || ''),
-               )
+                   'curr_value'    => scalar( $cgi->param('agentnum') ),
+                   'disable_empty' => 0,
+              )
+    %>
+
+%   # just this customer's domains?
+    <% include( '/elements/tr-select-domain.html',
+                   'element_name'  => 'domsvc',
+                   'curr_value'    => scalar( $cgi->param('domsvc') ),
+                   'disable_empty' => 0,
+              )
     %>
+% }
 
     <SCRIPT type="text/javascript">
       function toggle(what) {
 %   }
     
     <% include( '/elements/tr-selectmultiple-part_pkg.html' ) %> 
+
+    <TR>
+      <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
+    </TR>
  
     <TR>
-      <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
+      <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
     </TR>
+
+%   #move to /elements/tr-select-cust_pkg-fields if anything else needs it...
+    <TR>
+      <TD ALIGN="right">Package fields</TD>
+      <TD>
+        <SELECT NAME="cust_pkg_fields">
+          <OPTION VALUE="">(none)
+          <OPTION VALUE="setup,last_bill,bill,cancel">Setup date | Last bill date | Next bill date | Cancel date
+        </SELECT>
+      </TD>
+    </TR>
+
     <% include( '/elements/tr-select-cust-fields.html' ) %>
                        
   </TABLE>
 <%init>
 
 die "access denied"
-  unless $FS::CurrentUser::CurrentUser->access_right('List packages');
+  unless $FS::CurrentUser::CurrentUser->access_right('List packages'); #?
+
+my $title = 'Account Report';
+
+#false laziness w/report_cust_pkg.html
+my $custnum = '';
+if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
+  $custnum = $1;
+  my $cust_main = qsearchs({
+    'table'     => 'cust_main', 
+    'hashref'   => { 'custnum' => $custnum },
+    'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
+  }) or die "unknown custnum $custnum";
+  $title .= ': '. $cust_main->name;
+}
 
 </%init>
 <%once>