Hello community, In sales invoice currently i need 3 conditional formatting for print format. The scenario is that the customer already have the letter head and footer printed on the paper, so i need to print my content on the middle of the paper by adding page breaks in my jinja template code. currently i have a condition added that if the customer selected letter head dont show the div head box which is coded in jinja and if the customer didnt selected any letter head showcase the head box written in the jinja code. so here i need an elseif condition for the above scenario to add the break needed? anybody has any idea in this?
{% if not no_letterhead and footer %}
<div class="letter-head">
{{ letter_head }}
</div>
{% else %}
<div class="head-box">
<br>
<table style="width:100%">
<tr>
<th style="text-align: left; width: 15%">
<span style="font-size: 14px; font-weight: 700;">{{ company.company_name }}</span> <br>
<span>TAX ID :{{ company.tax_id }} </span><br>
<span>CR.NO :{{ company.registration_details }}</span><br>
<span>PHONE :{{ company.phone_no }}</span>
</th>
<th style="width: 15%;text-align: center;">
{% if company.company_logo %}
<img style="width:200px;" src={{ company.company_logo }}>
{% else %}
<img style="width:200px;" src={{ company.company_logo }}>
{% endif %}
</th>
<th style="text-align: right; width: 15%">
<span style="font-size: 14px; font-weight: 700;">{{ company.company_name_in_arabic }}</span> <br>
<span>معرف الضريبة :{{ company.tax_id }} </span><br>
<span>رقم السجل التجاري :{{ company.registration_details }}</span><br>
<span>{{ company.phone_no }}: هاتف</span>
</th>
</tr>
</table>
<br>
</div>
{% endif %}
here is my current code where i need an elseif condition
Jeel
August 22, 2024, 5:10am
2
@jaassim
{% if letterhead and footer %}
<!-- Scenario 1: Customer has both letterhead and footer -->
<div class="letter-head">
{{ letter_head }}
</div>
<!-- Handle page break here if needed -->
<div style="page-break-before: always;"></div> <!-- Add page break if needed -->
{% elif no_letterhead and footer %}
<!-- Scenario 2: Customer does not have a letterhead but has a footer -->
<div class="head-box">
<br>
<table style="width:100%">
<tr>
<th style="text-align: left; width: 15%">
<span style="font-size: 14px; font-weight: 700;">{{ company.company_name }}</span> <br>
<span>TAX ID :{{ company.tax_id }} </span><br>
<span>CR.NO :{{ company.registration_details }}</span><br>
<span>PHONE :{{ company.phone_no }}</span>
</th>
<th style="width: 15%;text-align: center;">
{% if company.company_logo %}
<img style="width:200px;" src={{ company.company_logo }}>
{% else %}
<img style="width:200px;" src={{ company.company_logo }}>
{% endif %}
</th>
<th style="text-align: right; width: 15%">
<span style="font-size: 14px; font-weight: 700;">{{ company.company_name_in_arabic }}</span> <br>
<span>معرف الضريبة :{{ company.tax_id }} </span><br>
<span>رقم السجل التجاري :{{ company.registration_details }}</span><br>
<span>{{ company.phone_no }}: هاتف</span>
</th>
</tr>
</table>
<br>
</div>
<!-- Handle page break here if needed -->
<div style="page-break-before: always;"></div> <!-- Add page break if needed -->
{% else %}
<!-- Scenario 3: No letterhead and no footer -->
<div class="head-box">
<br>
<table style="width:100%">
<tr>
<th style="text-align: left; width: 15%">
<span style="font-size: 14px; font-weight: 700;">{{ company.company_name }}</span> <br>
<span>TAX ID :{{ company.tax_id }} </span><br>
<span>CR.NO :{{ company.registration_details }}</span><br>
<span>PHONE :{{ company.phone_no }}</span>
</th>
<th style="width: 15%;text-align: center;">
{% if company.company_logo %}
<img style="width:200px;" src={{ company.company_logo }}>
{% else %}
<img style="width:200px;" src={{ company.company_logo }}>
{% endif %}
</th>
<th style="text-align: right; width: 15%">
<span style="font-size: 14px; font-weight: 700;">{{ company.company_name_in_arabic }}</span> <br>
<span>معرف الضريبة :{{ company.tax_id }} </span><br>
<span>رقم السجل التجاري :{{ company.registration_details }}</span><br>
<span>{{ company.phone_no }}: هاتف</span>
</th>
</tr>
</table>
<br>
</div>
{% endif %}
@Jeel Thanks for your valuable response. But the issue is not yet solved. currently the code which i provided is doing when printing if i select the letter head it will replace the head box section with the letter head which i selected and i didnt selected any letter head it will print the head box section now what i need is one more codition that to add blank line breaks to print only the content without anything. I think you will get it by this message.