-<%
-#
-# $Id: cust_pay.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $
-#
-# Usage: cust_pay.cgi invnum
-# http://server.name/path/cust_pay.cgi?invnum
-#
-# some hooks for modifications as well as additions, but needs work.
-#
-# ivan@voicenet.com 96-dec-11
-#
-# rewrite ivan@sisd.com 98-mar-16
-#
-# $Log: cust_pay.cgi,v $
-# Revision 1.1 2001-07-30 07:36:04 ivan
-# templates!!!
-#
-# Revision 1.6 1999/02/28 00:03:35 ivan
-# removed misleading comments
-#
-# Revision 1.5 1999/01/25 12:09:56 ivan
-# yet more mod_perl stuff
-#
-# Revision 1.4 1999/01/19 05:13:37 ivan
-# for mod_perl: no more top-level my() variables; use vars instead
-# also the last s/create/new/;
-#
-# Revision 1.3 1999/01/18 09:41:27 ivan
-# all $cgi->header calls now include ( '-expires' => 'now' ) for mod_perl
-# (good idea anyway)
-#
-# Revision 1.2 1998/12/17 06:17:03 ivan
-# fix double // in relative URLs, s/CGI::Base/CGI/;
-#
-
-use strict;
-use vars qw( $cgi $invnum $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 ( $link eq 'popup' ) {
+ <& /elements/header-popup.html, $title &>
+% } else {
+ <& /elements/header-cust_main.html, view=>'payment_history', custnum=>$custnum &>
+ <h2><% $title |h %></h2>
+% }
+
+<& /elements/init_calendar.html &>
+
+<& /elements/error.html &>
+
+<FORM NAME="PaymentForm" ACTION="<% popurl(1) %>process/cust_pay.cgi" METHOD=POST onSubmit="document.PaymentForm.submitButton.disabled=true">
+<INPUT TYPE="hidden" NAME="link" VALUE="<% $link %>">
+<INPUT TYPE="hidden" NAME="linknum" VALUE="<% $linknum %>">
+<INPUT TYPE="hidden" NAME="payby" VALUE="<% $payby %>">
+<INPUT TYPE="hidden" NAME="paybatch" VALUE="<% $paybatch %>">
+
+<TABLE CLASS="fsinnerbox">
+
+% my %date_args = (
+% 'name' => '_date',
+% 'label' => emt('Date'),
+% 'value' => $_date,
+% 'format' => $date_format. ' %r',
+% 'colspan' => 2,
+% );
+% if ( $FS::CurrentUser::CurrentUser->access_right('Backdate payment') ) {
+
+ <& /elements/tr-input-date-field.html, \%date_args &>
+
+% } else {
+
+ <& /elements/tr-fixed-date.html, \%date_args &>
+
+% }
+
+<TR>
+ <TH ALIGN="right"><% mt('Amount') |h %></TH>
+ <TD><% $money_char |h %><INPUT TYPE="text" NAME="paid" ID="paid" VALUE="<% $paid %>" SIZE=8 MAXLENGTH=9> <% mt('by') |h %> <B><% mt(FS::payby->payname($payby)) |h %></B></TD>
+</TR>
+
+% if ( $conf->exists('part_pkg-term_discounts') ) {
+ <& /elements/tr-select-discount_term.html,
+ 'custnum' => $custnum,
+ 'amount_id' => 'paid',
+ &>
+% }
+
+% if ( $payby eq 'BILL' ) {
+ <TR>
+ <TH ALIGN="right"><% mt('Check #') |h %></TH>
+ <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<% $payinfo %>" SIZE=10></TD>
+ </TR>
+% }
+% elsif ( $payby eq 'CASH' and $conf->exists('require_cash_deposit_info') ) {
+ <TR>
+ <TH ALIGN="right"><% mt('Bank') |h %></TH>
+ <TD COLSPAN=3><INPUT TYPE="text" NAME="bank" VALUE="<% $cgi->param('bank') %>"></TD>
+ </TR>
+ <TR>
+ <TH ALIGN="right"><% mt('Check #') |h %></TH>
+ <TD COLSPAN=2><INPUT TYPE="text" NAME="payinfo" VALUE="<% $payinfo %>" SIZE=10></TD>
+ </TR>
+ <TR>
+ <TH ALIGN="right"><% mt('Teller #') |h %></TH>
+ <TD COLSPAN=2><INPUT TYPE="text" NAME="teller" VALUE="<% $cgi->param('teller') %>" SIZE=10></TD>
+ </TR>
+ <TR>
+ <TH ALIGN="right"><% mt('Depositor') |h %></TH>
+ <TD COLSPAN=3><INPUT TYPE="text" NAME="depositor" VALUE="<% $cgi->param('depositor') %>"></TD>
+ </TR>
+ <TR>
+ <TH ALIGN="right"><% mt('Account #') |h %></TH>
+ <TD COLSPAN=2><INPUT TYPE="text" NAME="account" VALUE="<% $cgi->param('account') %>" SIZE=18></TD>
+ </TR>
+% }
+
+<TR>
+% if ( $link eq 'custnum' || $link eq 'popup' ) {
+
+ <TD ALIGN="right"><% mt('Auto-apply to invoices') |h %></TD>
+ <TD COLSPAN=2>
+ <SELECT NAME="apply">
+ <OPTION VALUE="yes" SELECTED><% mt('yes') |h %></OPTION>
+ <OPTION VALUE=""><% mt('not now') |h %></OPTION>
+ <OPTION VALUE="never"><% mt('never') |h %></OPTION>
+ </SELECT>
+ </TD>
+
+% } elsif ( $link eq 'invnum' ) {
+
+ <TH ALIGN="right"><% mt('Apply to') |h %></TH>
+ <TD COLSPAN=2>Invoice #<B><% $linknum %></B> only</TD>
+ <INPUT TYPE="hidden" NAME="apply" VALUE="">
+
+% }
+</TR>
+
+% if ( $conf->exists('pkg-balances') ) {
+ <& /elements/tr-select-cust_pkg-balances.html,
+ 'custnum' => $custnum,
+ 'cgi' => $cgi
+ &>
+% } else {
+ <INPUT TYPE="hidden" NAME="pkgnum" VALUE="">
+% }
+
+</TABLE>