3b8e464486652f9a8dd39d673a07d4364eeb7951
[freeside.git] / httemplate / search / report_svc_acct.html
1 <& /elements/header.html, $title &>
2
3 <FORM ACTION="svc_acct.cgi" METHOD="GET">
4 <INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
5 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
6
7   <FONT CLASS="fsinnerbox-title"><% emt('Search options') %></FONT>
8   <TABLE CLASS="fsinnerbox">
9
10 % unless ( $custnum ) {
11     <& /elements/tr-select-agent.html,
12                    'curr_value'    => scalar( $cgi->param('agentnum') ),
13                    'disable_empty' => 0,
14     &>
15
16 %   # just this customer's domains?
17     <& /elements/tr-select-domain.html,
18                    'element_name'  => 'domsvc',
19                    'curr_value'    => scalar( $cgi->param('domsvc') ),
20                    'disable_empty' => 0,
21     &>
22 % }
23
24     <SCRIPT type="text/javascript">
25       function toggle(what) {
26         label = document.getElementById (what + '_label');
27         field = document.getElementById ( what + '_invert');
28         if (field.value == 1) {
29           field.value = 0;
30         } else {
31           field.value = 1;
32         }
33         if (field.value == 1) {
34           label.firstChild.nodeValue = 'Did not ' + label.firstChild.nodeValue;
35         }else{
36           text = label.firstChild.nodeValue;
37           label.firstChild.nodeValue = text.replace(/Did not /, '');
38         }
39       }
40     </SCRIPT>
41 %   foreach my $field (qw( last_login last_logout )) {
42 %     my $invert = $field."_invert";
43
44       <TR>
45         <TD>
46           <TABLE>
47             <TR>
48               <TH ALIGN="right" VALIGN="center" ID="<% $field."_label" %>">
49                 <% $label{$field} %>
50               </TH>
51               <TH>
52                 <INPUT NAME="<% $invert %>" ID="<% $invert %>" TYPE="hidden">
53                 <A HREF="javascript:void(0)" onClick="toggle('<% $field %>'); return false;"><% mt('Invert') |h %></A>
54               </TH>
55             </TR>
56           </TABLE>
57         </TD>
58         <TD>
59           <TABLE>
60             <& /elements/tr-input-beginning_ending.html,
61                           prefix   => $field,
62                           layout   => 'horiz',
63             &>
64           </TABLE>
65         </TD>
66       </TR>
67
68 %   }
69     
70     <& /elements/tr-selectmultiple-part_pkg.html &> 
71
72 %   my $conf = new FS::Conf;
73 %   if ( $conf->exists('svc_acct-tower_sector') 
74 %        and FS::tower_sector->count > 0 ) {
75     <& /elements/tr-select-tower_sector.html,
76           'multiple'    => 1,
77           'label'       => 'Tower/Sector',
78     &>
79 %   }
80
81
82   </TABLE>
83   <BR>
84
85   <FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
86   <TABLE CLASS="fsinnerbox">
87  
88 %   #move to /elements/tr-select-cust_pkg-fields if anything else needs it...
89     <TR>
90       <TH ALIGN="right"><% mt('Package fields') |h %></TH>
91       <TD>
92         <SELECT NAME="cust_pkg_fields">
93           <OPTION VALUE=""><% mt('(none)') |h %> 
94           <OPTION VALUE="setup,last_bill,bill,cancel"><% mt('Setup date | Last bill date | Next bill date | Cancel date') |h %> 
95         </SELECT>
96       </TD>
97     </TR>
98
99     <& /elements/tr-select-cust-fields.html &>
100                        
101   </TABLE>
102
103 <BR>
104 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
105
106 </FORM>
107
108 <& /elements/footer.html &>
109 <%init>
110
111 die "access denied"
112   unless $FS::CurrentUser::CurrentUser->access_right('Services: Accounts: Advanced search'); #?
113
114 my $title = mt('Account Report');
115
116 #false laziness w/report_cust_pkg.html
117 my $custnum = '';
118 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
119   $custnum = $1;
120   my $cust_main = qsearchs({
121     'table'     => 'cust_main', 
122     'hashref'   => { 'custnum' => $custnum },
123     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
124   }) or die "unknown custnum $custnum";
125   $title = mt("Account Report: [_1]", $cust_main->name);
126 }
127
128 </%init>
129 <%once>
130
131 my %label = (
132   'last_login'  => 'Last login',
133   'last_logout' => 'Last logout',
134 );
135
136 </%once>