1 package FS::UI::Web::small_custview;
4 use vars qw(@EXPORT_OK @ISA);
8 use FS::Record qw(qsearchs);
12 @EXPORT_OK = qw( small_custview );
14 =item small_custview CUSTNUM || CUST_MAIN_OBJECT, COUNTRYDEFAULT, NOBALANCE_FLAG, URL
16 Sheesh. I did switch to mason, but this is still hanging around. Figure out
17 some better way to sling mason components to self-service & RT.
24 my $countrydefault = shift || 'US';
25 my $nobalance = shift;
28 my $cust_main = ref($arg) ? $arg
29 : qsearchs('cust_main', { 'custnum' => $arg } )
30 or die "unknown custnum $arg";
32 my $html = '<DIV ID="fs_small_custview">';
34 $html = qq!View <A HREF="$url?! . $cust_main->custnum . '">'
37 $html .= 'Customer #<B>'. $cust_main->display_custnum. '</B></A>'.
38 ' - <B><FONT COLOR="#'. $cust_main->statuscolor. '">'.
39 ucfirst($cust_main->status). '</FONT></B>';
41 my @part_tag = $cust_main->part_tag;
44 foreach my $part_tag ( @part_tag ) {
46 '<FONT '. ( length($part_tag->tagcolor)
47 ? 'STYLE="background-color:#'.$part_tag->tagcolor.'"'
51 encode_entities($part_tag->tagname.': '. $part_tag->tagdesc).
59 ntable('#e8e8e8'). '<TR><TD VALIGN="top">'. ntable("#cccccc",2).
60 '<TR><TD ALIGN="right" VALIGN="top">Billing<BR>Address</TD><TD BGCOLOR="#ffffff">'.
61 encode_entities($cust_main->getfield('last')). ', '.
62 encode_entities($cust_main->first). '<BR>';
64 $html .= encode_entities($cust_main->company). '<BR>' if $cust_main->company;
65 $html .= encode_entities($cust_main->address1). '<BR>';
66 $html .= encode_entities($cust_main->address2). '<BR>' if $cust_main->address2;
67 $html .= encode_entities($cust_main->city). ', '. $cust_main->state. ' '. $cust_main->zip. '<BR>';
68 $html .= $cust_main->country. '<BR>'
69 if $cust_main->country && $cust_main->country ne $countrydefault;
71 $html .= '</TD></TR><TR><TD></TD><TD BGCOLOR="#ffffff">';
72 if ( $cust_main->daytime && $cust_main->night ) {
73 $html .= ( FS::Msgcat::_gettext('daytime') || 'Day' ).
74 ' '. $cust_main->daytime.
75 '<BR>'. ( FS::Msgcat::_gettext('night') || 'Night' ).
76 ' '. $cust_main->night;
77 } elsif ( $cust_main->daytime || $cust_main->night ) {
78 $html .= $cust_main->daytime || $cust_main->night;
80 if ( $cust_main->fax ) {
81 $html .= '<BR>Fax '. $cust_main->fax;
84 $html .= '</TD></TR></TABLE></TD>';
86 if ( defined $cust_main->dbdef_table->column('ship_last') ) {
88 my $pre = $cust_main->ship_last ? 'ship_' : '';
90 $html .= '<TD VALIGN="top">'. ntable("#cccccc",2).
91 '<TR><TD ALIGN="right" VALIGN="top">Service<BR>Address</TD><TD BGCOLOR="#ffffff">'.
92 encode_entities($cust_main->get("${pre}last")). ', '.
93 encode_entities($cust_main->get("${pre}first")). '<BR>';
94 $html .= encode_entities($cust_main->get("${pre}company")). '<BR>'
95 if $cust_main->get("${pre}company");
96 $html .= encode_entities($cust_main->get("${pre}address1")). '<BR>';
97 $html .= encode_entities($cust_main->get("${pre}address2")). '<BR>'
98 if $cust_main->get("${pre}address2");
99 $html .= encode_entities($cust_main->get("${pre}city")). ', '.
100 $cust_main->get("${pre}state"). ' '.
101 $cust_main->get("${pre}zip"). '<BR>';
102 $html .= $cust_main->get("${pre}country"). '<BR>'
103 if $cust_main->get("${pre}country")
104 && $cust_main->get("${pre}country") ne $countrydefault;
106 $html .= '</TD></TR><TR><TD></TD><TD BGCOLOR="#ffffff">';
108 if ( $cust_main->get("${pre}daytime") && $cust_main->get("${pre}night") ) {
110 $html .= ( FS::Msgcat::_gettext('daytime') || 'Day' ).
111 ' '. $cust_main->get("${pre}daytime").
112 '<BR>'. ( FS::Msgcat::_gettext('night') || 'Night' ).
113 ' '. $cust_main->get("${pre}night");
114 } elsif ( $cust_main->get("${pre}daytime")
115 || $cust_main->get("${pre}night") ) {
116 $html .= $cust_main->get("${pre}daytime")
117 || $cust_main->get("${pre}night");
119 if ( $cust_main->get("${pre}fax") ) {
120 $html .= '<BR>Fax '. $cust_main->get("${pre}fax");
123 $html .= '</TD></TR></TABLE></TD>';
126 $html .= '</TR></TABLE>';
128 $html .= '<BR>Balance: <B>$'. $cust_main->balance. '</B><BR>'
131 # last payment might be good here too?
138 #bah. don't want to pull in all of FS::CGI, that's the whole problem in the
142 my $cellspacing = shift || 0;
144 qq!<TABLE BGCOLOR="$col" BORDER=0 CELLSPACING=$cellspacing>!;
146 '<TABLE BORDER CELLSPACING=0 CELLPADDING=2 BORDERCOLOR="#999999">';