X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbilling.html;h=7bca17b50dc984ab472aec4a98509d0045aae262;hb=8c8872f684ccfa43dae290877c2cf8aed8828a9f;hp=3f3d801763ef93b5f25966671ffd3f08e4a4a312;hpb=69678d308805f5ca4b171ea0c5ac1da957811aa0;p=freeside.git
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index 3f3d80176..7bca17b50 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -1,430 +1,226 @@
-%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 )) {
-
-
+% my $r = qq!* !;
-% }
+
-
-
+
<% mt('Billing information') |h %>
-
+
-
+% my $curuser = $FS::CurrentUser::CurrentUser;
-% } else {
-%
-% my $r = qq!* !;
+% ###
+% # complimentry flag
+% ###
-
Billing information
- <% &ntable("#cccccc") %>
+% if ( $curuser->access_right('Complimentary customer') ) {
-
- <%$r%>Billing type |
+ <& /elements/tr-checkbox.html,
+ field => 'complimentary',
+ label => emt('Complimentary customer'),
+ value => 'Y',
+ curr_value => $cust_main->complimentary,
+ box_first => 1,
+ &>
-
+% 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')
+% )
+% {
- <% 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' =>
-%
-% '',
-%
-% 'CHEK' =>
-%
-% '',
-%
-% 'LECB' =>
-%
-% '',
-%
-% 'BILL' =>
-%
-% '',
-%
-% 'COMP' =>
-%
-% '',
-%
-% 'CASH' =>
-%
-% '',
-%
-% 'WEST' =>
-%
-% '',
-%
-% 'MCRD' =>
-%
-% '',
-%
-% );
-%
-% #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');
+% } else {
-
- tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %> |
-
+ <& /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,
+ &>
-% 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') ) {
+% 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"));
+
+ onChange="tax_changed(this)"> Tax Exempt (<% $exempt_group %> taxes) |
+ - Exemption number exempt_number : '' ) |h %>" <% $checked ? '' : 'DISABLED' %>> |
+
+% } #"
+% }
-
- exists('emailinvoiceonly') ) {
- ? 'CHECKED'
- : ''
+ <& /elements/tr-checkbox.html,
+ field => 'postal_invoice',
+ label => emt('Postal mail invoices'),
+ value => 'Y',
+ curr_value => $cust_main->postal_invoice,
+ box_first => 1,
+ &>
- %>> Postal mail invoice
+% }
+% ###
+% # 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') ) {
+ |
+ <% mt('Prorate day') |h %>
+ |
+
|
-
-
+% }
- %>> Fax invoice
+% ###
+% # billday
+% ###
+ |
+ <% mt('Charge card/e-check on this day of the month') |h %>
+ |
+
|
-% }
+% 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;
+% }
+
+% ###
+% # invoice_terms
+% ###
-
- <% $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,
+ 'agentnum' => $cust_main->agentnum,
+ &>
|
- |
+% ###
+% # credit_limit
+% ###
+
- Invoice terms |
+ <% 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
+ %>
+
|
+% ###
+% # CDR flags / options
+% ###
+
% if ( $conf->exists('voip-cust_cdr_spools') ) {
- spool_cdr eq "Y" ? 'CHECKED' : '' %>> Spool CDRs |
+ spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %> |
% } else {
@@ -432,16 +228,36 @@
% if ( $conf->exists('voip-cust_cdr_squelch') ) {
- squelch_cdr eq "Y" ? 'CHECKED' : '' %>> Omit CDRs from invoices |
+ squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt($conf->exists('voip-cdr_email') ? 'Omit CDRs from printed invoices' : 'Omit CDRs from 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 ) {
- CDR termination settlement |
+ <% mt('CDR termination settlement') |h %>
|
% }
-
+% ###
+% # 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,
+ &>
+% }
- <% $r %> required fields
-% }
+% ###
+% # 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,
+ &>
+% }
-<%once>
+
+
-my $paystate_label = FS::Msgcat::_gettext('paystate');
-$paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
+ <% mt('Payment information') |h %>
+ <& cust_payby.html, 'cust_main'=>$cust_main, &>
-%once>
<%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;
+my $money_char = $conf->config('money_char') || '$';
my $show_term = '';
if ( $cust_main->custnum ) {
@@ -486,4 +340,6 @@ if ( $cust_main->custnum ) {
$show_term = $term_sth->fetchrow_arrayref->[0];
}
+my $agentnum = $cust_main->agentnum if $cust_main->custnum;
+
%init>
|