fix for uumlaut problem, RT#10359
[freeside.git] / httemplate / view / cust_main / billing.html
1 Billing information
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
4 %# machine, anyway)
5 %if (  $FS::CurrentUser::CurrentUser->access_right('Bill customer now')
6 %      && ! $cust_main->is_encrypted($cust_main->payinfo)
7 %   ) { 
8 %#  (<A HREF="<% $p %>misc/bill.cgi?<% $cust_main->custnum %>">Bill now</A>)
9   (<% include('/elements/bill.html',
10                 custnum   => $cust_main->custnum,
11                 label     => 'Bill now',
12                 url       => $p.'view/cust_main.cgi?'.$cust_main->custnum,
13   ) %>)
14 % } 
15
16 <% ntable("#cccccc") %><TR><TD><% ntable("#cccccc",2) %>
17
18 %( my $balance = $cust_main->balance )
19 %  =~ s/^(\-?)(.*)$/<FONT SIZE=+1>$1<\/FONT>$money_char$2/;
20
21 <TR>
22   <TD ALIGN="right">Balance due</TD>
23   <TD BGCOLOR="#ffffff"><B><% $balance %></B></TD>
24 </TR>
25
26 <TR>
27   <TD ALIGN="right">Billing&nbsp;type</TD>
28   <TD BGCOLOR="#ffffff">
29 % if ( $cust_main->payby eq 'CARD' || $cust_main->payby eq 'DCRD' ) { 
30
31
32     Credit&nbsp;card&nbsp;<% $cust_main->payby eq 'CARD' ? '(automatic)' : '(on-demand)' %>
33   </TD>
34 </TR>
35 <TR>
36   <TD ALIGN="right">Card number</TD>
37   <TD BGCOLOR="#ffffff"><% $cust_main->paymask %></TD>
38 </TR>
39 %
40 %#false laziness w/elements/select-month_year.html & edit/cust_main/billing.html
41 %my( $mon, $year );
42 %my $date = $cust_main->paydate || '12-2037';
43 %if ( $date  =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
44 %  ( $mon, $year ) = ( $2, $1 );
45 %} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
46 %  ( $mon, $year ) = ( $1, $3 );
47 %} else {
48 %  warn "unrecognized expiration date format: $date";
49 %  ( $mon, $year ) = ( '', '' );
50 %}
51 %
52
53 <TR>
54   <TD ALIGN="right">Expiration</TD>
55   <TD BGCOLOR="#ffffff"><% "$mon/$year" %></TD>
56 </TR>
57 % if ( $cust_main->paystart_month ) { 
58
59   <TR>
60     <TD ALIGN="right">Start date</TD>
61     <TD BGCOLOR="#ffffff"><% $cust_main->paystart_month. '/'. $cust_main->paystart_year %>
62   </TR>
63 % } elsif ( $cust_main->payissue ) { 
64
65   <TR>
66     <TD ALIGN="right">Issue #</TD>
67     <TD BGCOLOR="#ffffff"><% $cust_main->payissue %>
68   </TR>
69 % } 
70
71
72 <TR>
73   <TD ALIGN="right">Name on card</TD>
74   <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
75 </TR>
76 % } elsif ( $cust_main->payby eq 'CHEK' || $cust_main->payby eq 'DCHK') {
77 %     my( $account, $aba ) = split('@', $cust_main->paymask );
78
79
80     Electronic&nbsp;check&nbsp;<% $cust_main->payby eq 'CHEK' ? '(automatic)' : '(on-demand)' %>
81   </TD>
82 </TR>
83 <TR>
84   <TD ALIGN="right">ABA/Routing code</TD>
85   <TD BGCOLOR="#ffffff"><% $aba %></TD>
86 </TR>
87 <TR>
88   <TD ALIGN="right">Account number</TD>
89   <TD BGCOLOR="#ffffff"><% $account %></TD>
90 </TR>
91 <TR>
92   <TD ALIGN="right">Account type</TD>
93   <TD BGCOLOR="#ffffff"><% $cust_main->paytype %></TD>
94 </TR>
95 <TR>
96   <TD ALIGN="right">Bank name</TD>
97   <TD BGCOLOR="#ffffff"><% $cust_main->payname %></TD>
98 </TR>
99 % if ( $conf->exists('show_bankstate') ) {
100 <TR>
101   <TD ALIGN="right"><% $paystate_label %></TD>
102   <TD BGCOLOR="#ffffff"><% $cust_main->paystate || '&nbsp;&nbsp;&nbsp;' %></TD>
103 </TR>
104 % }
105 % } elsif ( $cust_main->payby eq 'LECB' ) {
106 %     $cust_main->payinfo =~ /^(\d{3})(\d{3})(\d{4})$/;
107 %     my $payinfo = "$1-$2-$3";
108 %
109
110
111     Phone&nbsp;bill&nbsp;billing
112   </TD>
113 </TR>
114 <TR>
115   <TD ALIGN="right">Phone number</TD>
116   <TD BGCOLOR="#ffffff"><% $payinfo %></TD>
117 </TR>
118 % } elsif ( $cust_main->payby eq 'BILL' ) { 
119
120
121     Billing
122   </TD>
123 </TR>
124 % if ( $cust_main->payinfo ) { 
125
126 <TR>
127   <TD ALIGN="right">P.O. </TD>
128   <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD>
129 </TR>
130 % } 
131
132
133 <TR>
134   <TD ALIGN="right">Attention</TD>
135   <TD BGCOLOR="#ffffff"><% $cust_main->payname |h %></TD>
136 </TR>
137 % } elsif ( $cust_main->payby eq 'COMP' ) { 
138
139
140     Complimentary
141   </TD>
142 </TR>
143 <TR>
144   <TD ALIGN="right">Authorized&nbsp;by</TD>
145   <TD BGCOLOR="#ffffff"><% $cust_main->payinfo %></TD>
146 </TR>
147 %
148 %#false laziness w/above etc.
149 %my( $mon, $year );
150 %my $date = $cust_main->paydate || '12-2037';
151 %if ( $date  =~ /^(\d{4})-(\d{1,2})-\d{1,2}$/ ) { #PostgreSQL date format
152 %  ( $mon, $year ) = ( $2, $1 );
153 %} elsif ( $date =~ /^(\d{1,2})-(\d{1,2}-)?(\d{4}$)/ ) {
154 %  ( $mon, $year ) = ( $1, $3 );
155 %} else {
156 %  warn "unrecognized expiration date format: $date";
157 %  ( $mon, $year ) = ( '', '' );
158 %}
159 %
160
161 <TR>
162   <TD ALIGN="right">Expiration</TD>
163   <TD BGCOLOR="#ffffff"><% "$mon/$year" %></TD>
164 </TR>
165 % } 
166
167 % my @exempt_groups = grep /\S/, $conf->config('tax-cust_exempt-groups');
168 <TR>
169   <TD ALIGN="right">Tax&nbsp;exempt<% @exempt_groups ? ' (all taxes)' : '' %></TD>
170   <TD BGCOLOR="#ffffff"><% $cust_main->tax ? 'yes' : 'no' %></TD>
171 </TR>
172 % foreach my $exempt_group ( @exempt_groups ) {
173 <TR>
174   <TD ALIGN="right">Tax&nbsp;exempt (<% $exempt_group %> taxes)</TD>
175   <TD BGCOLOR="#ffffff"><% $cust_main->tax_exemption($exempt_group) ? 'yes' : 'no' %></TD>
176 </TR>
177 % }
178
179 % if ( $conf->exists('enable_taxproducts') ) {
180 <TR>
181   <TD ALIGN="right">Tax&nbsp;location</TD>
182   <TD BGCOLOR="#ffffff"><% $cust_main->geocode('cch') %></TD>
183 </TR>
184 % }
185 <TR>
186   <TD ALIGN="right">Postal&nbsp;invoices</TD>
187   <TD BGCOLOR="#ffffff">
188     <% ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no' %>
189   </TD>
190 </TR>
191 <TR>
192   <TD ALIGN="right">FAX&nbsp;invoices</TD>
193   <TD BGCOLOR="#ffffff">
194     <% ( grep { $_ eq 'FAX' } @invoicing_list ) ? 'yes' : 'no' %>
195   </TD>
196 </TR>
197 <TR>
198   <TD ALIGN="right">Email&nbsp;invoices</TD>
199   <TD BGCOLOR="#ffffff">
200     <% join(', ', grep { $_ !~ /^(POST|FAX)$/ } @invoicing_list ) || 'no' %>
201   </TD>
202 </TR>
203 <TR>
204   <TD ALIGN="right">Invoice&nbsp;terms</TD>
205   <TD BGCOLOR="#ffffff">
206     <% $cust_main->invoice_terms || 'Default ('. ( $conf->config('invoice_default_terms') || 'Payable upon receipt' ). ')' %>
207   </TD>
208 </TR>
209 <TR>
210   <TD ALIGN="right">Credit&nbsp;limit</TD>
211   <TD BGCOLOR="#ffffff">
212     <% length($cust_main->credit_limit) ? 
213         $money_char.sprintf("%.2f", $cust_main->credit_limit) :
214         'Unlimited' %>
215   </TD>
216 </TR>
217
218 % if ( $conf->exists('voip-cust_cdr_spools') ) { 
219   <TR>
220     <TD ALIGN="right">Spool&nbsp;CDRs</TD>
221     <TD BGCOLOR="#ffffff"><% $cust_main->spool_cdr ? 'yes' : 'no' %></TD>
222   </TR>
223 % } 
224
225 % if ( $conf->exists('voip-cust_cdr_squelch') ) { 
226   <TR>
227     <TD ALIGN="right">Print&nbsp;CDRs</TD>
228     <TD BGCOLOR="#ffffff"><% $cust_main->squelch_cdr ? 'no' : 'yes' %></TD>
229   </TR>
230 % } 
231
232 % if ( $conf->exists('voip-cust_email_csv_cdr') ) { 
233   <TR>
234     <TD ALIGN="right">Email&nbsp;CDRs&nbsp;as&nbsp;CSV</TD>
235     <TD BGCOLOR="#ffffff"><% $cust_main->email_csv_cdr ? 'yes' : 'no' %></TD>
236   </TR>
237 % } 
238
239 % if ( $show_term || $cust_main->cdr_termination_percentage ) {
240   <TR>
241     <TD ALIGN="right">CDR termination settlement</TD>
242     <TD BGCOLOR="#ffffff"><% $cust_main->cdr_termination_percentage %><% $cust_main->cdr_termination_percentage =~ /\d/ ? '%' : '' %></TD>
243   </TR>
244 % }
245
246 </TABLE></TD></TR></TABLE>
247 <%once>
248
249 my $paystate_label = FS::Msgcat::_gettext('paystate');
250 $paystate_label = 'Bank state' if $paystate_label =~/^paystate$/;
251
252 </%once>
253 <%init>
254
255 my( $cust_main ) = @_;
256 my @invoicing_list = $cust_main->invoicing_list;
257 my $conf = new FS::Conf;
258 my $money_char = $conf->config('money_char') || '$';
259
260 #false laziness w/edit/cust_main/billing.html
261 my $term_sql = "SELECT COUNT(*) FROM cust_pkg LEFT JOIN part_pkg USING ( pkgpart ) WHERE custnum = ? AND plan = 'cdr_termination' LIMIT 1";
262 my $term_sth = dbh->prepare($term_sql)  or die dbh->errstr;
263 $term_sth->execute($cust_main->custnum) or die $term_sth->errstr;
264 my $show_term = $term_sth->fetchrow_arrayref->[0];
265
266 </%init>