diff --git a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js index f1037ff0586..d9d4c8c3ebf 100644 --- a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js +++ b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js @@ -3,6 +3,19 @@ frappe.query_reports["Employee Holiday Attendance"] = { "filters": [ - + { + "fieldname":"from_date", + "label": __("From Date"), + "fieldtype": "Date", + "reqd": 1, + "default": frappe.datetime.year_start() + }, + { + "fieldname":"to_date", + "label": __("To Date"), + "fieldtype": "Date", + "reqd": 1, + "default": frappe.datetime.year_end() + } ] } diff --git a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py index bb68cf3c702..6ba0e694efb 100644 --- a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py +++ b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py @@ -11,7 +11,7 @@ def execute(filters=None): filters = {} columns = get_columns() - data = get_employees() + data = get_employees(filters) return columns, data @@ -19,14 +19,19 @@ def get_columns(): return [ _("Employee") + ":Link/Employee:120", _("Name") + ":Data:200", - _("Date")+ ":Date:100", + _("Date") + ":Date:100", _("Status") + ":Data:70", _("Holiday") + ":Data:200" ] -def get_employees(): - holidays = frappe.get_all("Holiday", fields=["holiday_date", "description"]) +def get_employees(filters): + holidays = frappe.get_all("Holiday", + fields=["holiday_date", "description"], + filters=[["holiday_date", ">", + filters.from_date], + ["holiday_date", "<", filters.to_date]]) + print holidays holiday_names = {} holidays_list = [] @@ -35,15 +40,15 @@ def get_employees(): holiday_names[holiday.holiday_date] = holiday.description if(holidays_list): employee_list = frappe.db.sql("""select - employee, employee_name, att_date, status - from tabAttendance - where - att_date in ({0})""".format(', '.join(["%s"]*len(holidays_list))), - holidays_list, as_list=True) + employee, employee_name, att_date, status + from tabAttendance + where + att_date in ({0})""".format(', '.join(["%s"] * len(holidays_list))), + holidays_list, as_list=True) for employee_data in employee_list: employee_data.append(holiday_names[employee_data[2]]) return employee_list else: - return None \ No newline at end of file + return [] diff --git a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py index 0dc25d2d29e..3bc355c0810 100644 --- a/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py +++ b/erpnext/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py @@ -27,7 +27,7 @@ def execute(filters=None): total_p = total_a = 0.0 for day in range(filters["total_days_in_month"]): status = att_map.get(emp).get(day + 1, "Absent") - status_map = {"Present": "P", "Absent": "A", "Half Day": "HD"} + status_map = {"Present": "P", "Absent": "A", "Half Day": "H"} row.append(status_map[status]) if status == "Present":