updated
This commit is contained in:
@@ -3,10 +3,10 @@
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<!-- Title -->
|
||||
<h1 class="page-title">Helium Output Yearly Summary</h1>
|
||||
<h1 class="page-title">Heliumabgabe - Halbjahresübersicht</h1>
|
||||
<form method="post" action="{% url 'set_halfyear_interval' %}" class="interval-form">
|
||||
{% csrf_token %}
|
||||
<h3>Global 6-Month Interval</h3>
|
||||
<h3>Allgemeines 6-Monats-Intervall</h3>
|
||||
|
||||
<label>Year:</label>
|
||||
<select name="year">
|
||||
|
||||
@@ -222,52 +222,55 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for r in rows_sum %}
|
||||
<tr data-row-index="{{ r.row_index }}">
|
||||
<tr>
|
||||
<td>{{ r.label }}</td>
|
||||
<td class="sum-col sum-cell">
|
||||
{% if r.is_percent %}
|
||||
{{ r.total|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.total|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<tbody>
|
||||
{% for r in rows_sum %}
|
||||
<tr data-row-index="{{ r.row_index }}">
|
||||
<td>{{ r.label }}</td>
|
||||
|
||||
<td class="sum-col">
|
||||
{% if r.is_percent %}
|
||||
{{ r.lichtwiese|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.lichtwiese|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="sum-col sum-cell">
|
||||
{% if r.is_percent %}
|
||||
{{ r.total|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.total|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="sum-col">
|
||||
{% if r.is_percent %}
|
||||
{{ r.chemie|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.chemie|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td class="sum-col">
|
||||
{% if r.is_percent %}
|
||||
{{ r.lichtwiese|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.lichtwiese|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="sum-col">
|
||||
{% if r.is_percent %}
|
||||
{{ r.chemie|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.chemie|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="sum-col">
|
||||
{% if r.is_percent %}
|
||||
{{ r.mawi|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.mawi|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="sum-col">
|
||||
{% if r.is_percent %}
|
||||
{{ r.m3|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.m3|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
||||
<td class="sum-col">
|
||||
{% if r.is_percent %}
|
||||
{{ r.mawi|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.mawi|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td class="sum-col">
|
||||
{% if r.is_percent %}
|
||||
{{ r.m3|floatformat:2 }}%
|
||||
{% else %}
|
||||
{{ r.m3|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="table-container" style="margin-top: 20px;">
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
</div>
|
||||
|
||||
<!-- Top Tables Container -->
|
||||
<div class="top-section"></div>
|
||||
<div class="top-tables">
|
||||
<!-- Left Table (18 rows × clients) -->
|
||||
<div class="table-container top-left-table">
|
||||
@@ -114,7 +115,9 @@
|
||||
|
||||
|
||||
<td class="sum-cell">
|
||||
{{ row.sum|default_if_none:"" }}
|
||||
{% if row.sum is not None %}
|
||||
{{ row.sum|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
@@ -219,7 +222,11 @@
|
||||
{% endfor %}
|
||||
|
||||
<td class="sum-cell">
|
||||
{{ row.sum|default_if_none:"" }}
|
||||
<td class="sum-cell">
|
||||
{% if row.sum is not None %}
|
||||
{{ row.sum|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
{% endwith %}
|
||||
@@ -242,13 +249,18 @@
|
||||
<tr data-row-index="{{ row.row_index }}">
|
||||
<td class="row-label">{{ row.label }}</td>
|
||||
<td class="sum-cell overall-sum-cell">
|
||||
{{ row.sum|default_if_none:"" }}
|
||||
<td class="sum-cell">
|
||||
{% if row.sum is not None %}
|
||||
{{ row.sum|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Bottom Tables -->
|
||||
<div class="bottom-tables">
|
||||
<div class="table-container bottom-table-1">
|
||||
@@ -320,7 +332,9 @@
|
||||
data-row="{{ forloop.parentloop.counter0 }}"
|
||||
data-col="{{ forloop.counter0 }}"
|
||||
contenteditable="true">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% else %}
|
||||
<td class="readonly-cell"
|
||||
@@ -328,7 +342,9 @@
|
||||
data-table="bottom_1"
|
||||
data-row="{{ forloop.parentloop.counter0 }}"
|
||||
data-col="{{ forloop.counter0 }}">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
|
||||
@@ -339,7 +355,9 @@
|
||||
data-table="bottom_1"
|
||||
data-row="{{ forloop.parentloop.counter0 }}"
|
||||
data-col="{{ forloop.counter0 }}">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@@ -379,7 +397,9 @@
|
||||
data-col="0"
|
||||
data-client-id="{{ cell.client.id|default:'' }}"
|
||||
contenteditable="true">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
<td>Gefäss 1,0</td>
|
||||
@@ -392,7 +412,9 @@
|
||||
data-col="1"
|
||||
data-client-id="{{ cell.client.id|default:'' }}"
|
||||
contenteditable="true">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
<td id="bt2-j39" class="readonly-cell"></td>
|
||||
@@ -454,7 +476,9 @@
|
||||
<td id="bt3-j46"
|
||||
class="readonly-cell calculated-cell"
|
||||
data-cell-id="{{ cell.id|default:'' }}">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
|
||||
@@ -490,7 +514,9 @@
|
||||
data-col="1"
|
||||
data-cell-id="{{ cell.id|default:'' }}"
|
||||
contenteditable="true">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
|
||||
@@ -503,7 +529,9 @@
|
||||
data-col="2"
|
||||
data-cell-id="{{ cell.id|default:'' }}"
|
||||
contenteditable="true">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
|
||||
@@ -546,7 +574,9 @@
|
||||
data-col="2"
|
||||
data-client-id="{{ cell.client.id|default:'' }}"
|
||||
contenteditable="true">
|
||||
{{ cell.value|default:"" }}
|
||||
{% if cell.value is not None %}
|
||||
{{ cell.value|floatformat:2 }}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% endwith %}
|
||||
|
||||
@@ -800,6 +830,12 @@ $(document).ready(function() {
|
||||
const v = parseFloat(t);
|
||||
return isNaN(v) ? null : v;
|
||||
}
|
||||
function formatNumber(value) {
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
const num = parseFloat(String(value).replace(',', '.'));
|
||||
if (isNaN(num)) return value;
|
||||
return num.toFixed(2);
|
||||
}
|
||||
|
||||
// Recalculate Sum cell (last column) for a given row
|
||||
function recalcRowSum($row) {
|
||||
@@ -837,7 +873,7 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
if (hasValue) {
|
||||
$row.find('.sum-cell').text(total);
|
||||
$row.find('.sum-cell').text(total.toFixed(2));
|
||||
} else {
|
||||
$row.find('.sum-cell').text('');
|
||||
}
|
||||
@@ -1243,8 +1279,9 @@ $(document).ready(function() {
|
||||
const targetCell = $('[data-cell-id="' + cellData.id + '"]');
|
||||
if (!targetCell.length) return;
|
||||
|
||||
targetCell.text(cellData.value || '');
|
||||
targetCell.data('original-value', cellData.value || '');
|
||||
const formattedValue = formatNumber(cellData.value);
|
||||
targetCell.text(formattedValue);
|
||||
targetCell.data('original-value', formattedValue);
|
||||
|
||||
if (cellData.is_calculated) {
|
||||
targetCell.addClass('calculated-cell');
|
||||
|
||||
Reference in New Issue
Block a user