fix: show tax breakup in print format

This commit is contained in:
khushi8112
2025-09-30 10:52:25 +05:30
parent 780d3f5ba4
commit bf6c331ac4
2 changed files with 48 additions and 35 deletions

View File

@@ -285,8 +285,8 @@ print_heading_template=None) -%}
</table>
</div>
<div class="highlight-bg" style="border-radius: 12px; clear: both">
<table style="width: 100%; border-collapse: collapse">
<div style="border-bottom: 1px solid #ededed;">
<table class="highlight-bg" style="width: 100%; border-collapse: collapse; border-radius: 12px; margin-bottom: 10px;">
<tr>
<td class="text-left mw-400">
<div class="text-capitalize">

View File

@@ -118,6 +118,9 @@ print_heading_template=None) -%}
.pb-8 {
padding-bottom: 8px;
}
.amount-width {
width: 110px;
}
.totals-table {
border-radius: 5px;
@@ -216,8 +219,8 @@ print_heading_template=None) -%}
<table class="items-table mt-15" style="width: 100%">
<colgroup>
<col style="width: 5%" />
<col style="width: 45%" />
<col style="width: 10%" />
<col style="width: 40%" />
<col style="width: 15%" />
<col style="width: 20%" />
<col style="width: 20%" />
</colgroup>
@@ -246,47 +249,57 @@ print_heading_template=None) -%}
</table>
<!-- Totals Section -->
<div class="row section-break mt-20">
<div class="col-xs-7">
<div class="mt-80">
<p class="title">{{ _("Total in words") }}</p>
<div class="words-box text-uppercase">{{ doc.in_words }}</div>
</div>
</div>
<div class="col-xs-5">
<table style="width:100%; margin-top: 15px">
<td style="vertical-align: bottom !important;">
<p class="title">{{ _("Total in words") }}</p>
<div class="words-box text-uppercase">{{ doc.in_words }}</div>
</td>
<td>
<table class="totals-table">
<tr>
<td class="text-right text-muted">{{ _("Sub Total:") }}</td>
<td class="text-right">{{ doc.get_formatted("total", doc) }}</td>
<td class="text-right amount-width">{{ doc.get_formatted("total", doc) }}</td>
</tr>
<tr>
<td class="text-right text-muted">
{{ _("Discount") }} ({{ doc.additional_discount_percentage }}%):
</td>
<td class="text-right">{{ doc.get_formatted("discount_amount", doc) }}</td>
</tr>
{% set tax_rate = doc.taxes | selectattr("tax_amount") | sum(attribute="rate") %} {% if
tax_rate > 0 %}
<tr>
<td class="text-right text-muted">{{ _("Tax") }} ({{ tax_rate }}%):</td>
<td class="text-right">{{ doc.get_formatted("total_taxes_and_charges", doc) }}</td>
</tr>
{% endif %}
{%- if doc.apply_discount_on == "Net Total" -%}
<tr>
<td class="text-right text-muted">
{{ _("Discount") }} ({{ doc.additional_discount_percentage }}%):
</td>
<td class="text-right amount-width">{{ doc.get_formatted("discount_amount", doc) }}</td>
</tr>
{%- endif -%}
{%- for tax in doc.taxes -%}
{%- if (tax.tax_amount or print_settings.print_taxes_with_zero_amount) and (not tax.included_in_print_rate or doc.flags.show_inclusive_tax_in_print) -%}
<tr>
<td class="text-right text-muted">{{ tax.get_formatted("description") }} ({{ tax.get_formatted("rate") }}%):</td>
<td class="text-right amount-width">{{ tax.get_formatted("tax_amount") }}</td>
</tr>
{%- endif -%}
{%- endfor -%}
{%- if doc.apply_discount_on == "Grand Total" -%}
<tr>
<td class="text-right text-muted">
{{ _("Discount") }} ({{ doc.additional_discount_percentage }}%):
</td>
<td class="text-right amount-width">{{ doc.get_formatted("discount_amount", doc) }}</td>
</tr>
{%- endif -%}
<tr class="grand-total">
<td class="text-right">{{ _("Grand Total:") }}</td>
<td class="text-right">{{ doc.get_formatted("grand_total", doc) }}</td>
<td class="text-right amount-width">{{ doc.get_formatted("grand_total", doc) }}</td>
</tr>
</table>
</div>
</div>
</td>
</table>
<!-- Terms -->
{% if doc.terms %}
<div class="info-card mt-40">
<div>{{ _("Terms and Conditions") }}</div>
{{ doc.terms}}
</div>
{% endif %}
<div class="terms-section">
{% if doc.terms %}
<div class="info-card mt-40">
<div>{{ _("Terms and Conditions") }}</div>
{{ doc.terms}}
</div>
{% endif %}
</div>
</div>
{% endfor %}