summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_pay.cgi
blob: 3c0dbb2fe448a6880088a09c4585d0096a9bca44 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<%
#<!-- $Id: cust_pay.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ -->

use strict;
use vars qw( $cgi $link $linknum $p1 $_date $payby $payinfo $paid );
use Date::Format;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use FS::UID qw(cgisuidsetup);
use FS::CGI qw(header popurl);

$cgi = new CGI;
cgisuidsetup($cgi);

if ( $cgi->param('error') ) {
  $link = $cgi->param('link');
  $linknum = $cgi->param('linknum');
  $paid = $cgi->param('paid');
  $payby = $cgi->param('payby');
  $payinfo = $cgi->param('payinfo');
} elsif ($cgi->keywords) {
  my($query) = $cgi->keywords;
  $query =~ /^(\d+)$/;
  $link = 'invnum';
  $linknum = $1;
  $paid = '';
  $payby = 'BILL';
  $payinfo = "";
} elsif ( $cgi->param('custnum')  =~ /^(\d+)$/ ) {
  $link = 'custnum';
  $linknum = $1;
  $paid = '';
  $payby = 'BILL';
  $payinfo = '';
} else {
  die "illegal query ". $cgi->keywords;
}
$_date = time;

$p1 = popurl(1);
print header("Enter payment", '');

print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'),
      "</FONT>"
  if $cgi->param('error');

print <<END;
    <FORM ACTION="${p1}process/cust_pay.cgi" METHOD=POST>
    <INPUT TYPE="hidden" NAME="link" VALUE="$link">
    <INPUT TYPE="hidden" NAME="linknum" VALUE="$linknum">
END

if ( $link eq 'invnum' ) {
  print "Invoice #<B>$linknum</B>";
} elsif ( $link eq 'custnum' ) {
  print "Customer #<B>$linknum</B>";
}

print qq!<BR>Date: <B>!, time2str("%D",$_date), qq!</B><INPUT TYPE="hidden" NAME="_date" VALUE="$_date">!;

print qq!<BR>Amount \$<INPUT TYPE="text" NAME="paid" VALUE="$paid" SIZE=8 MAXLENGTH=8>!;

print qq!<BR>Payby: <B>$payby</B><INPUT TYPE="hidden" NAME="payby" VALUE="$payby">!;

#payinfo (check # now as payby="BILL" hardcoded.. what to do later?)
print qq!<BR>Check #<INPUT TYPE="text" NAME="payinfo" VALUE="$payinfo">!;

#paybatch
print qq!<INPUT TYPE="hidden" NAME="paybatch" VALUE="">!;

print <<END;
</PRE>
<BR>
<INPUT TYPE="submit" VALUE="Post payment">
END

print <<END;

    </FORM>
  </BODY>
</HTML>
END

%>