X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbilling.html;h=39a0b70ed24e361b4b51211eea81f7b5f1148700;hb=d0c5ddbd31af8b1747d447f31623e1af05961eb4;hp=394c5d8d52f2fcbe841ab377cb36e62858416c0c;hpb=fd8490781ff425e85cbd507e1166fa786b5ceddc;p=freeside.git diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index 394c5d8d5..39a0b70ed 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -1,18 +1,14 @@ %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 )) { - + % } @@ -27,28 +23,22 @@ % die "unrecognized expiration date format: $date"; % } - - - -
- -
+ + -
- % } else { % % my $r = qq!* !; -
Billing information +
<% mt('Billing information') |h %> <% &ntable("#cccccc") %> - <%$r%>Billing type + <%$r%><% mt('Billing type') |h %> + function payauto_changed(payauto_field){ + var f = (payauto_field.name == 'CARD_payauto') ? 'card_billday' : 'chek_billday'; + f = document.getElementById(f); + if ( f == null) return; + if(payauto_field.checked) f.style.display = 'inline'; + else f.style.display = 'none'; + } - - - - + <& /elements/init_overlib.html &> + % my $payby = $cust_main->payby; % my $paytype = $cust_main->paytype; % my( $account, $aba ) = split('@', $payinfo); @@ -130,38 +119,58 @@ % $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 $billday_card_display = $payby eq 'CARD' ? 'inline' : 'none'; +% my $billday_chek_display = $payby eq 'CHEK' ? 'inline' : 'none'; +% % my %payby = ( % % 'CARD' => % % ''. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % -% qq!!. +% qq!!. % ''. % -% qq!!. -% '!. +% qq!!. % '!. +% qq!!.emt('or Issue number').qq! !. +% '!. +% +% qq!!. +% qq!!. % -% qq!!. -% qq!!. +% qq!!. % -% qq!'. +% ( $conf->exists('cust_main-select-billday') ? +% qq!! +% : '' +% ). % % '
${r}Card number
${r}!.emt('Card number').qq!
${r}Expiration
${r}!.emt('Expiration').qq! '. % % include('/elements/select-month_year.html', -% 'prefix' => 'exp', +% 'prefix' => 'CARD_exp', % 'selected_date' => % ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), % ). % % '
CVV2 !. +% qq!
!.emt('CVV2').qq! !. % -% qq!(help)!. +% qq!(!.emt('help').qq!)!. % qq!'. +% ''. % -% -% qq!
Start date
!.emt('Start date').qq! '. % % include('/elements/select-month_year.html', -% 'prefix' => 'paystart', +% 'prefix' => 'CARD_paystart', % 'disabled' => $disabled, % 'empty_option' => 1, % 'start_year' => 2000, @@ -175,13 +184,20 @@ % ) % ). % -% qq! or Issue number !. -% '
${r}!.emt('Exact name on card').qq!
${r}Exact name on card
!.emt('Charge future payments to this [_1] automatically','credit card').qq!
Charge future payments to this card automatically
+% Charge on the day of each month
', % @@ -189,37 +205,44 @@ % % ''. % -% qq!!. -% qq!'. -% qq!!. +% qq!'. +% qq!!. % -% qq!!. -% qq!!. +% qq!!. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % ( $conf->exists('show_bankstate') ? % qq!!. % qq!" -% : '' % ). % % -% qq!'. +% qq!!. +% +% ( $conf->exists('cust_main-select-billday') ? +% qq!! +% : '' +% ). % % ''. % ''. @@ -231,12 +254,12 @@ % % '
${r}Account number Type
${r}!.emt('Account number').qq! !.emt('Type').qq!
${r}ABA/Routing number !. -% qq!(help)!. +% qq!
${r}!.emt('ABA/Routing number').qq! !. +% qq!(!.emt('help').qq!)!. % qq!
${r}Bank name
${r}!.emt('Bank name').qq!
$paystate_label!. -% include('select-state.html', -% 'empty' => '(choose)', +% include('/elements/select-state.html', +% 'empty' => emt('(choose)'), % 'state' => $cust_main->paystate, % 'country' => $cust_main->country, -% 'prefix' => 'pay', +% 'prefix' => 'CHEK_pay', % ). "
Charge future payments to this electronic check automatically
!.emt('Charge future payments to this [_1] automatically','electronic check').qq!
+% Charge on the day of each month
 
 
'. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % -% qq!!. -% qq!!. -% qq!!. +% qq!!. +% qq!!. +% qq!!. % % ''. % ''. @@ -251,14 +274,14 @@ % % '
${r}Phone number
${r}!.emt('Phone number').qq!
 
 
'. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % % ''. % ''. @@ -272,14 +295,14 @@ % % '
P.O.
!.emt('P.O.').qq!
Attention
!.emt('Attention').qq!
 
 
'. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % -% qq!!. +% qq!!. % '
${r}Approved by
${r}!.emt('Approved by').qq!
${r}Expiration
${r}!.emt('Expiration').qq! '. % % include('/elements/select-month_year.html', -% 'prefix' => 'exp', +% 'prefix' => 'COMP_exp', % 'selected_date' => % ( $payby eq 'COMP' ? $cust_main->paydate : '' ), % ). @@ -298,8 +321,8 @@ % % ''. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % % ''. % ''. @@ -314,8 +337,8 @@ % % '
${r}Amount
${r}!.emt('Amount').qq!
 
 
'. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % % ''. % ''. @@ -330,8 +353,8 @@ % % '
${r}Amount
${r}!.emt('Amount').qq!
 
 
'. % -% qq!!. -% qq!!. +% qq!!. +% qq!!. % % ''. % ''. @@ -345,57 +368,50 @@ % ); % % #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
${r}!.emt('Amount').qq!
 
 
', -% 'selected_layer' => $payby2option{$payby || $payby_default || $payby[0] }, -% 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, -% ); -% -% - -
<% $widget->html %> - -
+
+ <& /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 + 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') ) { @@ -406,7 +422,7 @@ ? 'CHECKED' : '' - %>> Postal mail invoice + %>> <% mt('Postal mail invoice') |h %> @@ -418,7 +434,7 @@ ? 'CHECKED' : '' - %>> Fax invoice + %>> <% mt('Fax invoice') |h %> @@ -426,38 +442,88 @@ % } - Email invoice + + <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es) + - Invoice terms + <% mt('Invoice terms') |h %> - + <& /elements/select-terms.html, + 'curr_value' => $cust_main->invoice_terms, + &> + + + + + <% mt('Credit limit') |h %> + + + credit_limit) %><% length($cust_main->credit_limit) ? '' : ' DISABLED' %>> + credit_limit) ? '' : ' CHECKED'%>> <% mt('Unlimited') |h %> % if ( $conf->exists('voip-cust_cdr_spools') ) { - spool_cdr eq "Y" ? 'CHECKED' : '' %>> Spool CDRs + spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %> % } else { - -% } +% } - +% if ( $conf->exists('voip-cust_cdr_squelch') ) { + + squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Omit CDRs from printed invoices') |h %> + +% } else { + +% } + +% if ( $conf->exists('voip-cust_email_csv_cdr') ) { + + email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Attach CDRs as CSV to emailed invoices') |h %> + +% } else { + +% } + +% if ( $conf->exists('voip-cust_accountcode_cdr') ) { + + + accountcode_cdr eq "Y" ? 'CHECKED' : '' %> + > <% mt('Breakdown CDRs by accountcode') |h %> + +% } else { + +% } - +% if ( $show_term || $cust_main->cdr_termination_percentage ) { + + <% mt('CDR termination settlement') |h %> + % + +% } else { + +% } - <% $r %> required fields + + + <% $r %> <% mt('required fields') |h %> % } <%once> @@ -479,4 +545,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]; +} +