477 report: state percentages to 3 decimal places, #24834
authorMark Wells <mark@freeside.biz>
Tue, 3 Sep 2013 19:47:09 +0000 (12:47 -0700)
committerMark Wells <mark@freeside.biz>
Tue, 3 Sep 2013 19:47:09 +0000 (12:47 -0700)
httemplate/search/477partIA.html
httemplate/search/477partIIA.html
httemplate/search/477partIIB.html
httemplate/search/477partVI_census.html

index 1cd0b70..5ee44da 100755 (executable)
@@ -139,7 +139,7 @@ for ( my $row = 0; $row < scalar @upload_option; $row++ ) {
     my $count = FS::Record->scalar_sql($this_count_query);
     my $residential = FS::Record->scalar_sql($this_count_query . $is_residential);
 
-    my $percent = sprintf('%.2f', $count ? 100 * $residential / $count : 0);
+    my $percent = sprintf('%.3f', $count ? 100 * $residential / $count : 0);
     $data[$col][$row] = [ $count, $percent ];
 
     $total_count += $count;
@@ -149,10 +149,10 @@ for ( my $row = 0; $row < scalar @upload_option; $row++ ) {
 }
 
 my $total_percentage =
-  sprintf("%.2f", $total_count ? 100*$total_residential/$total_count : 0);
+  sprintf("%.3f", $total_count ? 100*$total_residential/$total_count : 0);
 
 my $above_200_percentage =
-  sprintf("%.2f", $total_count ? 100*$above_200/$total_count : 0);
+  sprintf("%.3f", $total_count ? 100*$above_200/$total_count : 0);
 
 my @summary_row = (
   $total_count,
index 95c00a3..907a176 100755 (executable)
@@ -104,7 +104,7 @@ if ( $total_lines > 0 ) {
   foreach (@row_conds) {
     my $sql = $query_ds0 . $_;
     my $lines = FS::Record->scalar_sql($sql);
-    my $percent = sprintf('%.2f', 100 * $lines / $total_lines);
+    my $percent = sprintf('%.3f', 100 * $lines / $total_lines);
     push @{ $data[0] }, $percent;
   }
 }
index 5b9b307..cb181f4 100755 (executable)
@@ -120,7 +120,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++;
index 59a6fb5..0dafc6b 100755 (executable)
@@ -75,7 +75,7 @@ push @fields,
         $state_pkgcount{$state} += $row->quantity;
         $row->quantity;
       },
-  sub { my $row = shift; sprintf "%.2f", $row->residential },
+  sub { my $row = shift; sprintf "%.3f", $row->residential },
 ;
 
 my %search_hash = ();