From 51984ac3d3da3006809c6866fdecd4ad83610731 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 07:36:04 +0000 Subject: templates!!! --- httemplate/view/cust_main.cgi | 398 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 398 insertions(+) create mode 100755 httemplate/view/cust_main.cgi (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi new file mode 100755 index 000000000..6c260bb7d --- /dev/null +++ b/httemplate/view/cust_main.cgi @@ -0,0 +1,398 @@ + +<% + +use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral + @packages $package @history @bills $bill @credits $credit + $balance $item @agents @referrals @invoicing_list $n1 $conf ); +use CGI; +use CGI::Carp qw(fatalsToBrowser); +use Date::Format; +use FS::UID qw(cgisuidsetup); +use FS::Record qw(qsearchs qsearch); +use FS::CGI qw(header menubar popurl table itable ntable); +use FS::cust_credit; +use FS::cust_pay; +use FS::cust_bill; +use FS::part_pkg; +use FS::cust_pkg; +use FS::part_referral; +use FS::agent; +use FS::cust_main; +use FS::cust_refund; + +$cgi = new CGI; +&cgisuidsetup($cgi); + +$conf = new FS::Conf; + +print $cgi->header( '-expires' => 'now' ), header("Customer View", menubar( + 'Main Menu' => popurl(2) +)); + +die "No customer specified (bad URL)!" unless $cgi->keywords; +($query) = $cgi->keywords; # needs parens with my, ->keywords returns array +$query =~ /^(\d+)$/; +$custnum = $1; +$cust_main = qsearchs('cust_main',{'custnum'=>$custnum}); +die "Customer not found!" unless $cust_main; +$hashref = $cust_main->hashref; + +print qq!Edit this customer!; +print qq! | Delete this customer! + if $conf->exists('deletecustomers'); +print '

'; + +print ''; + +print &itable(), ''; + +print ''; + + print "Billing address", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + 'Contact name', + '', + $cust_main->last, ', ', $cust_main->first, + 'SS#', + $cust_main->ss || ' ', '', + 'Company', + $cust_main->company, + '', + 'Address', + $cust_main->address1, + '', + ; + print ' ', + $cust_main->address2, '' + if $cust_main->address2; + print 'City', + $cust_main->city, + 'State', + $cust_main->state, + 'Zip', + $cust_main->zip, '', + 'Country', + $cust_main->country, + '', + ; + print 'Day Phone', + $cust_main->daytime || ' ', '', + 'Night Phone', + $cust_main->night || ' ', '', + 'Fax', + $cust_main->fax || ' ', '', + '', "" + ; + + if ( defined $cust_main->dbdef_table->column('ship_last') ) { + + my $pre = $cust_main->ship_last ? 'ship_' : ''; + + print "
Service address", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + 'Contact name', + '', + $cust_main->get("${$pre}last"), ', ', $cust_main->get("${$pre}first"), + '', + 'Company', + $cust_main->get("${$pre}company"), + '', + 'Address', + $cust_main->get("${$pre}address1"), + '', + ; + print ' ', + $cust_main->get("${$pre}address2"), '' + if $cust_main->get("${$pre}address2"); + print 'City', + $cust_main->get("${$pre}city"), + 'State', + $cust_main->get("${$pre}state"), + 'Zip', + $cust_main->get("${$pre}zip"), '', + 'Country', + $cust_main->get("${$pre}country"), + '', + ; + print 'Day Phone', + '', + $cust_main->get("${$pre}daytime") || ' ', '', + 'Night Phone'. + '', + $cust_main->get("${$pre}night") || ' ', '', + 'Fax', + $cust_main->get("${$pre}fax") || ' ', '', + '', "" + ; + + } + +print ''; + +print ''; + + print &ntable("#cccccc"), "", &ntable("#cccccc",2), + 'Customer number', + $custnum, '', + ; + + @agents = qsearch( 'agent', {} ); + unless ( scalar(@agents) == 1 ) { + $agent = qsearchs('agent',{ + 'agentnum' => $cust_main->agentnum + } ); + print 'Agent', + $agent->agentnum, ": ", $agent->agent, ''; + } + @referrals = qsearch( 'part_referral', {} ); + unless ( scalar(@referrals) == 1 ) { + my $referral = qsearchs('part_referral', { + 'refnum' => $cust_main->refnum + } ); + print 'Referral', + $referral->refnum, ": ", $referral->referral, ''; + } + print 'Order taker', + $cust_main->otaker, ''; + + print ''; + +print '
'; + + @invoicing_list = $cust_main->invoicing_list; + print "Billing information (", + qq!!, "Bill now)", + &ntable("#cccccc"), "", &ntable("#cccccc",2), + 'Tax exempt', + $cust_main->tax ? 'yes' : 'no', + '', + 'Postal invoices', + ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no', + '', + 'Email invoices', + join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no', + '', + 'Billing type', + ; + + if ( $cust_main->payby eq 'CARD' ) { + print 'Credit card', + 'Card number', + $cust_main->payinfo, '', + 'Expiration', + $cust_main->paydate, '', + 'Name on card', + $cust_main->payname, '' + ; + } elsif ( $cust_main->payby eq 'BILL' ) { + print 'Billing'; + print 'P.O. ', + $cust_main->payinfo, '', + if $cust_main->payinfo; + print 'Expiration', + $cust_main->paydate, '', + 'Attention', + $cust_main->payname, '', + ; + } elsif ( $cust_main->payby eq 'COMP' ) { + print 'Complimentary', + 'Authorized by', + $cust_main->payinfo, '', + 'Expiration', + $cust_main->paydate, '', + ; + } + + print ""; + +print ''; + +print qq!

