-<!-- $Id: cust_main.cgi,v 1.1 2001-07-30 07:36:04 ivan Exp $ -->
<%
+#<!-- $Id: cust_main.cgi,v 1.5 2001-08-28 14:34:14 ivan Exp $ -->
+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 );
print qq! | <A HREF="!, popurl(2),
qq!misc/delete-customer.cgi?$custnum"> Delete this customer</A>!
if $conf->exists('deletecustomers');
-print '<BR><BR>';
+unless ( $conf->exists('disable_customer_referrals') ) {
+ print qq! | <A HREF="!, popurl(2),
+ qq!edit/cust_main.cgi?referral_custnum=$custnum">!,
+ qq!Refer a new customer</A>!;
+
+ print qq! | <A HREF="!, popurl(2),
+ qq!search/cust_main.cgi?referral_custnum=$custnum">!,
+ qq!View this customer's referrals<A>!;
+}
+
+print '<BR><BR>';
print '<A NAME="cust_main"></A>';
print &itable(), '<TR>';
&ntable("#cccccc",2),
'<TR><TD ALIGN="right">Contact name</TD>',
'<TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}last"), ', ', $cust_main->get("${$pre}first"),
+ $cust_main->get("${pre}last"), ', ', $cust_main->get("${pre}first"),
'</TD></TR>',
'<TR><TD ALIGN="right">Company</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}company"),
+ $cust_main->get("${pre}company"),
'</TD></TR>',
'<TR><TD ALIGN="right">Address</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}address1"),
+ $cust_main->get("${pre}address1"),
'</TD></TR>',
;
print '<TR><TD ALIGN="right"> </TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}address2"), '</TD></TR>'
- if $cust_main->get("${$pre}address2");
+ $cust_main->get("${pre}address2"), '</TD></TR>'
+ if $cust_main->get("${pre}address2");
print '<TR><TD ALIGN="right">City</TD><TD BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}city"),
+ $cust_main->get("${pre}city"),
'</TD><TD ALIGN="right">State</TD><TD BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}state"),
+ $cust_main->get("${pre}state"),
'</TD><TD ALIGN="right">Zip</TD><TD BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}zip"), '</TD></TR>',
+ $cust_main->get("${pre}zip"), '</TD></TR>',
'<TR><TD ALIGN="right">Country</TD><TD BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}country"),
+ $cust_main->get("${pre}country"),
'</TD></TR>',
;
print '<TR><TD ALIGN="right">Day Phone</TD>',
'<TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}daytime") || ' ', '</TD></TR>',
+ $cust_main->get("${pre}daytime") || ' ', '</TD></TR>',
'<TR><TD ALIGN="right">Night Phone</TD>'.
'<TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}night") || ' ', '</TD></TR>',
+ $cust_main->get("${pre}night") || ' ', '</TD></TR>',
'<TR><TD ALIGN="right">Fax</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->get("${$pre}fax") || ' ', '</TD></TR>',
+ $cust_main->get("${pre}fax") || ' ', '</TD></TR>',
'</TABLE>', "</TD></TR></TABLE>"
;
print '<TR><TD ALIGN="right">Order taker</TD><TD BGCOLOR="#ffffff">',
$cust_main->otaker, '</TD></TR>';
+ print '<TR><TD ALIGN="right">Referring Customer</TD><TD BGCOLOR="#ffffff">';
+ my $referring_cust_main = '';
+ if ( $cust_main->referral_custnum
+ && ( $referring_cust_main =
+ qsearchs('cust_main', { custnum => $cust_main->referral_custnum } )
+ )
+ ) {
+ print '<A HREF="'. popurl(1). 'cust_main.cgi?'.
+ $cust_main->referral_custnum. '">'.
+ $cust_main->referral_custnum. ': '.
+ ( $referring_cust_main->company
+ || $referring_cust_main->last. ', '. $referring_cust_main->first ).
+ '</A>';
+ }
+ print '</TD></TR>';
+
print '</TABLE></TD></TR></TABLE>';
print '<BR>';
print '</TD></TR></TABLE>';
-print qq!<BR><BR><A NAME="cust_pkg">Packages</A> !,
+if ( defined $cust_main->dbdef_table->column('comments')
+ && $cust_main->comments )
+{
+ print "<BR>Comments", &ntable("#cccccc"), "<TR><TD>",
+ &ntable("#cccccc",2),
+ '<TR><TD BGCOLOR="#ffffff"><PRE>', $cust_main->comments,
+ '</PRE></TD></TR></TABLE></TABLE>';
+}
+
+print '</TD></TR></TABLE>';
+
+print qq!<BR><A NAME="cust_pkg">Packages</A> !,
# qq!<BR>Click on package number to view/edit package.!,
qq!( <A HREF="!, popurl(2), qq!edit/cust_pkg.cgi?$custnum">Order and cancel packages</A> (preserves services) )!,
;