d57e64febbd8239d264fd7af296f93c22d4ff5cb
[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   <FONT CLASS="fsinnerbox-title"><% emt('Search options') %></FONT>
24   <TABLE CLASS="fsinnerbox">
25
26 % unless ( $custnum ) {
27
28     <& /elements/tr-select-agent.html,
29          curr_value    => scalar( $cgi->param('agentnum') ),
30          disable_empty => 0,
31     &>
32
33     <& /elements/tr-select-cust_main-status.html,
34          label         => 'Customer Status',
35          field         => 'cust_status',
36     &>
37
38 %# meaning-less in the post-4.x world, customers can have multiple payment
39 %# methods now
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   </TABLE>
76   <BR>
77
78   <FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
79   <TABLE CLASS="fsinnerbox">
80
81 %   #"package fields" ala advanced svc_acct search?
82 %   #move to /elements/tr-select-cust_pkg-fields and use it from there if so...
83
84     <& /elements/tr-select-cust-fields.html &>
85                        
86   </TABLE>
87
88 <BR>
89 <INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">
90
91 </FORM>
92
93 <& /elements/footer.html &>
94 <%init>
95
96 my(%opt) = @_;
97
98 my $svcdb = $opt{'table'};
99
100 my $name =        "FS::$svcdb"->table_info->{'name_plural'}
101            || PL( "FS::$svcdb"->table_info->{'name'}        );
102
103 die "access denied"
104   unless $FS::CurrentUser::CurrentUser->access_right("Services: $name: Advanced search");
105
106 my $title = $opt{'title'};
107
108 #false laziness w/report_cust_pkg.html
109 my( $custnum, $cust_main) = ('', '');
110 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
111   $custnum = $1;
112   my $cust_main = qsearchs({
113     'table'     => 'cust_main', 
114     'hashref'   => { 'custnum' => $custnum },
115     'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
116   }) or die "unknown custnum $custnum";
117   $title = mt("$title: [_1]", $cust_main->name);
118 }
119
120 </%init>