X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_credit_bill.cgi;h=e3627ff379fe28c6bc47da23e26c3b8f4f70890b;hb=2c112f32561f23f9c538ace00db46659ce16da32;hp=1a97e1312d6979d631826e30388f612952e551d3;hpb=5fc8c5edf574ab024d4646914b6432d458e2ffbd;p=freeside.git
diff --git a/httemplate/edit/cust_credit_bill.cgi b/httemplate/edit/cust_credit_bill.cgi
index 1a97e1312..e3627ff37 100755
--- a/httemplate/edit/cust_credit_bill.cgi
+++ b/httemplate/edit/cust_credit_bill.cgi
@@ -1,101 +1,14 @@
-
-<%
-
-my($crednum, $amount, $invnum);
-if ( $cgi->param('error') ) {
- #$cust_credit_bill = new FS::cust_credit_bill ( {
- # map { $_, scalar($cgi->param($_)) } fields('cust_credit_bill')
- #} );
- $crednum = $cgi->param('crednum');
- $amount = $cgi->param('amount');
- #$refund = $cgi->param('refund');
- $invnum = $cgi->param('invnum');
-} else {
- my($query) = $cgi->keywords;
- $query =~ /^(\d+)$/;
- $crednum = $1;
- $amount = '';
- #$refund = 'yes';
- $invnum = '';
-}
-
-my $otaker = getotaker;
-
-my $p1 = popurl(1);
-
-print header("Apply Credit", '');
-print qq!Error: !, $cgi->param('error'),
- "
"
- if $cgi->param('error');
-print <
-END
-
-my $cust_credit = qsearchs('cust_credit', { 'crednum' => $crednum } );
-die "credit $crednum not found!" unless $cust_credit;
-
-my $credited = $cust_credit->credited;
-
-print "Credit # $crednum".
- qq!!.
- '
Date: '. time2str("%D", $cust_credit->_date). ''.
- '
Amount: $'. $cust_credit->amount. ''.
- "
Unapplied amount: \$$credited".
- '
Reason: '. $cust_credit->reason. ''
- ;
-
-my @cust_bill = grep $_->owed != 0,
- qsearch('cust_bill', { 'custnum' => $cust_credit->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 < $cust_credit->credited
- ? $cust_bill->owed
- : $cust_credit->credited;
- print <
-END
-
-print qq!
Invoice #";
-
-print qq!
Amount \$!;
-
-print <
-
-END
-
-print < 'process/cust_credit_bill.cgi',
+ 'src_table' => 'cust_credit',
+ 'src_thing' => 'credit',
+ 'dst_table' => 'cust_bill',
+ 'dst_thing' => 'invoice',
+ )
+%>
+<%init>
-
-