Packages !, +# qq!
Click on package number to view/edit package.!, + qq!( Order and cancel packages (preserves services) )!, +; + +#display packages + +#formatting +print qq!!, &table(), "\n", + qq!Package!, + qq!DatesServices\n!, + qq!Setup!, + qq!Next bill!, + qq!Susp.Expire!, + qq!!, + qq!Cancel!, + qq!\n!; + +#get package info +if ( $conf->exists('hidecancelledpackages') ) { + @packages = $cust_main->ncancelled_pkgs; +} else { + @packages = $cust_main->all_pkgs; +} + +$n1 = ''; +foreach $package (@packages) { + my $pkgnum = $package->pkgnum; + my $pkg = $package->part_pkg->pkg; + my $comment = $package->part_pkg->comment; + my $pkgview = popurl(2). "view/cust_pkg.cgi?$pkgnum"; + my @cust_svc = qsearch( 'cust_svc', { 'pkgnum' => $pkgnum } ); + my $rowspan = scalar(@cust_svc) || 1; + + my $button_cgi = new CGI; + $button_cgi->param('clone', $package->part_pkg->pkgpart); + $button_cgi->param('pkgnum', $package->pkgnum); + my $button_url = popurl(2). "edit/part_pkg.cgi?". $button_cgi->query_string; + + #print $n1, qq!$pkgnum!, + print $n1, qq!$pkgnum!, + qq!!, + #qq!$pkg - $comment!, + qq!$pkg - $comment!, + qq! ( Edit | Customize pricing )!, + ; + for ( qw( setup bill susp expire cancel ) ) { + print "", ( $package->getfield($_) + ? time2str("%D", $package->getfield($_) ) + : ' ' + ), '', + ; + } + + my $n2 = ''; + foreach my $cust_svc ( @cust_svc ) { + my($label, $value, $svcdb) = $cust_svc->label; + my($svcnum) = $cust_svc->svcnum; + my($sview) = popurl(2). "view"; + print $n2,qq!$label!, + qq!$value!; + $n2=""; + } + $n1=""; +} +print ""; + +#formatting +print ""; + +#formatting +print qq!

