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