mirror of
https://github.com/rickbarrette/redmine_qbo_lineitems.git
synced 2026-07-01 16:51:07 -04:00
Show running total even if issue doesn't have line items but it's children do
This commit is contained in:
@@ -1,42 +1,50 @@
|
||||
<% if @issue.line_items.any? %>
|
||||
<% if @issue.line_items.any? || @issue.descendant_line_items_total > 0%>
|
||||
<hr/>
|
||||
<div>
|
||||
<p><strong><%= t :label_line_items %></strong></p>
|
||||
|
||||
<table class="list line-items-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width:70%;"><%= t :label_description %></th>
|
||||
<th style="width:10%;"><%= t :label_qty %></th>
|
||||
<th style="width:10%;"><%= t :label_price %></th>
|
||||
<th style="width:10%;"><%= t :label_total %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<% total = 0 %>
|
||||
|
||||
<tbody>
|
||||
<% total = 0 %>
|
||||
|
||||
<% @issue.line_items.each do |item| %>
|
||||
<% line_total = item.quantity.to_f * item.unit_price.to_f %>
|
||||
<% total += line_total %>
|
||||
<% if @issue.line_items.any?%>
|
||||
|
||||
<table class="list line-items-table">
|
||||
<thead>
|
||||
<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>
|
||||
<th style="width:70%;"><%= t :label_description %></th>
|
||||
<th style="width:10%;"><%= t :label_qty %></th>
|
||||
<th style="width:10%;"><%= t :label_price %></th>
|
||||
<th style="width:10%;"><%= t :label_total %></th>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</thead>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align:right;"><strong><%= t :label_total %></strong></td>
|
||||
<td>
|
||||
<strong><%= number_to_currency(total) %></strong>
|
||||
</td>
|
||||
</tr>
|
||||
<% if @issue.children? %>
|
||||
<tbody>
|
||||
|
||||
<% @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>
|
||||
|
||||
<% end %>
|
||||
|
||||
<tfoot>
|
||||
<% if @issue.line_items.any?%>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align:right;"><strong><%= t :label_total %></strong></td>
|
||||
<td>
|
||||
<strong><%= number_to_currency(total) %></strong>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
|
||||
<% if @issue.descendant_line_items_total > 0 %>
|
||||
<tr>
|
||||
<td colspan="3" style="text-align:right;"><strong><%= t :label_running_total %></strong></td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user