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