Merge branch 'master' of https://github.com/jgoodman/Freeside
[freeside.git] / httemplate / search / 477partIIB.html
index 714f15a..ce1ac03 100755 (executable)
@@ -3,9 +3,9 @@
 %   for ( my $row = 0; $row < scalar(@rows); $row++ ) {
 %     for my $col (0..2) {
 %       if ( exists($data[$col][$row]) ) {
-<PartII_<% $row %><% $cols[$col] %>>\
+<PartII_<% $row + 1 %><% $cols[$col] %>>\
 <% $data[$col][$row] %>\
-</PartII_<% $row %><% $cols[$col] %>>
+</PartII_<% $row + 1 %><% $cols[$col] %>>
 %       }
 %     } #for $col
 %   } #for $row
 <TABLE>
   <TR><TD VALIGN="bottom"><BR></TD></TR>
   <TR><TD COLSPAN=2>
-  <TABLE CLASS="grid" CELLSPACING=0 STYLE="border: 1px solid #cccccc;" BGCOLOR="#cccccc">
+  <TABLE CLASS="grid" CELLSPACING=0>
     <TR>
 % foreach (@headers) {
-      <TH class="grid"><% $_ %></TH>
+      <TH><% $_ %></TH>
 % }
     </TR>
-% my @bgcolor = ('eeeeee','ffffff');
 % my $row = 0;
 % foreach my $rowhead (@rows) {
-    <TR> 
-      <TD CLASS="grid" BGCOLOR="#<% $bgcolor[$row % 2] %>"><% $rowhead %></TD>
+    <TR CLASS="row<% $row % 2 %>"
+      <TD STYLE="text-align: left; font-weight: bold"><% $rowhead %></TD>
 %     for my $col (0..2) {
-      <TD CLASS="grid" BGCOLOR="#<% $bgcolor[$row % 2] %>">
+      <TD>
 %       if ( exists($data[$col][$row]) ) {
       <% $data[$col][$row] %>
 %       }
@@ -47,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'
   } @_
 };
 
@@ -121,7 +121,7 @@ foreach (@col_conds) {
       if ( $col_data[0] == 0 ) {
         $col_data[$row] = ''; # show nothing in this row, then
       } else {
-        $col_data[$row] = sprintf('%.2f', 100 * $count / $col_data[0]) . '%';
+        $col_data[$row] = sprintf('%.3f', 100 * $count / $col_data[0]) . '%';
       }
     } #if $row == 0
     $row++;