4 <%= form_tag({:action=>'index'}, :method=>:get, :id=>'controller_filter') do %>
6 <%= select_tag 'timeframe', options_for_select(@timeframes, @timeframe) , prompt: '-- Time Frame --' %>
7 <%= select_tag 'portfolio', options_from_collection_for_select(@portfolios, :id, :name, @portfolio) , prompt: '-- All Portfolios --' %>
8 <%= submit_tag 'Run Report' %>
12 <div id='report_statistic_summary'>
14 <% if @realized_gain >=0 then %>
15 <li class="profit">Realized Profit: <em><%= smr_humanize @realized_gain, :shortword=>true %></em></li>
17 <li class="loss">Realized Loss: <em><%= smr_humanize @realized_gain, :shortword=>true %></em></li>
19 <li>Revenue: <em><%= smr_humanize @revenue, :shortword=>true %></em></li>
23 <h2>Asset Development</h2>
24 <table id='asset_totals'>
30 <th>Profit / Loss</th>
38 @asset_totals.each do |t|
39 this_market_value = t.market_value
40 prev_market_value = this_market_value if prev_market_value == 0
41 change = percentage_change(prev_market_value, this_market_value) || '-'
43 <tr class="separaterows">
45 <%= link_to '+', asset_index_path %>
46 <%= smr_humanize t.date, :time_for_humans=>true %>
48 <td><%= smr_humanize t.invested, :shortword=>true %></td>
50 <%= smr_humanize this_market_value, :shortword=>true %>
51 <span class="<%= if change.length == 1 then ''
52 elsif change.length>2 and change.starts_with?'-' then 'loss'
53 else 'profit' end %>">
57 <td class="<%= smr_profitloss_status t.profit_loss, :css=>true %>">
58 <%= smr_humanize t.profit_loss, :shortword=>true %>
62 prev_market_value = this_market_value
68 <% unless @closed_positions.empty? %>
69 <h2>Closed Positions</h2>
70 <table id='closed_positions'>
75 <th>Purchase Volume</th>
76 <th>Settled Volume</th>
78 <th>Dividend / Interest Received</th>
83 <% @closed_positions.each do |p| %>
84 <tr class="separaterows">
86 <%= link_to '+', p.link.to_url %> <%= p.security %>
88 <span class="symbol"><%=p.security.symbol%></span>
90 <% if not p.comment.blank? %><span class="comment_text"><%= 'at %s:' % p.portfolio if p.is_cash_position? %> <%= p.comment %></span><% end %>
92 <td><%= smr_humanize p.time_closed %></td>
93 <td><%= smr_humanize p.purchase_volume %></td>
94 <td><%= smr_humanize p.settled_volume %></td>
96 <%= smr_humanize p.charges %>
97 <% if p.charges > 0 %><span><%= smr_humanize p.charges_per_kilo, :scale=>2 %>per 1k</span><% end %>
99 <td><%= smr_humanize p.dividend.received %></td>
100 <td class="<%= smr_profitloss_status p.profit_loss, :css=>true %>">
101 <%= smr_humanize p.gain %>
102 <span><%= percentage_of(p.purchase_volume, p.gain) %></span>