diff options
Diffstat (limited to 'httemplate/search/cust_main.cgi')
-rwxr-xr-x | httemplate/search/cust_main.cgi | 169 |
1 files changed, 113 insertions, 56 deletions
diff --git a/httemplate/search/cust_main.cgi b/httemplate/search/cust_main.cgi index 733e5dc15..f6841a099 100755 --- a/httemplate/search/cust_main.cgi +++ b/httemplate/search/cust_main.cgi @@ -109,6 +109,7 @@ if ( $cgi->param('browse') push @qual, FS::cust_main->cancel_sql if $cgi->param('cancelled'); push @qual, FS::cust_main->prospect_sql if $cgi->param('prospect'); push @qual, FS::cust_main->active_sql if $cgi->param('active'); + push @qual, FS::cust_main->inactive_sql if $cgi->param('inactive'); push @qual, FS::cust_main->susp_sql if $cgi->param('suspended'); #EWWWWWW @@ -117,6 +118,10 @@ if ( $cgi->param('browse') my $addl_qual = join(' AND ', @qual); + #here is the agent virtualization + $addl_qual .= ( $addl_qual ? ' AND ' : '' ). + $FS::CurrentUser::CurrentUser->agentnums_sql; + if ( $addl_qual ) { $qual .= ' AND ' if $qual; $qual .= $addl_qual; @@ -322,32 +327,43 @@ END print "<BR><BR>". $pager. include('/elements/table-grid.html'). <<END; <TR> - <TH></TH> - <TH>(bill) name</TH> - <TH>company</TH> + <TH CLASS="grid" BGCOLOR="#cccccc"></TH> + <TH CLASS="grid" BGCOLOR="#cccccc">(bill) name</TH> + <TH CLASS="grid" BGCOLOR="#cccccc">company</TH> END if ( defined dbdef->table('cust_main')->column('ship_last') ) { print <<END; - <TH>(service) name</TH> - <TH>company</TH> + <TH CLASS="grid" BGCOLOR="#cccccc">(service) name</TH> + <TH CLASS="grid" BGCOLOR="#cccccc">company</TH> END } foreach my $addl_header ( @addl_headers ) { - print "<TH>$addl_header</TH>"; + print '<TH CLASS="grid" BGCOLOR="#cccccc">'. "$addl_header</TH>"; } print <<END; - <TH>Packages</TH> - <TH COLSPAN=2>Services</TH> + <TH CLASS="grid" BGCOLOR="#cccccc">Packages</TH> + <TH CLASS="grid" BGCOLOR="#cccccc" COLSPAN=2>Services</TH> </TR> END + my $bgcolor1 = '#eeeeee'; + my $bgcolor2 = '#ffffff'; + my $bgcolor; + my(%saw,$cust_main); foreach $cust_main ( sort $sortby grep(!$saw{$_->custnum}++, @cust_main) ) { + + if ( $bgcolor eq $bgcolor1 ) { + $bgcolor = $bgcolor2; + } else { + $bgcolor = $bgcolor1; + } + my($custnum,$last,$first,$company)=( $cust_main->custnum, $cust_main->getfield('last'), @@ -377,9 +393,9 @@ END %> <TR> - <TD ROWSPAN=<%= $rowspan || 1 %>><A HREF="<%= $view %>"><FONT SIZE=-1><%= $custnum %></FONT></A></TD> - <TD ROWSPAN=<%= $rowspan || 1 %>><A HREF="<%= $view %>"><FONT SIZE=-1><%= "$last, $first" %></FONT></A></TD> - <TD ROWSPAN=<%= $rowspan || 1 %>><%= $pcompany %></TD> + <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %>><A HREF="<%= $view %>"><FONT SIZE=-1><%= $custnum %></FONT></A></TD> + <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %>><A HREF="<%= $view %>"><FONT SIZE=-1><%= "$last, $first" %></FONT></A></TD> + <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %>><%= $pcompany %></TD> <% if ( defined dbdef->table('cust_main')->column('ship_last') ) { @@ -393,55 +409,85 @@ END : '<FONT SIZE=-1> </FONT>'; %> - <TD ROWSPAN=<%= $rowspan || 1 %>><A HREF="<%= $view %>"><FONT SIZE=-1><%= "$ship_last, $ship_first" %></FONT></A></TD> - <TD ROWSPAN=<%= $rowspan || 1 %>><%= $pship_company %></A></TD> + <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %>><A HREF="<%= $view %>"><FONT SIZE=-1><%= "$ship_last, $ship_first" %></FONT></A></TD> + <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %>><%= $pship_company %></A></TD> <% } foreach my $addl_col ( @addl_cols ) { %> - <TD ROWSPAN=<%= $rowspan || 1 %> ALIGN=right><FONT SIZE=-1> - - <% if ( $addl_col eq 'tickets' ) { - if ( @custom_priorities ) { - print &itable('', 0); - foreach my $priority ( @custom_priorities, '' ) { - - my $num = - FS::TicketSystem->num_customer_tickets($custnum,$priority); - my $ahref = ''; - $ahref= '<A HREF="'. - FS::TicketSystem->href_customer_tickets($custnum,$priority). - '">' - if $num; - - print '<TR>'. - " <TD ALIGN=right><FONT SIZE=-1>$ahref$num</A></FONT></TD>". - "<TD ALIGN=left><FONT SIZE=-1>$ahref". - ( $priority || '<i>(none)</i>' ). - "</A></FONT></TD></TR>"; - - } - print '<TR><TD BGCOLOR="#000000" COLSPAN=2></TD></TR>'. - '<TR><TD ALIGN=right><FONT SIZE=-1>'; - } - - my $ahref = ''; - $ahref = '<A HREF="'. - FS::TicketSystem->href_customer_tickets($custnum). - '">' - if $cust_main->get($addl_col); - - print $ahref. $cust_main->get($addl_col). '</A>'; - print "</FONT></TD><TD ALIGN=left>". - "<FONT SIZE=-1>${ahref}Total</A><FONT>". - "</TD></TR></TABLE>" - if @custom_priorities; + <% if ( $addl_col eq 'tickets' ) { %> - } else { - print $cust_main->get($addl_col); + <% if ( @custom_priorities ) { %> + + <TD CLASS="inv" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %> ALIGN=right><FONT SIZE=-1> + + <TABLE CLASS="inv" CELLSPACING=0 CELLPADDING=0> + + <% foreach my $priority ( @custom_priorities, '' ) { %> + + <% + my $num = + FS::TicketSystem->num_customer_tickets($custnum,$priority); + my $ahref = ''; + $ahref= '<A HREF="'. + FS::TicketSystem->href_customer_tickets($custnum,$priority). + '">' + if $num; + %> + + <TR> + <TD ALIGN=right> + <FONT SIZE=-1><%= $ahref.$num %></A></FONT> + </TD> + <TD ALIGN=left> + <FONT SIZE=-1><%= $ahref %><%= $priority || '<i>(none)</i>' %></A></FONT> + </TD> + </TR> + + <% } %> + + <TR> + <TH ALIGN=right STYLE="border-top: dashed 1px black"> + <FONT SIZE=-1> + + <% } else { %> + + <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %> ALIGN=right><FONT SIZE=-1> + + <% } %> + + <% + my $ahref = ''; + $ahref = '<A HREF="'. + FS::TicketSystem->href_customer_tickets($custnum). + '">' + if $cust_main->get($addl_col); + %> + + <%= $ahref %><%= $cust_main->get($addl_col) %></A> + + <% if ( @custom_priorities ) { %> + + </FONT></TH> + <TH ALIGN=left STYLE="border-top: dashed 1px black"> + <FONT SIZE=-1><%= ${ahref} %>Total</A><FONT> + </TH> + </TR> + </TABLE> + + <% } %> + + </FONT></TD> + + <% } else { %> + + <TD CLASS="grid" BGCOLOR="<%= $bgcolor %>" ROWSPAN=<%= $rowspan || 1 %> ALIGN=right><FONT SIZE=-1> + <%= $cust_main->get($addl_col) %> + </FONT></TD> + +<% } - print "</FONT></TD>"; } my($n1)=''; @@ -457,19 +503,30 @@ END #my(@cust_svc) = qsearch( 'cust_svc', { 'pkgnum' => $_->pkgnum } ); my $rowspan = scalar(@cust_svc) || 1; - print $n1, qq!<TD ROWSPAN=$rowspan><A HREF="$pkgview"><FONT SIZE=-1>$pkg - $comment</FONT></A></TD>!; + print $n1, qq!<TD CLASS="grid" BGCOLOR="$bgcolor" ROWSPAN=$rowspan><A HREF="$pkgview"><FONT SIZE=-1>$pkg - $comment</FONT></A></TD>!; + my($n2)=''; foreach my $cust_svc ( @cust_svc ) { my($label, $value, $svcdb) = $cust_svc->label; my($svcnum) = $cust_svc->svcnum; my($sview) = $p.'view'; - print $n2,qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$label</FONT></A></TD>!, - qq!<TD><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!; + print $n2,qq!<TD CLASS="grid" BGCOLOR="$bgcolor" ><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$label</FONT></A></TD>!, + qq!<TD CLASS="grid" BGCOLOR="$bgcolor" ><A HREF="$sview/$svcdb.cgi?$svcnum"><FONT SIZE=-1>$value</FONT></A></TD>!; $n2="</TR><TR>"; } + + unless ( @cust_svc ) { + print qq!<TD CLASS="grid" BGCOLOR="$bgcolor" COLSPAN=2> </TD>!; + } + #print qq!</TR><TR>\n!; $n1="</TR><TR>"; } + + unless ( @{$all_pkgs{$custnum}} ) { + print qq!<TD CLASS="grid" BGCOLOR="$bgcolor" COLSPAN=3> </TD>!; + } + print "</TR>"; } |