credits return taxes, but the magic calculation button does not yet work properly...
[freeside.git] / httemplate / edit / cust_credit.cgi
1 <% include('/elements/header-popup.html', 'Enter Credit') %>
2
3 <% include('/elements/error.html') %>
4
5 <FORM NAME="credit_popup" ACTION="<% $p1 %>process/cust_credit.cgi" METHOD=POST>
6 <INPUT TYPE="hidden" NAME="crednum" VALUE="">
7 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum |h %>">
8 <INPUT TYPE="hidden" NAME="paybatch" VALUE="">
9 <INPUT TYPE="hidden" NAME="_date" VALUE="<% $_date %>">
10 <INPUT TYPE="hidden" NAME="credited" VALUE="">
11 <INPUT TYPE="hidden" NAME="otaker" VALUE="<% $otaker %>">
12
13 Credit
14 <% ntable("#cccccc", 2) %>
15
16   <TR>
17     <TD ALIGN="right">Date</TD>
18     <TD BGCOLOR="#ffffff"><% time2str("%D",$_date) %></TD>
19   </TR>
20
21   <TR>
22     <TD ALIGN="right">Amount</TD>
23     <TD BGCOLOR="#ffffff">$<INPUT TYPE="text" NAME="amount" VALUE="<% $amount |h %>" SIZE=8 MAXLENGTH=8></TD>
24   </TR>
25
26 %
27 %#print qq! <INPUT TYPE="checkbox" NAME="refund" VALUE="$refund">Also post refund!;
28 %
29
30 <% include( '/elements/tr-select-reason.html',
31               'field'          => 'reasonnum',
32               'reason_class'   => 'R',
33               'control_button' => "document.getElementById('confirm_credit_button')",
34               'cgi'            => $cgi,
35            )
36 %>
37
38   <TR>
39     <TD ALIGN="right">Auto-apply<BR>to invoices</TD>
40     <TD><SELECT NAME="apply"><OPTION VALUE="yes" SELECTED>yes<OPTION>no</SELECT></TD>
41   </TR>
42
43   <TR>
44     <TD ALIGN="right">Tax</TD>
45     <TD><SELECT NAME="tax"><OPTION VALUE="included" SELECTED>is included<OPTION VALUE="calculate">is to be calculated</SELECT></TD>
46   </TR>
47
48 % if ( $conf->exists('pkg-balances') ) {
49   <% include('/elements/tr-select-cust_pkg-balances.html',
50                'custnum' => $custnum,
51                'cgi'     => $cgi
52             )
53   %>
54 % } else {
55   <INPUT TYPE="hidden" NAME="pkgnum" VALUE="">
56 % }
57
58 </TABLE>
59
60 <BR>
61
62 <CENTER><INPUT TYPE="submit" ID="confirm_credit_button" VALUE="Enter credit" DISABLED></CENTER>
63
64 </FORM>
65 </BODY>
66 </HTML>
67 <%once>
68
69 my $conf = new FS::Conf;
70
71 </%once>
72 <%init>
73
74 die "access denied"
75   unless $FS::CurrentUser::CurrentUser->access_right('Post credit');
76
77 my $custnum = $cgi->param('custnum');
78 my $amount  = $cgi->param('amount');
79 my $_date   = time;
80 my $otaker  = getotaker;
81 my $p1      = popurl(1);
82
83 </%init>