X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main%2Fbilling.html;h=618e1913a95bfc7dbfc4fabaa799a9b29f2adcb6;hb=2009d9cee8038aeff5b4313113fc23f546455cf5;hp=294104b09269e77d2fbd7268b1afc01c98fbb985;hpb=62b12e8b09608b7081ffd596be899fafb5c2403f;p=freeside.git
diff --git a/httemplate/edit/cust_main/billing.html b/httemplate/edit/cust_main/billing.html
index 294104b09..618e1913a 100644
--- a/httemplate/edit/cust_main/billing.html
+++ b/httemplate/edit/cust_main/billing.html
@@ -1,516 +1,255 @@
-%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 )) {
-
-
-
-% }
-
-% #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!* !;
-
<% mt('Billing information') |h %>
- <% &ntable("#cccccc") %>
-
-
+
+% 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,
&>
- <% &ntable("#cccccc") %>
+% } 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,
+ &>
-
- 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) |
- |
+% 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' %>> |
+
+% } #"
% }
-% unless ( $conf->exists('emailinvoiceonly') ) {
+% ###
+% # postal invoices
+% ###
-
- exists('emailinvoiceonly') ) {
- ( grep { $_ eq 'POST' } @invoicing_list )
+ <& /elements/tr-checkbox.html,
+ field => 'postal_invoice',
+ label => emt('Postal mail invoices'),
+ value => 'Y',
+ curr_value => $cust_main->postal_invoice,
+ box_first => 1,
+ &>
- ? 'CHECKED'
- : ''
+% }
- %>> <% mt('Postal mail invoice') |h %>
+% ###
+% # 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,
+ &>
-
- config_bool('allow_payment_receipt_noemail', $cust_main->agentnum) ) {
+ <& /elements/tr-checkbox.html,
+ field => 'paymentreceipt_noemail',
+ label => emt('Do not send email payment receipts'),
+ value => 'Y',
+ curr_value => $cust_main->paymentreceipt_noemail,
+ box_first => 1,
+ &>
+% }
- ( grep { $_ eq 'FAX' } @invoicing_list )
- ? 'CHECKED'
- : ''
+ <& /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,
+ &>
- %>> <% mt('Fax invoice') |h %>
+% ###
+% # prorate_day
+% ###
+% if ( $conf->exists('cust_main-select-prorate_day') ) {
+ |
+ <% mt('Prorate day') |h %>
+ |
+
+ <& /elements/checkbox.html,
+ field => 'force_prorate_day',
+ value => 'Y',
+ curr_value => $cust_main->force_prorate_day
+ &>
+
|
+% sub prorate_day_options {
+% my $curr_value = shift;
+% my $ret = '';
+% for my $prorate_day ( 1 .. 28 ) {
+% my $sel = '';
+% $sel = "SELECTED='SELECTED'" if $curr_value == $prorate_day;
+% $ret .= "";
+% }
+% $ret;
+% }
+
+% } else {
+
% }
-% unless ( $conf->exists('cust-email-high-visibility')) {
+% ###
+% # billday
+% ###
+
-
- <% $conf->exists('cust_main-require_invoicing_list_email') ? $r : '' %>Email address(es)
+ | <% 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
+% ###
- <% mt('Invoice terms') |h %> |
+ <% mt('Invoice terms') |h %>
|
- <& /elements/select-terms.html,
- 'curr_value' => $cust_main->invoice_terms,
- &>
+% if ( $curuser->access_right('Edit customer invoice terms') ) {
+ <& /elements/select-terms.html,
+ 'curr_value' => $cust_main->invoice_terms,
+ 'agentnum' => $cust_main->agentnum,
+ &>
+% } else {
+%
+% my $terms =
+% $cust_main->invoice_terms
+% || emt('Default').' ('.
+% ( $conf->config('invoice_default_terms', $cust_main->agentnum)
+% || emt('Payable upon receipt')
+% ).
+% ')';
+ <% $terms |h %>
+
+ <& /elements/hidden.html,
+ 'field' => 'invoice_terms',
+ 'curr_value' => $cust_main->invoice_terms,
+ &>
+% }
|
+% ###
+% # credit_limit
+% ###
+
- <% mt('Credit limit') |h %> |
+ <% mt('Credit limit') |h %>
|
- credit_limit) %><% length($cust_main->credit_limit) ? '' : ' DISABLED' %>>
- credit_limit) ? '' : ' CHECKED'%>> <% mt('Unlimited') |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
+ %>
+
|
-% if ( $conf->exists('voip-cust_cdr_spools') ) {
-
- spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %> |
-
-% } else {
-
-% }
+% ###
+% # CDR flags / options
+% ###
% if ( $conf->exists('voip-cust_cdr_squelch') ) {
@@ -520,9 +259,9 @@ function toggle(obj) {
% }
-% if ( $conf->exists('voip-cust_email_csv_cdr') ) {
+% if ( my $attach = $conf->config('voip-cdr_email_attach') ) {
- email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Attach CDRs as CSV to emailed invoices') |h %> |
+ email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Attach CDRs as '. uc($attach). ' to emailed invoices') |h %> |
% } else {
@@ -543,7 +282,7 @@ function toggle(obj) {
% if ( $show_term || $cust_main->cdr_termination_percentage ) {
- <% mt('CDR termination settlement') |h %> |
+ <% 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,
+ &>
+% }
+
+% ###
+% # Invoicing locale
+% ###
+
%my @available_locales = $conf->config('available-locales');
%if ( scalar(@available_locales) ) {
-% push @available_locales, '';
-% my %locale_labels = map {
-% my %ll;
-% my %info = FS::Locales->locale_info($_);
-% $ll{$_} = $info{name} . " (" . $info{country} . ")";
-% %ll;
-% } FS::Locales->locales;
- <& /elements/tr-select.html,
- 'label' => emt('Invoicing locale'),
- 'field' => 'locale',
- 'options' => \@available_locales,
- 'labels' => \%locale_labels,
- 'curr_value' => $cust_main->locale,
- &>
+% 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,
+ &>
% }
|
+