915be49e528c71233403f8d5c12bb45455b1fa76
[freeside.git] / httemplate / view / cust_main / payment_history.html
1 <TABLE>
2   <TR>
3     <TD ALIGN="left">
4
5 %# payment links
6
7 % my $s = 0;
8 % if ( $payby{'BILL'} && $curuser->access_right(['Post payment', 'Post check payment' ]) ) { 
9   <% $s++ ? ' | ' : '' %>
10   <& /elements/popup_link-cust_main.html,
11                'label'       => emt('Enter check payment'),
12                'action'      => "${p}edit/cust_pay.cgi?popup=1;payby=BILL",
13                'cust_main'   => $cust_main,
14                'actionlabel' => emt('Enter check payment'),
15                'width'       => 392,
16                'height'      => 392,
17   &>
18 % } 
19
20 % if ( $payby{'CASH'} && $curuser->access_right(['Post payment', 'Post cash payment']) ) { 
21   <% $s++ ? ' | ' : '' %>
22   <& /elements/popup_link-cust_main.html,
23                'label'       => emt('Enter cash payment'),
24                'action'      => "${p}edit/cust_pay.cgi?popup=1;payby=CASH",
25                'cust_main'   => $cust_main,
26                'actionlabel' => emt('Enter cash payment'),
27                'width'       => 392,
28                'height'      => 392,
29   &>
30 % } 
31
32 % if ( $payby{'WEST'} && $curuser->access_right('Post payment') ) { 
33   <% $s++ ? ' | ' : '' %>
34   <A HREF="<% $p %>edit/cust_pay.cgi?payby=WEST;custnum=<% $custnum %>"><% mt('Enter Western Union payment') |h %></A>
35 % } 
36
37 <% $s ? '<BR>' : '' %>
38 % $s=0;
39
40 % if ( ( $payby{'CARD'} || $payby{'DCRD'} )
41 %        && $curuser->access_right(['Process payment', 'Process credit card payment'])
42 %        && ! $cust_main->is_encrypted($cust_main->payinfo)
43 %      ) {
44   <% $s++ ? ' | ' : '' %>
45   <A HREF="<% $p %>misc/payment.cgi?payby=CARD;custnum=<% $custnum %>"><% mt('Process credit card payment') |h %></A>
46 % } 
47
48 % if ( ( $payby{'CHEK'} || $payby{'DCHK'} )
49 %        && $curuser->access_right(['Process payment', 'Process Echeck payment'])
50 %        && ! $cust_main->is_encrypted($cust_main->payinfo)
51 %      ) {
52   <% $s++ ? ' | ' : '' %>
53   <A HREF="<% $p %>misc/payment.cgi?payby=CHEK;custnum=<% $custnum %>"><% mt('Process electronic check (ACH) payment') |h %></A>
54 % } 
55
56 % if ( $payby{'MCRD'} && $curuser->access_right('Post payment') ) { 
57   <% $s++ ? ' | ' : '' %>
58   <A HREF="<% $p %>edit/cust_pay.cgi?payby=MCRD;custnum=<% $custnum %>"><% mt('Post manual (offline/POS) credit card payment') |h %></A>
59 % } 
60
61 <% $s ? '<BR>' : '' %>
62
63 %# credit links
64
65 % $s=0;
66 % if ( $curuser->access_right('Post credit') ) { 
67   <% $s++ ? ' | ' : '' %>
68   <& /elements/popup_link-cust_main.html,
69                'label'       => emt('Enter credit'),
70                'action'      => "${p}edit/cust_credit.cgi",
71                'cust_main'   => $cust_main,
72                'actionlabel' => emt('Enter credit'),
73                'width'       => 616, #make room for reasons #540 default
74   &>
75 % }
76 % if ( $curuser->access_right('Credit line items') ) { 
77   <% $s++ ? ' | ' : '' %>
78   <& /elements/popup_link-cust_main.html,
79                'label'       => emt('Credit line items'),
80                #'action'      => "${p}search/cust_bill_pkg.cgi?nottax=1;type=select",
81                'action'      => "${p}edit/credit-cust_bill_pkg.html",
82                'cust_main'   => $cust_main,
83                'actionlabel' => emt('Credit line items'),
84                'width'       => 968, #763,
85                'height'      => 575,
86   &>
87 % } 
88 <% $s ? '<BR>' : '' %>
89
90 %# refund links
91
92 % $s = 0;
93 % if ( $payby{'BILL'} && $curuser->access_right(['Post refund', 'Post check refund']) ) { 
94   <% $s++ ? ' | ' : '' %>
95   <& /elements/popup_link-cust_main.html,
96                'label'       => emt('Enter check refund'),
97                'action'      => "${p}edit/cust_refund.cgi?popup=1;payby=BILL",
98                'cust_main'   => $cust_main,
99                'actionlabel' => emt('Enter check refund'),
100                'width'       => 392,
101   &>
102 % } 
103
104 % if ( $payby{'CASH'} && $curuser->access_right(['Post refund', 'Post cash refund']) ) { 
105   <% $s++ ? ' | ' : '' %>
106   <& /elements/popup_link-cust_main.html,
107                'label'       => emt('Enter cash refund'),
108                'action'      => "${p}edit/cust_refund.cgi?popup=1;payby=CASH",
109                'cust_main'   => $cust_main,
110                'actionlabel' => emt('Enter cash refund'),
111                'width'       => 392,
112   &>
113 % } 
114
115 %# someday, perhaps.  very few gateways let you do unlinked refunds at all.
116 %# Authorize.net makes you sign a special form
117 %#
118 %#    % if ( ( $payby{'CARD'} || $payby{'DCRD'} )
119 %#    %        && $curuser->access_right('Process refund')
120 %#    %        && ! $cust_main->is_encrypted($cust_main->payinfo)
121 %#    %      ) {
122 %#      <% $s++ ? ' | ' : '' %>
123 %#      <A HREF="<% $p %>misc/refund.cgi?payby=CARD;custnum=<% $custnum %>">Process credit card refund</A>
124 %#    % } 
125 %#    
126 %#    % if ( ( $payby{'CHEK'} || $payby{'DCHK'} )
127 %#    %        && $curuser->access_right('Process refund')
128 %#    %        && ! $cust_main->is_encrypted($cust_main->payinfo)
129 %#    %      ) {
130 %#      <% $s++ ? ' | ' : '' %>
131 %#      <A HREF="<% $p %>misc/refund.cgi?payby=CHEK;custnum=<% $custnum %>">Process electronic check (ACH) refund</A>
132 %#    % } 
133
134 % if ( $payby{'MCRD'} && $curuser->access_right('Post refund') ) { 
135   <% $s++ ? ' | ' : '' %>
136   <A HREF="<% $p %>edit/cust_refund.cgi?payby=MCRD;custnum=<% $custnum %>"><% mt('Post manual (offline/POS) credit card refund') |h %></A>
137 % } 
138
139     </TD>
140     <TD ALIGN="right" VALIGN="top">
141
142 %# invoice reports, combined statement
143 % if ( $curuser->access_right('List invoices') ) { 
144 %   if ( $conf->exists('cust_main-print_statement_link')
145 %        and $num_cust_bill > 0 ) {
146   <A HREF="<% $p %>view/cust_main_statement-pdf.cgi?<% $custnum %>"><%
147   mt('Print a current statement') |h %></A>
148   <BR>
149 %   }
150   <A HREF="<% $p %>search/report_cust_bill.html?custnum=<% $custnum %>"><% mt('Invoice reports') |h %></A>
151 % } 
152 <BR>
153
154 %# XXX payments, credits, refund reports
155
156 %# tax exemption link
157
158 % my $view_exemptions = $curuser->access_right('View customer tax exemptions');
159 % my $add_adjustment = ( $conf->exists('enable_tax_adjustments')
160 %                       && $curuser->access_right('Add customer tax adjustment')
161 %                      );
162 % if ( $view_exemptions || $add_adjustment ) {
163
164 %   if ( $view_exemptions ) {
165       <A HREF="<% $p %>search/cust_tax_exempt_pkg.cgi?custnum=<% $custnum %>"><% mt('View tax exemptions') |h %></A>
166       <% $add_adjustment ? '|' : '' %>
167 %   } 
168
169 %   if ( $add_adjustment ) {
170       <& /elements/popup_link.html, {
171            'action' => $p.'edit/cust_tax_adjustment.html?custnum='. $cust_main->custnum,
172            'label'  => emt('Add tax adjustment'),
173            'actionlabel' => emt('Add tax adjustment'),
174            'height' => 200,
175          }
176       &>
177       |
178       <A HREF="<% $p %>search/cust_tax_adjustment.html?custnum=<% $custnum %>"><% mt('View tax adjustments') |h %></A>
179 %   } 
180
181   <BR>
182 % }
183
184 %# batched payment links
185
186 % if ( ( $conf->exists('batch-enable') || $conf->config('batch-enable_payby') )
187 %      && $curuser->access_right('View customer batched payments')
188 %    )
189 % { 
190     <% mt('View batched payments:') |h %> 
191 %   foreach my $status (qw( Queued In-transit Complete All )) {
192       <A HREF="<% $p %>search/cust_pay_batch.cgi?status=<% $status{$status} %>;custnum=<% $custnum %>"><% mt($status) |h %></A> 
193       <% $status ne 'All' ? '|' : '' %>
194 %   }
195     <BR>
196 % } 
197
198 %# pending payment links
199
200 % if ( $curuser->access_right('View customer pending payments')
201 %      && scalar($cust_main->cust_pay_pending)
202 %    )
203 % {
204     <A HREF="<% $p %>search/cust_pay_pending.html?magic=_date;statusNOT=done;custnum=<% $custnum %>"><% mt('View pending payments') |h %></A><BR>
205 % }
206
207     </TD>
208   </TR>
209   <TR>
210     <TD COLSPAN=2>
211
212 %# and now the table
213
214 <& /elements/table-grid.html &>
215 % my $bgcolor1 = '#eeeeee';
216 %   my $bgcolor2 = '#ffffff';
217 %   my $bgcolor = '';
218
219 <TR>
220   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Date') |h %></TH>
221   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Description') |h %></TH>
222   <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><% mt('Invoice') |h %></FONT></TH>
223   <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><% mt('Payment') |h %></FONT></TH>
224   <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><% mt('In-house Credit') |h %></FONT></TH>
225   <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><% mt('Refund') |h %></FONT></TH>
226   <TH CLASS="grid" BGCOLOR="#cccccc"><FONT SIZE=-1><% mt('Balance') |h %></FONT></TH>
227 </TR>
228
229 %#display payment history
230
231 %my %target = ();
232 %
233 %my $hidden = 0;
234 %my $seen = 0;
235 %my $old_history = 0;
236 %my $lastdate = 0;
237 %
238 %foreach my $item ( @history ) {
239 %
240 %  $lastdate = $item->{'date'};
241 %
242 %  my $display = '';
243 %  if ( $item->{'hide'} ) {
244 %    $display = ' STYLE="display:none" ';
245 %  }
246 %
247 %  if ( $bgcolor eq $bgcolor1 ) {
248 %    $bgcolor = $bgcolor2;
249 %  } else {
250 %    $bgcolor = $bgcolor1;
251 %  }
252 %
253 %  my $charge  = exists($item->{'charge'})
254 %                  ? sprintf("$money_char\%.2f", $item->{'charge'})
255 %                  : exists($item->{'charge_nobal'})
256 %                    ? sprintf("$money_char\%.2f", $item->{'charge_nobal'})
257 %                    : exists($item->{'void_charge'})
258 %                      ? sprintf("<DEL>$money_char\%.2f</DEL>", $item->{'void_charge'})
259 %                      : '';
260 %
261 %  my $payment = exists($item->{'payment'})
262 %                  ? sprintf("-&nbsp;$money_char\%.2f", $item->{'payment'})
263 %                  : '';
264 %
265 %  $payment ||= sprintf( "<DEL>-&nbsp;$money_char\%.2f</DEL>",
266 %                        $item->{'void_payment'}
267 %                      )
268 %    if exists($item->{'void_payment'});
269 %
270 %  my $credit  = exists($item->{'credit'})
271 %                  ? sprintf("-&nbsp;$money_char\%.2f", $item->{'credit'})
272 %                  : '';
273 %
274 %  my $refund  = exists($item->{'refund'})
275 %                  ? sprintf("$money_char\%.2f", $item->{'refund'})
276 %                  : '';
277 %
278 %  my $target = exists($item->{'target'}) ? $item->{'target'} : '';
279 %
280 %  my $showbalance = $money_char . $item->{'balance'};
281 %  $showbalance =~ s/^\$\-/-&nbsp;\$/;
282
283   <TR <% $display ? $display.' ID="old_history'.$old_history++.'"'  : ''%>>
284     <TD VALIGN="top" CLASS="grid" BGCOLOR="<% $bgcolor %>">
285 % unless ( !$target || $target{$target}++ ) { 
286
287         <A NAME="<% $target %>">
288 % } 
289
290       <% time2str($date_format, $item->{'date'}) %>
291 % if ( $target && $target{$target} == 1 ) { 
292
293         </A>
294 % } 
295
296       </FONT>
297     </TD>
298     <TD CLASS="grid" BGCOLOR="<% $bgcolor %>">
299       <% $item->{'desc'} %>
300     </TD>
301     <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
302       <% $charge  %>
303     </TD>
304     <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
305       <% $payment %>
306     </TD>
307     <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
308       <% $credit  %>
309     </TD>
310     <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
311       <% $refund  %>
312     </TD>
313     <TD VALIGN="top" ALIGN="right" CLASS="grid" BGCOLOR="<% $bgcolor %>">
314       <% $showbalance %>
315     </TD>
316   </TR>
317
318 % if ( $item->{'balance_forward'} ) {
319 <& .balance_forward_row, $item->{'balance'}, $item->{'date'} &>
320 % } 
321 %} # foreach $item
322
323 </TABLE>
324     </TD>
325   </TR>
326 </TABLE>
327
328 <SCRIPT TYPE="text/javascript">
329
330 function show_history () {
331   //alert('showing history!');
332
333   var balance_forward_row = document.getElementById('balance_forward_row');
334
335   balance_forward_row.style.display = 'none';
336   for ( var i = 0; i < <% $old_history %>; i++ ) {
337     var oldRow = document.getElementById('old_history'+i);
338     oldRow.style.display = '';
339   }
340
341 }
342
343 </SCRIPT>
344 <%def .balance_forward_row>
345 %  my( $b, $date ) = @_;
346 %  ( my $balance_forward = $money_char. $b ) =~ s/^\$\-/-&nbsp;\$/;
347
348    <TR ID="balance_forward_row">
349      <TD CLASS="grid" BGCOLOR="#dddddd">
350        <% time2str($date_format, $date) %>
351      </TD>
352
353      <TD CLASS="grid" BGCOLOR="#dddddd">
354        <I><% mt("Starting balance on [_1]", time2str($date_format, $date) ) |h %></I>
355        (<A HREF="javascript:void(0);" onClick="show_history();"><% mt('show prior history') |h %></A>)
356      </TD>
357
358      <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
359      <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
360      <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
361      <TD CLASS="grid" BGCOLOR="#dddddd"></TD>
362      <TD CLASS="grid" BGCOLOR="#dddddd" ALIGN="right"><I><% $balance_forward %></I></TD>
363
364    </TR>
365 </%def>
366 <%shared>
367 my $conf = new FS::Conf;
368 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
369 my $money_char = $conf->config('money_char') || '$';
370 </%shared>
371 <%init>
372
373 my( $cust_main ) = @_;
374 my $custnum = $cust_main->custnum;
375
376 my $curuser = $FS::CurrentUser::CurrentUser;
377
378 my @payby = grep /\w/, $conf->config('payby');
379 #@payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH WEST COMP ))
380 @payby = (qw( CARD DCRD CHEK DCHK LECB BILL CASH COMP ))
381   unless @payby;
382 my %payby = map { $_=>1 } @payby;
383
384 my %status = (
385   'Queued'     => 'O', #Open
386   'In-transit' => 'I',
387   'Complete'   => 'R', #Resolved
388   'All'        => '',
389 );
390
391 #get payment history
392 my @history = ();
393
394 my %opt = (
395   ( map { $_ => scalar($conf->config($_)) }
396         qw( card_refund-days date_format )
397   ),
398   ( map { $_ => $conf->exists($_) } 
399         qw( deleteinvoices deletepayments deleterefunds pkg-balances )
400   )
401 );
402
403 $opt{'date_format'} ||= '%m/%d/%Y';
404
405 #legacy invoices
406 foreach my $legacy_cust_bill ($cust_main->legacy_cust_bill) {
407   push @history, {
408     'date'   => $legacy_cust_bill->_date,
409     'desc'   => include('payment_history/legacy_invoice.html', $legacy_cust_bill, %opt ),
410     'charge_nobal' => $legacy_cust_bill->charged,
411   };
412 }
413
414 #invoices
415 my $num_cust_bill = 0;
416 foreach my $cust_bill ($cust_main->cust_bill) {
417   push @history, {
418     'date'   => $cust_bill->_date,
419     'desc'   => include('payment_history/invoice.html', $cust_bill, %opt ),
420     'charge' => $cust_bill->charged,
421   };
422   $num_cust_bill++;
423 }
424
425 #voided invoices
426 foreach my $cust_bill_void ($cust_main->cust_bill_void) {
427   push @history, {
428     'date'        => $cust_bill_void->_date,
429     'desc'        => include('payment_history/voided_invoice.html', $cust_bill_void, %opt ),
430     'void_charge' => $cust_bill_void->charged,
431   };
432 }
433
434 #statements
435 foreach my $cust_statement ($cust_main->cust_statement) {
436   push @history, {
437     'date'   => $cust_statement->_date,
438     'desc'   => include('payment_history/statement.html', $cust_statement, %opt ),
439     #'charge' => $cust_bill->charged,
440   };
441 }
442
443 #payments (some false laziness w/credits)
444 foreach my $cust_pay ($cust_main->cust_pay) {
445   push @history, {
446     'date'    => $cust_pay->_date,
447     'desc'    => include('payment_history/payment.html', $cust_pay, %opt ),
448     'payment' => $cust_pay->paid,
449     #'target'  => $target, #XXX
450   };
451 }
452
453 #pending payments 
454 foreach my $cust_pay_pending ($cust_main->cust_pay_pending) {
455   push @history, {
456     'date'    => $cust_pay_pending->_date,
457     'desc'    => include('payment_history/pending_payment.html', $cust_pay_pending, %opt ),
458     'void_payment' => $cust_pay_pending->paid, 
459   };
460 }
461
462
463 #voided payments
464 foreach my $cust_pay_void ($cust_main->cust_pay_void) {
465   push @history, {
466     'date'   => $cust_pay_void->_date,
467     'desc'   => include('payment_history/voided_payment.html', $cust_pay_void, %opt ),
468     'void_payment' => $cust_pay_void->paid,
469   };
470
471 }
472
473 #declined payments
474 foreach my $cust_pay_pending ($cust_main->cust_pay_pending_attempt) {
475   push @history, {
476     'date'    => $cust_pay_pending->_date,
477     'desc'    => include('payment_history/attempted_payment.html', $cust_pay_pending, %opt ),
478     'void_payment' => $cust_pay_pending->paid, #??
479     #'target'  => $target, #XXX
480   };
481 }
482 #declined batch payments
483 foreach my $cust_pay_batch (
484   $cust_main->cust_pay_batch(hashref => {status => 'Declined'})
485 ) {
486   my $pay_batch = $cust_pay_batch->pay_batch;
487   push @history, {
488     'date'    => $pay_batch->upload,
489     'desc'    => include('payment_history/attempted_batch_payment.html', $cust_pay_batch, %opt),
490     'void_payment' => $cust_pay_batch->amount,
491   };
492 }
493
494 #credits (some false laziness w/payments)
495 foreach my $cust_credit ($cust_main->cust_credit) {
496   push @history, {
497     'date'   => $cust_credit->_date,
498     'desc'   => include('payment_history/credit.html', $cust_credit, %opt ),
499     'credit' => $cust_credit->amount,
500   };
501
502 }
503
504 #refunds
505 foreach my $cust_refund ($cust_main->cust_refund) {
506   push @history, {
507     'date'   => $cust_refund->_date,
508     'desc'   => include('payment_history/refund.html', $cust_refund, %opt),
509     'refund' => $cust_refund->refund,
510   };
511
512 }
513
514 # sort in forward order first, and calculate running balances
515 my $years =  $conf->config('payment_history-years') || 2;
516 my $older_than = time - $years * 31556926; #60*60*24*365.2422
517 my $balance = 0;
518
519 @history = sort { $a->{date} <=> $b->{date} } @history;
520 my $i = 0;
521 my $balance_forward;
522 foreach my $item (@history) {
523   $balance += $item->{'charge'}  if exists $item->{'charge'};
524   $balance -= $item->{'payment'} if exists $item->{'payment'};
525   $balance -= $item->{'credit'}  if exists $item->{'credit'};
526   $balance += $item->{'refund'}  if exists $item->{'refund'};
527   $balance = sprintf("%.2f", $balance);
528   $balance =~ s/^\-0\.00$/0.00/;
529   $item->{'balance'} = $balance;
530
531   if ( $item->{'date'} < $older_than ) {
532     $item->{'hide'} = 1;
533   } elsif ( $history[$i-1]->{'hide'} ) {
534     # this is the end of the hidden section
535     $history[$i-1]->{'balance_forward'} = 1;
536   }
537   $i++;
538 }
539 if ( @history and $history[-1]->{'hide'} ) {
540   # then everything is hidden
541   $history[-1]->{'balance_forward'} = 1;
542 }
543
544 # then sort in user-pref order
545 if ( $curuser->option('history_order') eq 'newest' ) {
546   @history = sort { $b->{date} <=> $a->{date} } @history;
547 } # else it's already oldest-first, and there are no other options yet
548
549 sub translate_payby {
550     my ($payby,$payinfo) = (shift,shift);
551     my %payby = (
552         FS::payby->payby2shortname,
553         BILL    => $payinfo ? emt('Check #') : '',
554         CHEK    => emt('Electronic check '),
555         PREP    => emt('Prepaid card '),
556         CARD    => emt('Credit card #'),
557         COMP    => emt('Complimentary by '),
558         #CASH    => emt('Cash'),
559         #WEST    => emt('Western Union'),
560         #MCRD    => emt('Manual credit card'),
561     );
562     $payby = (exists $payby{$payby}) ? $payby{$payby} : $payby; 
563     $payby;
564 };
565
566 sub translate_payby_refund {
567     my ($payby,$payinfo) = (shift,shift);
568     my %payby = (
569         FS::payby->payby2shortname,
570         BILL    => $payinfo ? emt('Check #') : emt('Check'),
571         CHEK    => emt('Electronic check '),
572         CARD    => emt('Credit card #'),
573         COMP    => emt('Complimentary by '),
574     );
575     $payby = (exists $payby{$payby}) ? $payby{$payby} : $payby; 
576     $payby;
577 };
578
579 sub translate_payinfo {
580     my $object = shift;
581     my $payby = $object->payby;
582     my $payinfo = $object->payinfo;
583
584     my $conf = new FS::Conf;
585
586     if ( $payby eq 'CARD' ) {
587         $payinfo = $object->paymask;
588     } elsif ( $payby eq 'CHEK' ) {
589         my( $account, $aba ) = split('@', $object->paymask );
590         $payinfo = emt("ABA [_1], Acct #[_2]",$aba,$account);
591     }
592
593     ($payby,$payinfo);
594 }
595
596 sub areyousure_link {
597     my ($url,$msg,$title,$label) = (shift,shift,shift,shift);
598     ' (<A HREF="javascript:areyousure(\''.$url.'\',\''.$msg.'\')" TITLE="'.$title.'">'.$label.'</A>)';
599 }
600
601 </%init>