1 % my $r = qq!<font color="#ff0000">*</font> !;
5 function tax_changed(what) {
6 var num = document.getElementById(what.id + '_num');
16 <BR><FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT>
18 <TABLE CLASS="fsinnerbox">
20 % my $curuser = $FS::CurrentUser::CurrentUser;
26 % if ( $curuser->access_right('Complimentary customer') ) {
29 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="complimentary" VALUE="Y" <% $cust_main->complimentary eq "Y" ? 'CHECKED' : '' %>>Complimentary customer
34 <INPUT TYPE="hidden" NAME="complimentary" VALUE="<% $cust_main->complimentary eq 'Y' ? 'Y' : '' %>">
42 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
43 % if ( $conf->exists('cust_class-tax_exempt')
44 % || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
45 % || $conf->config('tax-cust_exempt-groups-num_req') =~ /\w/
46 % || ! $curuser->access_right('Edit customer tax exemptions')
50 <INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax eq 'Y' ? 'Y' : '' %>">
55 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD>
60 % if ( $curuser->access_right('Edit customer tax exemptions') ) {
61 % foreach my $exempt_group ( @exempt_groups ) {
62 % my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
63 % #escape $exempt_group for NAME etc.
64 % my $checked = ($cust_main_exemption || $cgi->param("tax_$exempt_group"));
66 <TD STYLE="white-space:nowrap"> <INPUT TYPE="checkbox" NAME="tax_<% $exempt_group %>" ID="tax_<% $exempt_group %>" VALUE="Y" <% $checked ? 'CHECKED' : '' %> onChange="tax_changed(this)"> Tax Exempt (<% $exempt_group %> taxes)</TD>
67 <TD> - Exemption number <INPUT TYPE="text" NAME="tax_<% $exempt_group %>_num" ID="tax_<% $exempt_group %>_num" VALUE="<% $cgi->param("tax_$exempt_group".'_num') || ( $cust_main_exemption ? $cust_main_exemption->exempt_number : '' ) |h %>" <% $checked ? '' : 'DISABLED' %>></TD>
76 % unless ( $conf->exists('emailinvoiceonly') ) {
79 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%
81 ( grep { $_ eq 'POST' } @invoicing_list )
86 %>> <% mt('Postal mail invoices') |h %>
98 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoice_email" VALUE="Y" <%
100 ( $cust_main->invoice_noemail eq 'Y' )
104 %>> <% mt('Email invoices') |h %>
109 % unless ( $conf->exists('cust-email-high-visibility')) {
111 <TH ALIGN="right" WIDTH="200">
112 <% $conf->exists('cust_main-require_invoicing_list_email', $agentnum)
113 ? $r : '' %>Email address(es)
115 <TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
116 <INPUT TYPE="checkbox" NAME="message_noemail" VALUE="Y" <%
117 ( $cust_main->message_noemail eq 'Y' )
120 %>> <FONT SIZE="-1"><% emt('Do not send notices') %></FONT>
129 % if ( $conf->exists('cust_main-select-prorate_day') ) {
131 <TH ALIGN="right" WIDTH="200"><% mt('Prorate day (1-28)') |h %> </TD>
133 <INPUT TYPE="text" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>" SIZE=3 MAXLENGTH=2>
137 <INPUT TYPE="hidden" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>">
145 <TH ALIGN="right" WIDTH="200"><% mt('Charge card/e-check on this day of the month') |h %> </TD>
147 <SELECT NAME="billday">
148 <% billday_options($cust_main->billday) %>
153 % sub billday_options {
154 % my $curr_value = shift;
156 % for my $billday ( 1 .. 28 ) {
158 % $sel = "SELECTED='SELECTED'" if $curr_value == $billday;
159 % $ret .= "<OPTION VALUE='$billday' $sel>$billday</OPTION>";
169 <TH ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
171 <& /elements/select-terms.html,
172 'curr_value' => $cust_main->invoice_terms,
173 'agentnum' => $cust_main->agentnum,
183 <TH ALIGN="right" WIDTH="200"><% mt('Credit limit') |h %> </TD>
185 <SCRIPT TYPE="text/javascript">
186 function toggle(obj) {
187 obj.form.credit_limit.disabled = obj.checked;
191 NAME = "credit_limit"
192 VALUE = "<% sprintf('%.2f', $cust_main->credit_limit) %>"
193 <% length($cust_main->credit_limit) ? '' : ' DISABLED' %>
195 % my $default_credit_limit = $conf->config('default_credit_limit');
196 <INPUT TYPE = "checkbox"
197 NAME = "no_credit_limit"
199 onClick="toggle(this)"
200 <% length($cust_main->credit_limit) ? '' : ' CHECKED'%>
201 > <FONT SIZE="-1" COLOR="#333333">
202 <% $default_credit_limit
203 ? "Default ($money_char". sprintf("%.2f", $default_credit_limit).
213 % # CDR flags / options
216 % if ( $conf->exists('voip-cust_cdr_spools') ) {
218 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="spool_cdr" VALUE="Y" <% $cust_main->spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %></TD>
221 <INPUT TYPE="hidden" NAME="spool_cdr" VALUE="<% $cust_main->spool_cdr %>">
224 % if ( $conf->exists('voip-cust_cdr_squelch') ) {
226 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="squelch_cdr" VALUE="Y" <% $cust_main->squelch_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt($conf->exists('voip-cdr_email') ? 'Omit CDRs from printed invoices' : 'Omit CDRs from invoices') |h %></TD>
229 <INPUT TYPE="hidden" NAME="squelch_cdr" VALUE="<% $cust_main->squelch_cdr %>">
232 % if ( $conf->exists('voip-cust_email_csv_cdr') ) {
234 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="email_csv_cdr" VALUE="Y" <% $cust_main->email_csv_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Attach CDRs as CSV to emailed invoices') |h %></TD>
237 <INPUT TYPE="hidden" NAME="email_csv_cdr" VALUE="<% $cust_main->email_csv_cdr %>">
240 % if ( $conf->exists('voip-cust_accountcode_cdr') ) {
243 <INPUT TYPE="checkbox"
244 NAME="accountcode_cdr"
246 <% $cust_main->accountcode_cdr eq "Y" ? 'CHECKED' : '' %>
247 > <% mt('Breakdown CDRs by accountcode') |h %></TD>
250 <INPUT TYPE="hidden" NAME="accountcode_cdr" VALUE="<% $cust_main->accountcode_cdr %>">
253 % if ( $show_term || $cust_main->cdr_termination_percentage ) {
255 <TH ALIGN="right"><% mt('CDR termination settlement') |h %></TD>
256 <TD><INPUT TYPE = "text"
257 NAME = "cdr_termination_percentage"
259 VALUE = "<% $cust_main->cdr_termination_percentage %>"
260 STYLE = "text-align:right;"
264 <INPUT TYPE="hidden" NAME="cdr_termination_percentage" VALUE="<% $cust_main->cdr_termination_percentage %>">
268 % # Invoicing currency
271 %my @currencies = $conf->config('currencies');
272 %if ( scalar(@currencies) ) {
273 % unshift @currencies, ''; #default
274 % my %currency_labels = map { $_ => "$_: ". code2currency($_) } @currencies;
275 % $currency_labels{''} =
276 % 'Default: '. code2currency( $conf->config('currency') || 'USD' );
278 <& /elements/tr-select.html,
279 'label' => emt('Invoicing currency'),
280 'field' => 'currency',
281 'options' => \@currencies,
282 'labels' => \%currency_labels,
283 'curr_value' => $cust_main->currency,
291 %my @available_locales = $conf->config('available-locales');
292 %if ( scalar(@available_locales) ) {
293 % push @available_locales, ''
294 % unless $cust_main->locale && $conf->exists('cust_main-require_locale');
295 % my %locale_labels = map {
297 % my %info = FS::Locales->locale_info($_);
298 % $ll{$_} = $info{name} . " (" . $info{country} . ")";
300 % } FS::Locales->locales;
302 % my $label = ( $conf->exists('cust_main-require_locale') ? $r : '' ).
303 % emt('Invoicing locale');
305 <& /elements/tr-select.html,
308 'options' => \@available_locales,
309 'labels' => \%locale_labels,
310 'curr_value' => $cust_main->locale,
317 <FONT CLASS="fsinnerbox-title"><% mt('Payment information') |h %></FONT>
318 <& cust_payby.html, 'cust_main'=>$cust_main, &>
322 my( $cust_main, %options ) = @_;
323 my @invoicing_list = @{ $options{'invoicing_list'} };
324 my $payinfo = $options{'payinfo'};
325 my $conf = new FS::Conf;
327 my $money_char = $conf->config('money_char') || '$';
330 if ( $cust_main->custnum ) {
331 #false laziness w/view/cust_main/billing.html
332 my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
333 my $term_sth = dbh->prepare($term_sql) or die dbh->errstr;
334 $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
335 $show_term = $term_sth->fetchrow_arrayref->[0];
338 my $agentnum = $cust_main->agentnum if $cust_main->custnum;