diff options
-rw-r--r-- | FS/FS/cust_bill.pm | 4 | ||||
-rwxr-xr-x | httemplate/edit/cust_pay.cgi | 105 | ||||
-rwxr-xr-x | httemplate/view/cust_main.cgi | 6 |
3 files changed, 102 insertions, 13 deletions
diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 1a2ecaf1d..fbccff1ff 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -297,6 +297,8 @@ sub owed { $balance -= $_->amount foreach ( $self->cust_bill_pay ); $balance -= $_->amount foreach ( $self->cust_credited ); $balance = sprintf( "%.2f", $balance); + $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp + $balance; } =item print_text [TIME]; @@ -493,7 +495,7 @@ sub print_text { =head1 VERSION -$Id: cust_bill.pm,v 1.13 2001-12-17 23:59:56 ivan Exp $ +$Id: cust_bill.pm,v 1.14 2001-12-21 21:40:24 ivan Exp $ =head1 BUGS diff --git a/httemplate/edit/cust_pay.cgi b/httemplate/edit/cust_pay.cgi index 3c0dbb2fe..6669b9de4 100755 --- a/httemplate/edit/cust_pay.cgi +++ b/httemplate/edit/cust_pay.cgi @@ -1,13 +1,18 @@ <% -#<!-- $Id: cust_pay.cgi,v 1.5 2001-10-30 14:54:07 ivan Exp $ --> +#<!-- $Id: cust_pay.cgi,v 1.6 2001-12-21 21:40:24 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::Conf; use FS::UID qw(cgisuidsetup); -use FS::CGI qw(header popurl); +use FS::CGI qw(header popurl ntable); + +my $conf = new FS::Conf; + +my $countrydefault = $conf->config('countrydefault') || 'US'; $cgi = new CGI; cgisuidsetup($cgi); @@ -44,32 +49,112 @@ print qq!<FONT SIZE="+1" COLOR="#ff0000">Error: !, $cgi->param('error'), "</FONT>" if $cgi->param('error'); -print <<END; +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"> END +my $custnum; if ( $link eq 'invnum' ) { - print "Invoice #<B>$linknum</B>"; + + my $cust_bill = qsearchs('cust_bill', { 'invnum' => $linknum } ) + or die "unknown invnum $linknum"; + print "Invoice #<B>$linknum</B>". ntable("#cccccc",2). + '<TR><TD ALIGN="right">Date</TD><TD BGCOLOR="#ffffff">'. + time2str("%D", $cust_bill->_date). '</TD></TR>'. + '<TR><TD ALIGN="right" VALIGN="top">Items</TD><TD BGCOLOR="#ffffff">'; + foreach ( $cust_bill->cust_bill_pkg ) { #false laziness with FS::cust_bill + if ( $_->pkgnum ) { + + my($cust_pkg)=qsearchs('cust_pkg', { 'pkgnum', $_->pkgnum } ); + my($part_pkg)=qsearchs('part_pkg',{'pkgpart'=>$cust_pkg->pkgpart}); + my($pkg)=$part_pkg->pkg; + + if ( $_->setup != 0 ) { + print "$pkg Setup<BR>"; # $money_char. sprintf("%10.2f",$_->setup); + print join('<BR>', + map { " ". $_->[0]. ": ". $_->[1] } $cust_pkg->labels + ). '<BR>'; + } + + if ( $_->recur != 0 ) { + print + "$pkg (" . time2str("%x",$_->sdate) . " - " . + time2str("%x",$_->edate) . ")<BR>"; + #$money_char. sprintf("%10.2f",$_->recur) + print join('<BR>', + map { '--->'. $_->[0]. ": ". $_->[1] } $cust_pkg->labels + ). '<BR>'; + } + + } else { #pkgnum Tax + print "Tax<BR>" # $money_char. sprintf("%10.2f",$_->setup) + if $_->setup != 0; + } + + } + print '</TD></TR></TABLE>'; + + $custnum = $cust_bill->custnum; + } elsif ( $link eq 'custnum' ) { - print "Customer #<B>$linknum</B>"; + $custnum = $linknum; } -print qq!<BR>Date: <B>!, time2str("%D",$_date), qq!</B><INPUT TYPE="hidden" NAME="_date" VALUE="$_date">!; +print "<BR><BR>Customer #<B>$custnum</B>". ntable('#e8e8e8'); +my $cust_main = qsearchs('cust_main', { 'custnum' => $custnum } ) + or die "unknown custnum $custnum"; + +print '<TR><TD>'. ntable("#cccccc",2). + '<TR><TD ALIGN="right" VALIGN="top">Billing</TD><TD BGCOLOR="#ffffff">'. + $cust_main->getfield('last'). ', '. $cust_main->first. '<BR>'; +print $cust_main->company. '<BR>' if $cust_main->company; +print $cust_main->address1. '<BR>'; +print $cust_main->address2. '<BR>' if $cust_main->address2; +print $cust_main->city. ', '. $cust_main->state. ' '. $cust_main->zip. '<BR>'; +print $cust_main->country. '<BR>' if $cust_main->country + && $cust_main->country ne $countrydefault; + +print '</TD>'. + '</TR></TABLE></TD>'; + +if ( defined $cust_main->dbdef_table->column('ship_last') ) { + + print '<TD>'. ntable("#cccccc",2). + '<TR><TD ALIGN="right" VALIGN="top">Service</TD><TD BGCOLOR="#ffffff">'. + $cust_main->getfield('ship_last'). ', '. $cust_main->ship_first. '<BR>'; + print $cust_main->ship_company. '<BR>' if $cust_main->ship_company; + print $cust_main->ship_address1. '<BR>'; + print $cust_main->ship_address2. '<BR>' if $cust_main->ship_address2; + print $cust_main->ship_city. ', '. $cust_main->ship_state. ' '. $cust_main->ship_zip. '<BR>'; + print $cust_main->ship_country. '<BR>' + if $cust_main->ship_country && $cust_main->ship_country ne $countrydefault; + + print '</TD>'. + '</TR></TABLE></TD>'; +} + +print '</TR></TABLE>'; + + +print '<BR><BR>Payment'. ntable("#cccccc", 2). + '<TR><TD ALIGN="right">Date</TD><TD BGCOLOR="#ffffff">'. + time2str("%D",$_date). '</TD></TR>'. + qq!<INPUT TYPE="hidden" NAME="_date" VALUE="$_date">!; -print qq!<BR>Amount \$<INPUT TYPE="text" NAME="paid" VALUE="$paid" SIZE=8 MAXLENGTH=8>!; +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!<BR>Payby: <B>$payby</B><INPUT TYPE="hidden" NAME="payby" VALUE="$payby">!; +print qq!<TR><TD ALIGN="right">Payby</TD><TD BGCOLOR="#ffffff">$payby</TD></TR><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">!; +print qq!<TR><TD ALIGN="right">Check #</TD><TD BGCOLOR="#ffffff"><INPUT TYPE="text" NAME="payinfo" VALUE="$payinfo"></TD></TR>!; #paybatch print qq!<INPUT TYPE="hidden" NAME="paybatch" VALUE="">!; print <<END; -</PRE> +</TABLE> <BR> <INPUT TYPE="submit" VALUE="Post payment"> END diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index d43575a9a..b17c9277a 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -#<!-- $Id: cust_main.cgi,v 1.14 2001-10-30 14:54:07 ivan Exp $ --> +#<!-- $Id: cust_main.cgi,v 1.15 2001-12-21 21:40:24 ivan Exp $ --> use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -470,6 +470,8 @@ foreach $item (sort keyfield_numerically @history) { $refund ||= 0; $balance += $charge - $payment; $balance -= $credit - $refund; + $balance = sprintf("%.2f", $balance); + $balance =~ s/^\-0\.00$/0.00/; #yay ieee fp print "<TR><TD><FONT SIZE=-1>",time2str("%D",$date),"</FONT></TD>", "<TD><FONT SIZE=-1>$desc</FONT></TD>", @@ -485,7 +487,7 @@ foreach $item (sort keyfield_numerically @history) { "<TD><FONT SIZE=-1>", ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), "</FONT></TD>", - "<TD><FONT SIZE=-1>\$" . sprintf("%.2f",$balance), + "<TD><FONT SIZE=-1>\$" . $balance, "</FONT></TD>", "\n"; } |