How to calculate the total working hours of each employee in a week

hello I want to calculate the total working hours of each week of each employee .
Currently it shows the working hours of each day .
I want the sum of these working hours of each employee when we take start day as sunday and end day as saturday

you can create a custom field.
create custom files and client scripts.
“total hours”
Sunday to Saturday employee working hours fetch to total hours

Where?

Where? and how does the file work?

On which doctype?

@THANGAPANDIAN, do you have a complete solution? I am also looking the same.

Thanks

Hi:

Create a query report, with this query:

select employee_name as employee, year(start_date) as year, week(start_date) as week, sum(total_hours) as hours from `tabTimesheet` where status = 'Submitted' group by employee, week(start_date) 

This returns total hours for each employee each week from Timesheets, based on Start Date of Timesheet. Depending on your scenario, maybe need some tuning.

Hope this helps.

Sir, can you explain this in detail?

Sir, I have" working hours" field in the attendance doctype. I required the sum of these values in this field when we gives a start and end date, for all employees.
I also tried the custom server script and client script.

hope your valuable response.

Hi:

My sample was based on Timesheet … Maybe I didn’t understand your question, sorry …
So … Have you added a custom field on attendance doctype, right? Ok, you need to create a query report …

Check this:
https://frappeframework.com/docs/user/en/desk/reports/query-report

And this:

Query

select employee_name as employee, year(attendance_date) as year, week(attendance_date) as week, sum(working_hours) as hours from `tabAttendance` group by employee, week(attendance_date) 

Note that “working_hours” couldn’t be the real name of your custom field (check it).
Hope this helps.