I need "from date" and "to date" filter in query report

Hi All,
I created new query report, Attedance Summary report my query code is
SELECT
ta.attendance_date AS “Attendance Date:Date:100”,
ta.employee AS “Employee:Link/Employee:150”,
COUNT(CASE WHEN ta.status = ‘Present’ THEN 1 END) AS “Total Present:Int:100”,
COUNT(CASE WHEN ta.status = ‘Absent’ THEN 1 END) AS “Total Absent:Int:100”,
SUM(TIMESTAMPDIFF(HOUR, ta.in_time, ta.out_time)) AS “Total Working Hours:Float:120”,
COUNT(CASE WHEN ta.late_entry = 1 THEN 1 END) AS “Total Late Entry:Int:100”,
COUNT(CASE WHEN ta.early_exit = 1 THEN 1 END) AS “Total Early Exit:Int:100”
FROM
tabAttendance ta
WHERE
ta.docstatus = 1
GROUP BY
ta.employee, ta.attendance_date
ORDER BY
ta.employee, ta.attendance_date;

i need “from date” and “to date” filters in this query report
Thanks in Advance

You can add directly filters from here:

(go to your report)

Please check it.

WhatsApp Image 2024-06-28 at 11.44.42 AM
but i need like summary
Thanks in Advance

First you have to add the filter and you have to select the data, after then data will appear.

WhatsApp Image 2024-06-28 at 11.44.42 AM
but in my case need like above image summary report can u please guide me for a custom report or query report if they choose the employee monthly present,absent,Late entry,early exit need
Thanks in Advance

You have to develop the server script report according to the requirements.

WhatsApp Image 2024-06-28 at 11.44.42 AM
can guide for the server script code for following fields “Employee”,“Total Present”,“Total Absent”,Total Late Entry",“Total Early Exit”,“Total Working Hours” and month wise filter need like the above image
Thanks in Advance

Please apply the query:

SELECT
    ta.employee AS "Employee:Link/Employee:200",
    COUNT(CASE WHEN ta.status = 'Present' THEN 1 END) AS "Total Present:Int:200",
    COUNT(CASE WHEN ta.status = 'Absent' THEN 1 END) AS "Total Absent:Int:200",
    COUNT(CASE WHEN ta.late_entry = 1 THEN 1 END) AS "Total Late Entry:Int:200",
    COUNT(CASE WHEN ta.early_exit = 1 THEN 1 END) AS "Total Early Exit:Int:200",
    SUM(TIMESTAMPDIFF(HOUR, ta.in_time, ta.out_time)) AS "Total Working Hours:Float:200"
FROM
    tabAttendance ta
WHERE
    ta.docstatus = 1
    AND MONTH(ta.attendance_date) = 
        CASE 
            WHEN %(month)s = 'January' THEN 1
            WHEN %(month)s = 'February' THEN 2
            WHEN %(month)s = 'March' THEN 3
            WHEN %(month)s = 'April' THEN 4
            WHEN %(month)s = 'May' THEN 5
            WHEN %(month)s = 'June' THEN 6
            WHEN %(month)s = 'July' THEN 7
            WHEN %(month)s = 'August' THEN 8
            WHEN %(month)s = 'September' THEN 9
            WHEN %(month)s = 'October' THEN 10
            WHEN %(month)s = 'November' THEN 11
            WHEN %(month)s = 'December' THEN 12
        END
    AND YEAR(ta.attendance_date) = %(year)s
GROUP BY
    ta.employee
ORDER BY
    ta.employee;

Output:

If you want to make a more dynamic report then you have to build the server script report so please check the reference:

1 Like

Thank you so much bro