fix order model invoice genrator

This commit is contained in:
Parsa Nazer
2026-01-04 12:45:44 +03:30
parent 9e0cba4c2b
commit 0e0a6ccc24
3 changed files with 106 additions and 41 deletions
+40 -14
View File
@@ -264,7 +264,8 @@
<th>نام محصول</th>
<th>تنوع</th>
<th>تعداد</th>
<th>قیمت اصلی</th>
<th>قیمت واحد</th>
<th>جمع</th>
<th>تخفیف محصول</th>
<th>تخفیف ویژه</th>
<th>قیمت نهایی</th>
@@ -277,6 +278,7 @@
<td>{{ item_data.item.product.product.name }}</td>
<td>{{ item_data.item.product.title }}</td>
<td>{{ item_data.item.quantity }}</td>
<td>{{ item_data.unit_price|price_format }} تومان</td>
<td>{{ item_data.price_before_discount|price_format }} تومان</td>
<td class="discount-highlight">
{% if item_data.item.discount_percent > 0 %}
@@ -292,7 +294,7 @@
---
{% endif %}
</td>
<td>{{ item_data.item.price|price_format }} تومان</td>
<td>{{ item_data.final_price|price_format }} تومان</td>
</tr>
{% endfor %}
</tbody>
@@ -304,28 +306,52 @@
<span class="summary-label">تعداد کل اقلام:</span>
<span class="summary-value">{{ total_items }}</span>
</div>
<div class="summary-row">
<span class="summary-label">جمع کل:</span>
<!-- 1. Total Before Any Discount -->
<div class="summary-row" style="background-color: #e8f5e9; font-weight: bold;">
<span class="summary-label">۱. جمع سبد خرید (بعد از تخفیف محصولات):</span>
<span class="summary-value">{{ subtotal|price_format }} تومان</span>
</div>
<!-- 2. Product Discount -->
<div class="summary-row" style="background-color: #fff3e0;">
<span class="summary-label discount-highlight">۲. تخفیف محصولات:</span>
<span class="summary-value discount-highlight">
{% if items_discount_amount > 0 %}
-{{ items_discount_amount|price_format }} تومان
{% else %}
0 تومان
{% endif %}
</span>
</div>
<!-- 3. Special Product Discount -->
<div class="summary-row" style="background-color: #fce4ec;">
<span class="summary-label discount-highlight">۳. تخفیف ویژه محصولات:</span>
<span class="summary-value discount-highlight">
{% if special_discount_total > 0 %}
-{{ special_discount_total|price_format }} تومان
{% else %}
0 تومان
{% endif %}
</span>
</div>
{% if discount_amount > 0 %}
<div class="summary-row">
<span class="summary-label discount-highlight">تخفیف کد:</span>
<span class="summary-value discount-highlight">{{ discount_amount|price_format }} تومان</span>
<span class="summary-label discount-highlight">تخفیف کد تخفیف:</span>
<span class="summary-value discount-highlight">-{{ discount_amount|price_format }} تومان</span>
</div>
{% endif %}
{% if special_discount_total > 0 %}
<div class="summary-row">
<span class="summary-label discount-highlight">تخفیف ویژه:</span>
<span class="summary-value discount-highlight">{{ special_discount_total|price_format }} تومان</span>
</div>
{% endif %}
<div class="summary-row">
<span class="summary-label">مالیات:</span>
<span class="summary-label">مالیات ({{ tax_rate }}%):</span>
<span class="summary-value">{{ tax|price_format }} تومان</span>
</div>
<!-- 4. Final Price -->
<div class="summary-row total">
<span class="summary-label">مبلغ قابل پرداخت:</span>
<span class="summary-label">۴. قیمت نهایی (قابل پرداخت):</span>
<span class="summary-value">{{ final_price|price_format }} تومان</span>
</div>
</div>