1 <FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT>
2 % my $yes = emt('yes');
4 % my $allowed = emt('allowed');
5 % my $refused = emt('refused');
7 <TABLE CLASS="fsinnerbox">
9 % if ( $cust_main->complimentary ) {
11 <TH ALIGN="right"><% mt('Complimentary') |h %></TH>
16 %( my $balance = $cust_main->balance )
17 % =~ s/^(\-?)(.*)$/<FONT SIZE=+1>$1<\/FONT>$money_char$2/;
20 <TH ALIGN="right"><% mt('Balance due') |h %></TH>
21 <TD><B><% $balance %></B></TD>
24 % #54: just an arbitrary number i pulled out of my goober. ideally we'd like
25 % # to consider e.g. a histogram of num_ncancelled_packages for the entire
26 % # customer base, and compare it to a graph of the overhead for generating this
27 % # information. (and optimize it better, we could get it more from SQL)
28 % if ( $cust_main->num_ncancelled_pkgs < 54 ) {
29 % foreach my $freq_info ($cust_main->display_recurring) {
31 <TH ALIGN="right"><% emt( ucfirst($freq_info->{'freq_pretty'}). ' recurring' ) %></TH>
32 <TD><% $money_char. sprintf('%.2f', $freq_info->{'amount'}) %></TD>
37 % if ( $conf->exists('cust_main-select-prorate_day') ) {
39 <TH ALIGN="right"><% mt('Prorate day of month') |h %></TH>
40 <TD><% $cust_main->prorate_day %>
45 % if ( $conf->exists('cust_main-select-billday')
46 % && qsearch({ 'table' => 'cust_payby',
47 % 'hashref' => { 'custnum' => $cust_main->custnum, },
48 % 'extra_sql' => "AND payby IN ( 'CARD', 'CHEK' )",
49 % 'order_by' => 'LIMIT 1',
54 <TH ALIGN="right"><% mt('Payment day of month') |h %></TH>
55 <TD><% $cust_main->billday %>
60 % if ( $cust_main->po_number ) {
62 <TH ALIGN="right"><% mt('Purchase Order #') |h %></TH>
63 <TD><% $cust_main->po_number %></TD>
67 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
69 % unless ( $conf->exists('cust_class-tax_exempt')
70 % || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
74 <TH ALIGN="right"><% mt('Tax exempt') |h %><% @exempt_groups ? ' ('.emt('all taxes').')' : '' %></TH>
75 <TD><% $cust_main->tax ? $yes : $no %></TD>
79 % foreach my $exempt_group ( @exempt_groups ) {
80 % my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
82 <TH ALIGN="right"><% mt('Tax exempt') |h %> (<% $exempt_group %> taxes)</TH>
83 <TD><% $cust_main_exemption ? $yes : $no %>
84 <% $cust_main_exemption ? $cust_main_exemption->exempt_number : '' |h %>
89 % if ( $conf->config('tax_data_vendor') eq 'cch' ) {
91 <TH ALIGN="right"><% mt('Tax location') |h %></TH>
92 % my $tax_location = $conf->exists('tax-ship_address')
93 % ? $cust_main->ship_location
94 % : $cust_main->bill_location;
95 <TD><% $tax_location->geocode('cch') %></TD>
99 <TH ALIGN="right"><% mt('Postal mail invoices') |h %></TH>
100 % if ( $cust_main->postal_invoice ) {
101 <TD><% $yes . ( $cust_main->invoice_attn
102 ? ', attn: '. $cust_main->invoice_attn
106 % } elsif ( $cust_main->invoice_noemail
107 % or scalar(@invoicing_list) == 0 ) {
108 % # alert the user that this customer has no way to receive an invoice
109 <TD CLASS="error"><% $no %></TD>
116 <TH ALIGN="right"><% mt('Email invoices') |h %></TH>
117 % if ( $cust_main->invoice_noemail and ! $cust_main->postal_invoice ) {
118 % # as above, warn if the customer refuses both email and postal invoices
119 <TD CLASS="error"><% $refused %></TD>
121 <TD><% $cust_main->invoice_noemail ? $refused : $allowed %></TD>
125 <TH ALIGN="right"><% mt('Other email notices') |h %></TH>
127 <% $cust_main->message_noemail ? $refused : $allowed %>
131 <TH ALIGN="right"><% mt('Invoice terms') |h %></TH>
133 <% $cust_main->invoice_terms
134 || emt('Default').' ('. ( $conf->config('invoice_default_terms', $cust_main->agentnum)
135 || emt('Payable upon receipt')
142 <TH ALIGN="right"><% mt('Credit limit') |h %></TH>
144 % my $default_credit_limit = $conf->config('default_credit_limit');
145 <% length($cust_main->credit_limit)
146 ? $money_char. sprintf("%.2f", $cust_main->credit_limit)
147 : $default_credit_limit
148 ? "Default ($money_char". sprintf("%.2f", $default_credit_limit). ")"
151 % if ( $cust_main->num_cust_main_credit_limit ) {
152 <A HREF="<% $p %>search/cust_main_credit_limit.html?custnum=<% $cust_main->custnum %>">(incidents)</A>
157 % if ( $conf->exists('voip-cust_cdr_spools') ) {
159 <TH ALIGN="right"><% mt('Spool CDRs') |h %></TH>
160 <TD><% $cust_main->spool_cdr ? $yes : $no %></TD>
164 % if ( $conf->exists('voip-cust_cdr_squelch') ) {
166 <TH ALIGN="right"><% mt($conf->exists('voip-cdr_email') ? 'Print CDRs' : 'Show CDRs') |h %></TH>
167 <TD><% $cust_main->squelch_cdr ? $no : $yes %></TD>
171 % if ( $conf->exists('voip-cust_accountcode_cdr') ) {
173 <TH ALIGN="right"><% mt('Breakdown CDRs by accountcode') |h %></TH>
174 <TD><% $cust_main->accountcode_cdr ? $yes : $no %></TD>
178 % if ( my $attach = $conf->config('voip-cdr_email_attach') ) {
180 <TH ALIGN="right"><% mt('Email CDRs as '.uc($attach)) |h %></TH>
181 <TD><% $cust_main->email_csv_cdr ? $yes : $no %></TD>
185 % if ( $show_term || $cust_main->cdr_termination_percentage ) {
187 <TH ALIGN="right"><% mt('CDR termination settlement') |h %></TH>
188 <TD><% $cust_main->cdr_termination_percentage %><% $cust_main->cdr_termination_percentage =~ /\d/ ? '%' : '' %></TD>
192 % if ( $cust_main->currency ) {
194 <TH ALIGN="right"><% mt('Invoicing currency') |h %></TH>
195 <TD><% $cust_main->currency. ': '. code2currency($cust_main->currency) %></TD>
199 % if ( $cust_main->locale ) {
200 % my %locale_info = FS::Locales->locale_info($cust_main->locale);
202 <TH ALIGN="right"><% mt('Invoicing locale') |h %></TH>
203 <TD><% $locale_info{name} . " (" . $locale_info{country} .")" %></TD>
211 my( $cust_main ) = @_;
212 my @invoicing_list = $cust_main->invoicing_list_emailonly;
213 my $conf = new FS::Conf;
214 my $money_char = $conf->config('money_char') || '$';
216 #false laziness w/edit/cust_main/billing.html
217 my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
218 my $term_sth = dbh->prepare($term_sql) or die dbh->errstr;
219 $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
220 my $show_term = $term_sth->fetchrow_arrayref->[0];