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 <% &ntable("#cccccc") %>
20 % my $curuser = $FS::CurrentUser::CurrentUser;
21 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
22 % if ( $conf->exists('cust_class-tax_exempt')
23 % || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
24 % || $conf->config('tax-cust_exempt-groups-num_req') =~ /\w/
25 % || ! $curuser->access_right('Edit customer tax exemptions')
29 <INPUT TYPE="hidden" NAME="tax" VALUE="<% $cust_main->tax eq 'Y' ? 'Y' : '' %>">
34 <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="tax" VALUE="Y" <% $cust_main->tax eq "Y" ? 'CHECKED' : '' %>> Tax Exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD>
39 % if ( $curuser->access_right('Edit customer tax exemptions') ) {
40 % foreach my $exempt_group ( @exempt_groups ) {
41 % my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
42 % #escape $exempt_group for NAME etc.
43 % my $checked = ($cust_main_exemption || $cgi->param("tax_$exempt_group"));
45 <TD> <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>
46 <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>
51 % unless ( $conf->exists('emailinvoiceonly') ) {
54 <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoicing_list_POST" VALUE="POST" <%
56 ( grep { $_ eq 'POST' } @invoicing_list )
61 %>> <% mt('Postal mail invoices') |h %>
69 <TD WIDTH="608" COLSPAN="2"><INPUT TYPE="checkbox" NAME="invoice_email" VALUE="Y" <%
71 ( $cust_main->invoice_noemail eq 'Y' )
75 %>> <% mt('Email invoices') |h %>
80 % unless ( $conf->exists('cust-email-high-visibility')) {
82 <TD ALIGN="right" WIDTH="200">
83 <% $conf->exists('cust_main-require_invoicing_list_email', $agentnum)
84 ? $r : '' %>Email address(es)
86 <TD WIDTH="408"><INPUT TYPE="text" NAME="invoicing_list" VALUE="<% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) %>">
87 <INPUT TYPE="checkbox" NAME="message_noemail" VALUE="Y" <%
88 ( $cust_main->message_noemail eq 'Y' )
91 %>> <% emt('Do not send notices') %>
96 % if ( $conf->exists('cust_main-select-prorate_day') ) {
98 <TD ALIGN="right" WIDTH="200"><% mt('Prorate day (1-28)') |h %> </TD>
100 <INPUT TYPE="text" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>" SIZE=3 MAXLENGTH=2>
104 <INPUT TYPE="hidden" NAME="prorate_day" VALUE="<% $cust_main->prorate_day %>">
108 <TD ALIGN="right" WIDTH="200"><% mt('Charge card/e-check on this day of the month') |h %> </TD>
110 <SELECT NAME="billday">
111 <% billday_options($cust_main->billday) %>
116 % sub billday_options {
117 % my $curr_value = shift;
119 % for my $billday ( 1 .. 28 ) {
121 % $sel = "SELECTED='SELECTED'" if $curr_value == $billday;
122 % $ret .= "<OPTION VALUE='$billday' $sel>$billday</OPTION>";
128 <TD ALIGN="right" WIDTH="200"><% mt('Invoice terms') |h %> </TD>
130 <& /elements/select-terms.html,
131 'curr_value' => $cust_main->invoice_terms,
132 'agentnum' => $cust_main->agentnum,
138 <TD ALIGN="right" WIDTH="200"><% mt('Credit limit') |h %> </TD>
140 <SCRIPT TYPE="text/javascript">
141 function toggle(obj) {
142 obj.form.credit_limit.disabled = obj.checked;
146 NAME = "credit_limit"
147 VALUE = "<% sprintf('%.2f', $cust_main->credit_limit) %>"
148 <% length($cust_main->credit_limit) ? '' : ' DISABLED' %>
150 % my $default_credit_limit = $conf->config('default_credit_limit');
151 <INPUT TYPE = "checkbox"
152 NAME = "no_credit_limit"
154 onClick="toggle(this)"
155 <% length($cust_main->credit_limit) ? '' : ' CHECKED'%>
156 > <% $default_credit_limit
157 ? "Default ($money_char". sprintf("%.2f", $default_credit_limit).
165 % if ( $conf->exists('voip-cust_cdr_spools') ) {
167 <TD COLSPAN="2"><INPUT TYPE="checkbox" NAME="spool_cdr" VALUE="Y" <% $cust_main->spool_cdr eq "Y" ? 'CHECKED' : '' %>> <% mt('Spool CDRs') |h %></TD>
170 <INPUT TYPE="hidden" NAME="spool_cdr" VALUE="<% $cust_main->spool_cdr %>">
173 % if ( $conf->exists('voip-cust_cdr_squelch') ) {
175 <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>
178 <INPUT TYPE="hidden" NAME="squelch_cdr" VALUE="<% $cust_main->squelch_cdr %>">
181 % if ( $conf->exists('voip-cust_email_csv_cdr') ) {
183 <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>
186 <INPUT TYPE="hidden" NAME="email_csv_cdr" VALUE="<% $cust_main->email_csv_cdr %>">
189 % if ( $conf->exists('voip-cust_accountcode_cdr') ) {
192 <INPUT TYPE="checkbox"
193 NAME="accountcode_cdr"
195 <% $cust_main->accountcode_cdr eq "Y" ? 'CHECKED' : '' %>
196 > <% mt('Breakdown CDRs by accountcode') |h %></TD>
199 <INPUT TYPE="hidden" NAME="accountcode_cdr" VALUE="<% $cust_main->accountcode_cdr %>">
202 % if ( $show_term || $cust_main->cdr_termination_percentage ) {
204 <TD ALIGN="right"><% mt('CDR termination settlement') |h %></TD>
205 <TD><INPUT TYPE = "text"
206 NAME = "cdr_termination_percentage"
208 VALUE = "<% $cust_main->cdr_termination_percentage %>"
209 STYLE = "text-align:right;"
213 <INPUT TYPE="hidden" NAME="cdr_termination_percentage" VALUE="<% $cust_main->cdr_termination_percentage %>">
216 %my @currencies = $conf->config('currencies');
217 %if ( scalar(@currencies) ) {
218 % unshift @currencies, ''; #default
219 % my %currency_labels = map { $_ => "$_: ". code2currency($_) } @currencies;
220 % $currency_labels{''} =
221 % 'Default: '. code2currency( $conf->config('currency') || 'USD' );
223 <& /elements/tr-select.html,
224 'label' => emt('Invoicing currency'),
225 'field' => 'currency',
226 'options' => \@currencies,
227 'labels' => \%currency_labels,
228 'curr_value' => $cust_main->currency,
233 %my @available_locales = $conf->config('available-locales');
234 %if ( scalar(@available_locales) ) {
235 % push @available_locales, ''
236 % unless $cust_main->locale && $conf->exists('cust_main-require_locale');
237 % my %locale_labels = map {
239 % my %info = FS::Locales->locale_info($_);
240 % $ll{$_} = $info{name} . " (" . $info{country} . ")";
242 % } FS::Locales->locales;
244 % my $label = ( $conf->exists('cust_main-require_locale') ? $r : '' ).
245 % emt('Invoicing locale');
247 <& /elements/tr-select.html,
250 'options' => \@available_locales,
251 'labels' => \%locale_labels,
252 'curr_value' => $cust_main->locale,
259 <FONT CLASS="fsinnerbox-title"><% mt('Payment information') |h %></FONT>
260 <& cust_payby.html, 'cust_main'=>$cust_main, &>
264 my( $cust_main, %options ) = @_;
265 my @invoicing_list = @{ $options{'invoicing_list'} };
266 my $payinfo = $options{'payinfo'};
267 my $conf = new FS::Conf;
269 my $money_char = $conf->config('money_char') || '$';
271 my @payby = grep /\w/, $conf->config('payby');
272 #@payby = (qw( CARD DCRD CHEK DCHK BILL CASH WEST COMP ))
273 @payby = (qw( CARD DCRD CHEK DCHK BILL CASH COMP ))
277 if ( $cust_main->custnum ) {
278 #false laziness w/view/cust_main/billing.html
279 my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
280 my $term_sth = dbh->prepare($term_sql) or die dbh->errstr;
281 $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
282 $show_term = $term_sth->fetchrow_arrayref->[0];
285 my $agentnum = $cust_main->agentnum if $cust_main->custnum;