Item tax rate printing in Sales / Purchase Invoice

Item tax rate printing with account head and code. How to set Item tax rate printing only rate.

For that you have make your own custom print format.

1 Like

What ? Custom Print Format for displaying Tax% ?

Is’nt that the basics of invoicng ?

1 Like

Hi, did you find a solution to this problem. Please share the custom print format you have used for this issue.

<!-- Letterhead -->
<table style="width: 100%;">
    <tbody><tr>
        <td style="text-align: left;" style="width: 80%;">
        <p style="font-weight: bold; color: #00A59F;">GENERAL TRADING LLC</p>
        <p style="font-weight: bold; color: #00A59F;">.  ﻟﻠﺘﺠﺎرة اﻟﻌﺎﻣﺔ ذ.م.م</p>
        <p style="color: #2A276A;">Dubai, UAE <br></p>
        <p style="color: #2A276A;">
        <b style="color: #2A276A;">Tel :</b> +971 4 000000,
        <b style="color: #2A276A;">Email :</b> accounts@dummy.com,
        <b style="color: #2A276A;">Website :</b> www.dummy.com</p>
        <p style="color: #2A276A;"><b style="color: #2A276A;">TRN: </b>00000000000000</p>
        </td>
        <td align="right" style="width: 20%;"><img src="/files/logo-letterhead.png" width="120px"></td>
    </tr>
</tbody></table>
<hr style="border: 1.5px solid #00A59F;">

<!-- Document Title -->
<h1 style="text-align: center; font-size: 20px; font-weight: bold;">Tax Invoice</h1>

<!-- Invoice Details -->
<table border="1" style="width: 100%; font-size: 10px; margin-top: 20px; margin-bottom: 20px;">
    <tr>
        <td style="vertical-align: top; width: 60%;" rowspan="5"><strong>Buyer Details</strong><br>
        <p><strong>{{ doc.customer_name }}</strong><br>
        {{ doc.address_display }}
        {% if doc.tax_id %}<br>TRN: {{ doc.tax_id }}{% endif -%}</p>
        </td>
    </tr>
    <tr>
        <td style="width: 20%;"><strong>Invoice No.</strong></td>
        <td style="font-weight: bold; border-left: hidden; border-right: hidden;">:</td>
        <td style="width: 20%; text-align: left;">{{ doc.name }}</td>
    </tr>
    <tr>
        <td style="width: 20%;"><strong>Invoice Date</strong></td>
        <td style="font-weight: bold; border-left: hidden; border-right: hidden;">:</td>
        <td style="width: 20%; text-align: left;">{{doc.get_formatted("posting_date", doc)}}</td>
    </tr>
    <tr>
        <td style="width: 20%;"><strong>LPO No.:</strong></td>
        <td style="font-weight: bold; border-left: hidden; border-right: hidden;">:</td>
        <td style="width: 20%; text-align: left;">{% if doc.po_no %}{{ doc.po_no }}{% endif -%}</td>
    </tr>
    <tr>
        <td style="width: 20%;"><strong>Payment Terms</strong></td>
        <td style="font-weight: bold; border-left: hidden; border-right: hidden;">:</td>
        <td style="width: 20%; text-align: left;">{{ doc.payment_terms_template }}</td>
    </tr>
</table>

