-print '<A NAME="cust_main"></A>';
-
-print &itable(), '<TR>';
-
-print '<TD VALIGN="top">';
-
- print "Billing address", &ntable("#cccccc"), "<TR><TD>",
- &ntable("#cccccc",2),
- '<TR><TD ALIGN="right">Contact name</TD>',
- '<TD COLSPAN=3 BGCOLOR="#ffffff">',
- $cust_main->last, ', ', $cust_main->first,
- '</TD><TD ALIGN="right">SS#</TD><TD BGCOLOR="#ffffff">',
- $cust_main->ss || ' ', '</TD></TR>',
- '<TR><TD ALIGN="right">Company</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->company,
- '</TD></TR>',
- '<TR><TD ALIGN="right">Address</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->address1,
- '</TD></TR>',
- ;
- print '<TR><TD ALIGN="right"> </TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->address2, '</TD></TR>'
- if $cust_main->address2;
- print '<TR><TD ALIGN="right">City</TD><TD BGCOLOR="#ffffff">',
- $cust_main->city,
- '</TD><TD ALIGN="right">State</TD><TD BGCOLOR="#ffffff">',
- $cust_main->state,
- '</TD><TD ALIGN="right">Zip</TD><TD BGCOLOR="#ffffff">',
- $cust_main->zip, '</TD></TR>',
- '<TR><TD ALIGN="right">Country</TD><TD BGCOLOR="#ffffff">',
- $cust_main->country,
- '</TD></TR>',
- ;
- print '<TR><TD ALIGN="right">Day Phone</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->daytime || ' ', '</TD></TR>',
- '<TR><TD ALIGN="right">Night Phone</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->night || ' ', '</TD></TR>',
- '<TR><TD ALIGN="right">Fax</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->fax || ' ', '</TD></TR>',
- '</TABLE>', "</TD></TR></TABLE>"
- ;
-
- if ( defined $cust_main->dbdef_table->column('ship_last') ) {
-
- my $pre = $cust_main->ship_last ? 'ship_' : '';
-
- print "<BR>Service address", &ntable("#cccccc"), "<TR><TD>",
- &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"),
- '</TD></TR>',
- '<TR><TD ALIGN="right">Company</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $cust_main->get("${pre}company"),
- '</TD></TR>',
- '<TR><TD ALIGN="right">Address</TD><TD COLSPAN=5 BGCOLOR="#ffffff">',
- $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");
- print '<TR><TD ALIGN="right">City</TD><TD BGCOLOR="#ffffff">',
- $cust_main->get("${pre}city"),
- '</TD><TD ALIGN="right">State</TD><TD BGCOLOR="#ffffff">',
- $cust_main->get("${pre}state"),
- '</TD><TD ALIGN="right">Zip</TD><TD BGCOLOR="#ffffff">',
- $cust_main->get("${pre}zip"), '</TD></TR>',
- '<TR><TD ALIGN="right">Country</TD><TD BGCOLOR="#ffffff">',
- $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>',
- '<TR><TD ALIGN="right">Night Phone</TD>'.
- '<TD COLSPAN=5 BGCOLOR="#ffffff">',
- $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>',
- '</TABLE>', "</TD></TR></TABLE>"
- ;
-
- }
-
-print '</TD>';
-
-print '<TD VALIGN="top">';
-
- print &ntable("#cccccc"), "<TR><TD>", &ntable("#cccccc",2),
- '<TR><TD ALIGN="right">Customer number</TD><TD BGCOLOR="#ffffff">',
- $custnum, '</TD></TR>',
- ;
-
- @agents = qsearch( 'agent', {} );
- unless ( scalar(@agents) == 1 ) {
- $agent = qsearchs('agent',{ 'agentnum' => $cust_main->agentnum } );
- print '<TR><TD ALIGN="right">Agent</TD><TD BGCOLOR="#ffffff">',
- $agent->agentnum, ": ", $agent->agent, '</TD></TR>';
- } else {
- $agent = $agents[0];
- }
- @referrals = qsearch( 'part_referral', {} );
- unless ( scalar(@referrals) == 1 ) {
- my $referral = qsearchs('part_referral', {
- 'refnum' => $cust_main->refnum
- } );
- print '<TR><TD ALIGN="right">Referral</TD><TD BGCOLOR="#ffffff">',
- $referral->refnum, ": ", $referral->referral, '</TD></TR>';
- }
- 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->company. ' ('.
- $referring_cust_main->last. ', '. $referring_cust_main->first.
- ')'
- : $referring_cust_main->last. ', '. $referring_cust_main->first
- ).
- '</A>';
- }
- print '</TD></TR>';
-
- print '</TABLE></TD></TR></TABLE>';
-
-print '<BR>';
-
- @invoicing_list = $cust_main->invoicing_list;
- print "Billing information (",
- qq!<A HREF="!, popurl(2), qq!misc/bill.cgi?$custnum">!, "Bill now</A>)",
- &ntable("#cccccc"), "<TR><TD>", &ntable("#cccccc",2),
- '<TR><TD ALIGN="right">Tax exempt</TD><TD BGCOLOR="#ffffff">',
- $cust_main->tax ? 'yes' : 'no',
- '</TD></TR>',
- '<TR><TD ALIGN="right">Postal invoices</TD><TD BGCOLOR="#ffffff">',
- ( grep { $_ eq 'POST' } @invoicing_list ) ? 'yes' : 'no',
- '</TD></TR>',
- '<TR><TD ALIGN="right">Email invoices</TD><TD BGCOLOR="#ffffff">',
- join(', ', grep { $_ ne 'POST' } @invoicing_list ) || 'no',
- '</TD></TR>',
- '<TR><TD ALIGN="right">Billing type</TD><TD BGCOLOR="#ffffff">',
- ;
-
- if ( $cust_main->payby eq 'CARD' ) {
- print 'Credit card</TD></TR>',
- '<TR><TD ALIGN="right">Card number</TD><TD BGCOLOR="#ffffff">',
- $cust_main->payinfo, '</TD></TR>',
- '<TR><TD ALIGN="right">Expiration</TD><TD BGCOLOR="#ffffff">',
- $cust_main->paydate, '</TD></TR>',
- '<TR><TD ALIGN="right">Name on card</TD><TD BGCOLOR="#ffffff">',
- $cust_main->payname, '</TD></TR>'
- ;
- } elsif ( $cust_main->payby eq 'BILL' ) {
- print 'Billing</TD></TR>';
- print '<TR><TD ALIGN="right">P.O. </TD><TD BGCOLOR="#ffffff">',
- $cust_main->payinfo, '</TD></TR>',
- if $cust_main->payinfo;
- print '<TR><TD ALIGN="right">Expiration</TD><TD BGCOLOR="#ffffff">',
- $cust_main->paydate, '</TD></TR>',
- '<TR><TD ALIGN="right">Attention</TD><TD BGCOLOR="#ffffff">',
- $cust_main->payname, '</TD></TR>',
- ;
- } elsif ( $cust_main->payby eq 'COMP' ) {
- print 'Complimentary</TD></TR>',
- '<TR><TD ALIGN="right">Authorized by</TD><TD BGCOLOR="#ffffff">',
- $cust_main->payinfo, '</TD></TR>',
- '<TR><TD ALIGN="right">Expiration</TD><TD BGCOLOR="#ffffff">',
- $cust_main->paydate, '</TD></TR>',
- ;
- }
-
- print "</TABLE></TD></TR></TABLE>";
-
-print '</TD></TR></TABLE>';
-
-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>';
-}