Merge branch 'b-3.6.1' of ../kivitendo-erp_20220811
[kivitendo-erp.git] / templates / webpages / requirement_spec / _show_time_and_cost_estimate.html
index e8e4c3d..2cff5d9 100644 (file)
@@ -1,5 +1,6 @@
 [%- USE LxERP -%][%- USE L -%][%- USE HTML -%][%- USE P -%]
 [%- DEFAULT id_prefix = 'time_and_cost_estimate_form' %]
+[%- SET total_cost = 0 %]
 
 <div id="time_cost_estimate"[% IF initially_hidden %] style="display: none;"[% END %]>
  [%- IF !SELF.requirement_spec.sections.size %]
@@ -18,7 +19,7 @@
       <th>[%- LxERP.t8("Risk") %]</th>
       <th align="right">[%- LxERP.t8("Time estimate") %]</th>
       [%- UNLESS SELF.requirement_spec.is_template %]
-       <th align="right">[%- LxERP.t8("Cost") %]</th>
+       <th align="right">[%- LxERP.t8("Price") %]</th>
       [%- END %]
      </tr>
 
       [%- SET at_least_one_function_block = 1 %]
       [%- FOREACH child = section.children_sorted %]
        [%- INCLUDE 'requirement_spec/_show_time_and_cost_estimate_item.html'
-                   item  = child
-                   level = 1 %]
+                   section = section
+                   item    = child
+                   level   = 1 %]
       [%- END %]
 
       <tr class="listrow subtotal">
        <td style="padding-left: 50px" colspan="3" class="sum">[%- LxERP.t8("Sum for section") -%]:</td>
        <td align="right" nowrap>[%- P.format_man_days(section.time_estimation, 'skip_zero'=1) -%]</td>
        [%- UNLESS SELF.requirement_spec.is_template %]
-        <td align="right" nowrap>[%- LxERP.format_amount(section.time_estimation * SELF.requirement_spec.hourly_rate, 2) -%] EUR</td>
+        [%- SET section_cost = section.time_estimation * SELF.requirement_spec.hourly_rate * section.sellprice_factor;
+                total_cost   = total_cost + section_cost %]
+        <td align="right" nowrap>[%- LxERP.format_amount(section_cost, 2) -%] EUR</td>
        [%- END %]
       </tr>
      [%- END -%]
@@ -50,7 +54,7 @@
      <td colspan="3">[%- LxERP.t8("Sum for #1", SELF.requirement_spec.type.description) -%]:</td>
      <td align="right" nowrap>[%- P.format_man_days(SELF.requirement_spec.time_estimation) -%]</td>
      [%- UNLESS SELF.requirement_spec.is_template %]
-      <td align="right" nowrap>[%- LxERP.format_amount(SELF.requirement_spec.time_estimation * SELF.requirement_spec.hourly_rate, 2) -%] EUR</td>
+      <td align="right" nowrap>[%- LxERP.format_amount(total_cost, 2) -%] EUR</td>
      [%- END %]
     </tr>
    </tfoot>