summaryrefslogtreecommitdiff
path: root/httemplate/elements/bill.html
blob: 335779a0f6061a9a8b7445189c0f51737377c2ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<%doc>
Clickable link to bill a customer.

Example:
<FORM name="MyForm">
<% include( '/elements/bill.html',
            ###
            # required
            ###
            custnum   => $custnum,
            label     => 'Bill Now!',
            formname  => 'MyForm',

            ###
            # recommended
            ###
            url       => $p.'view/cust_main.cgi?'.$custnum,

            ###
            # optional, can contain any FS::cust_main::bill_and_collect options
            ###
            bill_opts => { 'batch_card' => 'yes' },
) %>
</FORM>
</%doc>
<% include('/elements/progress-init.html',
          $formname,
          [ 'custnum', @opt_keys ],
          $p.'misc/bill.cgi',
          $url ? { url => $url } : { message => $message },
          $key,
) %>
<A HREF="javascript:void(0);" onclick="javascript:<%$key%>process();"><%$label%></A>
<INPUT TYPE="hidden" NAME="custnum" VALUE="<%$custnum%>">
% foreach(@opt_keys) {
<INPUT TYPE="hidden" NAME="<%$_%>" VALUE="<%$bill_opts->{$_}%>">
% }
<%init>
my %opt = @_;
my $custnum   = $opt{'custnum'};
my $label     = $opt{'label'};
my $formname  = $opt{'formname'};
my $key       = $formname.'bill'.$custnum;
my $url       = $opt{'url'} || '';
my $message   = $opt{'message'} || 'Finished!';
my $bill_opts = $opt{'bill_opts'} || {};
my @opt_keys  = keys(%$bill_opts);
my @opt_vals  = values(%$bill_opts);
</%init>