1 <FONT CLASS="fsinnerbox-title"><% mt('Billing information') |h %></FONT>
2 %# If we can't see the unencrypted card, then bill now is an exercise in
3 %# frustration (without some sort of job queue magic to send it to a secure
5 %if ( $FS::CurrentUser::CurrentUser->access_right('Bill customer now')
6 % && ! $cust_main->is_encrypted($cust_main->payinfo)
8 %# (<A HREF="<% $p %>misc/bill.cgi?<% $cust_main->custnum %>"><% mt('Bill now') |h %></A>)
9 <& /elements/bill.html,
10 custnum => $cust_main->custnum,
11 label => emt('Bill now'),
12 url => $p.'view/cust_main.cgi?'.$cust_main->custnum,
16 % my $yes = emt('yes');
19 <TABLE CLASS="fsinnerbox">
21 % if ( $cust_main->complimentary ) {
23 <TD ALIGN="right"><% mt('Complimentary') |h %></TD>
24 <TD BGCOLOR="#ffffff"><% $yes %></TD>
28 %( my $balance = $cust_main->balance )
29 % =~ s/^(\-?)(.*)$/<FONT SIZE=+1>$1<\/FONT>$money_char$2/;
32 <TD ALIGN="right"><% mt('Balance due') |h %></TD>
33 <TD BGCOLOR="#ffffff"><B><% $balance %></B></TD>
36 % if ( $conf->exists('cust_main-select-prorate_day') ) {
38 <TD ALIGN="right"><% mt('Prorate day of month') |h %></TD>
39 <TD BGCOLOR="#ffffff"><% $cust_main->prorate_day %>
44 % if ( $conf->exists('cust_main-select-billday')
45 % && qsearch({ 'table' => 'cust_payby',
46 % 'hashref' => { 'custnum' => $cust_main->custnum, },
47 % 'extra_sql' => "AND payby IN ( 'CARD', 'CHEK' )",
48 % 'order_by' => 'LIMIT 1',
53 <TD ALIGN="right"><% mt('Payment day of month') |h %></TD>
54 <TD BGCOLOR="#ffffff"><% $cust_main->billday %>
59 % if ( $cust_main->po_number ) {
61 <TD ALIGN="right"><% mt('Purchase Order #') |h %></TD>
62 <TD BGCOLOR="#ffffff"><% $cust_main->po_number %></TD>
66 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
68 % unless ( $conf->exists('cust_class-tax_exempt')
69 % || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
73 <TD ALIGN="right"><% mt('Tax exempt') |h %><% @exempt_groups ? ' ('.emt('all taxes').')' : '' %></TD>
74 <TD BGCOLOR="#ffffff"><% $cust_main->tax ? $yes : $no %></TD>
78 % foreach my $exempt_group ( @exempt_groups ) {
79 % my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
81 <TD ALIGN="right"><% mt('Tax exempt') |h %> (<% $exempt_group %> taxes)</TD>
82 <TD BGCOLOR="#ffffff"><% $cust_main_exemption ? $yes : $no %>
83 <% $cust_main_exemption ? $cust_main_exemption->exempt_number : '' |h %>
88 % if ( $conf->exists('enable_taxproducts') ) {
90 <TD ALIGN="right"><% mt('Tax location') |h %></TD>
91 % my $tax_location = $conf->exists('tax-ship_address')
92 % ? $cust_main->ship_location
93 % : $cust_main->bill_location;
94 <TD BGCOLOR="#ffffff"><% $tax_location->geocode('cch') %></TD>
98 <TD ALIGN="right"><% mt('Postal mail invoices') |h %></TD>
99 <TD BGCOLOR="#ffffff">
100 <% ( grep { $_ eq 'POST' } @invoicing_list )
101 ? $yes. ( $cust_main->invoice_attn
102 ? ', attn: '. $cust_main->invoice_attn
110 <TD ALIGN="right"><% mt('Email invoices') |h %></TD>
111 <TD BGCOLOR="#ffffff">
112 <% $cust_main->invoice_noemail ? $no : $yes %>
115 % unless ( $conf->exists('cust-email-high-visibility')) {
117 <TD ALIGN="right"><% mt('Email address(es)') |h %></TD>
118 <TD BGCOLOR="#ffffff">
119 <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || $no %>
120 % if ( $cust_main->message_noemail ) {
122 <SPAN STYLE="font-size: small"><% emt('(do not send notices)') %></SPAN>
128 <TD ALIGN="right"><% mt('Invoice terms') |h %></TD>
129 <TD BGCOLOR="#ffffff">
130 <% $cust_main->invoice_terms
131 || emt('Default').' ('. ( $conf->config('invoice_default_terms', $cust_main->agentnum)
132 || emt('Payable upon receipt')
139 <TD ALIGN="right"><% mt('Credit limit') |h %></TD>
140 <TD BGCOLOR="#ffffff">
141 % my $default_credit_limit = $conf->config('default_credit_limit');
142 <% length($cust_main->credit_limit)
143 ? $money_char. sprintf("%.2f", $cust_main->credit_limit)
144 : $default_credit_limit
145 ? "Default ($money_char". sprintf("%.2f", $default_credit_limit). ")"
148 % if ( $cust_main->num_cust_main_credit_limit ) {
149 <A HREF="<% $p %>search/cust_main_credit_limit.html?custnum=<% $cust_main->custnum %>">(incidents)</A>
154 % if ( $conf->exists('voip-cust_cdr_spools') ) {
156 <TD ALIGN="right"><% mt('Spool CDRs') |h %></TD>
157 <TD BGCOLOR="#ffffff"><% $cust_main->spool_cdr ? $yes : $no %></TD>
161 % if ( $conf->exists('voip-cust_cdr_squelch') ) {
163 <TD ALIGN="right"><% mt($conf->exists('voip-cdr_email') ? 'Print CDRs' : 'Show CDRs') |h %></TD>
164 <TD BGCOLOR="#ffffff"><% $cust_main->squelch_cdr ? $no : $yes %></TD>
168 % if ( $conf->exists('voip-cust_accountcode_cdr') ) {
170 <TD ALIGN="right"><% mt('Breakdown CDRs by accountcode') |h %></TD>
171 <TD BGCOLOR="#ffffff"><% $cust_main->accountcode_cdr ? $yes : $no %></TD>
175 % if ( $conf->exists('voip-cust_email_csv_cdr') ) {
177 <TD ALIGN="right"><% mt('Email CDRs as CSV') |h %></TD>
178 <TD BGCOLOR="#ffffff"><% $cust_main->email_csv_cdr ? $yes : $no %></TD>
182 % if ( $show_term || $cust_main->cdr_termination_percentage ) {
184 <TD ALIGN="right"><% mt('CDR termination settlement') |h %></TD>
185 <TD BGCOLOR="#ffffff"><% $cust_main->cdr_termination_percentage %><% $cust_main->cdr_termination_percentage =~ /\d/ ? '%' : '' %></TD>
189 % if ( $cust_main->currency ) {
191 <TD ALIGN="right"><% mt('Invoicing currency') |h %></TD>
192 <TD BGCOLOR="#ffffff"><% $cust_main->currency. ': '. code2currency($cust_main->currency) %></TD>
196 % if ( $cust_main->locale ) {
197 % my %locale_info = FS::Locales->locale_info($cust_main->locale);
199 <TD ALIGN="right"><% mt('Invoicing locale') |h %></TD>
200 <TD BGCOLOR="#ffffff"><% $locale_info{name} . " (" . $locale_info{country} .")" %></TD>
208 my( $cust_main ) = @_;
209 my @invoicing_list = $cust_main->invoicing_list;
210 my $conf = new FS::Conf;
211 my $money_char = $conf->config('money_char') || '$';
213 #false laziness w/edit/cust_main/billing.html
214 my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
215 my $term_sth = dbh->prepare($term_sql) or die dbh->errstr;
216 $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
217 my $show_term = $term_sth->fetchrow_arrayref->[0];