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
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
|
%if ( $payby_default eq 'HIDE' ) {
%
% $cust_main->payby('BILL') unless $cust_main->payby;
% my $payby = $cust_main->payby;
<INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>">
<INPUT TYPE="hidden" NAME="<%$payby%>_payinfo" VALUE="<% $cust_main->paymask %>">
% foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate )) {
<INPUT TYPE="hidden" NAME="<% $payby.'_'.$field %>" VALUE="<% $cust_main->get($field) %>">
% }
% #false laziness w/elements/select-month_year.html & view/cust_main/billing.html
% my( $mon, $year );
% my $date = $cust_main->paydate || '12-2037';
% if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
% ( $mon, $year ) = ( $2, $1 );
% } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
% ( $mon, $year ) = ( $1, $3 );
% } else {
% die "unrecognized expiration date format: $date";
% }
<INPUT TYPE="hidden" NAME="<%$payby%>_exp_month" VALUE="<% $mon %>">
<INPUT TYPE="hidden" NAME="<%$payby%>_exp_year" VALUE="<% $year %>">
<INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax %>">
<INPUT TYPE="hidden" NAME="invoicing_list" VALUE="<% join(', ', @invoicing_list) %>">
% } else {
%
% my $r = qq!<font color="#ff0000">*</font> !;
<BR><FONT SIZE="+1"><B>Billing information</B></FONT>
<% &ntable("#cccccc") %>
<TR>
<TD ALIGN="right" WIDTH="200"><%$r%>Billing type</TD>
<SCRIPT>
var mywindow = -1;
function myopen(filename,windowname,properties) {
myclose();
mywindow = window.open(filename,windowname,properties);
}
function myclose() {
if ( mywindow != -1 )
mywindow.close();
mywindow = -1;
}
var achwindow = -1;
function achopen(filename,windowname,properties) {
achclose();
achwindow = window.open(filename,windowname,properties);
}
function achclose() {
if ( achwindow != -1 )
achwindow.close();
achwindow = -1;
}
function card_changed(what) {
if (
what.form.payinfo.value.substring(0, 4) == '4093'
|| what.form.payinfo.value.substring(0, 4) == '4911'
|| what.form.payinfo.value.substring(0, 4) == '4936'
|| what.form.payinfo.value.substring(0, 6) == '564132'
|| what.form.payinfo.value.substring(0, 2) == '63'
|| what.form.payinfo.value.substring(0, 2) == '67'
)
{
what.form.paystart_month.disabled = false;
what.form.paystart_year.disabled = false;
what.form.payissue.disabled = false;
what.form.paystart_month.style.backgroundColor = '#ffffff';
what.form.paystart_year.style.backgroundColor = '#ffffff';
what.form.payissue.style.backgroundColor = '#ffffff';
document.getElementById('paystart_label').style.color = '#000000';
document.getElementById('payissue_label').style.color = '#000000';
} else {
what.form.paystart_month.disabled = true;
what.form.paystart_year.disabled = true;
what.form.payissue.disabled = true;
what.form.paystart_month.style.backgroundColor = '#dddddd';
what.form.paystart_year.style.backgroundColor = '#dddddd';
what.form.payissue.style.backgroundColor = '#dddddd';
document.getElementById('paystart_label').style.color = '#999999';
document.getElementById('payissue_label').style.color = '#999999';
}
return true;
}
</SCRIPT>
<% include('/elements/init_overlib.html') %>
% my $payby = $cust_main->payby;
% my $paytype = $cust_main->paytype;
% my( $account, $aba ) = split('@', $payinfo);
%
% my $disabled = 'DISABLED style="background-color: #dddddd"';
% my $text_disabled = 'style="color: #999999"';
%
% if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) {
% $disabled = 'style="background-color: #ffffff"';
% $text_disabled = 'style="color: #000000";'
% }
%
% my %payby = (
%
% 'CARD' =>
%
% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Card number </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CARD_payinfo" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $payinfo : '' ). qq!" MAXLENGTH=19 onChange="card_changed(this)" onKeyUp="card_changed(this)"></TD></TR>!.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!.
% '<TD WIDTH="408">'.
%
% include('/elements/select-month_year.html',
% 'prefix' => 'CARD_exp',
% 'selected_date' =>
% ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ),
% ).
%
% '</TD></TR>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">CVV2 !.
%
% qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/cvv2.html', 480, 352, 'cvv2_popup' ), CAPTION, 'CVV2 Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!.
% qq!</TD>!.
% '<TD WIDTH="408"><INPUT TYPE="text" NAME="CARD_paycvv" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ && !$cust_main->is_encrypted($cust_main->paycvv) ? $cust_main->paycvv : '' ). '" SIZE=4 MAXLENGTH=4>'.
%
%
% qq!<TR><TD ALIGN="right" WIDTH="200"><SPAN ID="paystart_label" $text_disabled>Start date </SPAN></TD>!.
% '<TD WIDTH="408">'.
%
% include('/elements/select-month_year.html',
% 'prefix' => 'CARD_paystart',
% 'disabled' => $disabled,
% 'empty_option' => 1,
% 'start_year' => 2000,
% 'end_year' => (localtime())[5] + 1900,
% 'selected_date' => (
% ( $payby =~ /^(CARD|DCRD)$/
% && cardtype($payinfo) =~ /^(Switch|Solo)$/ )
% ? $cust_main->paystart_month. '-'.
% $cust_main->paystart_year
% : ''
% )
% ).
%
% qq!<SPAN ID="payissue_label" $text_disabled> or Issue number </SPAN>!.
% '<INPUT TYPE="text" NAME="CARD_payissue" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payissue : '' ). qq!" SIZE=3 MAXLENGTH=2 $disabled></TD></TR>!.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Exact name on card </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CARD_payname" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
%
% qq!<TR><TD COLSPAN=2 WIDTH="608"><INPUT TYPE="checkbox" NAME="CARD_payauto" !. ( $payby eq 'DCRD' ? '' : 'CHECKED' ). '> Charge future payments to this card automatically</TD></TR>'.
%
% '</TABLE>',
%
% 'CHEK' =>
%
% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Account number </TD>!.
% qq!<TD><INPUT TYPE="text" SIZE=12 NAME="CHEK_payinfo1" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $account : '' ). '"></TD>'.
% qq!<TD ALIGN="right">Type</TD><TD><SELECT NAME="CHEK_paytype">!.
% join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes).
% qq!</SELECT></TD></TR>!.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}ABA/Routing number </TD>!.
% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=10 MAXLENGTH=9 NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!" SIZE=10 MAXLENGTH=9> !.
% qq!(<A HREF="javascript:void(0);" onClick="overlib( OLiframeContent('../docs/ach.html', 380, 240, 'ach_popup' ), CAPTION, 'ACH Help', STICKY, AUTOSTATUSCAP, CLOSECLICK, DRAGGABLE ); return false;">help</A>)!.
% qq!</TD></TR>!.
%
% qq!<INPUT TYPE="hidden" NAME="CHEK_exp_month" VALUE="12">!.
% qq!<INPUT TYPE="hidden" NAME="CHEK_exp_year" VALUE="2037">!.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Bank name </TD>!.
% qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" NAME="CHEK_payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
% ( $conf->exists('show_bankstate') ?
% qq!<TR><TD ALIGN="right" WIDTH="200">$paystate_label</TD>!.
% qq!<TD COLSPAN="3" WIDTH="408">!.
% include('/elements/select-state.html',
% 'empty' => '(choose)',
% 'state' => $cust_main->paystate,
% 'country' => $cust_main->country,
% 'prefix' => 'CHEK_pay',
% ). "</TD></TR>"
% : '<INPUT TYPE="hidden" NAME="CHEK_paystate" VALUE="'.
% $cust_main->paystate. '">'
% ).
%
%
% qq!<TR><TD COLSPAN=4 WIDTH="608"><INPUT TYPE="checkbox" NAME="CHEK_payauto" !. ( $payby eq 'DCHK' ? '' : 'CHECKED' ). '> Charge future payments to this electronic check automatically</TD></TR>'.
%
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
%
% '</TABLE>',
%
% 'LECB' =>
%
% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Phone number </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="LECB_payinfo" VALUE="!. ( $payby eq 'LECB' ? $cust_main->payinfo : '' ). qq!" MAXLENGTH=15 SIZE=16></TD></TR>!.
%
% qq!<INPUT TYPE="hidden" NAME="LECB_exp_month" VALUE="12">!.
% qq!<INPUT TYPE="hidden" NAME="LECB_exp_year" VALUE="2037">!.
% qq!<INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!.
%
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
%
% '</TABLE>',
%
% 'BILL' =>
%
% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">P.O. </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payinfo" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payinfo : '' ). qq!"></TD></TR>!.
%
% qq!<INPUT TYPE="hidden" NAME="BILL_exp_month" VALUE="12">!.
% qq!<INPUT TYPE="hidden" NAME="BILL_exp_year" VALUE="2037">!.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">Attention </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payname" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!.
%
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
%
% '</TABLE>',
%
% 'COMP' =>
%
% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Approved by </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""></TD></TR>!.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Expiration </TD>!.
% '<TD WIDTH="408">'.
%
% include('/elements/select-month_year.html',
% 'prefix' => 'COMP_exp',
% 'selected_date' =>
% ( $payby eq 'COMP' ? $cust_main->paydate : '' ),
% ).
%
% '</TD></TR>'.
%
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
%
% '</TABLE>',
%
% 'CASH' =>
%
% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CASH_paid" VALUE="!. ( $payby eq 'CASH' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
%
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
%
% '</TABLE>',
%
% 'WEST' =>
%
% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="WEST_paid" VALUE="!. ( $payby eq 'WEST' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
%
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
%
% '</TABLE>',
%
% 'MCRD' =>
%
% '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
%
% qq!<TR><TD ALIGN="right" WIDTH="200">${r}Amount </TD>!.
% qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="MCRD_paid" VALUE="!. ( $payby eq 'MCRD' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
%
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
% '<TR><TD> </TD></TR>'.
%
% '</TABLE>',
%
% );
%
% #this should use FS::payby
% my @allopt = qw( CARD CHEK LECB BILL CASH WEST MCRD COMP );
%
% my %allopt = map { $_ => FS::payby->shortname($_) } @allopt;
%
% if ( $cust_main->custnum ) {
% #don't offer CASH/WEST/MCRD initial payment types when editing customer
% delete $allopt{$_} for qw(CASH WEST MCRD);
% }
%
% my @options = grep exists( $allopt{$_} ), @payby;
%
% my %payby2option = (
% ( map { $_ => $_ } @options ),
% 'DCRD' => 'CARD',
% 'DCHK' => 'CHEK',
% );
<TD WIDTH="408">
<% include( '/elements/selectlayers.html',
'field' => 'payby',
'curr_value' => $payby2option{$payby || $payby_default || $payby[0] },
'options' => \@options,
'labels' => \%allopt,
'html_between' => '</TD></TR></TABLE>',
'layer_callback' => sub { my $layer = shift; $payby{$layer}; },
)
%>
<% &ntable("#cccccc") %>
<TR><TD> </TD></TR>
% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
<TR>
<TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD>
</TR>
% foreach my $exempt_group ( @exempt_groups ) {
% #escape $exempt_group for NAME
<TR>
<TD WIDTH="608" COLSPAN="2"> <INPUT TYPE="checkbox" NAME="tax_<% $exempt_group %>" VALUE="Y" <% $cust_main->tax_exemption($exempt_group) ? 'CHECKED' : '' %>> Tax Exempt (<% $exempt_group %> taxes)<TD>
</TR>
% }
% unless ( $conf->exists('emailinvoiceonly') ) {
<TR>
<TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%
( grep { $_ eq 'POST' } @invoicing_list )
? 'CHECKED'
: ''
%>> Postal mail invoice
</TD>
</TR>
<TR>
<TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_FAX" VALUE="FAX" <%
( grep { $_ eq 'FAX' } @invoicing_list )
? 'CHECKED'
: ''
%>> Fax invoice
</TD>
</TR>
% }
<TR>
<TD ALIGN="right" WIDTH="200">
<% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es)
</TD>
<TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>"></TD>
</TR>
<TR>
<TD ALIGN="right" WIDTH="200">Invoice terms </TD>
<TD WIDTH="408">
<SELECT NAME="invoice_terms">
<OPTION VALUE="">Default (<% $conf->config('invoice_default_terms') || 'Payable upon receipt' %>)
% foreach my $term ( 'Payable upon receipt',
% ( map "Net $_", 0, 10, 15, 20, 30, 45, 60 ),
% ) {
<OPTION VALUE="<% $term %>" <% $cust_main->invoice_terms eq $term ? ' SELECTED' : '' %>><% $term %>
% }
</SELECT>
</TD>
</TR>
% if ( $conf->exists('voip-cust_cdr_spools') ) {
<TR>
<TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="spool_cdr" VALUE="Y" <% $cust_main->spool_cdr eq "Y" ? 'CHECKED' : '' %>> Spool CDRs</TD>
</TR>
% } else {
<INPUT TYPE="hidden" NAME="spool_cdr" VALUE="<% $cust_main->spool_cdr %>">
% }
% if ( $conf->exists('voip-cust_cdr_squelch') ) {
<TR>
<TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="squelch_cdr" VALUE="Y" <% $cust_main->squelch_cdr eq "Y" ? 'CHECKED' : '' %>> Omit CDRs from invoices</TD>
</TR>
% } else {
<INPUT TYPE="hidden" NAME="squelch_cdr" VALUE="<% $cust_main->squelch_cdr %>">
% }
% if ( $show_term || $cust_main->cdr_termination_percentage ) {
<TR>
<TD ALIGN="right">CDR termination settlement</TD>
<TD><INPUT TYPE = "text"
NAME = "cdr_termination_percentage"
SIZE = 6
VALUE = "<% $cust_main->cdr_termination_percentage %>"
STYLE = "text-align:right;"
><B>%</B></TD>
</TR>
% } else {
<INPUT TYPE="hidden" NAME="cdr_termination_percentage" VALUE="<% $cust_main->cdr_termination_percentage %>">
% }
</TABLE>
<% $r %> required fields
% }
<%once>
my $paystate_label = FS::Msgcat::_gettext('paystate');
$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
</%once>
<%init>
my( $cust_main, %options ) = @_;
my @invoicing_list = @{ $options{'invoicing_list'} };
my $payinfo = $options{'payinfo'};
my $conf = new FS::Conf;
my $payby_default = $conf->config('payby-default');
my @payby = grep /\w/, $conf->config('payby');
#@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
unless @payby;
#false laziness w/view/cust_main/billing.html
my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
my $term_sth = dbh->prepare($term_sql) or die dbh->errstr;
$term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
my $show_term = $term_sth->fetchrow_arrayref->[0];
</%init>
|