Dear Awesome Team,
If any one can help us in below. Highly appreciated.
We have customized Absent Days details of an employee in the Salary Slip Print Format.
But some times, employee is on long leave for more than 3 days. In this case, we want the rows to be clubbed i.e. Start Absent Date to End Absent Date in Single Column Field instead of each Absent Day coming on separate row, making the table very long and useless.
So, Condition will be → If Employee has no Checkins (IN & OUT both are NONE) and Working Hours is Zero for equal / more than 3 days, then the rows should be clubbed together in single line.
Ninja Code in Print FOrmat given below.
{% if doc.absent_days %}
Absent Dates & Details
<tbody>
<tr>
<th>Absent Dates </th>
<th>Working Hrs</th>
<th>In Time</th>
<th>Out Time</th>
</tr>
{% for row in frappe.get_list ('Attendance', filters={'employee': doc.employee,'status': 'Absent','attendance_date': ['between',(doc.start_date, doc.end_date)]}, fields= ['attendance_date','working_hours','in_time','out_time'],order_by='attendance_date asc') %}
<tr>
<td>{{ row.attendance_date.strftime("%d-%m-%Y") }}</td>
<td>{{ row.working_hours }}</td>
<td>
{% if row.in_time %}
{{ row.in_time.strftime("%H:%M:%S") }}
{% else %}
{{ row.in_time }}
{% endif %}
</td>
<td>
{% if row.out_time %}
{{ row.out_time.strftime("%H:%M:%S") }}
{% else %}
{{ row.out_time }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif%}
Pls refer images.
Instead of 3 rows, there should be SINGLE row with the below value in Absent Date Field.
value-> 01-12-2023 to 03-12-2023 …
Hope my question is clear.
Many Thanks