X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbilling.html;h=07266b9a6fc8ed4d94ca723d73d2b12a6191dc57;hb=b5dbd9e1bcbb701a20ed23e723b1e0105fd7c1a1;hp=a9b3c1f757d596d9442b2aca59c6cf589dcf1584;hpb=88c42d0423368bf52d593021f704bfa38845ff71;p=freeside.git diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index a9b3c1f75..07266b9a6 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -1,70 +1,44 @@ -<% +%if ( $payby_default eq 'HIDE' ) { +% $cust_main->payby('BILL') unless $cust_main->payby; +% my $payby = $cust_main->payby; -my( $cust_main, %options ) = @_; -my @invoicing_list = @{ $options{'invoicing_list'} }; -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; - -if ( $payby_default eq 'HIDE' ) { - - $cust_main->payby('BILL') unless $cust_main->payby; - -%> - - - - - -
<% # XXX key %> + - <% foreach my $field (qw( payinfo payname paycvv paystart_month paystart_year payissue payip )) { %> + - +% 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"; - } - %> +% } - - +% #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!* !; -
- -<% } else { - - my $r = qq!* !; - -%> - -
Billing information - <%= &ntable("#cccccc") %> +
<% 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'; + } - - - - - <% - - my($payby, $payinfo, $payname)=( - $cust_main->payby, - $cust_main->payinfo, - $cust_main->payname, - ); - 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' => 'exp', - 'selected_date' => - ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), - ). - - '
CVV2 !. - - qq!(help)!. - qq!'. - - - qq!
Start date '. - - include('/elements/select-month_year.html', - 'prefix' => '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!'. - - ''. - ''. - ''. - - '
${r}Account number
${r}ABA/Routing number !. - qq!(help)!. - qq!
${r}Bank name
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' => 'exp', - 'selected_date' => - ( $payby eq 'COMP' ? $cust_main->paydate : '' ), - ). - - '
 
 
 
 
 
', - - 'CASH' => - - ''. - - qq!!. - qq!!. - - ''. - ''. - ''. - ''. - ''. - ''. - - '
${r}Amount
 
 
 
 
 
 
', - - 'WEST' => - - ''. - - qq!!. - qq!!. - - ''. - ''. - ''. - ''. - ''. - ''. - - '
${r}Amount
 
 
 
 
 
 
', - - 'MCRD' => - - ''. - - qq!!. - qq!!. - - ''. - ''. - ''. - ''. - ''. - ''. - - '
${r}Amount
 
 
 
 
 
 
', - - ); - - - 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 - delete $allopt{$_} for qw(CASH WEST MCRD); - } - - tie my %options, 'Tie::IxHash', - map { $_ => $allopt{$_} } - grep { exists $allopt{$_} } - @payby; - - my %payby2option = ( - ( map { $_ => $_ } keys %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' => '', - 'selected_layer' => $payby2option{$payby || $payby_default || $payby[0] }, - 'layer_callback' => sub { my $layer = shift; $payby{$layer}; }, - ); - - %> - - <%= $widget->html %> - -
- - <%= &ntable("#cccccc") %> + <& /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 $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!!. +% +% ( $conf->exists('cust_main-select-billday') ? +% qq!! +% : '' +% ). +% +% '
${r}!.emt('Card number').qq!
${r}!.emt('Expiration').qq! '. +% +% include('/elements/select-month_year.html', +% 'prefix' => 'CARD_exp', +% 'selected_date' => +% ( $payby =~ /^(CARD|DCRD)$/ ? $cust_main->paydate : '' ), +% ). +% +% '
!.emt('CVV2').qq! !. +% +% qq!(!.emt('help').qq!)!. +% qq!'. +% +% qq!
!.emt('Start date').qq! '. +% +% 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!!.emt('or Issue number').qq! !. +% '
${r}!.emt('Exact name on card').qq!
!.emt('Charge future payments to this card automatically').qq!
+% Charge on the day of each month
', +% +% 'CHEK' => +% +% ''. +% +% qq!!. +% qq!'. +% qq!!. +% +% qq!!. +% qq!!. +% +% qq!!. +% qq!!. +% +% qq!!. +% qq!!. +% ( $conf->exists('show_bankstate') ? +% qq!!. +% qq!" +% : '' +% ). +% +% +% qq!!. +% +% ( $conf->exists('cust_main-select-billday') ? +% qq!! +% : '' +% ). +% +% ''. +% ''. +% ''. +% +% '
${r}!.emt('Account number').qq! !.emt('Type').qq!
${r}!.emt('ABA/Routing number').qq! !. +% qq!(!.emt('help').qq!)!. +% qq!
${r}!.emt('Bank name').qq!
$paystate_label!. +% include('/elements/select-state.html', +% 'empty' => emt('(choose)'), +% 'state' => $cust_main->paystate, +% 'country' => $cust_main->country, +% 'prefix' => 'CHEK_pay', +% ). "
!.emt('Charge future payments to this electronic check automatically').qq!
+% Charge on the day of each month
 
 
 
', +% +% 'LECB' => +% +% ''. +% +% qq!!. +% qq!!. +% +% qq!!. +% qq!!. +% qq!!. +% +% ''. +% ''. +% ''. +% ''. +% ''. +% ''. +% +% '
${r}!.emt('Phone number').qq!
 
 
 
 
 
 
', +% +% 'BILL' => +% +% ''. +% +% qq!!. +% qq!!. +% +% qq!!. +% qq!!. +% +% qq!!. +% qq!!. +% +% ''. +% ''. +% ''. +% ''. +% ''. +% +% '
!.emt('P.O.').qq!
!.emt('Attention').qq!
 
 
 
 
 
', +% +% 'COMP' => +% +% ''. +% +% qq!!. +% qq!!. +% +% qq!!. +% ''. +% +% ''. +% ''. +% ''. +% ''. +% ''. +% +% '
${r}!.emt('Approved by').qq!
${r}!.emt('Expiration').qq! '. +% +% include('/elements/select-month_year.html', +% 'prefix' => 'COMP_exp', +% 'selected_date' => +% ( $payby eq 'COMP' ? $cust_main->paydate : '' ), +% ). +% +% '
 
 
 
 
 
', +% +% 'CASH' => +% +% ''. +% +% qq!!. +% qq!!. +% +% ''. +% ''. +% ''. +% ''. +% ''. +% ''. +% +% '
${r}!.emt('Amount').qq!
 
 
 
 
 
 
', +% +% 'WEST' => +% +% ''. +% +% qq!!. +% qq!!. +% +% ''. +% ''. +% ''. +% ''. +% ''. +% ''. +% +% '
${r}!.emt('Amount').qq!
 
 
 
 
 
 
', +% +% 'MCRD' => +% +% ''. +% +% qq!!. +% qq!!. +% +% ''. +% ''. +% ''. +% ''. +% ''. +% ''. +% +% '
${r}!.emt('Amount').qq!
 
 
 
 
 
 
', +% +% ); +% +% #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', +% ); + + + <& /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') ) { + - exists('disablepostalinvoicedefault') ) - || grep { $_ eq 'POST' } @invoicing_list ) + ( grep { $_ eq 'POST' } @invoicing_list ) ? 'CHECKED' : '' - %>> Postal mail invoice + %>> <% mt('Postal mail invoice') |h %> - > Fax invoice + %>> <% mt('Fax invoice') |h %> +% } + - Email invoice - + + <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es) + + + + <% 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' : '' %>> <% 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 %> <% mt('required fields') |h %> +% } + +<%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'); - <%= $r %> required fields +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; -<% } %> +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]; +} +