added internal rates (#1591)

This commit is contained in:
Kevin Papst
2020-04-08 14:50:15 +02:00
committed by GitHub
parent 82c713031e
commit 68d703d1e3
128 changed files with 4044 additions and 1571 deletions

View File

@@ -51,6 +51,7 @@
'hourlyRate': false,
'fixedRate': false,
'duration': 'label.duration',
'rate_internal': 'label.rate_internal',
'rate': 'label.rate',
}) %}
@@ -63,38 +64,40 @@
document.getElementById('summary-show').addEventListener('click', function(event) {
document.getElementById('export-summary').style.display = event.target.checked ? 'block' : 'none';
});
{% if showTimeBudget %}
document.getElementById('summary-timeBudget').addEventListener('click', function(event) {
var cells = document.getElementsByClassName('export-timeBudget');
for (var columnCell of cells) {
columnCell.style.display = event.target.checked ? 'table-cell' : 'none';
}
});
{% endif %}
{% if showRateBudget %}
document.getElementById('summary-budget').addEventListener('click', function(event) {
var cells = document.getElementsByClassName('export-budget');
for (var columnCell of cells) {
columnCell.style.display = event.target.checked ? 'table-cell' : 'none';
}
});
{% endif %}
document.getElementById('summary-duration').addEventListener('click', function(event) {
if (!document.getElementById('summary-rate').checked) {
return;
}
document.getElementById('summary-rate').disabled = !event.target.checked;
var cells = document.getElementsByClassName('summary-duration');
for (var columnCell of cells) {
columnCell.style.display = event.target.checked ? 'table-cell' : 'none';
}
});
document.getElementById('summary-rate').addEventListener('click', function(event) {
if (!document.getElementById('summary-duration').checked) {
return;
}
document.getElementById('summary-duration').disabled = !event.target.checked;
var cells = document.getElementsByClassName('summary-rate');
for (var columnCell of cells) {
columnCell.style.display = event.target.checked ? 'table-cell' : 'none';
}
});
document.getElementById('summary-rate-internal').addEventListener('click', function(event) {
var cells = document.getElementsByClassName('summary-rate-internal');
for (var columnCell of cells) {
columnCell.style.display = event.target.checked ? 'table-cell' : 'none';
}
});
document.getElementById('summary-show').addEventListener('click', function(event) {
document.getElementById('export-summary').style.display = event.target.checked ? 'block' : 'none';
});
@@ -177,6 +180,12 @@
{{ 'label.duration'|trans }}
</label>
</div>
<div class="form-group">
<label class="control-label" for="summary-rate-internal">
<input type="checkbox" id="summary-rate-internal" name="summary-rate-internal" checked>
{{ 'label.rate_internal'|trans }}
</label>
</div>
<div class="form-group">
<label class="control-label" for="summary-rate">
<input type="checkbox" id="summary-rate" name="summary-rate" checked>
@@ -232,6 +241,7 @@
<th class="center export-budget">{{ 'label.budget'|trans }}</th>
{% endif %}
<th class="duration summary-duration">{{ 'label.duration'|trans }}</th>
<th class="cost summary-rate-internal">{{ 'label.rate_internal'|trans }}</th>
<th class="cost summary-rate">{{ 'label.rate'|trans }}</th>
</tr>
</thead>
@@ -239,6 +249,7 @@
{% set customer = null %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% set customerInternalRate = 0 %}
{% set customerCurrency = null %}
{% for id, summary in summaries %}
{% if customer is same as(null) %}
@@ -247,7 +258,7 @@
{% endif %}
{% if customer is not same as(summary.customer) %}
<tr class="summary">
<td colspan="2"></td>
<td colspan="2">&nbsp;</td>
{% if showTimeBudget %}
<td class="export-timeBudget"></td>
{% endif %}
@@ -255,12 +266,14 @@
<td class="export-budget"></td>
{% endif %}
<td class="totals duration summary-duration">{{ customerDuration|duration(decimal) }}</td>
<td class="totals cost summary-rate-internal">{{ customerInternalRate|money(customerCurrency) }}</td>
<td class="totals cost summary-rate">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% set customerCurrency = summary.currency %}
{% set customer = summary.customer %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% set customerInternalRate = 0 %}
{% endif %}
<tr>
<td>{{ summary.customer }}</td>
@@ -280,14 +293,16 @@
</td>
{% endif %}
<td class="duration summary-duration">{{ summary.duration|duration(decimal) }}</td>
<td class="cost summary-rate-internal">{{ summary.rate_internal|money(summary.currency) }}</td>
<td class="cost summary-rate">{{ summary.rate|money(summary.currency) }}</td>
</tr>
{% set customerDuration = customerDuration + summary.duration %}
{% set customerRate = customerRate + summary.rate %}
{% set customerInternalRate = customerInternalRate + summary.rate_internal %}
{% endfor %}
{% if customer is not same as(null) %}
<tr class="summary">
<td colspan="2"></td>
<td colspan="2">&nbsp;</td>
{% if showTimeBudget %}
<td class="export-timeBudget"></td>
{% endif %}
@@ -295,12 +310,19 @@
<td class="export-budget"></td>
{% endif %}
<td class="totals duration summary-duration">{{ customerDuration|duration(decimal) }}</td>
<td class="totals cost summary-rate-internal">{{ customerInternalRate|money(customerCurrency) }}</td>
<td class="totals cost summary-rate">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% endif %}
</tbody>
</table>
{#
============================================
SUMMARY: BY ACTIVITY
============================================
#}
<table class="items table table-condensed table-bordered dataTable" id="summary-activity" style="display:none">
<thead>
<tr>
@@ -308,6 +330,7 @@
<th>{{ 'label.project'|trans }}</th>
<th>{{ 'label.activity'|trans }}</th>
<th class="duration summary-duration">{{ 'label.duration'|trans }}</th>
<th class="cost summary-rate-internal">{{ 'label.rate_internal'|trans }}</th>
<th class="cost summary-rate">{{ 'label.rate'|trans }}</th>
</tr>
</thead>
@@ -315,39 +338,45 @@
{% set customer = null %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% set customerInternalRate = 0 %}
{% set customerCurrency = null %}
{% for summary in summaries %}
{% if customer is same as(null) %}
{% set customer = summary.customer %}
{% set customerCurrency = summary.currency %}
{% endif %}
{% if customer is not same as(summary.customer) %}
<tr class="summary">
<td colspan="3"></td>
<td class="totals duration summary-duration">{{ customerDuration|duration(decimal) }}</td>
<td class="totals cost summary-rate">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% set customerCurrency = summary.currency %}
{% set customer = summary.customer %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% endif %}
{% for activitySummary in summary.activities %}
<tr>
<td>{{ summary.customer }}</td>
<td>{{ summary.project }}</td>
<td>{{ activitySummary.activity }}</td>
<td class="duration summary-duration">{{ activitySummary.duration|duration(decimal) }}</td>
<td class="cost summary-rate">{{ activitySummary.rate|money(activitySummary.currency) }}</td>
</tr>
{% endfor %}
{% set customerDuration = customerDuration + summary.duration %}
{% set customerRate = customerRate + summary.rate %}
{% if customer is same as(null) %}
{% set customer = summary.customer %}
{% set customerCurrency = summary.currency %}
{% endif %}
{% if customer is not same as(summary.customer) %}
<tr class="summary">
<td colspan="3"></td>
<td class="totals duration summary-duration">{{ customerDuration|duration(decimal) }}</td>
<td class="totals cost summary-rate-internal">{{ customerInternalRate|money(customerCurrency) }}</td>
<td class="totals cost summary-rate">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% set customerCurrency = summary.currency %}
{% set customer = summary.customer %}
{% set customerDuration = 0 %}
{% set customerRate = 0 %}
{% set customerInternalRate = 0 %}
{% endif %}
{% for activitySummary in summary.activities %}
<tr>
<td>{{ summary.customer }}</td>
<td>{{ summary.project }}</td>
<td>{{ activitySummary.activity }}</td>
<td class="duration summary-duration">{{ activitySummary.duration|duration(decimal) }}</td>
<td class="cost summary-rate-internal">{{ activitySummary.rate_internal|money(activitySummary.currency) }}</td>
<td class="cost summary-rate">{{ activitySummary.rate|money(activitySummary.currency) }}</td>
</tr>
{% endfor %}
{% set customerDuration = customerDuration + summary.duration %}
{% set customerRate = customerRate + summary.rate %}
{% set customerInternalRate = customerInternalRate + summary.rate_internal %}
{% endfor %}
{% if customer is not same as(null) %}
<tr class="summary">
<td colspan="3"></td>
<td class="totals duration summary-duration">{{ customerDuration|duration(decimal) }}</td>
<td class="totals cost summary-rate-internal">{{ customerInternalRate|money(customerCurrency) }}</td>
<td class="totals cost summary-rate">{{ customerRate|money(customerCurrency) }}</td>
</tr>
{% endif %}
@@ -372,10 +401,16 @@
<tbody>
{% set timeWorked = 0 %}
{% set rateTotal = 0 %}
{% set rateInternalTotal = 0 %}
{% set currency = false %}
{% for entry in entries %}
{% set timeWorked = timeWorked + entry.duration %}
{% set rateTotal = rateTotal + entry.rate %}
{% if entry.internalRate is defined %}
{% set rateInternalTotal = rateInternalTotal + entry.internalRate %}
{% else %}
{% set rateInternalTotal = rateInternalTotal + entry.rate %}
{% endif %}
{% if currency is same as(false) %}
{% set currency = entry.project.customer.currency %}
{% endif %}
@@ -459,6 +494,13 @@
<td class="column-duration text-nowrap" {% if not columns.duration %}style="display: none"{% endif %}>
{{ entry.duration|duration(decimal) }}
</td>
<td class="column-rate_internal text-nowrap" {% if not columns.rate_internal %}style="display: none"{% endif %}>
{% if entry.internalRate is defined %}
{{ entry.internalRate|money(entry.project.customer.currency) }}
{% else %}
{{ entry.rate|money(entry.project.customer.currency) }}
{% endif %}
</td>
<td class="column-rate text-nowrap" {% if not columns.rate %}style="display: none"{% endif %}>
{{ entry.rate|money(entry.project.customer.currency) }}
</td>
@@ -467,13 +509,20 @@
{# leave in tbody instead of adding it to tfoot, as tfoot will be repeated on each page when printing #}
<tr>
{% for id, visibility in columns %}
{% if id != 'duration' and id != 'rate' %}
{% if id not in ['duration', 'rate', 'rate_internal'] %}
<th class="column-{{ id }}" {% if not visibility %}style="display: none"{% endif %}></th>
{% endif %}
{% endfor %}
<th class="text-nowrap column-duration">
{{- timeWorked|duration(decimal) -}}
</th>
<th class="text-nowrap column-rate_internal">
{%- if currency is not null and currency is not same as(false) %}
{{ rateInternalTotal|money(currency) }}
{% else %}
{{ rateInternalTotal|money }}
{% endif -%}
</th>
<th class="text-nowrap column-rate">
{%- if currency is not null and currency is not same as(false) %}
{{ rateTotal|money(currency) }}