Payment History!, + qq!!, + qq! ( Click on invoice to view invoice/enter payment. | !, + qq!!, + qq!Post credit / refund )!; + +#get payment history +# +# major problem: this whole thing is way too sloppy. +# minor problem: the description lines need better formatting. + +@history = (); #needed for mod_perl :) + +@bills = qsearch('cust_bill',{'custnum'=>$custnum}); +foreach $bill (@bills) { + my($bref)=$bill->hashref; + push @history, + $bref->{_date} . qq!\tInvoice #! . $bref->{invnum} . + qq! (Balance \$! . $bill->owed . qq!)\t! . + $bref->{charged} . qq!\t\t\t!; + + my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); + my($payment); + foreach $payment (@payments) { + my($date,$invnum,$payby,$payinfo,$paid)=($payment->getfield('_date'), + $payment->getfield('invnum'), + $payment->getfield('payby'), + $payment->getfield('payinfo'), + $payment->getfield('paid'), + ); + push @history, + "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; + } +} + +@credits = qsearch('cust_credit',{'custnum'=>$custnum}); +foreach $credit (@credits) { + my($cref)=$credit->hashref; + push @history, + $cref->{_date} . "\tCredit #" . $cref->{crednum} . ", (Balance \$" . + $cref->{credited} . ") by " . $cref->{otaker} . " - " . + $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; + + my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } ); + my($refund); + foreach $refund (@refunds) { + my($rref)=$refund->hashref; + push @history, + $rref->{_date} . "\tRefund, Credit #" . $rref->{crednum} . " (" . + $rref->{payby} . " " . $rref->{payinfo} . ") by " . + $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . + $rref->{refund}; + } +} + + #formatting + print &table(), < + Date + Description + Charge + Payment + In-house
Credit
+ Refund + Balance + +END + +#display payment history + +$balance = 0; +foreach $item (sort keyfield_numerically @history) { + my($date,$desc,$charge,$payment,$credit,$refund)=split(/\t/,$item); + $charge ||= 0; + $payment ||= 0; + $credit ||= 0; + $refund ||= 0; + $balance += $charge - $payment; + $balance -= $credit - $refund; + + print "",time2str("%D",$date),"", + "$desc", + "", + ( $charge ? "\$".sprintf("%.2f",$charge) : '' ), + "", + "", + ( $payment ? "- \$".sprintf("%.2f",$payment) : '' ), + "", + "", + ( $credit ? "- \$".sprintf("%.2f",$credit) : '' ), + "", + "", + ( $refund ? "\$".sprintf("%.2f",$refund) : '' ), + "", + "\$" . sprintf("%.2f",$balance), + "", + "\n"; +} + +#formatting +print ""; + +#end + +#formatting +print < + +END + +#subroutiens +sub keyfield_numerically { (split(/\t/,$a))[0] <=> (split(/\t/,$b))[0] ; } + +%> -- cgit v1.2.1 From 2066bf9d3ebb4e53c49ab8b4b447c4eb88e425a4 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 30 Jul 2001 10:41:44 +0000 Subject: shipping address additions --- httemplate/view/cust_main.cgi | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 6c260bb7d..752896847 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,6 +1,7 @@ - <% +# +use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @packages $package @history @bills $bill @credits $credit $balance $item @agents @referrals @invoicing_list $n1 $conf ); @@ -94,36 +95,36 @@ print ''; &ntable("#cccccc",2), 'Contact name', '', - $cust_main->get("${$pre}last"), ', ', $cust_main->get("${$pre}first"), + $cust_main->get("${pre}last"), ', ', $cust_main->get("${pre}first"), '', 'Company', - $cust_main->get("${$pre}company"), + $cust_main->get("${pre}company"), '', 'Address', - $cust_main->get("${$pre}address1"), + $cust_main->get("${pre}address1"), '', ; print ' ', - $cust_main->get("${$pre}address2"), '' - if $cust_main->get("${$pre}address2"); + $cust_main->get("${pre}address2"), '' + if $cust_main->get("${pre}address2"); print 'City', - $cust_main->get("${$pre}city"), + $cust_main->get("${pre}city"), 'State', - $cust_main->get("${$pre}state"), + $cust_main->get("${pre}state"), 'Zip', - $cust_main->get("${$pre}zip"), '', + $cust_main->get("${pre}zip"), '', 'Country', - $cust_main->get("${$pre}country"), + $cust_main->get("${pre}country"), '', ; print 'Day Phone', '', - $cust_main->get("${$pre}daytime") || ' ', '', + $cust_main->get("${pre}daytime") || ' ', '', 'Night Phone'. '', - $cust_main->get("${$pre}night") || ' ', '', + $cust_main->get("${pre}night") || ' ', '', 'Fax', - $cust_main->get("${$pre}fax") || ' ', '', + $cust_main->get("${pre}fax") || ' ', '', '', "" ; -- cgit v1.2.1 From 3dddb60bd783aaf5fa1fda90a351f1e877b7e19b Mon Sep 17 00:00:00 2001 From: ivan Date: Sat, 11 Aug 2001 05:52:56 +0000 Subject: add customer comments fields --- httemplate/view/cust_main.cgi | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 752896847..8b6fb0c09 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -210,7 +210,16 @@ print '
'; print ''; -print qq!

