i create print format for Quotaion if i add more item in item table. Then on printing the content go in more than one page . i want that when content print more than one page so at end of every page P.T.O word print this word not print in last page.
/* Ensure the content is styled properly for printing */
@media print {
.page {
page-break-after: always;
position: relative;
}
.pto {
position: absolute;
bottom: 0;
text-align: right;
width: 100%;
}
.pto:last-of-type {
display: none;
}
}
</style>
<div class="item-table">
<!-- Assume this section will loop through items dynamically -->
{%- for item in doc.items -%}
<!-- Each item rendering here -->
<div class="item">
<!-- Item details -->
</div>
<!-- Page break logic - Adjust based on your requirement -->
{% if loop.index % 5 == 0 %}
<div class="page">
<div class="pto">P.T.O</div>
</div>
{% endif %}
{%- endfor -%}
</div>
<!-- Your other footer details here -->
</div>
please try this type of print format code
1 Like
this is my print format below .In my Item some item has more description(more than 10 lines) some item has less description (less than four line)
{% if letter_head %}
<div class="letter-head">
{{ letter_head }}
</div>
{% endif %}
<table width="100%">
<tr>
{% set transaction_date = frappe.utils.get_datetime(doc.transaction_date).strftime("%d-%B-%Y") %}
<td> {{ transaction_date or ''}}</td>
</tr>
<tr width="100%">
<td width="40%">To,<br>
<b style="color: #191ff9; font-size: 20px; font-family: sans-serif;">{{doc.customer_name}}</b><br>
<span><b>Contact Person : </b>{{ doc.contact_display or ''}}</span><br>
<span><b>Add : </b>
{% set lead_address = doc.customer_address %}
{% set add = frappe.get_doc("Address", lead_address) %}
{{add.address_line1}}
{{add.address_line2}}<br>{{add.city}}, {{add.state}}, {{add.pincode}}
</span><br>
<span><b>Contact Number : </b>{{doc.contact_mobile}}</span><br>
<span><b>Email : </b>{{doc.contact_email}}</span>
</td>
<td width="60%"></td>
</tr>
<tr>
<td>
<span><b>Subject : </b>Quotaion for {% for item in doc.items %}{{item.item_group}} {% endfor %}</span><br>
<span><b>Ref Number :</b>{{doc.custom_ref_no or " "}}</span>
</td>
</tr>
<tr>
<td colspan='2'>
<p>Respected Sir,<br>
Thank you for giving us an opportunity for serving your esteem organization. We would like to submit our quotation for the above requirement as mentioned by you
</p>
</td>
<tr>
</table>
<table width="100%" border="1" cellspcing="0">
<tr width="100%" class="txt-alg-C">
<th></th>
<th></th>
<th>Description</th>
<th>Price</th>
<th>Qty</th>
<th>Total</th>
</tr>
{% for item in doc.items %}
<tr width="100%">
<td width="4%" class="txt-c"><b>{{loop.index}}</b></td>
<td width="25%" style="text-align: center;"><img src="{{item.image or ''}}" alt=""></td>
<td width="40%"><b>{{item.item_name}}</b> <br> <span style="font-size: 12px;">{{item.description or ''}}</span></td>
<td width="10%" class="txt-c">{{item.rate or ''}}</td>
<td width="5%" class="txt-c">{{ '%g'|format(item.qty) }}</td>
<td width="13%" class="txt-c">{{item.base_amount or ''}}</td>
</tr>
{% endfor %}
<tr><td colspan='4' style='text-align: right;'>Sub Total</td> <td colspan='2' style='text-align: right;'>{{ frappe.format(doc.base_total | abs, {'fieldtype': 'Currency'}) }}</td> </tr>
<tr><td colspan='4' style='text-align: right;'>GST 18%</td> <td colspan='2' style='text-align: right;'>{{ frappe.format(doc.base_total_taxes_and_charges | abs, {'fieldtype': 'Currency'}) }}</td> </tr>
<tr><td colspan='4' style='text-align: right;'>Grand Total</td> <td colspan='2' style='text-align: right; color: #191ff9; font-weight:bold;'>{{ frappe.format(doc.base_rounded_total | abs, {'fieldtype': 'Currency'}) }}</td> </tr>
</table>
<div style="page-break-after: always;"> </div>
<table width="100%" border="1" cellspcing="0">
<tr><td align="center"><b>Term and Conditions</b></td></tr>
<tr>
<td> {% for item in doc.items %}
{% set term = frappe.get_doc("Item", item.item_code) %}
{{ term.custom_item_terms_and_conditions or ""}} <hr style="width:4px; color: black;">
{% endfor %}
</td>
</tr>
</table>
<br>
<br>
<table width="100%"><tr><td>
<p>We hope that our quotation falls in line with your requirement and assuring for our best services.</p><br>
<p>Thanking you,<br>
Yours’s faithfully <br>
<span style="font-size: 16px; color: red; font-weight: bold; font-family:Times New Roman;">For M/s. HI-TECH ENTERPRISES</span>
</p><br><br><br><br>
<p><b> {% set creator = frappe.get_doc("User", doc.owner) %}
{{creator.full_name or ''}}<br>
{{creator.role_profile_name or ''}}<br>
{{creator.mobile_no or ''}}</b>
</p></td></tr>
</table>