X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=httemplate%2Fedit%2Fcust_bill_pay.cgi;h=532db6a6e2d43874bbafd71078f913b828dd7674;hb=51add281a0ca46ffa75bfa5e2aa45c0da9bb9643;hp=61c8a1785c20fea2363405b175f6898e307dacd9;hpb=2d53ea6d86d638d65f0d14ef5921daf46981269e;p=freeside.git
diff --git a/httemplate/edit/cust_bill_pay.cgi b/httemplate/edit/cust_bill_pay.cgi
index 61c8a1785..532db6a6e 100755
--- a/httemplate/edit/cust_bill_pay.cgi
+++ b/httemplate/edit/cust_bill_pay.cgi
@@ -1,109 +1,14 @@
-<%
-#
-
-use strict;
-use vars qw( $cgi $query $custnum $paynum $amount $invnum $p1 $otaker $cust_pay );
-use CGI;
-use CGI::Carp qw(fatalsToBrowser);
-use Date::Format;
-use FS::UID qw(cgisuidsetup getotaker);
-use FS::CGI qw(header popurl);
-use FS::Record qw(qsearch fields);
-use FS::cust_pay;
-use FS::cust_bill;
-
-
-$cgi = new CGI;
-cgisuidsetup($cgi);
-
-if ( $cgi->param('error') ) {
- $paynum = $cgi->param('paynum');
- $amount = $cgi->param('amount');
- $invnum = $cgi->param('invnum');
-} else {
- ($query) = $cgi->keywords;
- $query =~ /^(\d+)$/;
- $paynum = $1;
- $amount = '';
- $invnum = '';
-}
-
-$otaker = getotaker;
-
-$p1 = popurl(1);
-
-print header("Apply Payment", '');
-print qq!Error: !, $cgi->param('error'),
- "
"
- if $cgi->param('error');
-print <
-END
-
-die unless $cust_pay = qsearchs('cust_pay', { 'paynum' => $paynum } );
-
-my $unapplied = $cust_pay->unapplied;
-
-print "Payment # $paynum".
- qq!!.
- '
Date: '. time2str("%D", $cust_pay->_date). ''.
- '
Amount: $'. $cust_pay->paid. ''.
- "
Unapplied amount: \$$unapplied".
- ;
-
-my @cust_bill = grep $_->owed != 0,
- qsearch('cust_bill', { 'custnum' => $cust_pay->custnum } );
-
-print <
-function changed(what) {
- cust_bill = what.options[what.selectedIndex].value;
-END
-
-foreach my $cust_bill ( @cust_bill ) {
- my $invnum = $cust_bill->invnum;
- my $changeto = $cust_bill->owed < $unapplied
- ? $cust_bill->owed
- : $unapplied;
- print <
-#END
-print "\n";
-
-print qq!
Invoice #";
-
-print qq!
Amount \$!;
-
-print <
-
-END
-
-print < 'process/cust_bill_pay.cgi',
+ 'src_table' => 'cust_pay',
+ 'src_thing' => 'payment',
+ 'dst_table' => 'cust_bill',
+ 'dst_thing' => 'invoice',
+ )
+%>
+<%init>
-
-