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">Account type</TD>
87 <TD BGCOLOR="#ffffff"><% $cust_main->paytype %></TD>
90 <TD ALIGN="right">Bank name</TD>
91 <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
93 % if ( $conf->exists('show_bankstate') ) {
95 <TD ALIGN="right"><% $paystate_label %></TD>
96 <TD BGCOLOR="#ffffff"><% $cust_main->paystate || ' ' %></TD>
99 % } elsif ( $cust_main->payby eq 'LECB' ) {
100 % $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/;
101 % my $payinfo = "$1-$2-$3";
105 Phone bill billing
109 <TD ALIGN="right">Phone number</TD>
110 <TD BGCOLOR="#ffffff"><% $payinfo %></TD>
112 % } elsif ( $cust_main->payby eq 'BILL' ) {
118 % if ( $cust_main->payinfo ) {
121 <TD ALIGN="right">P.O. </TD>
122 <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD>
128 <TD ALIGN="right">Attention</TD>
129 <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
131 % } elsif ( $cust_main->payby eq 'COMP' ) {
138 <TD ALIGN="right">Authorized by</TD>
139 <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD>
142 %#false laziness w/above etc.
144 %my $date = $cust_main->paydate || '12-2037';
145 %if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
146 % ( $mon, $year ) = ( $2, $1 );
147 %} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
148 % ( $mon, $year ) = ( $1, $3 );
150 % warn "unrecognized expiration date format: $date";
151 % ( $mon, $year ) = ( '', '' );
156 <TD ALIGN="right">Expiration</TD>
157 <TD BGCOLOR="#ffffff"><% "$mon/$year" %></TD>
163 <TD ALIGN="right">Tax exempt</TD>
164 <TD BGCOLOR="#ffffff"><% $cust_main->tax ? 'yes' : 'no' %></TD>
167 <TD ALIGN="right">Postal invoices</TD>
168 <TD BGCOLOR="#ffffff">
169 <% ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %>
173 <TD ALIGN="right">FAX invoices</TD>
174 <TD BGCOLOR="#ffffff">
175 <% ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %>
179 <TD ALIGN="right">Email invoices</TD>
180 <TD BGCOLOR="#ffffff">
181 <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %>
185 <TD ALIGN="right">Invoice terms</TD>
186 <TD BGCOLOR="#ffffff">
187 <% $cust_main->invoice_terms || 'Default ('. ( $conf->config('invoice_default_terms') || 'Payable upon receipt' ). ')' %>
191 % if ( $conf->exists('voip-cust_cdr_spools') ) {
193 <TD ALIGN="right">Spool CDRs</TD>
194 <TD BGCOLOR="#ffffff"><% $cust_main->spool_cdr ? 'yes' : 'no' %></TD>
198 </TABLE></TD></TR></TABLE>
201 my $paystate_label = FS::Msgcat::_gettext('paystate');
202 $paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
206 my( $cust_main ) = @_;
207 my @invoicing_list = $cust_main->invoicing_list;
208 my $conf = new FS::Conf;
209 my $money_char = $conf->config('money_char') || '$';