summaryrefslogtreecommitdiff
path: root/httemplate/search/elements/report_svc_Common.html
blob: 434197078c57851b9e6a5bd4866f9372eafdde72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<%doc>

Example:

  <& elements/report_svc_Common.html,

    #required
    'table' => 'svc_something',
    'title'  => 'Page title',

    #optional
    'action' => 'svc_tablename.html', #defaults to svc_tablename.html

  &>

</%doc>
<& /elements/header.html, $title &>

<FORM ACTION="<% $opt{'action'} || $opt{'table'}. '.html' %>" METHOD="GET">
<INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">

  <TABLE BGCOLOR="#cccccc" CELLSPACING=0>

    <TR>
      <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Search options') |h %></FONT></TH>
    </TR>

% unless ( $custnum ) {

    <& /elements/tr-select-agent.html,
         curr_value    => scalar( $cgi->param('agentnum') ),
         disable_empty => 0,
    &>

    <& /elements/tr-select-cust_main-status.html,
         label         => 'Customer Status',
         field         => 'cust_status',
    &>

    <& /elements/tr-select-payby.html,
         label         => emt('Payment method:'),
         payby_type    => 'cust',
         multiple      => 1,
         all_selected  => 1,
    &>

    <& /elements/tr-input-money.html,
         label         => 'Balance over',
         field         => 'balance',
    &>

    <& /elements/tr-input-text.html,
         label         => 'Balance age (days)',
         field         => 'balance_days',
         size          => 4,
    &>

% }

%   # just this customer's domains?
%#    <& /elements/tr-select-domain.html,
%#                   'element_name'  => 'domsvc',
%#                   'curr_value'    => scalar( $cgi->param('domsvc') ),
%#                   'disable_empty' => 0,
%#    &>

    <& /elements/tr-selectmultiple-part_pkg.html &> 

    <& /elements/tr-select-part_svc.html,
         'svcdb' => $svcdb,
         'label' => 'Services',
    &> 

    <TR>
      <TH CLASS="background" COLSPAN=2>&nbsp;</TH>
    </TR>
 
    <TR>
      <TH CLASS="background" COLSPAN=2 ALIGN="left"><FONT SIZE="+1"><% mt('Display options') |h %></FONT></TH>
    </TR>

%   #"package fields" ala advanced svc_acct search?
%   #move to /elements/tr-select-cust_pkg-fields and use it from there if so...

    <& /elements/tr-select-cust-fields.html &>
                       
  </TABLE>

<BR>
<INPUT TYPE="submit" VALUE="<% mt('Get Report') |h %>">

</FORM>

<& /elements/footer.html &>
<%init>

my(%opt) = @_;

my $svcdb = $opt{'table'};

my $name =        "FS::$svcdb"->table_info->{'name_plural'}
           || PL( "FS::$svcdb"->table_info->{'name'}        );

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right("Services: $name: Advanced search");

my $title = $opt{'title'};

#false laziness w/report_cust_pkg.html
my( $custnum, $cust_main) = ('', '');
if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
  $custnum = $1;
  my $cust_main = qsearchs({
    'table'     => 'cust_main', 
    'hashref'   => { 'custnum' => $custnum },
    'extra_sql' => ' AND '. $FS::CurrentUser::CurrentUser->agentnums_sql,
  }) or die "unknown custnum $custnum";
  $title = mt("$title: [_1]", $cust_main->name);
}

</%init>