<!-- Line Items -->
<table border="1" style="width: 100%; font-size: 10px; margin-top: 20px; margin-bottom: 20px;">
<tbody>
	<tr style="font-weight: bold; background-color: #f1f1f1;">
		<th style="text-align: center;">Sr</th>
		<th style="text-align: left;">Item</th>
		<th style="text-align: center;">Stock UoM</th>
		<th style="text-align: center;">Qty</th>
		<th style="text-align: center;">Rate</th>
		<th style="text-align: center;">Amount</th>
		<th style="text-align: center;">VAT %</th>
		<th style="text-align: center;">VAT Amt</th>
		<th style="text-align: center;">Total</th>
	</tr>
	{% set vat_rate = [] -%}
	{% set vat_account_head = [] -%}
	{% set tot_vat_amount = [] %}
	{% set grand_total = {"qty":0.0, "amount":0.0, "vat_amt":0.0} %}
	{%- for row in doc.taxes -%}
  	   {% if 'VAT 5% - SIGTL' in row.account_head -%}
		{% set _ = vat_account_head.append(row.account_head) %}
		{% set _ = vat_rate.append(row.rate) %}
	   {%- endif -%}
	   {%- endfor -%}
{%- for row in doc.items -%}
	<tr>
	    {% set vat_amt = [] -%}
		{% set total = [] -%}
		 {% set it_vat_rate = [] -%}
		 {% set rate_found_item = 0 -%}
	      {%- set item_record = frappe.get_doc("Item", row.item_code) -%}
		{% for item_tax in item_record.taxes %}
		{% if item_tax.item_tax_template == vat_account_head[0] %}
			{% set _ = it_vat_rate.append(item_tax.tax_category) %}
			{% set _ = vat_amt.append(row.amount * it_vat_rate[0] / 100) -%}
			{% set _ = total.append(row.amount + vat_amt[0]) -%}
			{% set rate_found_item = 1 -%}
		{% endif %}		
	{% endfor %}	
  	{% if rate_found_item == 0 %}

		{% if vat_rate[0] -%}
		   {% set _ = vat_amt.append((row.amount * vat_rate[0])/100) -%}
		   {% set _ = total.append(row.amount + vat_amt[0]) -%}
		   {% set _ = it_vat_rate.append(vat_rate[0]) -%}
		   {% set rate_found_inv = 1 -%}
	       	{%- endif -%}
	{% endif %}
	{% if not it_vat_rate[0] %}
		{% set _ = it_vat_rate.append(0) %}
		{% set _ = vat_amt.append(0) %}
		{% set _ = total.append(0) -%}
	{% endif %}
	{% set temp_vat_amt = grand_total["vat_amt"] + vat_amt[0] %}
	{% set temp_qty = grand_total["qty"] + row.qty %}
	{% set temp_amount = grand_total["amount"] + row.amount %}
	{% set check = grand_total.update({"qty": temp_qty, "amount": temp_amount, "vat_amt":temp_vat_amt}) %}
	
		<td>{{ row.idx }}</td>
		<td>{{ row.item_name }} {% if row.rate == 0 %}[FOC]{% endif %}</td>
		<td style="text-align: center;">{{ row.stock_qty }} {{ row.stock_uom }}</td>
		<td style="text-align: center;">{{ row.qty }} {{ row.uom or row.stock_uom }}</td>
		<td align="right">{{ row.get_formatted("rate", doc) }}</td>
		<td align="right">{{ row.get_formatted("amount", doc) }}</td>
		<td style="text-align: center;">{{ it_vat_rate[0] }}%</td>
		<td align="right">{{ "{:,.2f} د.إ ".format(vat_amt[0])}}</td>
		<td align="right">{{ "{:,.2f} د.إ ".format(total[0]) }}</td>
</tr>
{%- endfor -%}
<tr style="font-weight: bold; background-color: #f1f1f1;">
    <td></td>
    <td>Totals</td>
    <td style="text-align: center;"></td>
    <td style="text-align: center;"></td>
    <td align="right"></td>
    <td align="right">{{ "{:,.2f} د.إ ".format(grand_total["amount"]) }}</td>
    <td style="text-align: center;"></td>
    <td align="right">{{ "{:,.2f} د.إ ".format(grand_total["vat_amt"]) }}</td>
    <td align="right">{{doc.get_formatted("grand_total", doc)}}</td>

</tr>
</tbody>
</table>

<!-- Invoice Summary -->
<table style="width: 100%; font-size: 10px; margin-top: 20px; margin-bottom: 20px;">
    <tr>
        <td style="vertical-align: top; width: 50%;" rowspan="3">
            <b>Total Net Weight : </b>{{ doc.total_net_weight }}
        </td>
    </tr>
    <tr style="font-weight: bold; font-size: 12px;">
        <td style="vertical-align: top; text-align: left;">Grand Total</td>
        <td style="vertical-align: top; text-align: right;">{{doc.get_formatted("grand_total", doc)}}</td>
    </tr>
    <tr>
        <td style="width: 25%; text-align: left;" colspan="2">{{doc.get_formatted("in_words", doc)}}</td>
    </tr>
</table>

<!-- Signature Columns -->
<table border="1" style="width: 100%; margin-top: 20px; margin-bottom: 20px;">
    <tr style="height: 125px;">
        <td style="width: 50%;"> </td>
        <td style="width: 50%;"> </td>
    </tr>
    <tr>
        <td>For {{ doc.customer_name }}</td>
        <td>For GENERAL TRADING LLC</td>
    </tr>
</table>

<!-- Bank Details -->
<table>
	<tr>
		<td>
			<strong>Bank Account Details</strong><br>
			<strong>Bank:</strong> MASHREQ BANK, MURAQABAT BRANCH, DEIRA, DUBAI<br>
			<strong>Account No.:</strong> 0000000<br>
			<strong>SWIFT:</strong> 000000<br>
			<strong>IBAN:</strong> 000000000<br>
		</td>
	</tr>
</table>