RT# 39340 - removed min_selfservice dir and merged into ng_selfservice
[freeside.git] / httemplate / elements / tr-select-invoice.html
1 <%doc>
2
3 Example:
4
5   include( '/elements/tr-select-invoice.html',
6
7     #opt - most get used in /elements/tr-amount-fee
8     'cust_main'            => $cust_main,     # cust_main,
9     'status'               => 'open' # type of invoices to show.  Possible values are:
10                                      # open - shows only open invoices
11                                      # void - shows only voided invoices
12                                      # all  - shows all invoices, this is default if no status is set.
13     'prefix'               => 'pre', # prefix to fields and row ID's
14   )
15
16 </%doc>
17
18   <TR ID="invoice_row" STYLE="display:none;">
19     <TH ALIGN="right"><% mt('Open invoices') |h %></TH>
20     <TD>
21      <SELECT
22           ID       = "<% $opt{prefix} %>invoice"
23           NAME     = "<% $opt{prefix} %>invoice"
24           onChange = "<% $opt{prefix} %>invoice_select_changed(this)"
25         >
26                 <OPTION VALUE="select">Select an invoice to pay</OPTION>
27 %         foreach my $record (@invoices) {
28 %            my $read_date = time2str("%b %o, %Y", $record->_date);
29 %             $hidden .= '<INPUT TYPE="hidden" ID="inv'.$record->invnum.'" NAME="inv'.$record->invnum.'" VALUE="'.$record->owed.'">';
30             <OPTION VALUE="<% $record->invnum %>"><% $record->invnum %> (<% $read_date %>) - <% $record->owed %></OPTION>
31 %         }
32
33         </SELECT>
34
35   <% $hidden %>
36
37     </TD>
38   </TR>
39
40 <%init>
41
42 my %opt = @_;
43 my $status = $opt{'status'} ? $opt{'status'} : 'all';
44 my $hidden;
45
46 my @invoices;
47 if ($status eq "all") { @invoices = $opt{'cust_main'}->cust_bill; }
48 elsif ($status eq "open") { @invoices = $opt{'cust_main'}->open_cust_bill; }
49 elsif ($status eq "void") { @invoices = $opt{'cust_main'}->cust_bill_void; }
50
51 </%init>