summaryrefslogtreecommitdiff
path: root/httemplate/search/report_svc_acct.html
blob: 711905ac5e61a58cc96ed836e9b54660c54fcb1b (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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<& /elements/header.html, $title &>

<FORM ACTION="svc_acct.cgi" METHOD="GET">
<INPUT TYPE="hidden" NAME="magic" VALUE="advanced">
<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>">

  <FONT CLASS="fsinnerbox-title"><% emt('Search options') %></FONT>
  <TABLE CLASS="fsinnerbox">

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

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

    <SCRIPT type="text/javascript">
      function toggle(what) {
        label = document.getElementById (what + '_label');
        field = document.getElementById ( what + '_invert');
        if (field.value == 1) {
          field.value = 0;
        } else {
          field.value = 1;
        }
        if (field.value == 1) {
          label.firstChild.nodeValue = 'Did not ' + label.firstChild.nodeValue;
        }else{
          text = label.firstChild.nodeValue;
          label.firstChild.nodeValue = text.replace(/Did not /, '');
        }
      }
    </SCRIPT>
%   foreach my $field (qw( last_login last_logout )) {
%     my $invert = $field."_invert";

      <TR>
        <TD>
          <TABLE>
            <TR>
              <TH ALIGN="right" VALIGN="center" ID="<% $field."_label" %>">
                <% $label{$field} %>
              </TH>
              <TH>
                <INPUT NAME="<% $invert %>" ID="<% $invert %>" TYPE="hidden">
                <A HREF="javascript:void(0)" onClick="toggle('<% $field %>'); return false;"><% mt('Invert') |h %></A>
              </TH>
            </TR>
          </TABLE>
        </TD>
        <TD>
          <TABLE>
            <& /elements/tr-input-beginning_ending.html,
                          prefix   => $field,
                          layout   => 'horiz',
            &>
          </TABLE>
        </TD>
      </TR>

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

    <& /elements/tr-select-part_svc.html, svcdb=>'svc_acct' &> 

%   my $conf = new FS::Conf;
%   if ( $conf->exists('svc_acct-tower_sector') 
%        and FS::tower_sector->count > 0 ) {
    <& /elements/tr-select-tower_sector.html,
          'multiple'    => 1,
          'label'       => 'Tower/Sector',
    &>
%   }


  </TABLE>
  <BR>

  <FONT CLASS="fsinnerbox-title"><% emt('Display options') %></FONT>
  <TABLE CLASS="fsinnerbox">
 
%   #move to /elements/tr-select-cust_pkg-fields if anything else needs it...
    <TR>
      <TH ALIGN="right"><% mt('Package fields') |h %></TH>
      <TD>
        <SELECT NAME="cust_pkg_fields">
          <OPTION VALUE=""><% mt('(none)') |h %> 
          <OPTION VALUE="setup,last_bill,bill,cancel"><% mt('Setup date | Last bill date | Next bill date | Cancel date') |h %> 
        </SELECT>
      </TD>
    </TR>

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

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

</FORM>

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

die "access denied"
  unless $FS::CurrentUser::CurrentUser->access_right('Services: Accounts: Advanced search'); #?

my $title = mt('Account Report');

#false laziness w/report_cust_pkg.html
my $custnum = '';
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("Account Report: [_1]", $cust_main->name);
}

</%init>
<%once>

my %label = (
  'last_login'  => 'Last login',
  'last_logout' => 'Last logout',
);

</%once>