X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbilling.html;h=5714f9a2be860e1503d2874983e84ab475f2748c;hp=d3cd77dbb31e1b83828e843ca30a54b4918f974d;hb=ea1f12bb5c5764f784e884fa8d7c37e5cd0b28e0;hpb=a0ddcb6b2ac38076c48e8f0b69e0758d5283303a diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html index d3cd77dbb..5714f9a2b 100644 --- a/httemplate/edit/cust_main/billing.html +++ b/httemplate/edit/cust_main/billing.html @@ -1,454 +1,342 @@ -% -% -%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( payname paycvv paystart_month paystart_year payissue payip )) { - - - -% } -% -% #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 - - - - -% -% -% my($payby, $paymask, $payname)=( -% $cust_main->payby, -% $cust_main->paymask, -% $cust_main->payname, -% ); -% my( $account, $aba ) = split('@', $paymask); -% -% my $disabled = 'DISABLED style="background-color: #dddddd"'; -% my $text_disabled = 'style="color: #999999"'; -% -% if ( $payby =~ /^(CARD|DCRD)$/ && cardtype($paymask) =~ /^(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($paymask) =~ /^(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
 
 
 
 
 
 
', -% -% ); -% -% #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 -% 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") %> - -   - +
<% mt('Billing information') |h %> + + + +% my $curuser = $FS::CurrentUser::CurrentUser; + +% ### +% # complimentry flag +% ### + +% if ( $curuser->access_right('Complimentary customer') ) { + + <& /elements/tr-checkbox.html, + field => 'complimentary', + label => emt('Complimentary customer'), + value => 'Y', + curr_value => $cust_main->complimentary, + box_first => 1, + &> + +% } else { + + + +% } + +% ### +% # tax exemptions +% ### + +% my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups'); +% if ( $conf->exists('cust_class-tax_exempt') +% || $conf->exists('tax-cust_exempt-groups-require_individual_nums') +% || $conf->config('tax-cust_exempt-groups-num_req') =~ /\w/ +% || ! $curuser->access_right('Edit customer tax exemptions') +% ) +% { + + + +% } else { + + <& /elements/tr-checkbox.html, + field => 'tax', + label => emt('Tax Exempt' . (scalar(@exempt_groups) ? '(all taxes)' : '') ), + value => 'Y', + curr_value => $cust_main->tax, + box_first => 1, + &> + +% } + +% if ( $curuser->access_right('Edit customer tax exemptions') ) { +% foreach my $exempt_group ( @exempt_groups ) { +% my $cust_main_exemption = $cust_main->tax_exemption($exempt_group); +% #escape $exempt_group for NAME etc. +% my $checked = ($cust_main_exemption || $cgi->param("tax_$exempt_group")); + + + + +% } #" +% } + +% ### +% # postal invoices +% ### + +% unless ( $conf->exists('emailinvoiceonly') ) { + + <& /elements/tr-checkbox.html, + field => 'postal_invoice', + label => emt('Postal mail invoices'), + value => 'Y', + curr_value => $cust_main->postal_invoice, + box_first => 1, + &> + +% } + +% ### +% # email invoices +% ### + + <& /elements/tr-checkbox.html, + field => 'invoice_noemail', + label => emt('Do not send email invoices'), + value => 'Y', + curr_value => $cust_main->invoice_noemail, + box_first => 1, + &> + + <& /elements/tr-checkbox.html, + field => 'message_noemail', + label => emt('Do not send other email notices'), + value => 'Y', + curr_value => $cust_main->message_noemail, + box_first => 1, + &> + +% ### +% # prorate_day +% ### + +% if ( $conf->exists('cust_main-select-prorate_day') ) { - + - - + - - + +% ### +% # credit_limit +% ### + - - + -% if ( $conf->exists('voip-cust_cdr_spools') ) { +% ### +% # CDR flags / options +% ### + +% if ( $conf->exists('voip-cust_cdr_squelch') ) { - + % } else { + +% } - -% } +% if ( my $attach = $conf->config('voip-cdr_email_attach') ) { + + + +% } else { + +% } + +% if ( $conf->exists('voip-cust_accountcode_cdr') ) { + + + +% } else { + +% } +% if ( $show_term || $cust_main->cdr_termination_percentage ) { + + + +% } else { + +% } + +% ### +% # Invoicing currency +% ### + +%my @currencies = $conf->config('currencies'); +%if ( scalar(@currencies) ) { +% unshift @currencies, ''; #default +% my %currency_labels = map { $_ => "$_: ". code2currency($_) } @currencies; +% $currency_labels{''} = +% 'Default: '. code2currency( $conf->config('currency') || 'USD' ); + + <& /elements/tr-select.html, + 'label' => emt('Invoicing currency'), + 'field' => 'currency', + 'options' => \@currencies, + 'labels' => \%currency_labels, + 'curr_value' => $cust_main->currency, + &> +% } + +% ### +% # Invoicing locale +% ### + +%my @available_locales = $conf->config('available-locales'); +%if ( scalar(@available_locales) ) { +% push @available_locales, '' +% unless $cust_main->locale && $conf->exists('cust_main-require_locale'); +% my %locale_labels = map { +% my %ll; +% my %info = FS::Locales->locale_info($_); +% $ll{$_} = $info{name} . " (" . $info{country} . ")"; +% %ll; +% } FS::Locales->locales; +% +% my $label = ( $conf->exists('cust_main-require_locale') ? $r : '' ). +% emt('Invoicing locale'); + + <& /elements/tr-select.html, + 'label' => $label, + 'field' => 'locale', + 'options' => \@available_locales, + 'labels' => \%locale_labels, + 'curr_value' => $cust_main->locale, + &> +% }
   onChange="tax_changed(this)"> Tax Exempt (<% $exempt_group %> taxes) - Exemption number exempt_number : '' ) |h %>" <% $checked ? '' : 'DISABLED' %>>
tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% mt('Prorate day') |h %> + + + <& /elements/checkbox.html, + field => 'force_prorate_day', + value => 'Y', + curr_value => $cust_main->force_prorate_day + &> + +
+% } - %>> Postal mail invoice +% ### +% # billday +% ### +
<% mt('Charge card/e-check on this day of the month') |h %> + +
> Fax invoice +% ### +% # invoice_terms +% ### +
<% mt('Invoice terms') |h %> + + <& /elements/select-terms.html, + 'curr_value' => $cust_main->invoice_terms, + 'agentnum' => $cust_main->agentnum, + &>
Email invoice <% mt('Credit limit') |h %> + + + credit_limit) ? '' : ' DISABLED' %> + > +% my $default_credit_limit = $conf->config('default_credit_limit'); + credit_limit) ? '' : ' CHECKED'%> + > + <% $default_credit_limit + ? "Default ($money_char". sprintf("%.2f", $default_credit_limit). + ")" + : mt('Unlimited') + |h + %> + +
spool_cdr eq "Y" ? 'CHECKED' : '' %>> Spool CDRssquelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt($conf->exists('voip-cdr_email') ? 'Omit CDRs from printed invoices' : 'Omit CDRs from invoices') |h %>
email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Attach CDRs as '. uc($attach). ' to emailed invoices') |h %>
+ accountcode_cdr eq "Y" ? 'CHECKED' : '' %> + > <% mt('Breakdown CDRs by accountcode') |h %>
<% mt('CDR termination settlement') |h %> + %
+
+ + <% mt('Payment information') |h %> + <& cust_payby.html, 'cust_main'=>$cust_main, &> + +<%init> + +my( $cust_main, %options ) = @_; +my @invoicing_list = @{ $options{'invoicing_list'} }; +my $conf = new FS::Conf; -
+my $money_char = $conf->config('money_char') || '$'; - <% $r %> required fields -% } +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]; +} +my $agentnum = $cust_main->agentnum if $cust_main->custnum; +