Show running total even if issue doesn't have line items but it's children do

This commit is contained in:
2026-04-17 21:31:46 -04:00
parent 3ca45a457f
commit 5b1d98aa07
@@ -1,8 +1,12 @@
<% if @issue.line_items.any? %> <% if @issue.line_items.any? || @issue.descendant_line_items_total > 0%>
<hr/> <hr/>
<div> <div>
<p><strong><%= t :label_line_items %></strong></p> <p><strong><%= t :label_line_items %></strong></p>
<% total = 0 %>
<% if @issue.line_items.any?%>
<table class="list line-items-table"> <table class="list line-items-table">
<thead> <thead>
<tr> <tr>
@@ -14,7 +18,6 @@
</thead> </thead>
<tbody> <tbody>
<% total = 0 %>
<% @issue.line_items.each do |item| %> <% @issue.line_items.each do |item| %>
<% line_total = item.quantity.to_f * item.unit_price.to_f %> <% line_total = item.quantity.to_f * item.unit_price.to_f %>
@@ -29,14 +32,19 @@
<% end %> <% end %>
</tbody> </tbody>
<% end %>
<tfoot> <tfoot>
<% if @issue.line_items.any?%>
<tr> <tr>
<td colspan="3" style="text-align:right;"><strong><%= t :label_total %></strong></td> <td colspan="3" style="text-align:right;"><strong><%= t :label_total %></strong></td>
<td> <td>
<strong><%= number_to_currency(total) %></strong> <strong><%= number_to_currency(total) %></strong>
</td> </td>
</tr> </tr>
<% if @issue.children? %> <% end %>
<% if @issue.descendant_line_items_total > 0 %>
<tr> <tr>
<td colspan="3" style="text-align:right;"><strong><%= t :label_running_total %></strong></td> <td colspan="3" style="text-align:right;"><strong><%= t :label_running_total %></strong></td>
<td> <td>