-#referral
-
-$refnum = $cust_main->refnum || $conf->config('referraldefault') || 0;
-if ( $custnum && ! $conf->exists('editreferrals') ) {
- print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
-} else {
- my(@referrals) = qsearch('part_referral',{});
- if ( scalar(@referrals) == 1 ) {
- $refnum ||= $referrals[0]->refnum;
- print qq!<INPUT TYPE="hidden" NAME="refnum" VALUE="$refnum">!;
- } else {
- print qq!<BR><BR>${r}Referral <SELECT NAME="refnum" SIZE="1">!;
- print "<OPTION> " unless $refnum;
- my($referral);
- foreach $referral (sort {
- $a->refnum <=> $b->refnum;
- } @referrals) {
- print "<OPTION" . " SELECTED"x($referral->refnum==$refnum),
- ">", $referral->refnum, ": ", $referral->referral;
- }
- print "</SELECT>";
- }
-}
-
-#referring customer
-
-print qq!<BR><BR>Referring Customer: !;
-if ( $cust_main->referral_custnum ) {
- my $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><INPUT TYPE="hidden" NAME="referral_custnum" VALUE="'.
- $cust_main->referral_custnum. '">';
-} else {
- print '(none)<INPUT TYPE="hidden" NAME="referral_custnum" VALUE="">';
-}
-
-# contact info
-
-($last,$first,$ss,$company,$address1,$address2,$city,$zip)=(
- $cust_main->last,
- $cust_main->first,
- $cust_main->ss,
- $cust_main->company,
- $cust_main->address1,
- $cust_main->address2,
- $cust_main->city,
- $cust_main->zip,
-);
-
-print "<BR><BR>Billing address", &itable("#cccccc"), <<END;
-<TR><TH ALIGN="right">${r}Contact name<BR>(last, first)</TH><TD COLSPAN=3>
-END
-
-print <<END;
-<INPUT TYPE="text" NAME="last" VALUE="$last"> ,
-<INPUT TYPE="text" NAME="first" VALUE="$first">
-END
-
-print <<END;
-</TD><TD ALIGN="right">SS#</TD><TD><INPUT TYPE="text" NAME="ss" VALUE="$ss" SIZE=11></TD></TR>
-<TR><TD ALIGN="right">Company</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="company" VALUE="$company" SIZE=70></TD></TR>
-<TR><TH ALIGN="right">${r}Address</TH><TD COLSPAN=5><INPUT TYPE="text" NAME="address1" VALUE="$address1" SIZE=70></TD></TR>
-<TR><TD ALIGN="right"> </TD><TD COLSPAN=5><INPUT TYPE="text" NAME="address2" VALUE="$address2" SIZE=70></TD></TR>
-<TR><TH ALIGN="right">${r}City</TH><TD><INPUT TYPE="text" NAME="city" VALUE="$city"></TD><TH ALIGN="right">${r}State/Country</TH><TD><SELECT NAME="state" SIZE="1">
-END
-
-$cust_main->country( $conf->config('countrydefault') || 'US' )
- unless $cust_main->country;
-$cust_main->state( $conf->config('statedefault') || 'CA' )
- unless $cust_main->state || $cust_main->country ne 'US';
-foreach ( qsearch('cust_main_county',{}) ) {
- print "<OPTION";
- print " SELECTED" if ( $cust_main->state eq $_->state
- && $cust_main->county eq $_->county
- && $cust_main->country eq $_->country
- );
- print ">",$_->state;
- print " (",$_->county,")" if $_->county;
- print " / ", $_->country;
-}
-print qq!</SELECT></TD><TH>${r}Zip</TH><TD><INPUT TYPE="text" NAME="zip" VALUE="$zip" SIZE=10></TD></TR>!;
-
-($daytime,$night,$fax)=(
- $cust_main->daytime,
- $cust_main->night,
- $cust_main->fax,
-);
-
-print <<END;
-<TR><TD ALIGN="right">Day Phone</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="daytime" VALUE="$daytime" SIZE=18></TD></TR>
-<TR><TD ALIGN="right">Night Phone</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="night" VALUE="$night" SIZE=18></TD></TR>
-<TR><TD ALIGN="right">Fax</TD><TD COLSPAN=5><INPUT TYPE="text" NAME="fax" VALUE="$fax" SIZE=12></TD></TR>
-END