quiet warnings about CGI::param in list context
[freeside.git] / httemplate / search / report_svc_broadband.html
1 <% include('/elements/header.html', $title ) %>
2
3 %# extensive false laziness with svc_acct
4
5 <FORM ACTION="svc_broadband.cgi" METHOD="POST">
6 <INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
7 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
8
9   <FONT CLASS="fsinnerbox-title"><% emt('Search options') %></FONT>
10   <TABLE CLASS="fsinnerbox">
11
12 % unless ( $custnum ) {
13     <% include( '/elements/tr-select-agent.html',
14                     'curr_value'    => scalar( $cgi->param('agentnum') ),
15                     'disable_empty' => 0,
16               )
17     %>
18
19     <% include( '/elements/tr-select-table.html',
20                     'label'         => 'Routers',
21                     'table'         => 'router',
22                     'name_col'      => 'routername',
23                     'curr_value'    => $routernum,
24                     'hashref'       => {},
25                     'multiple'      => 'multiple',
26               )
27     %>
28     <tr>
29       <td></td>
30       <td><input type="checkbox" name="routernum" value="none" checked> Include services with no router</td>
31     </tr>
32
33     <% include( '/elements/tr-selectmultiple-part_pkg.html',
34                 %pkg_search,
35               )
36     %> 
37
38 %     if ( FS::tower_sector->count > 0 ) {
39     <& /elements/tr-select-tower_sector.html,
40           'multiple'    => 1,
41           'label'       => 'Tower/Sector',
42     &>
43 %     }
44
45 %   }
46
47   </TABLE>
48   <BR>
49
50   <FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
51   <TABLE CLASS="fsinnerbox">
52  
53 %   #move to /elements/tr-select-cust_pkg-fields if anything else needs it...
54     <TR>
55       <TH ALIGN="right">Package fields</TD>
56       <TD>
57         <SELECT NAME="cust_pkg_fields">
58           <OPTION VALUE="">(none)
59           <OPTION VALUE="setup,last_bill,bill,cancel">Setup date | Last bill date | Next bill date | Cancel date
60           <OPTION VALUE="package,setup,last_bill,bill,cancel">Package Name | Setup date | Last bill date | Next bill date | Cancel date
61         </SELECT>
62       </TD>
63     </TR>
64
65     <% include( '/elements/tr-select-cust-fields.html' ) %>
66                        
67   </TABLE>
68
69 <BR>
70 <INPUT TYPE="submit" VALUE="Get Report">
71
72 </FORM>
73
74 <% include('/elements/footer.html') %>
75 <%init>
76
77 die "access denied"
78   unless $FS::CurrentUser::CurrentUser->access_right('Services: Wireless broadband services: Advanced search');
79
80 my $title = 'Broadband Service Report';
81 my $routernum = [ $cgi->param('routernum') || '' ];
82 $routernum = join(',', @$routernum);
83
84 #false laziness w/report_cust_pkg.html
85 my $custnum = '';
86 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
87   $custnum = $1;
88   my $cust_main = qsearchs({
89     'table'     => 'cust_main', 
90     'hashref'   => { 'custnum' => $custnum },
91     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
92   }) or die "unknown custnum $custnum";
93   $title .= ': '. $cust_main->name;
94 }
95
96 # exclude one-time charges, disabled packages, and packages with no 
97 # broadband services
98 my %pkg_search = (
99   'extra_sql'   => "
100 WHERE freq != '0' AND disabled IS NULL AND 0 < (
101   SELECT COUNT(*) FROM part_svc JOIN pkg_svc USING ( svcpart ) 
102   WHERE pkg_svc.pkgpart = part_pkg.pkgpart AND part_svc.svcdb = 'svc_broadband'
103   AND pkg_svc.quantity > 0
104 )",
105 );
106
107 </%init>
108 <%once>
109
110 </%once>