X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Fcust_class.html;h=a35c045cf8208b1547301e6125ada7493de66cc4;hp=da303cf72afe1bb26a08fb5af3993e314e3485bb;hb=b71b1576c68bc40ad26592b354feace37a029f0e;hpb=63a268637b2d51a8766412617724b9436439deb6 diff --git a/httemplate/browse/cust_class.html b/httemplate/browse/cust_class.html index da303cf72..a35c045cf 100644 --- a/httemplate/browse/cust_class.html +++ b/httemplate/browse/cust_class.html @@ -6,7 +6,7 @@ 'disabled_statuspos' => 2, 'query' => { 'table' => 'cust_class', 'hashref' => {}, - 'extra_sql' => 'ORDER BY classnum', + 'order_by' => 'ORDER BY classnum', }, 'count_query' => $count_query, 'header' => $header, @@ -23,12 +23,62 @@ my $html_init = 'Customer classes define groups of customer for reporting.

'. qq!Add a customer class

!; +#cust_class-disable_counts? or just migrate this to one config probably +#my $disable_counts = $conf->exists('agent-disable_counts'); +my $disable_counts = 0; + +my $customers_sub = sub { + my $cust_class = shift; + + my $cust_main_link = $p. 'search/cust_main.html?'. + 'classnum='. $cust_class->classnum; + + #false laziness w/agent.cgi + my $OUT = ''; + + my @cust_status = + qw( prospect inactive ordered active suspended cancelled ); + my %PL = ( 'prospect' => 'prospects', ); + #my %link = ( 'cancelled' => 'showcancelledcustomers=1&cancelled' ); + my $statuscolor = FS::cust_main->statuscolors; + + foreach my $status ( @cust_status ) { + my $meth = 'num_'. $status; + #my $link = exists($link{$status}) ? $link{$status} : $status; + + $OUT .= ''; + my $num = 0; + unless ( $disable_counts ) { + $num = $cust_class->$meth(); + $OUT .= ''; + } + $OUT .= ''; + + } + + $OUT .= '
'. + ''. + $num. ' '; + + if ( $num || $disable_counts ) { + $OUT .= ''; + } + $OUT .= exists($PL{$status}) ? $PL{$status} : $status; + if ($num || $disable_counts ) { + $OUT .= ''; + } + + $OUT .= '
'; + + $OUT; + +}; + my $count_query = 'SELECT COUNT(*) FROM cust_class'; my $link = [ $p.'edit/cust_class.html?', 'classnum' ]; - -my $header = [ '#', 'Class' ]; -my $fields = [ 'classnum', 'classname' ]; +my $header = [ '#', 'Class', 'Customers' ]; +my $fields = [ 'classnum', 'classname', $customers_sub, ]; my $links = [ $link, $link ]; my $cat_query = 'SELECT COUNT(*) FROM cust_class where categorynum IS NOT NULL'; @@ -42,4 +92,11 @@ if ($sth->fetchrow_arrayref->[0]) { push @$links, $link; } +my $conf = new FS::Conf; +if ( $conf->exists('cust_class-tax_exempt') ) { + push @$header, 'Tax exempt'; + push @$fields, 'tax'; + push @$links, ''; +} +