option to credit unused time on suspension as part of suspend reason, #31702
[freeside.git] / httemplate / elements / bill.html
1 <%doc>
2
3 Clickable link to bill a customer.
4
5 Example:
6 <% include( '/elements/bill.html',
7             ###
8             # required
9             ###
10             custnum   => $custnum,
11             label     => 'Bill Now!',
12
13             ###
14             # recommended
15             ###
16             url       => $p.'view/cust_main.cgi?'.$custnum,
17
18             ###
19             # optional, can contain any FS::cust_main::bill_and_collect options
20             ###
21             bill_opts => { 'batch_card' => 'yes' },
22             formname  => 'MyBillNowLink', # if for some reason you want this
23 ) %>
24
25 </%doc>
26 <FORM NAME="<%$formname%>" STYLE="display:inline">
27 <% include('/elements/progress-init.html',
28           $formname,
29           [ 'custnum', @opt_keys ],
30           $p.'misc/bill.cgi',
31           $url ? { url => $url } : { message => $message },
32           $formname, # use it as 'key'
33 ) %>
34 <A HREF="javascript:void(0);" onclick="javascript:<%$formname%>process();"><%$label%></A>
35 <INPUT TYPE="hidden" NAME="custnum" VALUE="<%$custnum%>">
36 % foreach(@opt_keys) {
37 <INPUT TYPE="hidden" NAME="<%$_%>" VALUE="<%$bill_opts->{$_}%>">
38 % }
39 </FORM>
40 <%init>
41
42 my %opt = @_;
43 my $custnum   = $opt{'custnum'};
44 my $label     = $opt{'label'};
45 # formname no longer needs to be passed from outside, but we still 
46 # need one and it needs to be unique
47 my $formname  = $opt{'formname'} ||
48                 'bill'.sprintf('%04d',int(rand(10000))).$custnum;
49 my $url       = $opt{'url'} || '';
50 my $message   = $opt{'message'} || 'Finished!';
51 my $bill_opts = $opt{'bill_opts'} || {};
52 my @opt_keys  = keys(%$bill_opts);
53 my @opt_vals  = values(%$bill_opts);
54
55 </%init>