2 % # If we can't see the unencrypted card, then bill now is an exercise in frustration
3 %if ( ! $cust_main->is_encrypted($cust_main->payinfo) ) {
4 (<A HREF="<% $p %>misc/bill.cgi?<% $cust_main->custnum %>">Bill now</A>)
7 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
9 %( my $balance = $cust_main->balance )
10 % =~ s/^(\-?)(.*)$/<FONT SIZE=+1>$1<\/FONT>$money_char$2/;
15 <TD ALIGN="right">Balance due</TD>
16 <TD BGCOLOR="#ffffff"><B><% $balance %></B></TD>
20 <TD ALIGN="right">Billing type</TD>
21 <TD BGCOLOR="#ffffff">
22 % if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) {
25 Credit card <% $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' %>
29 <TD ALIGN="right">Card number</TD>
30 <TD BGCOLOR="#ffffff"><% $cust_main->paymask %></TD>
33 %#false laziness w/elements/select-month_year.html & edit/cust_main/billing.html
35 %my $date = $cust_main->paydate || '12-2037';
36 %if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
37 % ( $mon, $year ) = ( $2, $1 );
38 %} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
39 % ( $mon, $year ) = ( $1, $3 );
41 % warn "unrecognized expiration date format: $date";
42 % ( $mon, $year ) = ( '', '' );
47 <TD ALIGN="right">Expiration</TD>
48 <TD BGCOLOR="#ffffff"><% "$mon/$year" %></TD>
50 % if ( $cust_main->paystart_month ) {
53 <TD ALIGN="right">Start date</TD>
54 <TD BGCOLOR="#ffffff"><% $cust_main->paystart_month. '/'. $cust_main->paystart_year %>
56 % } elsif ( $cust_main->payissue ) {
59 <TD ALIGN="right">Issue #</TD>
60 <TD BGCOLOR="#ffffff"><% $cust_main->payissue %>
66 <TD ALIGN="right">Name on card</TD>
67 <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
69 % } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') {
70 % my( $account, $aba ) = split('@', $cust_main->payinfo );
74 Electronic check <% $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' %>
78 <TD ALIGN="right">ABA/Routing code</TD>
79 <TD BGCOLOR="#ffffff"><% $aba %></TD>
82 <TD ALIGN="right">Account number</TD>
83 <TD BGCOLOR="#ffffff"><% 'x'x(length($account)-2). substr($account,(length($account)-2)) %></TD>
86 <TD ALIGN="right">Bank name</TD>
87 <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
89 % } elsif ( $cust_main->payby eq 'LECB' ) {
90 % $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/;
91 % my $payinfo = "$1-$2-$3";
95 Phone bill billing
99 <TD ALIGN="right">Phone number</TD>
100 <TD BGCOLOR="#ffffff"><% $payinfo %></TD>
102 % } elsif ( $cust_main->payby eq 'BILL' ) {
108 % if ( $cust_main->payinfo ) {
111 <TD ALIGN="right">P.O. </TD>
112 <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD>
118 <TD ALIGN="right">Attention</TD>
119 <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
121 % } elsif ( $cust_main->payby eq 'COMP' ) {
128 <TD ALIGN="right">Authorized by</TD>
129 <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD>
132 %#false laziness w/above etc.
134 %my $date = $cust_main->paydate || '12-2037';
135 %if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
136 % ( $mon, $year ) = ( $2, $1 );
137 %} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
138 % ( $mon, $year ) = ( $1, $3 );
140 % warn "unrecognized expiration date format: $date";
141 % ( $mon, $year ) = ( '', '' );
146 <TD ALIGN="right">Expiration</TD>
147 <TD BGCOLOR="#ffffff"><% "$mon/$year" %></TD>
153 <TD ALIGN="right">Tax exempt</TD>
154 <TD BGCOLOR="#ffffff"><% $cust_main->tax ? 'yes' : 'no' %></TD>
157 <TD ALIGN="right">Postal invoices</TD>
158 <TD BGCOLOR="#ffffff">
159 <% ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %>
163 <TD ALIGN="right">FAX invoices</TD>
164 <TD BGCOLOR="#ffffff">
165 <% ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %>
169 <TD ALIGN="right">Email invoices</TD>
170 <TD BGCOLOR="#ffffff">
171 <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %>
175 <TD ALIGN="right">Invoice terms</TD>
176 <TD BGCOLOR="#ffffff">
177 <% $cust_main->invoice_terms || 'Default ('. ( $conf->config('invoice_default_terms') || 'Payable upon receipt' ). ')' %>
181 % if ( $conf->exists('voip-cust_cdr_spools') ) {
183 <TD ALIGN="right">Spool CDRs</TD>
184 <TD BGCOLOR="#ffffff"><% $cust_main->spool_cdr ? 'yes' : 'no' %></TD>
188 </TABLE></TD></TR></TABLE>
191 my( $cust_main ) = @_;
192 my @invoicing_list = $cust_main->invoicing_list;
193 my $conf = new FS::Conf;
194 my $money_char = $conf->config('money_char') || '$';