Printformat erpnext

How get itemwise vat amount in purchase order print format?

Use this HTML code and modify it as per your own need. Hope this will help. Thanks

<!DOCTYPE html>
<html>
<head>
    <style>
        /* Add your custom styles here */
        table {
            width: 100%;
            border-collapse: collapse;
            font-size: 8pt;
        }
        th, td {
            border: 1px solid black;
            padding: 5px;
            text-align: left;
        }
        th {
            background-color: #f2f2f2;
        }
    </style>
</head>
<body>
    <div>
        <table>
            <thead>
                <tr>
                    <th>Item Code</th>
                    <th>Description</th>
                    <th>Quantity</th>
                    <th>Rate (Ex-GST)</th>
                    <th>Tax Rate</th>
                    <th>Tax Amount</th>
                    <th>Rate (GST-Inc)</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                {% for item in doc.items %}
                    <tr>
                        <td>{{ item.item_code }}</td>
                        <td>{{ item.description }}</td>
                        <td>{{ item.qty }}</td>
                        <td>{{ item.rate }}</td>
                        <!-- Display the Item Tax Template in percentage-->
                            {% set tax = namespace(per=0) %}
                            {% set template = frappe.get_doc("Item Tax Template",item.item_tax_template) %}
                            {% for taxes in template.taxes %}
                                {% set tax.per = tax.per + taxes.tax_rate %}
                            {% endfor %}
                        <td>{{ tax.per }}%</td>
                        <td>
                            <!-- Calculate the tax amount -->
                            {% set tax = namespace(amount=0) %}
                            {% set template = frappe.get_doc("Item Tax Template",item.item_tax_template) %}
                            {% for taxes in template.taxes %}
                                {% set tax.amount = tax.amount + ( item.rate * (taxes.tax_rate / 100)) %}
                            {% endfor %}
                            {{ '{:,.2f}'.format(tax.amount|float) }}
                        </td>
                        <!-- Calculate the total including taxes -->
                        <td>{{ '{:,.2f}'.format((item.rate + tax.amount)|float) }}</td>
                        <td>{{ '{:,.2f}'.format(((item.rate + tax.amount) * item.qty)|float) }}</td>
                    </tr>
                {% endfor %}
            </tbody>
        </table>
    </div>
</body>
</html>

1 Like