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 <TABLE CLASS="fsinnerbox">
18 %( my $balance = $cust_main->balance )
19 % =~ s/^(\-?)(.*)$/<FONT SIZE=+1>$1<\/FONT>$money_char$2/;
22 <TD ALIGN="right"><% mt('Balance due') |h %></TD>
23 <TD BGCOLOR="#ffffff"><B><% $balance %></B></TD>
26 % if ( $conf->exists('cust_main-select-prorate_day') ) {
28 <TD ALIGN="right"><% mt('Prorate day of month') |h %></TD>
29 <TD BGCOLOR="#ffffff"><% $cust_main->prorate_day %>
34 % if ( $conf->exists('cust_main-select-billday')
35 % && qsearch({ 'table' => 'cust_payby',
36 % 'hashref' => { 'custnum' => $cust_main->custnum, },
37 % 'extra_sql' => "AND payby IN ( 'CARD', 'CHEK' )",
38 % 'order_by' => 'LIMIT 1',
43 <TD ALIGN="right"><% mt('Payment day of month') |h %></TD>
44 <TD BGCOLOR="#ffffff"><% $cust_main->billday %>
49 % if ( $cust_main->po_number ) {
51 <TD ALIGN="right"><% mt('Purchase Order #') |h %></TD>
52 <TD BGCOLOR="#ffffff"><% $cust_main->po_number %></TD>
56 % my $yes = emt('yes');
59 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
61 % unless ( $conf->exists('cust_class-tax_exempt')
62 % || $conf->exists('tax-cust_exempt-groups-require_individual_nums')
66 <TD ALIGN="right"><% mt('Tax exempt') |h %><% @exempt_groups ? ' ('.emt('all taxes').')' : '' %></TD>
67 <TD BGCOLOR="#ffffff"><% $cust_main->tax ? $yes : $no %></TD>
71 % foreach my $exempt_group ( @exempt_groups ) {
72 % my $cust_main_exemption = $cust_main->tax_exemption($exempt_group);
74 <TD ALIGN="right"><% mt('Tax exempt') |h %> (<% $exempt_group %> taxes)</TD>
75 <TD BGCOLOR="#ffffff"><% $cust_main_exemption ? $yes : $no %>
76 <% $cust_main_exemption ? $cust_main_exemption->exempt_number : '' |h %>
81 % if ( $conf->exists('enable_taxproducts') ) {
83 <TD ALIGN="right"><% mt('Tax location') |h %></TD>
84 % my $tax_location = $conf->exists('tax-ship_address')
85 % ? $cust_main->ship_location
86 % : $cust_main->bill_location;
87 <TD BGCOLOR="#ffffff"><% $tax_location->geocode('cch') %></TD>
91 <TD ALIGN="right"><% mt('Postal mail invoices') |h %></TD>
92 <TD BGCOLOR="#ffffff">
93 <% ( grep { $_ eq 'POST' } @invoicing_list )
94 ? $yes. ( $cust_main->invoice_attn
95 ? ', attn: '. $cust_main->invoice_attn
103 <TD ALIGN="right"><% mt('Email invoices') |h %></TD>
104 <TD BGCOLOR="#ffffff">
105 <% $cust_main->invoice_noemail ? $no : $yes %>
108 % unless ( $conf->exists('cust-email-high-visibility')) {
110 <TD ALIGN="right"><% mt('Email address(es)') |h %></TD>
111 <TD BGCOLOR="#ffffff">
112 <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || $no %>
113 % if ( $cust_main->message_noemail ) {
115 <SPAN STYLE="font-size: small"><% emt('(do not send notices)') %></SPAN>
121 <TD ALIGN="right"><% mt('Invoice terms') |h %></TD>
122 <TD BGCOLOR="#ffffff">
123 <% $cust_main->invoice_terms
124 || emt('Default').' ('. ( $conf->config('invoice_default_terms', $cust_main->agentnum)
125 || emt('Payable upon receipt')
132 <TD ALIGN="right"><% mt('Credit limit') |h %></TD>
133 <TD BGCOLOR="#ffffff">
134 % my $default_credit_limit = $conf->config('default_credit_limit');
135 <% length($cust_main->credit_limit)
136 ? $money_char. sprintf("%.2f", $cust_main->credit_limit)
137 : $default_credit_limit
138 ? "Default ($money_char". sprintf("%.2f", $default_credit_limit). ")"
141 % if ( $cust_main->num_cust_main_credit_limit ) {
142 <A HREF="<% $p %>search/cust_main_credit_limit.html?custnum=<% $cust_main->custnum %>">(incidents)</A>
147 % if ( $conf->exists('voip-cust_cdr_spools') ) {
149 <TD ALIGN="right"><% mt('Spool CDRs') |h %></TD>
150 <TD BGCOLOR="#ffffff"><% $cust_main->spool_cdr ? $yes : $no %></TD>
154 % if ( $conf->exists('voip-cust_cdr_squelch') ) {
156 <TD ALIGN="right"><% mt($conf->exists('voip-cdr_email') ? 'Print CDRs' : 'Show CDRs') |h %></TD>
157 <TD BGCOLOR="#ffffff"><% $cust_main->squelch_cdr ? $no : $yes %></TD>
161 % if ( $conf->exists('voip-cust_accountcode_cdr') ) {
163 <TD ALIGN="right"><% mt('Breakdown CDRs by accountcode') |h %></TD>
164 <TD BGCOLOR="#ffffff"><% $cust_main->accountcode_cdr ? $yes : $no %></TD>
168 % if ( $conf->exists('voip-cust_email_csv_cdr') ) {
170 <TD ALIGN="right"><% mt('Email CDRs as CSV') |h %></TD>
171 <TD BGCOLOR="#ffffff"><% $cust_main->email_csv_cdr ? $yes : $no %></TD>
175 % if ( $show_term || $cust_main->cdr_termination_percentage ) {
177 <TD ALIGN="right"><% mt('CDR termination settlement') |h %></TD>
178 <TD BGCOLOR="#ffffff"><% $cust_main->cdr_termination_percentage %><% $cust_main->cdr_termination_percentage =~ /\d/ ? '%' : '' %></TD>
182 % if ( $cust_main->currency ) {
184 <TD ALIGN="right"><% mt('Invoicing currency') |h %></TD>
185 <TD BGCOLOR="#ffffff"><% $cust_main->currency. ': '. code2currency($cust_main->currency) %></TD>
189 % if ( $cust_main->locale ) {
190 % my %locale_info = FS::Locales->locale_info($cust_main->locale);
192 <TD ALIGN="right"><% mt('Invoicing locale') |h %></TD>
193 <TD BGCOLOR="#ffffff"><% $locale_info{name} . " (" . $locale_info{country} .")" %></TD>
201 my( $cust_main ) = @_;
202 my @invoicing_list = $cust_main->invoicing_list;
203 my $conf = new FS::Conf;
204 my $money_char = $conf->config('money_char') || '$';
206 #false laziness w/edit/cust_main/billing.html
207 my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
208 my $term_sth = dbh->prepare($term_sql) or die dbh->errstr;
209 $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
210 my $show_term = $term_sth->fetchrow_arrayref->[0];