Budget reality: <%= @report.name %>

To date: <%= Date.today.to_s %>. Budet from <%= @report.date_from %> to <%= @report.date_to %>.

<% sum_report = 0 sum_reality = 0 sum_remaining = 0 def separate_thousands(num) return ('%d' % num).gsub(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1,") end %> <% for item in @items %> <% reality = item.reality sum_reality += reality sum_remaining += item.amount-reality sum_report += item.amount %> <% end %> <% if @items.size > 0 %> <% end %>
categorybudgetedreality up to now probably paidestimate for future totalTotal %remaining
<% if item.account == nil %> Nonexisting account with id: <%= item.account_id %> <% else %> <%= link_to item.account.popis, :action => 'show', :controller =>'account', :id => item.account.id, :budget=> @report.id %> <% end %> <%= separate_thousands( item.amount ) %> <%= separate_thousands( reality ) %>     <%= separate_thousands( reality ) %> <%= separate_thousands((reality/item.amount*100).round.to_i) %>% <%= separate_thousands(item.amount-reality) %>
total <%= separate_thousands(sum_report) %> <%= separate_thousands(sum_reality) %>     <%= separate_thousands(sum_reality ) %> <%= separate_thousands((sum_reality/sum_report*100).round.to_i) %>% <%= separate_thousands(sum_remaining) %>

<%= link_to 'Parent', @report %> | <%= link_to 'Edit', edit_report_path(@report) %> | <%= link_to 'Report list', reports_path %>