diff options
author | ivan <ivan> | 2004-12-24 02:54:12 +0000 |
---|---|---|
committer | ivan <ivan> | 2004-12-24 02:54:12 +0000 |
commit | e84dda39cd83ef67dd2debd7d06d97d1a124b598 (patch) | |
tree | 1926889bf51dedf7b912df621246d963b2ce8e5e | |
parent | 74d770e94f656d69ae156903360238822a8baa45 (diff) |
add ability to set payment date manually
-rwxr-xr-x | httemplate/edit/cust_pay.cgi | 132 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_pay.cgi | 5 |
2 files changed, 82 insertions, 55 deletions
diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index f6ae7b299..755050bd8 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -3,51 +3,61 @@ my $conf = new FS::Conf; -my($link, $linknum, $paid, $payby, $payinfo, $quickpay); +my($link, $linknum, $paid, $payby, $payinfo, $quickpay, $_date); if ( $cgi->param('error') ) { - $link = $cgi->param('link'); - $linknum = $cgi->param('linknum'); - $paid = $cgi->param('paid'); - $payby = $cgi->param('payby'); - $payinfo = $cgi->param('payinfo'); + $link = $cgi->param('link'); + $linknum = $cgi->param('linknum'); + $paid = $cgi->param('paid'); + $payby = $cgi->param('payby'); + $payinfo = $cgi->param('payinfo'); $quickpay = $cgi->param('quickpay'); + $_date = $cgi->param('_date') ? str2time($cgi->param('_date')) : time; } elsif ($cgi->keywords) { my($query) = $cgi->keywords; $query =~ /^(\d+)$/; - $link = 'invnum'; - $linknum = $1; - $paid = ''; - $payby = 'BILL'; - $payinfo = ""; + $link = 'invnum'; + $linknum = $1; + $paid = ''; + $payby = 'BILL'; + $payinfo = ""; $quickpay = ''; + $_date = time; } elsif ( $cgi->param('custnum') =~ /^(\d+)$/ ) { - $link = 'custnum'; - $linknum = $1; - $paid = ''; - $payby = 'BILL'; - $payinfo = ''; + $link = 'custnum'; + $linknum = $1; + $paid = ''; + $payby = 'BILL'; + $payinfo = ''; $quickpay = $cgi->param('quickpay'); + $_date = time; } else { die "illegal query ". $cgi->keywords; } -my $_date = time; my $paybatch = "webui-$_date-$$-". rand() * 2**32; -my $p1 = popurl(1); -print header("Post payment", ''); +%> + +<%= header("Post payment", '') %> + +<% if ( $cgi->param('error') ) { %> +<FONT SIZE="+1" COLOR="#ff0000">Error: <%= $cgi->param('error') %></FONT> +<BR><BR> +<% } %> + +<%= ntable("#cccccc",2) %> -print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), - "</FONT><BR><BR>" - if $cgi->param('error'); +<LINK REL="stylesheet" TYPE="text/css" HREF="../elements/calendar-win2k-2.css" TITLE="win2k-2"> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar_stripped.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-en.js"></SCRIPT> +<SCRIPT TYPE="text/javascript" SRC="../elements/calendar-setup.js"></SCRIPT> -print <<END, ntable("#cccccc",2); - <FORM ACTION="${p1}process/cust_pay.cgi" METHOD=POST> - <INPUT TYPE="hidden" NAME="link" VALUE="$link"> - <INPUT TYPE="hidden" NAME="linknum" VALUE="$linknum"> - <INPUT TYPE="hidden" NAME="quickpay" VALUE="$quickpay"> -END +<FORM ACTION="<%= popurl(1) %>process/cust_pay.cgi" METHOD=POST> +<INPUT TYPE="hidden" NAME="link" VALUE="<%= $link %>"> +<INPUT TYPE="hidden" NAME="linknum" VALUE="<%= $linknum %>"> +<INPUT TYPE="hidden" NAME="quickpay" VALUE="<%= $quickpay %>"> +<% my $custnum; if ( $link eq 'invnum' ) { @@ -94,36 +104,50 @@ if ( $link eq 'invnum' ) { } elsif ( $link eq 'custnum' ) { $custnum = $linknum; } +%> -print small_custview($custnum, $conf->config('countrydefault')); - -print qq!<INPUT TYPE="hidden" NAME="_date" VALUE="$_date">!; -print qq!<INPUT TYPE="hidden" NAME="payby" VALUE="$payby">!; - -print '<BR><BR>Payment'. ntable("#cccccc", 2). - '<TR><TD ALIGN="right">Date</TD><TD BGCOLOR="#ffffff">'. - time2str("%D",$_date). '</TD></TR>'; - -print qq!<TR><TD ALIGN="right">Amount</TD><TD BGCOLOR="#ffffff">\$<INPUT TYPE="text" NAME="paid" VALUE="$paid" SIZE=8 MAXLENGTH=8></TD></TR>!; - -print qq!<TR><TD ALIGN="right">Payby</TD><TD BGCOLOR="#ffffff">$payby</TD></TR>!; - -#payinfo (check # now as payby="BILL" hardcoded.. what to do later?) -print qq!<TR><TD ALIGN="right">Check #</TD><TD BGCOLOR="#ffffff"><INPUT TYPE="text" NAME="payinfo" VALUE="$payinfo"></TD></TR>!; - -print qq!<TR><TD ALIGN="right">Auto-apply<BR>to invoices</TD><TD><SELECT NAME="apply"><OPTION VALUE="yes" SELECTED>yes<OPTION>no</SELECT></TD>!; - -print "</TABLE>"; - -#paybatch -print qq!<INPUT TYPE="hidden" NAME="paybatch" VALUE="$paybatch">!; +<%= small_custview($custnum, $conf->config('countrydefault')) %> + +<INPUT TYPE="hidden" NAME="payby" VALUE="<%= $payby %>"> + +<BR><BR> +Payment +<%= ntable("#cccccc", 2) %> +<TR> + <TD ALIGN="right">Date</TD> + <TD COLSPAN=2> + <INPUT TYPE="text" NAME="_date" ID="_date_text" VALUE="<%= time2str("%m/%d/%Y %r",$_date) %>"> + <IMG SRC="../images/calendar.png" ID="_date_button" STYLE="cursor: pointer" TITLE="Select date"> + </TD> +</TR> +<SCRIPT TYPE="text/javascript"> + Calendar.setup({ + inputField: "_date_text", + ifFormat: "%m/%d/%Y", + button: "_date_button", + align: "BR" + }); +</SCRIPT> +<TR> + <TD ALIGN="right">Amount</TD> + <TD BGCOLOR="#ffffff" ALIGN="right">$</TD> + <TD><INPUT TYPE="text" NAME="paid" VALUE="<%= $paid %>" SIZE=8 MAXLENGTH=8></TD> +</TR> +<TR> + <TD ALIGN="right">Check #</TD> + <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<%= $payinfo %>" SIZE=10></TD> +</TR> +<TR> + <TD ALIGN="right">Auto-apply<BR>to invoices</TD> + <TD COLSPAN=2><SELECT NAME="apply"><OPTION VALUE="yes" SELECTED>yes<OPTION>no</SELECT></TD> +</TR> + +</TABLE> + +<INPUT TYPE="hidden" NAME="paybatch" VALUE="<%= $paybatch %>"> -print <<END; <BR> <INPUT TYPE="submit" VALUE="Post payment"> </FORM> </BODY> </HTML> -END - -%> diff --git a/httemplate/edit/process/cust_pay.cgi b/httemplate/edit/process/cust_pay.cgi index 82442ae00..87d6011e7 100755 --- a/httemplate/edit/process/cust_pay.cgi +++ b/httemplate/edit/process/cust_pay.cgi @@ -8,11 +8,14 @@ $cgi->param('link') =~ /^(custnum|invnum)$/ or die "Illegal link: ". $cgi->param('link'); my $link = $1; +my $_date = str2time($cgi->param('_date')); + my $new = new FS::cust_pay ( { $link => $linknum, + _date => $_date, map { $_, scalar($cgi->param($_)); - } qw(paid _date payby payinfo paybatch) + } qw(paid payby payinfo paybatch) #} fields('cust_pay') } ); |