1 %if ( $payby_default eq 'HIDE' ) {
2 % $cust_main->payby('BILL') unless $cust_main->payby;
3 % my $payby = $cust_main->payby;
5 <INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>">
7 <INPUT TYPE="hidden" NAME="<%$payby%>_payinfo" VALUE="<% $cust_main->paymask %>">
9 % foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate billday )) {
11 <INPUT TYPE="hidden" NAME="<% $payby.'_'.$field %>" VALUE="<% $cust_main->get($field) %>">
15 % #false laziness w/elements/select-month_year.html & view/cust_main/billing.html
17 % my $date = $cust_main->paydate || '12-2037';
18 % if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
19 % ( $mon, $year ) = ( $2, $1 );
20 % } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
21 % ( $mon, $year ) = ( $1, $3 );
23 % die "unrecognized expiration date format: $date";
26 <INPUT TYPE="hidden" NAME="<%$payby%>_exp_month" VALUE="<% $mon %>">
27 <INPUT TYPE="hidden" NAME="<%$payby%>_exp_year" VALUE="<% $year %>">
29 <INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax %>">
31 <INPUT TYPE="hidden" NAME="invoicing_list" VALUE="<% join(', ', @invoicing_list) %>">
35 % my $r = qq!<font color="#ff0000">*</font> !;
37 <BR><FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT>
38 <% &ntable("#cccccc") %>
41 <TD ALIGN="right" WIDTH="200"><%$r%><% mt('Billing type') |h %></TD>
46 function myopen(filename,windowname,properties) {
48 mywindow = window.open(filename,windowname,properties);
57 function achopen(filename,windowname,properties) {
59 achwindow = window.open(filename,windowname,properties);
62 if ( achwindow != -1 )
67 function card_changed(what) {
69 what.form.payinfo.value.substring(0, 4) == '4093'
70 || what.form.payinfo.value.substring(0, 4) == '4911'
71 || what.form.payinfo.value.substring(0, 4) == '4936'
72 || what.form.payinfo.value.substring(0, 6) == '564132'
73 || what.form.payinfo.value.substring(0, 2) == '63'
74 || what.form.payinfo.value.substring(0, 2) == '67'
77 what.form.paystart_month.disabled = false;
78 what.form.paystart_year.disabled = false;
79 what.form.payissue.disabled = false;
80 what.form.paystart_month.style.backgroundColor = '#ffffff';
81 what.form.paystart_year.style.backgroundColor = '#ffffff';
82 what.form.payissue.style.backgroundColor = '#ffffff';
83 document.getElementById('paystart_label').style.color = '#000000';
84 document.getElementById('payissue_label').style.color = '#000000';
86 what.form.paystart_month.disabled = true;
87 what.form.paystart_year.disabled = true;
88 what.form.payissue.disabled = true;
89 what.form.paystart_month.style.backgroundColor = '#dddddd';
90 what.form.paystart_year.style.backgroundColor = '#dddddd';
91 what.form.payissue.style.backgroundColor = '#dddddd';
92 document.getElementById('paystart_label').style.color = '#999999';
93 document.getElementById('payissue_label').style.color = '#999999';
98 function init_payauto_changed(){
99 var f = document.getElementById('CARD_payauto');
100 if(f != null) payauto_changed(f);
101 f = document.getElementById('CHEK_payauto');
102 if(f != null) payauto_changed(f);
105 function payauto_changed(payauto_field){
106 var select = (payauto_field.name == 'CARD_payauto') ? 'CARD_billday' : 'CHEK_billday';
107 var span = document.getElementById('td_'+select);
108 select = document.getElementById(select);
109 if (span == null || select == null) return;
110 if(payauto_field.checked) {
111 span.style.color = '#000000';
112 select.disabled = false;
115 span.style.color = '#999999';
116 select.disabled = true;
117 //why? select.selectedIndex = 0;
121 function tax_changed(what) {
122 var num = document.getElementById(what.id + '_num');
123 if ( what.checked ) {
124 num.disabled = false;
132 <& /elements/init_overlib.html &>
134 % my $payby = $cust_main->payby;
135 % my $paytype = $cust_main->paytype;
136 % my( $account, $aba ) = split('@', $payinfo);
138 % ($branch,$aba) = split('\.',$aba)
139 % if $conf->config('echeck-country') eq 'CA';
141 % my $disabled = 'DISABLED style="background-color: #dddddd"';
142 % my $text_disabled = 'style="color: #999999"';
144 % if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($payinfo) =~ /^(Switch|Solo)$/ ) {
145 % $disabled = 'style="background-color: #ffffff"';
146 % $text_disabled = 'style="color: #000000";'
149 % my $disable_payauto = $conf->exists('disable_payauto_default');
150 % my $CARD_payauto_checked = $payby eq 'DCRD' ? ''
151 % : $payby eq 'CARD' ? 'CHECKED'
152 % : $disable_payauto ? '' : 'CHECKED';
153 % my $CHEK_payauto_checked = $payby eq 'DCHK' ? ''
154 % : $payby eq 'CHEK' ? 'CHECKED'
155 % : $disable_payauto ? '' : 'CHECKED';
157 % sub billday_options {
158 % my $curr_value = shift;
160 % for my $billday ( 1 .. 28 ) {
162 % $sel = "SELECTED='SELECTED'" if $curr_value == $billday;
163 % $ret .= "<OPTION VALUE='$billday' $sel>$billday</OPTION>";
168 % my $card_billday_style = $payby eq 'CARD' ? '' : 'style="color: #999999"';
169 % my $chek_billday_style = $payby eq 'CHEK' ? '' : 'style="color: #999999"';
170 % my $card_billday_select_disabled = $payby eq 'CARD' ? '' : 'DISABLED';
171 % my $chek_billday_select_disabled = $payby eq 'CHEK' ? '' : 'DISABLED';
173 % #false laziness w/view/cust_main/billing.html and misc/payment.cgi
174 % my $routing_label = $conf->config('echeck-country') eq 'US'
175 % ? 'ABA/Routing number'
176 % : 'Routing number';
177 % my $routing_size = $conf->config('echeck-country') eq 'CA' ? 4 : 10;
178 % my $routing_maxlength = $conf->config('echeck-country') eq 'CA' ? 3 : 9;
185 % '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
187 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Card number').qq! </TD>!.
188 % 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>!.
190 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Expiration').qq! </TD>!.
191 % '<TD WIDTH="408">'.
193 % include('/elements/select-month_year.html',
194 % 'prefix' => 'CARD_exp',
196 % ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ),
201 % qq!<TR><TD ALIGN="right" WIDTH="200">!.emt('CVV2').qq! !.
203 % 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;">!.emt('help').qq!</A>)!.
205 % '<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>'.
207 % qq!<TR><TD ALIGN="right" WIDTH="200"><SPAN ID="paystart_label" $text_disabled>!.emt('Start date').qq! </SPAN></TD>!.
208 % '<TD WIDTH="408">'.
210 % include('/elements/select-month_year.html',
211 % 'prefix' => 'CARD_paystart',
212 % 'disabled' => $disabled,
213 % 'empty_option' => 1,
214 % 'start_year' => 2000,
215 % 'end_year' => (localtime())[5] + 1900,
216 % 'selected_date' => (
217 % ( $payby =~ /^(CARD|DCRD)$/
218 % && cardtype($payinfo) =~ /^(Switch|Solo)$/ )
219 % ? $cust_main->paystart_month. '-'.
220 % $cust_main->paystart_year
225 % qq!<SPAN ID="payissue_label" $text_disabled>!.emt('or Issue number').qq! </SPAN>!.
226 % '<INPUT TYPE="text" NAME="CARD_payissue" VALUE="'. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payissue : '' ). qq!" SIZE=3 MAXLENGTH=2 $disabled></TD></TR>!.
228 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Exact name on card').qq! </TD>!.
229 % qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CARD_payname" VALUE="!. ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
231 % qq!<TR><TD COLSPAN=2 WIDTH="608">!.
232 % qq!<INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CARD_payauto" NAME="CARD_payauto" $CARD_payauto_checked> !.
233 % emt('Charge future payments to this [_1] automatically','credit card').'</TD></TR>'.
235 % ( $conf->exists('cust_main-select-billday') ?
236 % qq!<TR><TD ALIGN="RIGHT" id="td_CARD_billday" $card_billday_style>
237 % Charge on this day of each month</TD><TD>
238 % <SELECT id="CARD_billday" $card_billday_select_disabled NAME="CARD_billday">!
239 % . billday_options($cust_main->billday) . qq!</SELECT> </TD></TR>!
247 % '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
249 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Account number').qq! </TD>!.
250 % qq!<TD><INPUT TYPE="text" SIZE=12 NAME="CHEK_payinfo1" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $account : '' ). '"></TD>'.
251 % qq!<TD ALIGN="right">!.emt('Type').qq!</TD><TD><SELECT NAME="CHEK_paytype">!.
252 % join('', map { qq!<OPTION VALUE="$_" !.($paytype eq $_ ? 'SELECTED' : '').">$_</OPTION>" } @FS::cust_main::paytypes).
253 % qq!</SELECT></TD></TR>!.
255 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt($routing_label).qq! </TD>!.
256 % qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" SIZE=$routing_size MAXLENGTH=$routing_maxlength NAME="CHEK_payinfo2" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $aba : '' ). qq!"> !.
257 % 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;">!.emt('help').qq!</A>)!.
260 % qq!<INPUT TYPE="hidden" NAME="CHEK_exp_month" VALUE="12">!.
261 % qq!<INPUT TYPE="hidden" NAME="CHEK_exp_year" VALUE="2037">!.
263 % ( $conf->config('echeck-country') eq 'CA' ?
264 % qq!<TR><TD ALIGN="right">$r !.emt('Branch number').qq!</TD><TD COLSPAN="3">
265 % <INPUT TYPE="text" name="CHEK_payinfo3" VALUE="$branch" SIZE=6 MAXLENGTH=5></TD></TR>! : '' ).
267 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Bank name').qq! </TD>!.
268 % qq!<TD COLSPAN="3" WIDTH="408"><INPUT TYPE="text" NAME="CHEK_payname" VALUE="!. ( $payby =~ /^(CHEK|DCHK)$/ ? $cust_main->payname : '' ). qq!"></TD></TR>!.
269 % ( $conf->exists('show_bankstate') ?
270 % qq!<TR><TD ALIGN="right" WIDTH="200">$paystate_label</TD>!.
271 % qq!<TD COLSPAN="3" WIDTH="408">!.
272 % include('/elements/select-state.html',
273 % 'empty' => emt('(choose)'),
274 % 'state' => $cust_main->paystate,
275 % 'country' => $cust_main->country,
276 % 'prefix' => 'CHEK_pay',
278 % : '<INPUT TYPE="hidden" NAME="CHEK_paystate" VALUE="'.
279 % $cust_main->paystate. '">'
283 % qq!<TR><TD COLSPAN=4 WIDTH="608">!.
284 % qq!<INPUT TYPE="checkbox" onchange="payauto_changed(this);" ID="CHEK_payauto" NAME="CHEK_payauto" $CHEK_payauto_checked> !.
285 % emt('Charge future payments to this [_1] automatically','electronic check').'</TD></TR>'.
287 % ( $conf->exists('cust_main-select-billday') ?
288 % qq!<TR><TD ALIGN="RIGHT" id="td_CHEK_billday" $chek_billday_style>
289 % Charge on this day of each month</TD><TD>
290 % <SELECT id="CHEK_billday" $chek_billday_select_disabled NAME="CHEK_billday">!
291 % . billday_options($cust_main->billday) . qq!</SELECT> </TD></TR>!
299 % '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
301 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Phone number').qq! </TD>!.
302 % qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="LECB_payinfo" VALUE="!. ( $payby eq 'LECB' ? $cust_main->payinfo : '' ). qq!" MAXLENGTH=15 SIZE=16></TD></TR>!.
304 % qq!<INPUT TYPE="hidden" NAME="LECB_exp_month" VALUE="12">!.
305 % qq!<INPUT TYPE="hidden" NAME="LECB_exp_year" VALUE="2037">!.
306 % qq!<INPUT TYPE="hidden" NAME="LECB_payname" VALUE="">!.
308 % '<TR><TD> </TD></TR>'.
309 % '<TR><TD> </TD></TR>'.
310 % '<TR><TD> </TD></TR>'.
311 % '<TR><TD> </TD></TR>'.
312 % '<TR><TD> </TD></TR>'.
313 % '<TR><TD> </TD></TR>'.
319 % '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
321 % qq!<TR><TD ALIGN="right" WIDTH="200">!.emt('P.O.').qq! </TD>!.
322 % qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payinfo" VALUE="!. ( $payby eq 'BILL' ? $cust_main->payinfo : '' ). qq!"></TD></TR>!.
324 % qq!<INPUT TYPE="hidden" NAME="BILL_exp_month" VALUE="12">!.
325 % qq!<INPUT TYPE="hidden" NAME="BILL_exp_year" VALUE="2037">!.
327 % qq!<TR><TD ALIGN="right" WIDTH="200">!.emt('Attention').qq! </TD>!.
328 % qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="BILL_payname" VALUE="!. encode_entities( $payby eq 'BILL' ? $cust_main->payname : '' ). qq!"></TD></TR>!.
330 % '<TR><TD> </TD></TR>'.
331 % '<TR><TD> </TD></TR>'.
332 % '<TR><TD> </TD></TR>'.
333 % '<TR><TD> </TD></TR>'.
334 % '<TR><TD> </TD></TR>'.
340 % '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
342 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Approved by').qq! </TD>!.
343 % qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="COMP_payinfo" VALUE=""></TD></TR>!.
345 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Expiration').qq! </TD>!.
346 % '<TD WIDTH="408">'.
348 % include('/elements/select-month_year.html',
349 % 'prefix' => 'COMP_exp',
351 % ( $payby eq 'COMP' ? $cust_main->paydate : '' ),
356 % '<TR><TD> </TD></TR>'.
357 % '<TR><TD> </TD></TR>'.
358 % '<TR><TD> </TD></TR>'.
359 % '<TR><TD> </TD></TR>'.
360 % '<TR><TD> </TD></TR>'.
366 % '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
368 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Amount').qq! </TD>!.
369 % qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="CASH_paid" VALUE="!. ( $payby eq 'CASH' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
371 % '<TR><TD> </TD></TR>'.
372 % '<TR><TD> </TD></TR>'.
373 % '<TR><TD> </TD></TR>'.
374 % '<TR><TD> </TD></TR>'.
375 % '<TR><TD> </TD></TR>'.
376 % '<TR><TD> </TD></TR>'.
382 % '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
384 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Amount').qq! </TD>!.
385 % qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="WEST_paid" VALUE="!. ( $payby eq 'WEST' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
387 % '<TR><TD> </TD></TR>'.
388 % '<TR><TD> </TD></TR>'.
389 % '<TR><TD> </TD></TR>'.
390 % '<TR><TD> </TD></TR>'.
391 % '<TR><TD> </TD></TR>'.
392 % '<TR><TD> </TD></TR>'.
398 % '<TABLE BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0 HEIGHT=192>'.
400 % qq!<TR><TD ALIGN="right" WIDTH="200">${r}!.emt('Amount').qq! </TD>!.
401 % qq!<TD WIDTH="408"><INPUT TYPE="text" NAME="MCRD_paid" VALUE="!. ( $payby eq 'MCRD' ? $cust_main->paid : '' ). qq!"></TD></TR>!.
403 % '<TR><TD> </TD></TR>'.
404 % '<TR><TD> </TD></TR>'.
405 % '<TR><TD> </TD></TR>'.
406 % '<TR><TD> </TD></TR>'.
407 % '<TR><TD> </TD></TR>'.
408 % '<TR><TD> </TD></TR>'.
414 % #this should use FS::payby
415 % my @allopt = qw( CARD CHEK LECB BILL CASH WEST MCRD COMP );
417 % my %allopt = map { $_ => FS::payby->shortname($_) } @allopt;
419 % if ( $cust_main->custnum ) {
420 % #don't offer CASH/WEST/MCRD initial payment types when editing customer
421 % delete $allopt{$_} for qw(CASH WEST MCRD);
424 % my @options = grep exists( $allopt{$_} ), @payby;
426 % my %payby2option = (
427 % ( map { $_ => $_ } @options ),
433 <& /elements/selectlayers.html,
435 'curr_value' => $payby2option{$payby || $payby_default || $payby[0] },
436 'options' => \@options,
437 'labels' => \%allopt,
438 'html_between' => '</TD></TR></TABLE>',
439 'layer_callback' => sub { my $layer = shift; $payby{$layer}; },
440 'onchange' => 'init_payauto_changed();',
443 <% &ntable("#cccccc") %>
445 <TR><TD> </TD></TR>
447 % my $curuser = $FS::CurrentUser::CurrentUser;
448 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
449 % if ( $conf->exists('cust_class-tax_exempt')
450 % || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
451 % || $conf->config('tax-cust_exempt-groups-num_req') =~ /\w/
452 % || ! $curuser->access_right('Edit customer tax exemptions')
456 <INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax eq 'Y' ? 'Y' : '' %>">
461 <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>
466 % if ( $curuser->access_right('Edit customer tax exemptions') ) {
467 % foreach my $exempt_group ( @exempt_groups ) {
468 % my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
469 % #escape $exempt_group for NAME etc.
470 % my $checked = ($cust_main_exemption || $cgi->param("tax_$exempt_group"));
472 <TD> <INPUT TYPE="checkbox" NAME="tax_<% $exempt_group %>" ID="tax_<% $exempt_group %>" VALUE="Y" <% $checked ? 'CHECKED' : '' %> onChange="tax_changed(this)"> Tax Exempt (<% $exempt_group %> taxes)</TD>
473 <TD> - Exemption number <INPUT TYPE="text" NAME="tax_<% $exempt_group %>_num" ID="tax_<% $exempt_group %>_num" VALUE="<% $cgi->param("tax_$exempt_group".'_num') || ( $cust_main_exemption ? $cust_main_exemption->exempt_number : '' ) |h %>" <% $checked ? '' : 'DISABLED' %>></TD>
478 % unless ( $conf->exists('emailinvoiceonly') ) {
481 <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%
483 ( grep { $_ eq 'POST' } @invoicing_list )
488 %>> <% mt('Postal mail invoices') |h %>
494 <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_FAX" VALUE="FAX" <%
496 ( grep { $_ eq 'FAX' } @invoicing_list )
500 %>> <% mt('Fax invoices') |h %>
508 <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoice_email" VALUE="Y" <%
510 ( $cust_main->invoice_noemail eq 'Y' )
514 %>> <% mt('Email invoices') |h %>
519 % unless ( $conf->exists('cust-email-high-visibility')) {
521 <TD ALIGN="right" WIDTH="200">
522 <% $conf->exists('cust_main-require_invoicing_list_email', $agentnum)
523 ? $r : '' %>Email address(es)
525 <TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
526 <INPUT TYPE="checkbox" NAME="message_noemail" VALUE="Y" <%
527 ( $cust_main->message_noemail eq 'Y' )
530 %>> <% emt('Do not send notices') %>
535 % if ( $conf->exists('cust_main-select-prorate_day') ) {
537 <TD ALIGN="right" WIDTH="200"><% mt('Prorate day (1-28)') |h %> </TD>
539 <INPUT TYPE="text" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>" SIZE=3 MAXLENGTH=2>
543 <INPUT TYPE="hidden" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>">
547 <TD ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
549 <& /elements/select-terms.html,
550 'curr_value' => $cust_main->invoice_terms,
556 <TD ALIGN="right" WIDTH="200"><% mt('Credit limit') |h %> </TD>
558 <SCRIPT TYPE="text/javascript">
559 function toggle(obj) {
560 obj.form.credit_limit.disabled = obj.checked;
564 NAME = "credit_limit"
565 VALUE = "<% sprintf('%.2f', $cust_main->credit_limit) %>"
566 <% length($cust_main->credit_limit) ? '' : ' DISABLED' %>
568 % my $default_credit_limit = $conf->config('default_credit_limit');
569 <INPUT TYPE = "checkbox"
570 NAME = "no_credit_limit"
572 onClick="toggle(this)"
573 <% length($cust_main->credit_limit) ? '' : ' CHECKED'%>
574 > <% $default_credit_limit
575 ? "Default ($money_char". sprintf("%.2f", $default_credit_limit).
583 % if ( $conf->exists('voip-cust_cdr_spools') ) {
585 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="spool_cdr" VALUE="Y" <% $cust_main->spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %></TD>
588 <INPUT TYPE="hidden" NAME="spool_cdr" VALUE="<% $cust_main->spool_cdr %>">
591 % if ( $conf->exists('voip-cust_cdr_squelch') ) {
593 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="squelch_cdr" VALUE="Y" <% $cust_main->squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt($conf->exists('voip-cdr_email') ? 'Omit CDRs from printed invoices' : 'Omit CDRs from invoices') |h %></TD>
596 <INPUT TYPE="hidden" NAME="squelch_cdr" VALUE="<% $cust_main->squelch_cdr %>">
599 % if ( $conf->exists('voip-cust_email_csv_cdr') ) {
601 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="email_csv_cdr" VALUE="Y" <% $cust_main->email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Attach CDRs as CSV to emailed invoices') |h %></TD>
604 <INPUT TYPE="hidden" NAME="email_csv_cdr" VALUE="<% $cust_main->email_csv_cdr %>">
607 % if ( $conf->exists('voip-cust_accountcode_cdr') ) {
610 <INPUT TYPE="checkbox"
611 NAME="accountcode_cdr"
613 <% $cust_main->accountcode_cdr eq "Y" ? 'CHECKED' : '' %>
614 > <% mt('Breakdown CDRs by accountcode') |h %></TD>
617 <INPUT TYPE="hidden" NAME="accountcode_cdr" VALUE="<% $cust_main->accountcode_cdr %>">
620 % if ( $show_term || $cust_main->cdr_termination_percentage ) {
622 <TD ALIGN="right"><% mt('CDR termination settlement') |h %></TD>
623 <TD><INPUT TYPE = "text"
624 NAME = "cdr_termination_percentage"
626 VALUE = "<% $cust_main->cdr_termination_percentage %>"
627 STYLE = "text-align:right;"
631 <INPUT TYPE="hidden" NAME="cdr_termination_percentage" VALUE="<% $cust_main->cdr_termination_percentage %>">
634 %my @available_locales = $conf->config('available-locales');
635 %if ( scalar(@available_locales) ) {
636 % push @available_locales, ''
637 % unless $cust_main->locale && $conf->exists('cust_main-require_locale');
638 % my %locale_labels = map {
640 % my %info = FS::Locales->locale_info($_);
641 % $ll{$_} = $info{name} . " (" . $info{country} . ")";
643 % } FS::Locales->locales;
645 % my $label = ( $conf->exists('cust_main-require_locale') ? $r : '' ).
646 % emt('Invoicing locale');
648 <& /elements/tr-select.html,
651 'options' => \@available_locales,
652 'labels' => \%locale_labels,
653 'curr_value' => $cust_main->locale,
659 <% $r %><% mt('required fields') |h %>
662 <script type="text/javascript">
663 init_payauto_changed();
668 my $paystate_label = FS::Msgcat::_gettext('paystate');
669 $paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
674 my( $cust_main, %options ) = @_;
675 my @invoicing_list = @{ $options{'invoicing_list'} };
676 my $payinfo = $options{'payinfo'};
677 my $conf = new FS::Conf;
678 my $payby_default = $conf->config('payby-default');
680 my $money_char = $conf->config('money_char') || '$';
682 my @payby = grep /\w/, $conf->config('payby');
683 #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
684 @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
688 if ( $cust_main->custnum ) {
689 #false laziness w/view/cust_main/billing.html
690 my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
691 my $term_sth = dbh->prepare($term_sql) or die dbh->errstr;
692 $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
693 $show_term = $term_sth->fetchrow_arrayref->[0];
696 my $agentnum = $cust_main->agentnum if $cust_main->custnum;