fix: streamlined discount display in all breakdowns
This commit is contained in:
@@ -94,42 +94,17 @@
|
||||
{{ (priceBreakdown.total / 100)|format_currency(currency) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% set accommodationDiscountAmount = booking.accommodationDiscount is not null
|
||||
? ((priceBreakdown.basePrice + priceBreakdown.additionalPersonsPrice) * booking.accommodationDiscount / 100) | round
|
||||
: 0 %}
|
||||
{% set boardDiscountAmount = booking.boardServiceDiscount is not null
|
||||
? (priceBreakdown.boardPrice * booking.boardServiceDiscount / 100) | round
|
||||
: 0 %}
|
||||
{% set servicesDiscountAmount = booking.additionalServicesDiscount is not null
|
||||
? (priceBreakdown.servicesPrice * booking.additionalServicesDiscount / 100) | round
|
||||
: 0 %}
|
||||
{% set discountSum = accommodationDiscountAmount + boardDiscountAmount + servicesDiscountAmount %}
|
||||
|
||||
{% if booking.accommodationDiscount is not null %}
|
||||
{% for discount in priceBreakdown.discounts %}
|
||||
<tr>
|
||||
<td style="{{ cell }}">Rabatt Unterkunft {{ booking.accommodationDiscount }} %</td>
|
||||
<td style="{{ amount }}">– {{ (accommodationDiscountAmount / 100)|format_currency(currency) }}</td>
|
||||
<td style="{{ cell }}">Rabatt {{ discount.label }} {{ discount.percent }} %</td>
|
||||
<td style="{{ amount }}">– {{ (discount.amount / 100)|format_currency(currency) }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if booking.boardServiceDiscount is not null %}
|
||||
<tr>
|
||||
<td style="{{ cell }}">Rabatt Verpflegung {{ booking.boardServiceDiscount }} %</td>
|
||||
<td style="{{ amount }}">– {{ (boardDiscountAmount / 100)|format_currency(currency) }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if booking.additionalServicesDiscount is not null %}
|
||||
<tr>
|
||||
<td style="{{ cell }}">Rabatt Zusatzleistungen {{ booking.additionalServicesDiscount }} %</td>
|
||||
<td style="{{ amount }}">– {{ (servicesDiscountAmount / 100)|format_currency(currency) }}</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% if discountSum > 0 %}
|
||||
{#- The frozen snapshot wins where it exists; without one the discounted total has to
|
||||
be derived from the very rows shown above, so the mail can never contradict itself. -#}
|
||||
{% endfor %}
|
||||
{% if priceBreakdown.discounts is not empty %}
|
||||
<tr>
|
||||
<td style="{{ cell }} border-top: 1px solid #d1d5db; font-weight: bold;">Gesamtpreis nach Rabatt</td>
|
||||
<td style="{{ amount }} border-top: 1px solid #d1d5db; font-weight: bold;">
|
||||
{{ ((booking.totalPrice ?? (priceBreakdown.total - discountSum)) / 100)|format_currency(currency) }}
|
||||
{{ (priceBreakdown.discountedTotal / 100)|format_currency(currency) }}
|
||||
</td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user