%if ( $payby_default eq 'HIDE' ) { % % $cust_main->payby('BILL') unless $cust_main->payby; % my $payby = $cust_main->payby; % foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate )) { % } % #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"; % } % } else { % % my $r = qq!* !;
Billing information <% &ntable("#cccccc") %> <%$r%>Billing type <% 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' => % % ''. % % qq!!. % qq!!. % % qq!!. % ''. % % qq!!. % '!. % '!. % % qq!!. % qq!!. % % qq!'. % % '
${r}Card number
${r}Expiration '. % % include('/elements/select-month_year.html', % 'prefix' => 'CARD_exp', % 'selected_date' => % ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), % ). % % '
CVV2 !. % % qq!(help)!. % qq!'. % % % qq!
Start date '. % % 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! or Issue number !. % '
${r}Exact name on card
Charge future payments to this card automatically
', % % 'CHEK' => % % ''. % % qq!!. % qq!'. % qq!!. % % qq!!. % qq!!. % % qq!!. % qq!!. % % qq!!. % qq!!. % ( $conf->exists('show_bankstate') ? % qq!!. % qq!" % : '' % ). % % % qq!'. % % ''. % ''. % ''. % % '
${r}Account number Type
${r}ABA/Routing number !. % qq!(help)!. % qq!
${r}Bank name
$paystate_label!. % include('/elements/select-state.html', % 'empty' => '(choose)', % 'state' => $cust_main->paystate, % 'country' => $cust_main->country, % 'prefix' => 'CHEK_pay', % ). "
Charge future payments to this electronic check automatically
 
 
 
', % % 'LECB' => % % ''. % % qq!!. % qq!!. % % qq!!. % qq!!. % qq!!. % % ''. % ''. % ''. % ''. % ''. % ''. % % '
${r}Phone number
 
 
 
 
 
 
', % % 'BILL' => % % ''. % % qq!!. % qq!!. % % qq!!. % qq!!. % % qq!!. % qq!!. % % ''. % ''. % ''. % ''. % ''. % % '
P.O.
Attention
 
 
 
 
 
', % % 'COMP' => % % ''. % % qq!!. % qq!!. % % qq!!. % ''. % % ''. % ''. % ''. % ''. % ''. % % '
${r}Approved by
${r}Expiration '. % % include('/elements/select-month_year.html', % 'prefix' => 'COMP_exp', % 'selected_date' => % ( $payby eq 'COMP' ? $cust_main->paydate : '' ), % ). % % '
 
 
 
 
 
', % % 'CASH' => % % ''. % % qq!!. % qq!!. % % ''. % ''. % ''. % ''. % ''. % ''. % % '
${r}Amount
 
 
 
 
 
 
', % % 'WEST' => % % ''. % % qq!!. % qq!!. % % ''. % ''. % ''. % ''. % ''. % ''. % % '
${r}Amount
 
 
 
 
 
 
', % % 'MCRD' => % % ''. % % qq!!. % qq!!. % % ''. % ''. % ''. % ''. % ''. % ''. % % '
${r}Amount
 
 
 
 
 
 
', % % ); % % #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', % ); <% include( '/elements/selectlayers.html', 'field' => 'payby', 'curr_value' => $payby2option{$payby || $payby_default || $payby[0] }, 'options' => \@options, 'labels' => \%allopt, 'html_between' => '', 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, ) %> <% &ntable("#cccccc") %>   % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups'); tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %> % foreach my $exempt_group ( @exempt_groups ) { % #escape $exempt_group for NAME   tax_exemption($exempt_group) ? 'CHECKED' : '' %>> Tax Exempt (<% $exempt_group %> taxes) % } % unless ( $conf->exists('emailinvoiceonly') ) { > Postal mail invoice > Fax invoice % } <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es) Invoice terms % if ( $conf->exists('voip-cust_cdr_spools') ) { spool_cdr eq "Y" ? 'CHECKED' : '' %>> Spool CDRs % } else { % } % if ( $conf->exists('voip-cust_cdr_squelch') ) { squelch_cdr eq "Y" ? 'CHECKED' : '' %>> Omit CDRs from invoices % } else { % } % if ( $show_term || $cust_main->cdr_termination_percentage ) { CDR termination settlement % % } else { % } <% $r %> required fields % } <%once> my $paystate_label = FS::Msgcat::_gettext('paystate'); $paystate_label = 'Bank state' if $paystate_label =~/^paystate$/; <%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];