Packages !, +if ( defined $cust_main->dbdef_table->column('comments') ) { + print "
Comments", &ntable("#cccccc"), "", + &ntable("#cccccc",2), + '
', $cust_main->comments,
+        '
'; +} + +print ''; + +print qq!
Packages !, # qq!
Click on package number to view/edit package.!, qq!( Order and cancel packages (preserves services) )!, ; -- cgit v1.2.1 From cad8a048ce2d89814d1d3b0783310191bc76684e Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 13 Aug 2001 23:15:35 +0000 Subject: don't display empty comment box --- httemplate/view/cust_main.cgi | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 8b6fb0c09..088e2bb2f 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -210,7 +210,9 @@ print '
'; print ''; -if ( defined $cust_main->dbdef_table->column('comments') ) { +if ( defined $cust_main->dbdef_table->column('comments') + && $cust_main->comments ) +{ print "
Comments", &ntable("#cccccc"), "", &ntable("#cccccc",2), '
', $cust_main->comments,
-- 
cgit v1.2.1


From aa7b51c0794f6a61e522fbba978f6c64446d8696 Mon Sep 17 00:00:00 2001
From: ivan 
Date: Tue, 28 Aug 2001 14:34:14 +0000
Subject: customer-to-customer referrals!

---
 httemplate/view/cust_main.cgi | 30 ++++++++++++++++++++++++++++--
 1 file changed, 28 insertions(+), 2 deletions(-)

(limited to 'httemplate/view/cust_main.cgi')

diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 088e2bb2f..cba702670 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -1,5 +1,5 @@
 <%
-#
+#
 
 use strict;
 use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral 
@@ -43,8 +43,18 @@ print qq! Delete this customer!
   if $conf->exists('deletecustomers');
-print '

'; +unless ( $conf->exists('disable_customer_referrals') ) { + print qq! | !, + qq!Refer a new customer!; + + print qq! | !, + qq!View this customer's referrals!; +} + +print '

