fix: better sub total section with tax breakup

This commit is contained in:
khushi8112
2025-09-29 23:10:02 +05:30
parent dbf9faa87c
commit 780d3f5ba4

View File

@@ -251,64 +251,58 @@ print_heading_template=None) -%}
</tbody> </tbody>
</table> </table>
<table class="totals mt-16" style="width: 100%"> <div class="test" style="float: right; margin-top: 15px; margin-bottom: 5px;">
<tr> <table style="width: 100%; border-collapse: collapse">
<td style="width: 65%">&nbsp;</td> <tr class="row-divider">
<td class="text-right text-muted" style="padding-right: 30px !important;">{{ _("Sub Total:") }}</td>
<td class="text-right">{{ doc.get_formatted("total", doc) }}</td>
</tr>
<td {%- if doc.apply_discount_on == "Net Total" -%}
style=" <tr class="row-divider">
width: 35%; <td class="text-right text-muted" style="padding-right: 30px !important;">
vertical-align: top; {{ _("Discount") }} ({{ doc.additional_discount_percentage }}%):
text-align: right; </td>
padding: 0px 0px 6px 0px !important; <td class="text-right">{{ doc.get_formatted("discount_amount", doc) }}</td>
" </tr>
> {%- endif -%}
<table style="width: 100%; border-collapse: collapse"> {%- 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 class="row-divider"> <tr class="row-divider">
<td class="text-right title">{{ _("Sub Total:") }}</td> <td class="text-right text-muted" style="padding-right: 30px !important;">{{ tax.get_formatted("description") }} ({{ tax.get_formatted("rate") }}%):</td>
<td class="text-right">{{ doc.get_formatted("total", doc) }}</td> <td class="text-right">{{ tax.get_formatted("tax_amount") }}</td>
</tr> </tr>
<tr class="row-divider"> {%- endif -%}
<td class="text-right title"> {%- endfor -%}
{{ _("Discount") }} ({{ doc.additional_discount_percentage or 0 }}%): {%- if doc.apply_discount_on == "Grand Total" -%}
</td> <tr class="row-divider">
<td class="text-right">{{ doc.get_formatted("discount_amount", doc) }}</td> <td class="text-right text-muted" style="padding-right: 30px !important;">
</tr> {{ _("Discount") }} ({{ doc.additional_discount_percentage }}%):
{% set tax_rate = doc.taxes | selectattr("tax_amount") | sum(attribute="rate") %} {% </td>
if tax_rate > 0 %} <td class="text-right">{{ doc.get_formatted("discount_amount", doc) }}</td>
<tr class="row-divider"> </tr>
<td class="text-right title">{{ _("Tax") }} ({{ tax_rate }}%):</td> {%- endif -%}
<td class="text-right"> </table>
{{ doc.get_formatted("total_taxes_and_charges", doc) }} </div>
</td>
</tr> <div class="highlight-bg" style="border-radius: 12px; clear: both">
{% endif %} <table style="width: 100%; border-collapse: collapse">
</table> <tr>
</td> <td class="text-left mw-400">
</tr> <div class="text-capitalize">
<span class="title"> {{ _("In Words: ") }}</span>{{ doc.in_words }}
</div>
</td>
<td class="text-right"><b>{{ _("Grand Total:") }}</b></td>
<td class="text-right">
<span style="font-weight: 700">
{{ doc.get_formatted("grand_total", doc) }}
</span>
</td>
</tr>
</table>
</div>
<tr style="border-bottom: 1px solid #ededed">
<td colspan="2" style="padding: 0 0 6px 0 !important">
<div class="highlight-bg" style="border-radius: 12px">
<table style="width: 100%; border-collapse: collapse">
<tr>
<td class="text-left mw-400">
<div class="text-capitalize">
<span class="title"> {{ _("In Words: ") }}</span>{{ doc.in_words }}
</div>
</td>
<td class="text-right"><b>{{ _("Grand Total:") }}</b></td>
<td class="text-right">
<span style="font-weight: 700">
{{ doc.get_formatted("grand_total", doc) }}
</span>
</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
<!-- Terms --> <!-- Terms -->
{% if doc.terms %} {% if doc.terms %}