1 package FS::UI::Web::small_custview;
4 use vars qw(@EXPORT_OK @ISA);
7 use FS::Record qw(qsearchs);
11 @EXPORT_OK = qw( small_custview );
13 =item small_custview CUSTNUM || CUST_MAIN_OBJECT, COUNTRYDEFAULT, NOBALANCE_FLAG, URL
15 Sheesh. I did switch to mason, but this is still hanging around. Figure out
16 some better way to sling mason components to self-service & RT.
23 my $countrydefault = shift || 'US';
24 my $nobalance = shift;
27 my $cust_main = ref($arg) ? $arg
28 : qsearchs('cust_main', { 'custnum' => $arg } )
29 or die "unknown custnum $arg";
33 $html = qq!View <A HREF="$url?! . $cust_main->custnum . '">'
36 $html .= 'Customer #<B>'. $cust_main->display_custnum. '</B></A>'.
37 ' - <B><FONT COLOR="#'. $cust_main->statuscolor. '">'.
38 ucfirst($cust_main->status). '</FONT></B>'.
39 ntable('#e8e8e8'). '<TR><TD VALIGN="top">'. ntable("#cccccc",2).
40 '<TR><TD ALIGN="right" VALIGN="top">Billing<BR>Address</TD><TD BGCOLOR="#ffffff">'.
41 $cust_main->getfield('last'). ', '. $cust_main->first. '<BR>';
43 $html .= $cust_main->company. '<BR>' if $cust_main->company;
44 $html .= $cust_main->address1. '<BR>';
45 $html .= $cust_main->address2. '<BR>' if $cust_main->address2;
46 $html .= $cust_main->city. ', '. $cust_main->state. ' '. $cust_main->zip. '<BR>';
47 $html .= $cust_main->country. '<BR>'
48 if $cust_main->country && $cust_main->country ne $countrydefault;
50 $html .= '</TD></TR><TR><TD></TD><TD BGCOLOR="#ffffff">';
51 if ( $cust_main->daytime && $cust_main->night ) {
52 $html .= ( FS::Msgcat::_gettext('daytime') || 'Day' ).
53 ' '. $cust_main->daytime.
54 '<BR>'. ( FS::Msgcat::_gettext('night') || 'Night' ).
55 ' '. $cust_main->night;
56 } elsif ( $cust_main->daytime || $cust_main->night ) {
57 $html .= $cust_main->daytime || $cust_main->night;
59 if ( $cust_main->fax ) {
60 $html .= '<BR>Fax '. $cust_main->fax;
63 $html .= '</TD></TR></TABLE></TD>';
65 if ( defined $cust_main->dbdef_table->column('ship_last') ) {
67 my $pre = $cust_main->ship_last ? 'ship_' : '';
69 $html .= '<TD VALIGN="top">'. ntable("#cccccc",2).
70 '<TR><TD ALIGN="right" VALIGN="top">Service<BR>Address</TD><TD BGCOLOR="#ffffff">'.
71 $cust_main->get("${pre}last"). ', '.
72 $cust_main->get("${pre}first"). '<BR>';
73 $html .= $cust_main->get("${pre}company"). '<BR>'
74 if $cust_main->get("${pre}company");
75 $html .= $cust_main->get("${pre}address1"). '<BR>';
76 $html .= $cust_main->get("${pre}address2"). '<BR>'
77 if $cust_main->get("${pre}address2");
78 $html .= $cust_main->get("${pre}city"). ', '.
79 $cust_main->get("${pre}state"). ' '.
80 $cust_main->get("${pre}zip"). '<BR>';
81 $html .= $cust_main->get("${pre}country"). '<BR>'
82 if $cust_main->get("${pre}country")
83 && $cust_main->get("${pre}country") ne $countrydefault;
85 $html .= '</TD></TR><TR><TD></TD><TD BGCOLOR="#ffffff">';
87 if ( $cust_main->get("${pre}daytime") && $cust_main->get("${pre}night") ) {
89 $html .= ( FS::Msgcat::_gettext('daytime') || 'Day' ).
90 ' '. $cust_main->get("${pre}daytime").
91 '<BR>'. ( FS::Msgcat::_gettext('night') || 'Night' ).
92 ' '. $cust_main->get("${pre}night");
93 } elsif ( $cust_main->get("${pre}daytime")
94 || $cust_main->get("${pre}night") ) {
95 $html .= $cust_main->get("${pre}daytime")
96 || $cust_main->get("${pre}night");
98 if ( $cust_main->get("${pre}fax") ) {
99 $html .= '<BR>Fax '. $cust_main->get("${pre}fax");
102 $html .= '</TD></TR></TABLE></TD>';
105 $html .= '</TR></TABLE>';
107 $html .= '<BR>Balance: <B>$'. $cust_main->balance. '</B><BR>'
110 # last payment might be good here too?
115 #bah. don't want to pull in all of FS::CGI, that's the whole problem in the
119 my $cellspacing = shift || 0;
121 qq!<TABLE BGCOLOR="$col" BORDER=0 CELLSPACING=$cellspacing>!;
123 '<TABLE BORDER CELLSPACING=0 CELLPADDING=2 BORDERCOLOR="#999999">';