'; print '
'; print &itable(), ''; @@ -158,6 +168,22 @@ print ''; print 'Order taker', $cust_main->otaker, ''; + print 'Referring Customer'; + my $referring_cust_main = ''; + if ( $cust_main->referral_custnum + && ( $referring_cust_main = + qsearchs('cust_main', { custnum => $cust_main->referral_custnum } ) + ) + ) { + print ''. + $cust_main->referral_custnum. ': '. + ( $referring_cust_main->company + || $referring_cust_main->last. ', '. $referring_cust_main->first ). + ''; + } + print ''; + print ''; print '
'; -- cgit v1.2.1 From 6412f71a3557249225abf5eb2096ebad1729c585 Mon Sep 17 00:00:00 2001 From: jeff Date: Sat, 1 Sep 2001 21:52:20 +0000 Subject: add cust_credit_bill relating multiple invoices to credits --- httemplate/view/cust_main.cgi | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index cba702670..492183d11 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -357,9 +357,15 @@ foreach $bill (@bills) { @credits = qsearch('cust_credit',{'custnum'=>$custnum}); foreach $credit (@credits) { my($cref)=$credit->hashref; + my($credited)=$credit->credited; push @history, - $cref->{_date} . "\tCredit #" . $cref->{crednum} . ", (Balance \$" . - $cref->{credited} . ") by " . $cref->{otaker} . " - " . + $cref->{_date} . "\t" . + ($credited ? + (qq!!) : + "") . + "Credit #" . + $cref->{crednum} . ", (Balance \$" . + $credited . ")" . ($credited ? "" : "") . $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } ); -- cgit v1.2.1 From dbfb0ae501d5acba37f9348476d94b99a4c92450 Mon Sep 17 00:00:00 2001 From: ivan Date: Sun, 2 Sep 2001 07:49:52 +0000 Subject: things are starting to work again, sorta. --- httemplate/view/cust_main.cgi | 76 ++++++++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 26 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 492183d11..6ece5c2be 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -20,6 +20,8 @@ use FS::part_referral; use FS::agent; use FS::cust_main; use FS::cust_refund; +use FS::cust_bill_pay; +use FS::cust_credit_bill; $cgi = new CGI; &cgisuidsetup($cgi); @@ -329,6 +331,8 @@ print qq!

Payment History!, # major problem: this whole thing is way too sloppy. # minor problem: the description lines need better formatting. +# SHOULD SHOW UNAPPLIED PAYMENTS (now show unapplied credits) + @history = (); #needed for mod_perl :) @bills = qsearch('cust_bill',{'custnum'=>$custnum}); @@ -340,46 +344,66 @@ foreach $bill (@bills) { qq! (Balance \$! . $bill->owed . qq!)\t! . $bref->{charged} . qq!\t\t\t!; - my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); - my($payment); - foreach $payment (@payments) { - my($date,$invnum,$payby,$payinfo,$paid)=($payment->getfield('_date'), - $payment->getfield('invnum'), - $payment->getfield('payby'), - $payment->getfield('payinfo'), - $payment->getfield('paid'), + my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); +# my(@payments)=qsearch('cust_pay',{'invnum'=> $bref->{invnum} } ); +# my($payment); +# foreach $payment (@payments) { + foreach my $cust_bill_pay (@cust_bill_pay) { + my $payment = $cust_bill_pay->cust_pay; + my($date,$invnum,$payby,$payinfo,$paid)=($payment->_date, + $cust_bill_pay->invnum, + $payment->payby, + $payment->payinfo, + $cust_bill_pay->amount, ); push @history, "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; } + + my(@cust_credit_bill)= + qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); + foreach my $cust_credit_bill (@cust_credit_bill) { + my $cust_credit = $cust_credit_bill->cust_credit; + my($date, $invnum, $crednum, $amount, $reason ) = ( + $cust_credit->_date, + $cust_credit_bill->invnum, + $cust_credit_bill->crednum, + $cust_credit_bill->amount, + $cust_credit->reason, + ); + push @history, + "$date\tCredit #$crednum, Invoice #$invnum $reason\t\t\t$amount\t"; + } } -@credits = qsearch('cust_credit',{'custnum'=>$custnum}); +@credits = grep $_->credited, qsearch('cust_credit',{'custnum'=>$custnum}); foreach $credit (@credits) { my($cref)=$credit->hashref; - my($credited)=$credit->credited; push @history, $cref->{_date} . "\t" . - ($credited ? - (qq!!) : - "") . - "Credit #" . + qq!!. + 'Unapplied credit #' . $cref->{crednum} . ", (Balance \$" . - $credited . ")" . ($credited ? "" : "") . + $credit->credited . ") ". $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; +} - my(@refunds)=qsearch('cust_refund',{'crednum'=> $cref->{crednum} } ); - my($refund); - foreach $refund (@refunds) { - my($rref)=$refund->hashref; - push @history, - $rref->{_date} . "\tRefund, Credit #" . $rref->{crednum} . " (" . - $rref->{payby} . " " . $rref->{payinfo} . ") by " . - $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . - $rref->{refund}; - } +my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); +my($refund); +foreach $refund (@refunds) { + my($rref)=$refund->hashref; + my($refundnum) = ( + $refund->refundnum, + ); + + push @history, + $rref->{_date} . "\tRefund #$refundnum, (" . + $rref->{payby} . " " . $rref->{payinfo} . ") by " . + $rref->{otaker} . " - ". $rref->{reason} . "\t\t\t\t" . + $rref->{refund}; } + #formatting print &table(), < -- cgit v1.2.1 From fbcb45dfe5a1bce7981fe4527176b9fdf2ec54b7 Mon Sep 17 00:00:00 2001 From: ivan Date: Mon, 3 Sep 2001 22:07:39 +0000 Subject: fix more bugs --- httemplate/view/cust_main.cgi | 59 +++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 22 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index 6ece5c2be..a32abc0e1 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -192,7 +192,7 @@ print '
'; @invoicing_list = $cust_main->invoicing_list; print "Billing information (", - qq!!, "Bill now)", + qq!!, "Bill now)", &ntable("#cccccc"), "", &ntable("#cccccc",2), 'Tax exempt', $cust_main->tax ? 'yes' : 'no', @@ -269,9 +269,9 @@ print qq!!, &table(), "\n", #get package info if ( $conf->exists('hidecancelledpackages') ) { - @packages = $cust_main->ncancelled_pkgs; + @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->ncancelled_pkgs); } else { - @packages = $cust_main->all_pkgs; + @packages = sort { $a->pkgnum <=> $b->pkgnum } ($cust_main->all_pkgs); } $n1 = ''; @@ -320,28 +320,31 @@ print ""; print ""; #formatting -print qq!

