Hide Salary component from salaryslip

I want to hide particular ‘salary component’ from ‘salary slip’ printing using “do not include in total” checkbox.

Thanks in advance…

@Saditi

If you want to hide Salary component based on some condition then you need to design a custom print format.

Example of Custom Print Format:-

jinja_templating_example

1 Like

Thanks for replying @ROHAN_JAIN1,
Can I use this code here?

<div {{ fieldmeta(df) }}>
		<table class="table table-bordered table-condensed">
			<thead>
				<tr>
					<th style="width: 40px" class="table-sr">{{ _("Sr") }}</th>
					{% for tdf in visible_columns %}
					{% if (data and not data[0].flags.compact_item_print) or tdf.fieldname in doc.get(df.fieldname)[0].flags.compact_item_fields %}
						<th style="width: {{ get_width(tdf) }};" class="{{ get_align_class(tdf) }}" {{ fieldmeta(df) }}>
							{{ _(tdf.label) }}</th>
					{% endif %}
					{% endfor %}
				</tr>
			</thead>
			<tbody>
				{% for d in data %}
				<tr>
					<td class="table-sr">{{ d.idx }}</td>
					{% for tdf in visible_columns %}
					{% if not d.flags.compact_item_print or tdf.fieldname in doc.get(df.fieldname)[0].flags.compact_item_fields %}
						<td class="{{ get_align_class(tdf) }}" {{ fieldmeta(df) }}>
                            <div class="value">{{ print_value(tdf, d, doc, visible_columns) }}</div></td>
					{% endif %}
					{% endfor %}
				</tr>
				{% endfor %}
			</tbody>
		</table>

It prints salaryslip by fetching all the components.

If you have used custom print format then you can use it.

Yes.

@ROHAN_JAIN1 I was using standard format.
Can you please explain your code?

In my code, I am trying to get those value only whos do_not_include_in_total value is 0 (not checked).
to access anything of the document in the custom print format we use doc.fieldname

1 Like

Thank you so much @ROHAN_JAIN1 ,you saved me again.
I tried your code and it worked acc to my need…

1 Like