mirror of
https://github.com/rickbarrette/redmine_qbo_lineitems.git
synced 2026-04-02 07:01:59 -04:00
display line items on issue if any exist
This commit is contained in:
40
app/views/line_items/_issue_line_items.html.erb
Normal file
40
app/views/line_items/_issue_line_items.html.erb
Normal file
@@ -0,0 +1,40 @@
|
||||
<% if @issue.line_items.any? %>
|
||||
<hr/>
|
||||
<div>
|
||||
<p><strong>Line Items</strong></p>
|
||||
|
||||
<table class="list line-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Description</th>
|
||||
<th style="width:120px;">Quantity</th>
|
||||
<th style="width:150px;">Unit Price</th>
|
||||
<th style="width:150px;">Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<% total = 0 %>
|
||||
|
||||
<% @issue.line_items.each do |item| %>
|
||||
<% line_total = item.quantity.to_f * item.unit_price.to_f %>
|
||||
<% total += line_total %>
|
||||
|
||||
<tr>
|
||||
<td><%= h item.description %></td>
|
||||
<td><%= item.quantity %></td>
|
||||
<td><%= number_to_currency(item.unit_price) %></td>
|
||||
<td><%= number_to_currency(line_total) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align:right;"><strong>Total</strong></td>
|
||||
<td><strong><%= number_to_currency(total) %></strong></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user