app/views/home/index.html.erb
<div class="page-header">
<h1>
KK400 Ølloge™!
<small>
Grafer, tabeller og statistik
<i class="fa fa-beer"></i>
<i class="fa fa-heart"></i>
</small>
</h1>
</div>
<table class="table table-bordered table-striped table-home">
<thead>
<tr>
<th>
Navn
<span class="pull-right label label-success">
<a class="show-old-users fa fa-eye"></a>
<a class="hide-old-users fa fa-eye-slash hide"></a>
</span>
</th>
<th>Værelse</th>
<% @products.each do |product| %>
<th<%= ' class="hidden-product hide"'.html_safe unless product.visible -%>>
<%= product.name %>
<span class="pull-right">
<%= link_to graph_path(product.id), class: 'graph label label-success' do %>
<i class="fa fa-bar-chart-o"></i>
<% end %>
</span>
</th>
<% end %>
<th>Indbetalt</th>
<th>Balance</th>
</tr>
</thead>
<tbody>
<% @users.each do |user| %>
<tr<%= user.visible? ? '' : ' class="old-user"'.html_safe -%>>
<td><%= user.name %></td>
<td><%= user.room %></td>
<% @products.each do |product| %>
<td class="text-right<%= ' hidden-product hide"'.html_safe unless product.visible -%>">
<%= number_with_delimiter (@quantities[[user.id, product.id]].presence || 0) %>
</td>
<% end %>
<td class="text-right">
<%= number_to_colored_currency (@payments[user.id].presence || 0) %>
<%= link_to payment_path(user.id), class: 'btn btn-xs btn-primary' do %>
<i class="fa fa-money"></i>
<% end %>
</td>
<td class="text-right"><%= number_to_colored_currency ((@balances[user.id].presence || 0) + (@payments[user.id].presence || 0)) %></td>
</tr>
<% end %>
<tr>
<th>
Total
<span class="pull-right label label-success">
<a class="show-old-users fa fa-eye"></a>
<a class="hide-old-users fa fa-eye-slash hide"></a>
</span>
</th>
<th></th>
<% @products.each do |product| %>
<th class="text-right<%= ' hidden-product hide"'.html_safe unless product.visible -%>"><%= number_with_delimiter @totals[product.id] %></th>
<% end %>
<% total_paid = @payments.inject(0) {|sum, b| sum += b.second} %>
<th class="text-right"><%= number_to_colored_currency total_paid %></th>
<% total_balance = (@balances.inject(0) {|sum, b| sum += b.second} + total_paid) %>
<th class="text-right"><%= number_to_colored_currency total_balance %></th>
</tr>
</tbody>
</table>
<div class="row">
<div class="col col-lg-2">
<table class="table table-bordered table-striped table-condensed">
<% @products.each do |product| %>
<tr>
<td><%= product.name %></td>
<td class="text-right"><%= number_to_currency product.price %></td>
<% end %>
</table>
</div>
<div class="col col-lg-6">
<div class="text-center">
Reg nr.: <%= @settings[:reg_no] %> Konto nr.: <%= @settings[:account_no] %>
</div>
</div>
<div class="col col-lg-4">
<table class="table table-bordered table-striped table-condensed">
<tbody>
<tr>
<td><%= fa_icon 'legal', text: 'Salg sidste måned' %></td>
<td class="text-right"><%= number_to_colored_currency @sales_last_month %></td>
</tr>
<tr>
<td><%= fa_icon 'usd', text: 'Kontant' %></td>
<td class="text-right"><%= number_to_colored_currency @last_month_meta[:cash] %></td>
</tr>
<tr>
<td><%= fa_icon 'frown-o', text: 'Svind' %></td>
<td class="text-right"><%= number_to_colored_currency @last_month_meta[:loss] %></td>
</tr>
<tr>
<td><%= fa_icon 'dashboard', text: 'Ølbeholdning' %></td>
<td class="text-right"><%= number_to_colored_currency @last_month_meta[:stock] %></td>
</tr>
<tr>
<th><%= fa_icon 'money', text: 'Penge i alt' %></th>
<th class="text-right"><%= number_to_colored_currency -total_balance + @last_month_meta[:stock] + @last_month_meta[:cash] %></th>
</tr>
</tbody>
</table>
<div class="text-right">
Sidst opgjort: <%= l @last_bill %>
</div>
</div>
</div>