X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fsearch%2F477partIIB.html;h=bd56ecc60e0b49f20f32189c3e2a405222d81681;hb=08db5f6900bb754efb597a2967adde4dbd12e731;hp=c58310d361d3aefb0af4fe7920a36260c602f7d9;hpb=b7ce9a95a6fa002d0d537c950f11f8a23d3dfc25;p=freeside.git diff --git a/httemplate/search/477partIIB.html b/httemplate/search/477partIIB.html index c58310d36..bd56ecc60 100755 --- a/httemplate/search/477partIIB.html +++ b/httemplate/search/477partIIB.html @@ -3,9 +3,10 @@ % for ( my $row = 0; $row < scalar(@rows); $row++ ) { % for my $col (0..2) { % if ( exists($data[$col][$row]) ) { -<% $cols[$col] %>> +<% $cols[$col] %>>\ +<% $data[$col][$row] %>\ +<% $cols[$col] %>> % } -<% $cols[$col] %>> % } #for $col % } #for $row % } else { # HTML mode @@ -14,19 +15,18 @@

- +
% foreach (@headers) { - + % } -% my @bgcolor = ('eeeeee','ffffff'); % my $row = 0; % foreach my $rowhead (@rows) { - - + + % for my $col (0..2) { -
<% $_ %><% $_ %>
<% $rowhead %>
<% $rowhead %> + % if ( exists($data[$col][$row]) ) { <% $data[$col][$row] %> % } @@ -46,28 +46,29 @@ my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" unless $curuser->access_right('List packages'); +my %opt = @_; my %search_hash = (); $search_hash{'agentnum'} = $cgi->param('agentnum'); $search_hash{'state'} = $cgi->param('state'); $search_hash{'classnum'} = [ $cgi->param('classnum') ]; -$search_hash{'status'} = 'active'; +$search_hash{'active'} = [ $opt{date}, $opt{date} ]; my @row_option; foreach ($cgi->param('part2b_row_option')) { push @row_option, (/^\d+$/ ? $_ : undef); } -my $is_residential = "AND COALESCE(cust_main.company, '') = ''"; +my $is_residential = " AND COALESCE(cust_main.company, '') = ''"; my $has_report_option = sub { map { defined($row_option[$_]) ? - "AND EXISTS( + " AND EXISTS( SELECT 1 FROM part_pkg_option WHERE part_pkg_option.pkgpart = part_pkg.pkgpart AND optionname = 'report_option_" . $row_option[$_]."' AND optionvalue = '1' - )" : 'AND FALSE' + )" : ' AND FALSE' } @_ }; @@ -117,11 +118,14 @@ foreach (@col_conds) { if ( $row == 0 ) { $col_data[$row] = $count; # the raw count } else { + # the rows that are percentages of the raw count if ( $col_data[0] == 0 ) { - $col_data[$row] = ''; # show nothing in this row, then + # 0 out of 0 is not 0%, but supposedly this works + $col_data[$row] = '0.000'; } else { - $col_data[$row] = sprintf('%.2f', 100 * $count / $col_data[0]) . '%'; + $col_data[$row] = sprintf('%.3f', 100 * $count / $col_data[0]); } + $col_data[$row] .= '%' unless $cgi->param('_type') eq 'xml'; } #if $row == 0 $row++; }