X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbilling.html;h=5e97934c1b801a925da0138baac72ce9feecf328;hb=5cebf6d642a74554ca424397d806f9b59ac19c5c;hp=ba10929eddb3e1d27d50fda7521a5649ffe5b1ee;hpb=4a0dddbf7361428155698bacec70942be9029586;p=freeside.git diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index ba10929ed..5e97934c1 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -1,18 +1,15 @@ %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 )) { +% foreach my $field (qw( payname paycvv paystart_month paystart_year payissue payip paytype paystate )) { - + % } @@ -27,24 +24,18 @@ % die "unrecognized expiration date format: $date"; % } - - - -
- -
+ + -
- % } else { % % my $r = qq!* !; -
Billing information +
Billing information <% &ntable("#cccccc") %> @@ -105,21 +96,38 @@ return true; } - + function init_payauto_changed(){ + var f = document.getElementById('CARD_payauto'); + if(f != null) payauto_changed(f); + f = document.getElementById('CHEK_payauto'); + if(f != null) payauto_changed(f); + } + + function payauto_changed(payauto_field){ + var span = (payauto_field.name == 'CARD_payauto') ? 'card_billday' : 'chek_billday'; + var select = document.getElementById('select_'+span); + span = document.getElementById(span); + if (span == null || select == null) return; + if(payauto_field.checked) { + span.style.color = '#000000'; + select.disabled = false; + } + else { + span.style.color = '#999999'; + select.disabled = true; + select.selectedIndex = 0; + } + } - - - - + <% include('/elements/init_overlib.html') %> + % my $payby = $cust_main->payby; +% my $paytype = $cust_main->paytype; % my( $account, $aba ) = split('@', $payinfo); +% my $branch = ''; +% ($branch,$aba) = split('\.',$aba) if $conf->exists('cust_main-require-bank-branch'); % % my $disabled = 'DISABLED style="background-color: #dddddd"'; % my $text_disabled = 'style="color: #999999"'; @@ -129,6 +137,30 @@ % $text_disabled = 'style="color: #000000";' % } % +% my $disable_payauto = $conf->exists('disable_payauto_default'); +% my $CARD_payauto_checked = $payby eq 'DCRD' ? '' +% : $payby eq 'CARD' ? 'CHECKED' +% : $disable_payauto ? '' : 'CHECKED'; +% my $CHEK_payauto_checked = $payby eq 'DCHK' ? '' +% : $payby eq 'CHEK' ? 'CHECKED' +% : $disable_payauto ? '' : 'CHECKED'; +% +% sub billday_options { +% my $curr_value = shift; +% my $ret = ''; +% for my $billday ( 1 .. 28 ) { +% my $sel = ''; +% $sel = "SELECTED='SELECTED'" if $curr_value == $billday; +% $ret .= ""; +% } +% $ret; +% } +% +% my $card_billday_style = $payby eq 'CARD' ? '' : 'style="color: #999999"'; +% my $chek_billday_style = $payby eq 'CHEK' ? '' : 'style="color: #999999"'; +% my $card_billday_select_disabled = $payby eq 'CARD' ? '' : 'DISABLED'; +% my $chek_billday_select_disabled = $payby eq 'CHEK' ? '' : 'DISABLED'; +% % my %payby = ( % % 'CARD' => @@ -136,13 +168,13 @@ % ''. % % qq!!. -% qq!!. +% qq!!. % % qq!!. % '!. -% '!. % '!. +% '!. % % qq!!. -% qq!!. +% qq!!. % -% qq!'. +% qq!!. +% +% ( $conf->exists('cust_main-select-billday') ? +% qq!! +% : '' +% ). % % '
${r}Card number
${r}Expiration '. % % include('/elements/select-month_year.html', -% 'prefix' => 'exp', +% 'prefix' => 'CARD_exp', % 'selected_date' => % ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), % ). @@ -153,14 +185,14 @@ % % qq!(help)!. % qq!'. +% ''. % % % qq!
Start date '. % % include('/elements/select-month_year.html', -% 'prefix' => 'paystart', +% 'prefix' => 'CARD_paystart', % 'disabled' => $disabled, % 'empty_option' => 1, % 'start_year' => 2000, @@ -175,12 +207,22 @@ % ). % % qq! or Issue number !. -% '
${r}Exact name on card
Charge future payments to this card automatically
!. +% qq! !. +% qq!Charge future payments to this card automatically
+% Charge on this day of each month   +%
', % @@ -189,24 +231,50 @@ % ''. % % qq!!. -% qq!'. +% qq!'. +% qq!!. % % qq!!. -% qq!!. % -% qq!!. -% qq!!. -% -% qq!!. -% qq!!. +% qq!!. +% qq!!. % -% qq!'. +% ( $conf->exists('cust_main-require-bank-branch') ? +% qq!! : '' ). % -% ''. -% ''. -% ''. +% qq!!. +% qq!!. +% ( $conf->exists('show_bankstate') ? +% qq!!. +% qq!" +% : '' +% ). +% +% +% qq!!. +% +% ( $conf->exists('cust_main-select-billday') ? +% qq!! +% : '' +% ). % % '
${r}Account number
Type
${r}ABA/Routing number !. +% qq! !. % qq!(help)!. % qq!
${r}Bank name
Charge future payments to this electronic check automatically
$r Branch number +%
 
 
 
${r}Bank name
$paystate_label!. +% include('/elements/select-state.html', +% 'empty' => '(choose)', +% 'state' => $cust_main->paystate, +% 'country' => $cust_main->country, +% 'prefix' => 'CHEK_pay', +% ). "
!. +% qq! !. +% qq!Charge future payments to this electronic check automatically
+% Charge on this day of each month   +%
', % @@ -215,11 +283,11 @@ % ''. % % qq!!. -% qq!!. +% qq!!. % -% qq!!. -% qq!!. -% qq!!. +% qq!!. +% qq!!. +% qq!!. % % ''. % ''. @@ -235,13 +303,13 @@ % '
${r}Phone number
 
 
'. % % qq!!. -% qq!!. +% qq!!. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % % qq!!. -% qq!!. +% qq!!. % % ''. % ''. @@ -256,13 +324,13 @@ % '
P.O.
Attention
 
 
'. % % qq!!. -% qq!!. +% qq!!. % % qq!!. % '
${r}Approved by
${r}Expiration '. % % include('/elements/select-month_year.html', -% 'prefix' => 'exp', +% 'prefix' => 'COMP_exp', % 'selected_date' => % ( $payby eq 'COMP' ? $cust_main->paydate : '' ), % ). @@ -282,7 +350,7 @@ % ''. % % qq!!. -% qq!!. +% qq!!. % % ''. % ''. @@ -298,7 +366,7 @@ % '
${r}Amount
 
 
'. % % qq!!. -% qq!!. +% qq!!. % % ''. % ''. @@ -314,7 +382,7 @@ % '
${r}Amount
 
 
'. % % qq!!. -% qq!!. +% qq!!. % % ''. % ''. @@ -328,57 +396,54 @@ % ); % % #this should use FS::payby -% my %allopt = ( -% 'CARD' => 'Credit card', -% 'CHEK' => 'Electronic check', -% 'LECB' => 'Phone bill billing', -% 'BILL' => 'Billing', -% 'CASH' => 'Cash', # initial payment, then billing', -% 'WEST' => 'Western Union', # initial payment, then billing', -% 'MCRD' => 'Manual credit card', # initial payment, then billing', -% 'COMP' => 'Complimentary', -% ); -% if ( $cust_main->custnum ) { #don't offer CASH/WEST/MCRD initial payment types -% # when editing customer +% 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); % } % -% tie my %options, 'Tie::IxHash', -% map { $_ => $allopt{$_} } -% grep { exists $allopt{$_} } -% @payby; +% my @options = grep exists( $allopt{$_} ), @payby; % % my %payby2option = ( -% ( map { $_ => $_ } keys %options ), +% ( map { $_ => $_ } @options ), % 'DCRD' => 'CARD', % 'DCHK' => 'CHEK', % ); -% -% my $widget = new HTML::Widgets::SelectLayers( -% 'options' => \%options, -% #'form_name' => 'dummy', -% #'form_action' => 'nothingyet', -% #chops bottom of page in IE# 'under_position' => 'absolute', -% 'html_between' => '
${r}Amount
 
 
', -% 'selected_layer' => $payby2option{$payby || $payby_default || $payby[0] }, -% 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, -% ); -% -% - -
<% $widget->html %> - -
+
+ <% 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}; }, + 'onchange' => 'init_payauto_changed();', + ) + %> <% &ntable("#cccccc") %>   +% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups'); + - tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt + 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') ) { + +% } + +% unless ( $conf->exists('cust-email-high-visibility')) { - Email invoice + + <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es) + -% if ( $conf->exists('voip-cust_cdr_spools') ) { +% } + + + Invoice terms + + <% include('/elements/select-terms.html', + 'curr_value' => $cust_main->invoice_terms, + ) + %> + + + + Credit limit + + + credit_limit) %><% length($cust_main->credit_limit) ? '' : ' DISABLED' %>> + credit_limit) ? '' : ' CHECKED'%>> Unlimited + + +% 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 printed invoices + +% } else { + +% } - +% if ( $conf->exists('voip-cust_email_csv_cdr') ) { + + email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> Attach CDRs as CSV to emailed 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 ) = @_; @@ -439,4 +568,13 @@ my @payby = grep /\w/, $conf->config('payby'); @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP )) unless @payby; +my $show_term = ''; +if ( $cust_main->custnum ) { + #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; + $show_term = $term_sth->fetchrow_arrayref->[0]; +} +