Payment History!, - qq!!, - qq! ( Click on invoice to view invoice/enter payment. | !, - qq!!, - qq!Post credit / refund )!; +print qq!

Payment History!. + qq! ( !. + qq!!. + qq!Post payment | !. + qq!!. + qq!Post credit )!; #get payment history # # major problem: this whole thing is way too sloppy. # minor problem: the description lines need better formatting. -# SHOULD SHOW UNAPPLIED PAYMENTS (now show unapplied credits) - @history = (); #needed for mod_perl :) @bills = qsearch('cust_bill',{'custnum'=>$custnum}); foreach $bill (@bills) { my($bref)=$bill->hashref; + my $bpre = ( $bill->owed > 0 ) + ? ' Open ' + : ''; + my $bpost = ( $bill->owed > 0 ) ? '' : ''; push @history, $bref->{_date} . qq!\tInvoice #! . $bref->{invnum} . - qq! (Balance \$! . $bill->owed . qq!)\t! . + $bref->{invnum} . qq!">${bpre}Invoice #! . $bref->{invnum} . + qq! (Balance \$! . $bill->owed . qq!)$bpost\t! . $bref->{charged} . qq!\t\t\t!; my(@cust_bill_pay)=qsearch('cust_bill_pay',{'invnum'=> $bref->{invnum} } ); @@ -356,6 +359,7 @@ foreach $bill (@bills) { $payment->payinfo, $cust_bill_pay->amount, ); + $payinfo = substr($payinfo,0,4). 'x'x(length($payinfo)-4) if $payby eq 'CARD'; push @history, "$date\tPayment, Invoice #$invnum ($payby $payinfo)\t\t$paid\t\t"; } @@ -364,33 +368,34 @@ foreach $bill (@bills) { qsearch('cust_credit_bill', { 'invnum'=> $bref->{invnum} } ); foreach my $cust_credit_bill (@cust_credit_bill) { my $cust_credit = $cust_credit_bill->cust_credit; - my($date, $invnum, $crednum, $amount, $reason ) = ( + my($date, $invnum, $crednum, $amount, $reason, $app_date ) = ( $cust_credit->_date, $cust_credit_bill->invnum, $cust_credit_bill->crednum, $cust_credit_bill->amount, $cust_credit->reason, + time2str("%D", $cust_credit_bill->_date), ); push @history, - "$date\tCredit #$crednum, Invoice #$invnum $reason\t\t\t$amount\t"; + "$date\tCredit #$crednum: $reason
". + "(applied to invoice #$invnum on $app_date)\t\t\t$amount\t"; } } -@credits = grep $_->credited, qsearch('cust_credit',{'custnum'=>$custnum}); +@credits = grep { $_->credited > 0 } + qsearch('cust_credit',{'custnum'=>$custnum}); foreach $credit (@credits) { my($cref)=$credit->hashref; push @history, $cref->{_date} . "\t" . qq!!. - 'Unapplied credit #' . - $cref->{crednum} . ", (Balance \$" . - $credit->credited . ") ". - $cref->{reason} . "\t\t\t" . $cref->{amount} . "\t"; + 'Unapplied credit #' . + $cref->{crednum} . ": ". + $cref->{reason} . "\t\t\t" . $credit->credited . "\t"; } my(@refunds)=qsearch('cust_refund',{'custnum'=> $custnum } ); -my($refund); -foreach $refund (@refunds) { +foreach my $refund (@refunds) { my($rref)=$refund->hashref; my($refundnum) = ( $refund->refundnum, @@ -403,6 +408,16 @@ foreach $refund (@refunds) { $rref->{refund}; } +my @unapplied_payments = + grep { $_->unapplied > 0 } qsearch('cust_pay', { 'custnum' => $custnum } ); +foreach my $payment (@unapplied_payments) { + push @history, + $payment->_date. "\t". + ''. + 'Unapplied payment #' . + $payment->paynum . "". + "\t\t" . $payment->unapplied . "\t\t"; +} #formatting print &table(), < Date: Tue, 4 Sep 2001 14:44:07 +0000 Subject: new admin documentation, quick one-pkg order --- httemplate/view/cust_main.cgi | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index a32abc0e1..b3ea336e9 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -153,11 +153,11 @@ print ''; @agents = qsearch( 'agent', {} ); unless ( scalar(@agents) == 1 ) { - $agent = qsearchs('agent',{ - 'agentnum' => $cust_main->agentnum - } ); + $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } ); print 'Agent', $agent->agentnum, ": ", $agent->agent, ''; + } else { + $agent = $agents[0]; } @referrals = qsearch( 'part_referral', {} ); unless ( scalar(@referrals) == 1 ) { @@ -249,6 +249,21 @@ if ( defined $cust_main->dbdef_table->column('comments') print ''; +print '
'. + '
'. + qq!!. + '
'; + print qq!
Packages !, # qq!
Click on package number to view/edit package.!, qq!( Order and cancel packages (preserves services) )!, -- cgit v1.2.1 From 89301379ac6f1e2ebab203e458849001d3f8fb49 Mon Sep 17 00:00:00 2001 From: ivan Date: Tue, 11 Sep 2001 09:56:27 +0000 Subject: fix quick order --- httemplate/view/cust_main.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'httemplate/view/cust_main.cgi') diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi index b3ea336e9..174c08760 100755 --- a/httemplate/view/cust_main.cgi +++ b/httemplate/view/cust_main.cgi @@ -1,5 +1,5 @@ <% -# +# use strict; use vars qw ( $cgi $query $custnum $cust_main $hashref $agent $referral @@ -252,7 +252,7 @@ print ''; print '
'. ''. qq!!. - '