434197078c57851b9e6a5bd4866f9372eafdde72
[freeside.git] / httemplate / search / elements / report_svc_Common.html
1 <%doc>
2
3 Example:
4
5   <& elements/report_svc_Common.html,
6
7     #required
8     'table' => 'svc_something',
9     'title'  => 'Page title',
10
11     #optional
12     'action' => 'svc_tablename.html', #defaults to svc_tablename.html
13
14   &>
15
16 </%doc>
17 <& /elements/header.html, $title &>
18
19 <FORM ACTION="<% $opt{'action'} || $opt{'table'}. '.html' %>" METHOD="GET">
20 <INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
21 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">
22
23   <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
24
25     <TR>
26       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Search options') |h %></FONT></TH>
27     </TR>
28
29 % unless ( $custnum ) {
30
31     <& /elements/tr-select-agent.html,
32          curr_value    => scalar( $cgi->param('agentnum') ),
33          disable_empty => 0,
34     &>
35
36     <& /elements/tr-select-cust_main-status.html,
37          label         => 'Customer Status',
38          field         => 'cust_status',
39     &>
40
41     <& /elements/tr-select-payby.html,
42          label         => emt('Payment method:'),
43          payby_type    => 'cust',
44          multiple      => 1,
45          all_selected  => 1,
46     &>
47
48     <& /elements/tr-input-money.html,
49          label         => 'Balance over',
50          field         => 'balance',
51     &>
52
53     <& /elements/tr-input-text.html,
54          label         => 'Balance age (days)',
55          field         => 'balance_days',
56          size          => 4,
57     &>
58
59 % }
60
61 %   # just this customer's domains?
62 %#    <& /elements/tr-select-domain.html,
63 %#                   'element_name'  => 'domsvc',
64 %#                   'curr_value'    => scalar( $cgi->param('domsvc') ),
65 %#                   'disable_empty' => 0,
66 %#    &>
67
68     <& /elements/tr-selectmultiple-part_pkg.html &> 
69
70     <& /elements/tr-select-part_svc.html,
71          'svcdb' => $svcdb,
72          'label' => 'Services',
73     &> 
74
75     <TR>
76       <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
77     </TR>
78  
79     <TR>
80       <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
81     </TR>
82
83 %   #"package fields" ala advanced svc_acct search?
84 %   #move to /elements/tr-select-cust_pkg-fields and use it from there if so...
85
86     <& /elements/tr-select-cust-fields.html &>
87                        
88   </TABLE>
89
90 <BR>
91 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
92
93 </FORM>
94
95 <& /elements/footer.html &>
96 <%init>
97
98 my(%opt) = @_;
99
100 my $svcdb = $opt{'table'};
101
102 my $name =        "FS::$svcdb"->table_info->{'name_plural'}
103            || PL( "FS::$svcdb"->table_info->{'name'}        );
104
105 die "access denied"
106   unless $FS::CurrentUser::CurrentUser->access_right("Services: $name: Advanced search");
107
108 my $title = $opt{'title'};
109
110 #false laziness w/report_cust_pkg.html
111 my( $custnum, $cust_main) = ('', '');
112 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
113   $custnum = $1;
114   my $cust_main = qsearchs({
115     'table'     => 'cust_main', 
116     'hashref'   => { 'custnum' => $custnum },
117     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
118   }) or die "unknown custnum $custnum";
119   $title = mt("$title: [_1]", $cust_main->name);
120 }
121
122 </%init>