- if grants.empty?
  %p There are no grants associated with this account.
-else
  %table.table.table-hover#grants_datatable
    %thead
      %tr
        %th.left Grant
        %th.center Fiscal Year
        %th.left Source
        %th.right Amount
        %th.right Expenditures
        %th.right Total Expended
        %th.center

    %tbody
      - total = 0
      - spent = 0
      - grants.each do |grant|
        - total += grant.amount
        -# spent += grant.spent
        %tr{:data => {:action_path => grant_path(grant)}}
          %td.left= grant.grant_number
          %td.center= format_as_fiscal_year(grant.fy_year)
          %td.left= grant.funding_source
          %td.right= format_as_currency(grant.amount)
          %td.right= format_as_integer(grant.grant_purchases.count)
          %td.right= format_as_currency(grant.spent)
          %td.center
            = render :partial => "grants/popup_table", :locals => {:grant => grant}
    %tfoot
      %tr
        %td{:colspan => 3}
        %td.right= format_as_currency(total)
        %td.right
        %td.right= format_as_currency(spent)
        %td

= render :partial => 'shared/datatable_javascript', :locals => {:id => 'grants_datatable'}
- if grants.empty?
  %p There are no grants associated with this account.
-else
  %table.table.table-hover#grants_datatable
    %thead
      %tr
        %th.left Grant
        %th.center Fiscal Year
        %th.left Source
        %th.right Amount
        %th.right Expenditures
        %th.right Total Expended
        %th.center

    %tbody
      - total = 0
      - spent = 0
      - grants.each do |grant|
        - total += grant.amount
        - spent += grant.spent
        %tr{:data => {:action_path => grant_path(grant)}}
          %td.left= grant.grant_number
          %td.center= format_as_fiscal_year(grant.fy_year)
          %td.left= grant.funding_source
          %td.right= format_as_currency(grant.amount)
          %td.right= format_as_integer(grant.grant_purchases.count)
          %td.right= format_as_currency(grant.spent)
          %td.center
            = render :partial => "grants/popup_table", :locals => {:grant => grant}
    %tfoot
      %tr
        %td{:colspan => 3}
        %td.right= format_as_currency(total)
        %td.right
        %td.right= format_as_currency(spent)
        %td

= render :partial => 'shared/datatable_javascript', :locals => {:id => 'grants_datatable'}

Fix missing summary value on grants index table
Fix missing summary value on grants index table
