02b8008f7e23095f823cea5d7446d758406563d1
[freeside.git] / htdocs / edit / cust_credit.cgi
1 #!/usr/bin/perl -Tw
2 #
3 # $Id: cust_credit.cgi,v 1.3 1998-12-23 02:26:06 ivan Exp $
4 #
5 # Usage: cust_credit.cgi custnum [ -paybatch ]
6 #        http://server.name/path/cust_credit?custnum [ -paybatch ]
7 #
8 # Note: Should be run setuid root as user nobody.
9 #
10 # some hooks in here for modifications as well as additions, but needs (lots) more work.
11 # also see process/cust_credit.cgi, the script that processes the form.
12 #
13 # ivan@voicenet.com 96-dec-05
14 #
15 # paybatch field, differentiates between credits & credits+refunds by commandline
16 # ivan@voicenet.com 96-dec-08
17 #
18 # added (but commented out) sprintf("%.2f" in amount field.  Hmm.
19 # ivan@voicenet.com 97-jan-3
20 #
21 # paybatch stuff thrown out - has checkbox now instead.  
22 # (well, sort of.  still passed around for backward compatability and possible editing hook)
23 # ivan@voicenet.com 97-apr-21
24 #
25 # rewrite ivan@sisd.com 98-mar-16
26 #
27 # $Log: cust_credit.cgi,v $
28 # Revision 1.3  1998-12-23 02:26:06  ivan
29 # *** empty log message ***
30 #
31 # Revision 1.2  1998/12/17 06:16:59  ivan
32 # fix double // in relative URLs, s/CGI::Base/CGI/;
33 #
34
35 use strict;
36 use Date::Format;
37 use CGI;
38 use CGI::Carp qw(fatalsToBrowser);
39 use FS::UID qw(cgisuidsetup getotaker);
40 use FS::CGI qw(header popurl);
41
42 my $cgi = new CGI;
43
44 cgisuidsetup($cgi);
45
46 my($query) = $cgi->keywords;
47 $query =~ /^(\d+)$/;
48 my($custnum)=$1;
49
50 my($otaker)=getotaker;
51
52 my $p1 = popurl(1);
53
54 print $cgi->header, header("Post Credit", ''), <<END;
55     <FORM ACTION="${p1}process/cust_credit.cgi" METHOD=POST>
56     <HR><PRE>
57 END
58
59 #crednum
60 my($crednum)="";
61 print qq!Credit #<B>!, $crednum ? $crednum : " <I>(NEW)</I>", qq!</B><INPUT TYPE="hidden" NAME="crednum" VALUE="$crednum">!;
62
63 #custnum
64 print qq!\nCustomer #<B>$custnum</B><INPUT TYPE="hidden" NAME="custnum" VALUE="$custnum">!;
65
66 #paybatch
67 print qq!<INPUT TYPE="hidden" NAME="paybatch" VALUE="">!;
68
69 #date
70 my($date)=time;
71 print qq!\nDate: <B>!, time2str("%D",$date), qq!</B><INPUT TYPE="hidden" NAME="_date" VALUE="$date">!;
72
73 #amount
74 my($amount)='';
75 print qq!\nAmount \$<INPUT TYPE="text" NAME="amount" VALUE="$amount" SIZE=8 MAXLENGTH=8>!;
76
77 #refund?
78 #print qq! <INPUT TYPE="checkbox" NAME="refund" VALUE="yes">Also post refund!;
79
80 #otaker (hidden)
81 print qq!<INPUT TYPE="hidden" NAME="otaker" VALUE="$otaker">!;
82
83 #reason
84 my($reason)='';
85 print qq!\nReason <INPUT TYPE="text" NAME="reason" VALUE="$reason" SIZE=72>!;
86
87 print <<END;
88 </PRE>
89 <BR>
90 <CENTER><INPUT TYPE="submit" VALUE="Post"></CENTER>
91 END
92
93 print <<END;
94
95     </FORM>
96   </BODY>
97 </HTML>
98 END
99