fix: update styles to work with wkhtmltopdf rendering

This commit is contained in:
khushi8112
2025-09-19 02:14:32 +05:30
parent 6703610596
commit 39b6aab714
2 changed files with 456 additions and 403 deletions

View File

@@ -2,23 +2,26 @@
print_heading_template=None) -%} {% if letter_head and not no_letterhead %}
<div class="letter-head">{{ letter_head }}</div>
{% endif %} {% if print_heading_template %} {{ frappe.render_template(print_heading_template, {"doc":doc}) }}
{% endif %} {%- if doc.meta.is_submittable and doc.docstatus==2 -%}
<div class="text-center" document-status="cancelled">
<h4 style="margin: 0px; color: red">{{ _("CANCELLED") }}</h4>
</div>
{%- endif -%} {%- endmacro -%} {% for page in layout %}
{% endif %} {%- endmacro -%} {% for page in layout %}
<div class="page-break invoice-page">
<div {% if print_settings.repeat_header_footer %} id="header-html" class="hidden-pdf" {% endif %}>
{{ add_header(loop.index, layout|len, doc, letter_head, no_letterhead, footer, print_settings) }}
</div>
<style>
.letter-head {
padding-top: 12px !important;
/* margin-top: 0px !important; */
}
.invoice-page {
font-family: Inter, sans-serif;
font-size: 13px;
color: #171717;
}
.print-format-body {
padding: 30px 12px 12px 12px !important;
}
.title {
color: #7c7c7c !important;
}
@@ -86,12 +89,12 @@ print_heading_template=None) -%} {% if letter_head and not no_letterhead %}
.items-table tr:first-child td:first-child,
.tax-table tr:first-child td:first-child {
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
border-bottom-left-radius: 10px;
}
.items-table tr:first-child td:last-child,
.tax-table tr:first-child td:last-child {
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
border-bottom-right-radius: 10px;
}
.in-words {
@@ -128,185 +131,209 @@ print_heading_template=None) -%} {% if letter_head and not no_letterhead %}
color: #7c7c7c;
}
.info-text {
margin-bottom: 12px;
}
.info-text {
margin-bottom: 12px;
}
.print-format {
padding: 24px;
line-height: 1.5;
letter-spacing: 0.14px;
}
.print-format {
color: #171717;
font-size: 14px;
font-style: normal;
font-weight: 420;
line-height: 21px;
padding: 0px !important;
margin-left: 0mm !important;
margin-right: 0mm !important;
}
.print-format td{
padding: 8px 8px !important;
}
.letter-head-footer {
margin-top: 0px !important;
}
.tax-table td, .items-table td{
height: 40px;
}
.print-format-body td {
padding: 8px 8px !important;
}
.tax-table thead td, .items-table thead td{
height: 32px;
}
.tax-table td,
.items-table td {
height: 40px;
}
.tax-table thead td,
.items-table thead td {
height: 32px;
}
</style>
<table class="info-table col-xs-12" style="width: 100%">
<tr>
<td class="col-xs-7" style="padding: 0 !important;">
<div class="title col-xs-5 p-0">
<div class="info-text">Customer Name:</div>
<div class="info-text">Bill to:</div>
</div>
<div class="col-xs-7">
<div class="info-text">{{ doc.customer_name }}</div>
<div class="info-text">{{ doc.address_display or "" }}</div>
</div>
</td>
<td class="col-xs-5" style="padding: 0 !important;">
<div class="title col-xs-6 p-0">
<div class="info-text">Invoice Number:</div>
<div class="info-text">Invoice Date:</div>
<div class="info-text">Payment Due Date:</div>
</div>
<div class="col-xs-6">
<div class="info-text">{{ doc.name }}</div>
<div class="info-text">{{ frappe.utils.format_date(doc.posting_date) }}</div>
<div class="info-text">{{ frappe.utils.format_date(doc.due_date) }}</div>
</div>
</td>
</tr>
</table>
<!-- Items Table -->
<table class="items-table mt-15">
<colgroup>
<col style="width: 5%" />
<col style="width: 35%" />
<col style="width: 15%" />
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 15%" />
</colgroup>
<thead class="highlight-bg">
<div class="print-format-body">
<table class="info-table col-xs-12" style="width: 100%">
<tr>
<td class="text-center">{{ _("No") }}</td>
<td class="text-left">{{ _("Item") }}</td>
<td class="text-center">{{ _("HSN/SAC") }}</td>
<td class="text-right">{{ _("Quantity") }}</td>
<td class="text-right">{{ _("Rate") }}</td>
<td class="text-right">{{ _("Amount") }}</td>
</tr>
</thead>
<tbody>
{% for item in doc.items %}
<tr>
<td class="text-center">{{ loop.index }}</td>
<td class="text-left">
<div style="display: flex; align-items: center; gap: 8px">
<div class="img-thumb">
{% if item.image %}
<div>
<img src="{{ item.image }}" alt="{{ item.item_name }}" />
</div>
{% endif %}
</div>
<div>{{ item.item_name }}</div>
<td class="col-xs-7" style="padding: 0 !important">
<div class="title col-xs-5 p-0">
<div class="info-text">Customer Name:</div>
<div class="info-text">Bill to:</div>
</div>
<div class="col-xs-7">
<div class="info-text">{{ doc.customer_name }}</div>
<div class="info-text">{{ doc.address_display or "" }}</div>
</div>
</td>
<td class="text-center">{{ item.gst_hsn_code }}</td>
<td class="text-right">{{ item.get_formatted("qty", 0) }} {{ item.uom }}</td>
<td class="text-right">{{ item.get_formatted("net_rate", doc) }}</td>
<td class="text-right">{{ item.get_formatted("net_amount", doc) }}</td>
<td class="col-xs-5" style="padding: 0 !important">
<div class="title col-xs-6 p-0">
<div class="info-text">Invoice Number:</div>
<div class="info-text">Invoice Date:</div>
<div class="info-text">Payment Due Date:</div>
</div>
<div class="col-xs-6">
<div class="info-text">{{ doc.name }}</div>
<div class="info-text">{{ frappe.utils.format_date(doc.posting_date) }}</div>
<div class="info-text">{{ frappe.utils.format_date(doc.due_date) }}</div>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</table>
<table class="totals mt-16" style="width: 100%;">
<tr>
<td style="width: 65%">&nbsp;</td>
<!-- Items Table -->
<table class="items-table mt-15">
<colgroup>
<col style="width: 5%" />
<col style="width: 35%" />
<col style="width: 15%" />
<col style="width: 10%" />
<col style="width: 20%" />
<col style="width: 15%" />
</colgroup>
<thead class="highlight-bg">
<tr>
<td class="text-center">{{ _("No") }}</td>
<td class="text-left">{{ _("Item") }}</td>
<td class="text-center">{{ _("HSN/SAC") }}</td>
<td class="text-right">{{ _("Quantity") }}</td>
<td class="text-right">{{ _("Rate") }}</td>
<td class="text-right">{{ _("Amount") }}</td>
</tr>
</thead>
<tbody>
{% for item in doc.items %}
<tr>
<td class="text-center">{{ loop.index }}</td>
<td class="text-left">
<div style="display: flex; align-items: center; gap: 8px">
<div class="img-thumb">
{% if item.image %}
<div>
<img src="{{ item.image }}" alt="{{ item.item_name }}" />
</div>
{% endif %}
</div>
<div>{{ item.item_name }}</div>
</div>
</td>
<td style="width: 35%; vertical-align: top; text-align: right; padding: 0px 0px 6px 0px !important">
<table style="width: 100%; border-collapse: collapse">
<tr class="row-divider">
<td class="text-right title">{{ _("Sub Total:") }}</td>
<td class="text-right">{{ doc.get_formatted("total", doc) }}</td>
</tr>
<tr class="row-divider">
<td class="text-right title">
{{ _("Discount") }} ({{ doc.additional_discount_percentage or 0 }}%):
</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 class="row-divider">
<td class="text-right title">{{ _("Tax") }} ({{ tax_rate }}%):</td>
<td class="text-right">{{ doc.get_formatted("total_taxes_and_charges", doc) }}</td>
</tr>
{% endif %}
</table>
</td>
</tr>
<td class="text-center">{{ item.gst_hsn_code }}</td>
<td class="text-right">{{ item.get_formatted("qty", 0) }} {{ item.uom }}</td>
<td class="text-right">{{ item.get_formatted("net_rate", doc) }}</td>
<td class="text-right">{{ item.get_formatted("net_amount", doc) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<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 class="totals mt-16" style="width: 100%">
<tr>
<td style="width: 65%">&nbsp;</td>
<td
style="
width: 35%;
vertical-align: top;
text-align: right;
padding: 0px 0px 6px 0px !important;
"
>
<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>
<tr class="row-divider">
<td class="text-right title">{{ _("Sub Total:") }}</td>
<td class="text-right">{{ doc.get_formatted("total", doc) }}</td>
</tr>
<tr class="row-divider">
<td class="text-right title">
{{ _("Discount") }} ({{ doc.additional_discount_percentage or 0 }}%):
</td>
<td class="text-right"><b>{{ _("Grand Total:") }}</b></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 class="row-divider">
<td class="text-right title">{{ _("Tax") }} ({{ tax_rate }}%):</td>
<td class="text-right">
<span style="font-weight: 700">
{{ doc.get_formatted("grand_total", doc) }}
</span>
{{ doc.get_formatted("total_taxes_and_charges", doc) }}
</td>
</tr>
{% endif %}
</table>
</div>
</td>
</tr>
</table>
{% if doc.taxes_and_charges %}
<table class="tax-table mt-15">
<div class="mt-40 pb-8">{{ _("Tax Breakup") }}</div>
<thead class="highlight-bg">
<tr>
<td style="width: 5%" class="text-left">{{ _("HSN/SAC") }}</td>
<td style="width: 15%" class="text-right">{{ _("Taxable Amount") }}</td>
{% for row in doc.taxes %}
<td style="width: 10%" class="text-right">{{ row.description }} ({{ row.rate }}%)</td>
{% endfor %}
</tr>
</thead>
<tbody>
{% for item in doc.items %}
<tr>
<td class="text-left">{{ item.gst_hsn_code }}</td>
<td class="text-right">{{ item.get_formatted("base_net_amount", doc) }}</td>
{% for row in doc.taxes %} {% set tax_amount = item.base_net_amount * (row.rate / 100) %}
<td class="text-right">
{{ frappe.format_value(tax_amount, {"fieldtype": "Currency"}, doc) }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<!-- Terms -->
{% if doc.terms %}
<div class="info-card">
<div class="title">{{ _("Terms and Conditions") }}</div>
{{ doc.terms}}
<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>
{% if doc.taxes_and_charges %}
<table class="tax-table mt-15">
<div class="mt-40 pb-8">{{ _("Tax Breakup") }}</div>
<thead class="highlight-bg">
<tr>
<td style="width: 5%" class="text-left">{{ _("HSN/SAC") }}</td>
<td style="width: 15%" class="text-right">{{ _("Taxable Amount") }}</td>
{% for row in doc.taxes %}
<td style="width: 10%" class="text-right">{{ row.description }} ({{ row.rate }}%)</td>
{% endfor %}
</tr>
</thead>
<tbody>
{% for item in doc.items %}
<tr>
<td class="text-left">{{ item.gst_hsn_code }}</td>
<td class="text-right">{{ item.get_formatted("base_net_amount", doc) }}</td>
{% for row in doc.taxes %} {% set tax_amount = item.base_net_amount * (row.rate / 100) %}
<td class="text-right">
{{ frappe.format_value(tax_amount, {"fieldtype": "Currency"}, doc) }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<!-- Terms -->
{% if doc.terms %}
<div class="info-card">
<div class="title">{{ _("Terms and Conditions") }}</div>
{{ doc.terms}}
</div>
{% endif %}
</div>
{% endif %}
</div>
{% endfor %}

View File

@@ -12,278 +12,304 @@ print_heading_template=None) -%} {% if letter_head and not no_letterhead %}
{{ add_header(loop.index, layout|len, doc, letter_head, no_letterhead, footer, print_settings) }}
</div>
<style>
.invoice-wrapper {
font-family: "Inter", sans-serif;
color: var(--black-overlay-700);
padding: 12px;
}
<style>
.letter-head {
margin-top: 12px !important;
}
.invoice-wrapper {
font-family: "Inter", sans-serif;
color: var(--black-overlay-700);
}
table.info-table,
table.items-table,
table.tax-table {
border-collapse: separate;
border-spacing: 0;
border: 1px solid #ededed;
border-radius: 10px;
overflow: hidden;
}
.print-format-body {
padding: 30px 12px 12px 12px !important;
}
table.info-table td {
border-bottom: 1px solid #ededed;
padding: 8px 10px !important;
}
table.items-table td,
table.tax-table td {
border-bottom: 1px solid #ededed;
padding: 8px;
}
body {
margin-bottom: 0mm !important;
padding: 0px !important;
}
table.info-table td:not(:first-of-type),
table.items-table td:not(:first-of-type),
table.tax-table td:not(:first-of-type) {
border-left: 1px solid #ededed;
}
table.info-table,
table.items-table,
table.tax-table {
border-collapse: separate;
border-spacing: 0;
border: 1px solid #ededed;
border-radius: 10px;
overflow: hidden;
}
table.info-table tbody tr:last-of-type td,
table.items-table tbody tr:last-of-type td,
table.tax-table tbody tr:last-of-type td {
border-bottom: none;
}
table.info-table td {
border-bottom: 1px solid #ededed;
padding: 8px 10px !important;
}
table.items-table td,
table.tax-table td {
border-bottom: 1px solid #ededed;
padding: 8px;
}
thead.table-header {
background: #f8f8f8;
}
thead.table-header td {
color: #7c7c7c;
}
table.info-table td:not(:first-of-type),
table.items-table td:not(:first-of-type),
table.tax-table td:not(:first-of-type) {
border-left: 1px solid #ededed;
}
.text-center {
text-align: center;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-muted {
color: #7c7c7c;
}
.text-dark {
color: #525252;
}
.text-bold {
font-weight: bold;
}
.small-text {
color: #666;
}
table.info-table tbody tr:last-of-type td,
table.items-table tbody tr:last-of-type td,
table.tax-table tbody tr:last-of-type td {
border-bottom: none;
}
.mt-10 {
margin-top: 10px;
}
.mt-15 {
margin-top: 15px;
}
.mt-20 {
margin-top: 20px;
}
.mt-40 {
margin-top: 40px;
}
.mt-80 {
margin-top: 80px;
}
.mb-20 {
margin-bottom: 20px;
}
.pb-8 {
padding-bottom: 8px;
}
thead.table-header {
background: #f8f8f8;
}
thead.table-header td {
color: #7c7c7c;
}
.totals-table {
border-radius: 5px;
width: 100%;
}
.totals-table td {
padding: 4px 8px;
}
.totals-table tr {
border-bottom: 1px solid #ededed;
}
.totals-table tr:last-child {
border-bottom: none;
}
.totals-table .grand-total td {
padding: 6px 8px;
font-weight: bold;
}
.text-center {
text-align: center;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-muted {
color: #7c7c7c;
}
.text-dark {
color: #525252;
}
.text-bold {
font-weight: bold;
}
.small-text {
color: #666;
}
.words-box {
background: #f8f8f8;
border-radius: 8px;
padding: 8px;
line-height: 21px;
letter-spacing: 0.21px;
font-size: small;
}
.mt-10 {
margin-top: 10px;
}
.mt-15 {
margin-top: 15px;
}
.mt-20 {
margin-top: 20px;
}
.mt-40 {
margin-top: 40px;
}
.mt-80 {
margin-top: 80px;
}
.mb-20 {
margin-bottom: 20px;
}
.pb-8 {
padding-bottom: 8px;
}
.info-card {
color: #7c7c7c;
}
.totals-table {
border-radius: 5px;
width: 100%;
}
.totals-table td {
padding: 4px 8px;
}
.totals-table tr {
border-bottom: 1px solid #ededed;
}
.totals-table tr:last-child {
border-bottom: none;
}
.totals-table .grand-total td {
padding: 6px 8px;
font-weight: bold;
}
.title {
color: #7c7c7c !important;
}
.words-box {
background: #f8f8f8;
border-radius: 8px;
padding: 8px;
line-height: 21px;
letter-spacing: 0.21px;
font-size: small;
}
.heading {
color: #525252 !important;
font-weight: 300;
}
.info-card {
color: #7c7c7c;
}
.print-format {
color: var(--ink-gray-8, #171717);
font-size: 14px;
font-style: normal;
font-weight: 420;
line-height: 21px;
padding: 5px;
letter-spacing: 0.14px;
}
</style>
.title {
color: #7c7c7c !important;
}
<table class="info-table mb-20">
<tr>
<td style="width: 50%">
<span class="heading">{{ _("Customer Name") }}:</span> {{doc.customer_name }}
</td>
<td style="width: 50%">
<span class="heading">{{ _("Payment Due Date") }}:</span> {{
frappe.utils.format_date(doc.due_date) }}
</td>
</tr>
<tr>
<td><span class="heading">{{ _("Invoice Number") }}:</span> {{ doc.name }}</td>
<td>
<span class="heading">{{ _("Invoice Date") }}:</span> {{
frappe.utils.format_date(doc.posting_date) }}
</td>
</tr>
<tr>
{% set address = (doc.address_display) %} {% if address and address.rstrip().endswith("<br />") %} {% set
address = address[:-5] %} {% endif %} {% set company_address_display =
(doc.company_address_display) %} {% if company_address_display and company_address_display.rstrip().endswith("<br />") %} {%
set company_address_display = company_address_display[:-5] %} {% endif %}
<td><span class="heading">{{ _("Bill From") }}:</span><br />{{ address }}</td>
<td><span class="heading">{{ _("Bill To") }}:</span><br />{{ company_address_display }}</td>
</tr>
</table>
.heading {
color: #525252 !important;
font-weight: 300;
}
<!-- Items Table -->
<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: 20%" />
<col style="width: 20%" />
</colgroup>
<thead class="table-header">
.print-format {
color: #171717;
font-size: 14px;
font-style: normal;
font-weight: 420;
line-height: 21px;
padding: 0px;
letter-spacing: 0.14px;
margin-left: 0mm !important;
margin-right: 0mm !important;
}
.letter-head-footer {
margin-top: 0px !important;
}
.print-heading {
margin-top: 0px !important;
margin-bottom: 0px !important;
padding-bottom: 0px !important;
}
</style>
<div class="print-format-body">
<table class="info-table mb-20">
<tr>
<td class="text-center">{{ _("No") }}</td>
<td class="text-left">{{ _("Item") }}</td>
<td class="text-right">{{ _("Quantity") }}</td>
<td class="text-right">{{ _("Rate") }}</td>
<td class="text-right">{{ _("Amount") }}</td>
<td style="width: 50%">
<span class="heading">{{ _("Customer Name") }}:</span> {{doc.customer_name }}
</td>
<td style="width: 50%">
<span class="heading">{{ _("Payment Due Date") }}:</span> {{
frappe.utils.format_date(doc.due_date) }}
</td>
</tr>
</thead>
<tbody>
{% for item in doc.items %}
<tr>
<td class="text-center text-dark">{{ loop.index }}</td>
<td>{{ item.item_name }}</td>
<td class="text-right text-dark">{{ item.get_formatted("qty", 0) }} {{ item.uom }}</td>
<td class="text-right text-dark">{{ item.get_formatted("net_rate", doc) }}</td>
<td class="text-right" style="color: #171717">{{ item.get_formatted("net_amount", doc) }}</td>
<td><span class="heading">{{ _("Invoice Number") }}:</span> {{ doc.name }}</td>
<td>
<span class="heading">{{ _("Invoice Date") }}:</span> {{
frappe.utils.format_date(doc.posting_date) }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
<tr>
{% set address = (doc.address_display) %} {% if address and address.rstrip().endswith("<br />")
%} {% set address = address[:-5] %} {% endif %} {% set company_address_display =
(doc.company_address_display) %} {% if company_address_display and
company_address_display.rstrip().endswith("<br />") %} {% set company_address_display =
company_address_display[:-5] %} {% endif %}
<td><span class="heading">{{ _("Bill From") }}:</span><br />{{ address }}</td>
<td><span class="heading">{{ _("Bill To") }}:</span><br />{{ company_address_display }}</td>
</tr>
</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 class="totals-table">
<tr>
<td class="text-right text-muted">{{ _("Sub Total:") }}</td>
<td class="text-right">{{ 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 %}
<tr class="grand-total">
<td class="text-right">{{ _("Grand Total:") }}</td>
<td class="text-right">{{ doc.get_formatted("grand_total", doc) }}</td>
</tr>
</table>
</div>
</div>
<!-- Tax Breakup -->
{% if doc.taxes_and_charges %}
<div class="mt-40 pb-8">{{ _("Tax Breakup") }}</div>
<div>
<table class="tax-table" style="width: 100%">
<!-- Items Table -->
<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: 20%" />
<col style="width: 20%" />
</colgroup>
<thead class="table-header">
<tr>
<td class="text-left">{{ _("HSN/SAC") }}</td>
<td class="text-right">{{ _("Taxable Amount") }}</td>
{% for row in doc.taxes %}
<td class="text-right">{{ row.description }}</td>
{% endfor %}
<td class="text-center">{{ _("No") }}</td>
<td class="text-left">{{ _("Item") }}</td>
<td class="text-right">{{ _("Quantity") }}</td>
<td class="text-right">{{ _("Rate") }}</td>
<td class="text-right">{{ _("Amount") }}</td>
</tr>
</thead>
<tbody>
{% for item in doc.items %}
<tr>
<td class="text-left">{{ item.gst_hsn_code }}</td>
<td class="text-right">{{ item.get_formatted("base_net_amount", doc) }}</td>
{% for row in doc.taxes %} {% set tax_amount = item.base_net_amount * (row.rate / 100) %}
<td class="text-right">
({{ (row.rate) }}%) {{ frappe.format_value(tax_amount, {"fieldtype": "Currency"}, doc)
}}
<td class="text-center text-dark">{{ loop.index }}</td>
<td>{{ item.item_name }}</td>
<td class="text-right text-dark">{{ item.get_formatted("qty", 0) }} {{ item.uom }}</td>
<td class="text-right text-dark">{{ item.get_formatted("net_rate", doc) }}</td>
<td class="text-right" style="color: #171717">
{{ item.get_formatted("net_amount", doc) }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
<!-- Terms -->
{% if doc.terms %}
<div class="info-card mt-40">
<div>{{ _("Terms and Conditions") }}</div>
{{ doc.terms}}
<!-- 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 class="totals-table">
<tr>
<td class="text-right text-muted">{{ _("Sub Total:") }}</td>
<td class="text-right">{{ 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 %}
<tr class="grand-total">
<td class="text-right">{{ _("Grand Total:") }}</td>
<td class="text-right">{{ doc.get_formatted("grand_total", doc) }}</td>
</tr>
</table>
</div>
</div>
<!-- Tax Breakup -->
{% if doc.taxes_and_charges %}
<div class="mt-40 pb-8">{{ _("Tax Breakup") }}</div>
<div>
<table class="tax-table" style="width: 100%">
<thead class="table-header">
<tr>
<td class="text-left">{{ _("HSN/SAC") }}</td>
<td class="text-right">{{ _("Taxable Amount") }}</td>
{% for row in doc.taxes %}
<td class="text-right">{{ row.description }}</td>
{% endfor %}
</tr>
</thead>
<tbody>
{% for item in doc.items %}
<tr>
<td class="text-left">{{ item.gst_hsn_code }}</td>
<td class="text-right">{{ item.get_formatted("base_net_amount", doc) }}</td>
{% for row in doc.taxes %} {% set tax_amount = item.base_net_amount * (row.rate / 100)
%}
<td class="text-right">
({{ (row.rate) }}%) {{ frappe.format_value(tax_amount, {"fieldtype": "Currency"},
doc) }}
</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
<!-- Terms -->
{% if doc.terms %}
<div class="info-card mt-40">
<div>{{ _("Terms and Conditions") }}</div>
{{ doc.terms}}
</div>
{% endif %}
</div>
{% endif %}
</div>
{% endfor %}