3 my @invoicing_list = $cust_main->invoicing_list;
4 my $conf = new FS::Conf;
5 my $money_char = $conf->config('money_char') || '$';
9 (<A HREF="<%= $p %>misc/bill.cgi?<%= $cust_main->custnum %>">Bill now</A>)
10 <%= ntable("#cccccc") %><TR><TD><%= ntable("#cccccc",2) %>
13 ( my $balance = $cust_main->balance )
14 =~ s/^(\-?)(.*)$/<FONT SIZE=+1>$1<\/FONT>$money_char$2/;
18 <TD ALIGN="right">Balance due</TD>
19 <TD BGCOLOR="#ffffff"><B><%= $balance %></B></TD>
23 <TD ALIGN="right">Billing type</TD>
24 <TD BGCOLOR="#ffffff">
26 <% if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { %>
28 Credit card <%= $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' %>
32 <TD ALIGN="right">Card number</TD>
33 <TD BGCOLOR="#ffffff"><%= $cust_main->payinfo_masked %></TD>
37 #false laziness w/elements/select-month_year.html & edit/cust_main/billing.html
39 my $date = $cust_main->paydate || '12-2037';
40 if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
41 ( $mon, $year ) = ( $2, $1 );
42 } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
43 ( $mon, $year ) = ( $1, $3 );
45 warn "unrecognized expiration date format: $date";
46 ( $mon, $year ) = ( '', '' );
50 <TD ALIGN="right">Expiration</TD>
51 <TD BGCOLOR="#ffffff"><%= "$mon/$year" %></TD>
54 <% if ( $cust_main->paystart_month ) { %>
56 <TD ALIGN="right">Start date</TD>
57 <TD BGCOLOR="#ffffff"><%= $cust_main->paystart_month. '/'. $cust_main->paystart_year %>
59 <% } elsif ( $cust_main->payissue ) { %>
61 <TD ALIGN="right">Issue #</TD>
62 <TD BGCOLOR="#ffffff"><%= $cust_main->payissue %>
67 <TD ALIGN="right">Name on card</TD>
68 <TD BGCOLOR="#ffffff"><%= $cust_main->payname %></TD>
71 <% } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') {
72 my( $account, $aba ) = split('@', $cust_main->payinfo );
75 Electronic check <%= $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' %>
79 <TD ALIGN="right">ABA/Routing code</TD>
80 <TD BGCOLOR="#ffffff"><%= $aba %></TD>
83 <TD ALIGN="right">Account number</TD>
84 <TD BGCOLOR="#ffffff"><%= 'x'x(length($account)-2). substr($account,(length($account)-2)) %></TD>
87 <TD ALIGN="right">Bank name</TD>
88 <TD BGCOLOR="#ffffff"><%= $cust_main->payname %></TD>
91 <% } elsif ( $cust_main->payby eq 'LECB' ) {
92 $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/;
93 my $payinfo = "$1-$2-$3";
96 Phone bill billing
100 <TD ALIGN="right">Phone number</TD>
101 <TD BGCOLOR="#ffffff"><%= $payinfo %></TD>
104 <% } elsif ( $cust_main->payby eq 'BILL' ) { %>
110 <% if ( $cust_main->payinfo ) { %>
112 <TD ALIGN="right">P.O. </TD>
113 <TD BGCOLOR="#ffffff"><%= $cust_main->payinfo %></TD>
118 <TD ALIGN="right">Attention</TD>
119 <TD BGCOLOR="#ffffff"><%= $cust_main->payname %></TD>
122 <% } elsif ( $cust_main->payby eq 'COMP' ) { %>
128 <TD ALIGN="right">Authorized by</TD>
129 <TD BGCOLOR="#ffffff"><%= $cust_main->payinfo %></TD>
133 #false laziness w/above etc.
135 my $date = $cust_main->paydate || '12-2037';
136 if ( $date =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
137 ( $mon, $year ) = ( $2, $1 );
138 } elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
139 ( $mon, $year ) = ( $1, $3 );
141 warn "unrecognized expiration date format: $date";
142 ( $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' %>
174 <% if ( $conf->exists('voip-cust_cdr_spools') ) { %>
176 <TD ALIGN="right">Spool CDRs</TD>
177 <TD BGCOLOR="#ffffff"><%= $cust_main->spool_cdr ? 'yes' : 'no' %></TD>
181 </TABLE></TD></TR></TABLE>