correct discount model

This commit is contained in:
Tobias Brunner 2025-05-23 16:37:03 +02:00
parent f5f4ec8ac9
commit 3896636f9b
No known key found for this signature in database
6 changed files with 201 additions and 55 deletions

View file

@ -32,6 +32,7 @@
<th>SLA Per Unit</th>
<th>SLA Price</th>
<th>Discount Model</th>
<th>Discount Details</th>
<th class="table-warning">Final Price</th>
</tr>
</thead>
@ -60,6 +61,24 @@
None
{% endif %}
</td>
<td>
{% if row.has_discount %}
<small class="text-muted">
<strong>Total Units:</strong> {{ row.total_units }}<br>
<strong>Standard Price:</strong> {{ row.standard_sla_price|floatformat:2 }}<br>
<strong>Discounted Price:</strong> {{ row.discounted_sla_price|floatformat:2 }}<br>
<strong>Savings:</strong> {{ row.discount_savings|floatformat:2 }} ({{ row.discount_percentage|floatformat:1 }}%)<br>
{% if row.discount_breakdown %}
<strong>Breakdown:</strong><br>
{% for tier in row.discount_breakdown %}
{{ tier.tier_range }} units: {{ tier.units }} × {{ tier.rate|floatformat:4 }} = {{ tier.subtotal|floatformat:2 }}<br>
{% endfor %}
{% endif %}
</small>
{% else %}
<small class="text-muted">No discount applied</small>
{% endif %}
</td>
<td class="table-warning fw-bold">{{ row.final_price|floatformat:2 }}</td>
</tr>
{% endfor %}