created a very ugly report

This commit is contained in:
Senad Uka
2015-04-08 07:35:00 +02:00
parent 670f58fcff
commit 6da4e6c9fd
10 changed files with 186 additions and 17 deletions

View File

@@ -0,0 +1,32 @@
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;font-weight:normal;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
</style>
<div><%= "report is nil" if @report.nil? %></div>
<table class="tg">
<tr>
<th class="tg-031e">Code</th>
<th class="tg-031e">Item name</th>
<th class="tg-031e">Amount</th>
<th class="tg-031e">Price</th>
<th class="tg-031e">Total</th>
</tr>
<% unless @report.nil? %>
<% @report.sections.each do |section| %>
<tr><td><%= section.supplier.name %></td></tr>
<% section.items.each do |item| %>
<tr>
<td class="tg-031e"><%= item.code %></td>
<td class="tg-031e"><%= item.name %></td>
<td class="tg-031e"><%= item.amount %></td>
<td class="tg-031e"><%= item.current_input_price %></td>
<td class="tg-031e"><%= item.current_input_price * item.amount %></td>
</tr>
<% end %>
<tr><td>Sub-total: <%= section.sum_amount %></td></tr>
<% end %>
<tr><td><strong>Total: <%= @report.full_sum %></strong> </td></tr>
<% end %>
</table>