summaryrefslogtreecommitdiff
path: root/httemplate/search/report_cust_main.html
blob: 3dd92af2e55e0b162210639de85b02d1c5f84386 (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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
<& /elements/header.html, mt('Customer Report') &>

<FORM ACTION="cust_main.html" METHOD="GET">
<INPUT TYPE="hidden" NAME="magic" VALUE="bill">

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

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

    <& /elements/tr-select-sales.html,
                  'curr_value'    => scalar($cgi->param('salesnum')),
                  'pre_options'   => [ '' => 'all',
                                       0  => '(none)', ],
                  'disable_empty' => 1,
                  'th' => 1,
    &>

    <& /elements/tr-select-cust_main-status.html,
                  'label' => emt('Status'),
    &>

    <& /elements/tr-select-cust_class.html,
                  'label'        => emt('Class'),
                  'multiple'     => 1,
                  'pre_options'  => [ '' => emt('(none)') ],
                  'all_selected' => 1,
    &>

    <& /elements/tr-select-part_referral.html,
                  'label'        => emt('Advertising Source'),
                  'multiple'     => 1,
                  #no, causes customers with disabled ones to disappear
                  #'all_selected' => 1,
    &>

    <TR>
        <TH ALIGN="right" VALIGN="center"><% mt('Signup date') |h %></TH>
        <TD>
        <TABLE>
            <& /elements/tr-input-beginning_ending.html,
                      prefix   => 'signupdate',
                      layout   => 'horiz',
            &>
        </TABLE>
        </TD>
    </TR>

%    if ( $conf->exists('cust_main-enable_birthdate') ) {
      <TR>
          <TH ALIGN="right" VALIGN="center"><% mt('Date of Birth') |h %></TH>
          <TD>
          <TABLE>
              <& /elements/tr-input-beginning_ending.html,
                        prefix   => 'birthdate',
                        layout   => 'horiz',
              &>
          </TABLE>
          </TD>
      </TR>
%   }

%    if ( $conf->exists('cust_main-enable_spouse_birthdate') ) {
      <TR>
          <TH ALIGN="right" VALIGN="center"><% mt('Spouse Date of Birth') |h %></TH>
          <TD>
          <TABLE>
              <& /elements/tr-input-beginning_ending.html,
                        prefix   => 'spouse_birthdate',
                        layout   => 'horiz',
              &>
          </TABLE>
          </TD>
      </TR>
%   }

%    if ( $conf->exists('cust_main-enable_anniversary_date') ) {
      <TR>
          <TH ALIGN="right" VALIGN="center"><% mt('Anniversary Date') |h %></TH>
          <TD>
          <TABLE>
              <& /elements/tr-input-beginning_ending.html,
                        prefix   => 'anniversary_date',
                        layout   => 'horiz',
              &>
          </TABLE>
          </TD>
      </TR>
%   }

      <TR>
        <TH ALIGN="right">Tags</TH>
        <TD>
            <& /elements/select-cust_tag.html,
                          'cgi'	        => $cgi,
                          'is_report'   => 1,
                          'multiple'    => 1,
            &>
          <DIV STYLE="display:inline-block; vertical-align:baseline">
            <INPUT TYPE="radio" NAME="all_tags" VALUE="0" CHECKED> Any of these
            <BR>
            <INPUT TYPE="radio" NAME="all_tags" VALUE="all"> All of these
            <BR>
            <INPUT TYPE="radio" NAME="all_tags" VALUE="none"> None of these
          </DIV>
        </TD>
      </TR>

  </TABLE>
  <BR>

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

      <& /elements/tr-input-text.html,
           label     => emt('At least this many'),
           field     => 'with_referrals',
           size      => 4,
           maxlength => 4,
      &>

      <& /elements/tr-select-cust_main-status.html,
           label => emt('Referral status'),
           field => 'referral_status',
      &>

  </TABLE>
  <BR>

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

      <TR>

        <TH ALIGN="right">With</TH>
        <TD><SELECT NAME="any_pkg_status">
              <OPTION VALUE="0">active packages
              <OPTION VALUE="1">any status packages
            </SELECT>
        </TD>
     </TR>

        <TH ALIGN="right">of class</TH>
        <TD>
            <& /elements/select-pkg_class.html,
                          'field'       => 'pkg_classnum',
                          'multiple'    => 1,
            &>
          <DIV STYLE="display:inline-block; vertical-align:baseline">
            <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="0" CHECKED>
              Any of these
            <BR>
            <INPUT TYPE="radio" NAME="all_pkg_classnums" VALUE="1">
              All of these
          </DIV>
        </TD>
      </TR>

  </TABLE>
  <BR>

  <FONT CLASS="fsinnerbox-title"><% emt('Location search options') %></FONT>
  <TABLE CLASS="fsinnerbox">
    <& elements/options_cust_location.html &>
    <& elements/cust_main_phones.html &>
  </TABLE>
  <BR>

  <FONT CLASS="fsinnerbox-title"><% emt('Contacts search options') %></FONT>
  <TABLE CLASS="fsinnerbox">
    <& elements/options_cust_contacts.html,
        'pre_fix'   => 'contacts_',
    &>
  </TABLE>
  <BR>

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

% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
% unless ( @exempt_groups ) { 

%   #falze laziness with With/Without postal mail invoices
     <TR>
      <TH ALIGN="right" VALIGN="center"><% mt('Tax exempt') |h %></TH>
        <TD><INPUT TYPE="checkbox" NAME="tax" ID="tax" onClick="tax_changed();"></TD>
    </TR>

    <TR>
      <TH ALIGN="right" VALIGN="center"><% mt('Not tax exempt') |h %></TH>
        <TD><INPUT TYPE="checkbox" NAME="no_tax" ID="no_tax" onClick="no_tax_changed();"></TD>
    </TR>

    <SCRIPT TYPE="text/javascript">
      function  tax_changed() {
        if ( document.getElementById('tax').checked == true ) {
          document.getElementById('no_tax').checked = false;
        }
      }
      function no_tax_changed() {
        if ( document.getElementById('no_tax').checked == true ) {
          document.getElementById('tax').checked = false;
        }
      }
    </SCRIPT>
% }

    <TR>
      <TH ALIGN="right"><% mt('Invoice terms') |h %></TH>
      <TD>
%       my @agentnums = $FS::CurrentUser::CurrentUser->agentnums;
%       my $agentnum = scalar(@agentnums) == 1 ? $agentnums[0] : '';
        <& /elements/select-terms.html,
             'pre_options' => [ '' => emt('all') ],
             'empty_value' => 'NULL',
             'agentnum'    => $agentnum,
        &>
      </TD>
    </TR>
    
    <& /elements/tr-input-lessthan_greaterthan.html,
                  label   => emt('Current balance'),
                  field   => 'current_balance',
    &>

    <TR>
      <TH ALIGN="right" VALIGN="center"><% mt('With invoicing email address(es)') |h %></TH>
        <TD><INPUT TYPE="checkbox" NAME="with_email"></TD>
    </TR>

    <TR>
      <TH ALIGN="right" VALIGN="center"><% mt('With postal mail invoices') |h %></TH>
        <TD><INPUT TYPE="checkbox" NAME="POST" ID="POST" onClick="POST_changed();"></TD>
    </TR>

    <TR>
      <TH ALIGN="right" VALIGN="center"><% mt('Without postal mail invoices') |h %></TH>
        <TD><INPUT TYPE="checkbox" NAME="no_POST" ID="no_POST" onClick="no_POST_changed();"></TD>
    </TR>

    <SCRIPT TYPE="text/javascript">
      function POST_changed() {
        if ( document.getElementById('POST').checked == true ) {
          document.getElementById('no_POST').checked = false;
        }
      }
      function no_POST_changed() {
        if ( document.getElementById('no_POST').checked == true ) {
          document.getElementById('POST').checked = false;
        }
      }
    </SCRIPT>

  </TABLE>
  <BR>

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

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

    <TR>
      <TH ALIGN="right" VALIGN="center"><% mt('Add package columns') |h %></TH>
        <TD><INPUT TYPE="checkbox" NAME="flattened_pkgs"></TD>
    </TR>

    <TR>
      <TH ALIGN="right" VALIGN="center"><% mt('Include cancelled packages') |h %></TH>
        <TD><INPUT TYPE="checkbox" NAME="cancelled_pkgs"></TD>
    </TR>

  </TABLE>

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

</FORM>

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

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

my $conf = new FS::Conf;

</%init>