%fieldset
  %legend All Transit Operators
  %table.table
    %thead
      %tr
        %th.left Fiscal Year
        %th.left Type
        %th.left Sub Type
        %th.right Count
        %th.right Replacement Cost
    %tbody
      - sum_cost = 0
      - @data.assets.includes(:asset_subtype).group_by(&:asset_subtype).each do |subtype, assets_by_subtype|
        %tr
          %td.left= format_as_fiscal_year(@data.fy)
          %td.left= subtype.asset_type
          %td.left= subtype
          %td.right= format_as_integer(assets_by_subtype.count)
          - cost = assets_by_subtype.sum{ |a| a.estimated_replacement_cost.to_i }
          - sum_cost += cost
          %td.right= format_as_currency(cost)
    %tfoot
      %tr
        %td{:colspan => 3}
        %td.right= format_as_integer(@data.assets.count)
        %td.right= format_as_currency(sum_cost)

%fieldset
  %legend All Transit Operators
  %table.table
    %thead
      %tr
        %th.left Fiscal Year
        %th.left Type
        %th.left Sub Type
        %th.right Count
        %th.right Book Value
        %th.right Replacement Cost
    %tbody
      - sum_book_val = 0
      - sum_cost = 0
      - @data.assets.includes(:asset_subtype).group_by(&:asset_subtype).each do |subtype, assets_by_subtype|
        %tr
          %td.left= format_as_fiscal_year(@data.fy)
          %td.left= subtype.asset_type
          %td.left= subtype
          %td.right= format_as_integer(assets_by_subtype.count)
          - book_val = assets_by_subtype.sum{ |a| a.book_value.to_i }
          - cost = assets_by_subtype.sum{ |a| a.estimated_replacement_cost.to_i }
          - sum_book_val += book_val
          - sum_cost += cost
          %td.right= format_as_currency(book_val)
          %td.right= format_as_currency(cost)
    %tfoot
      %tr
        %td{:colspan => 3}
        %td.right= format_as_integer(@data.assets.count)
        %td.right= format_as_currency(sum_book_val)
        %td.right= format_as_currency(sum_cost)
Add book value to report rollup header
Add book value to report rollup header
