From 1890c794d75ee394bc574a941630ea03baf95f4e Mon Sep 17 00:00:00 2001 From: Valmik Jangla Date: Wed, 27 Jan 2016 12:11:47 +0530 Subject: [PATCH] Added Employee Report Attendance Report Made Holiday details mandatory --- erpnext/config/hr.py | 7 +++ erpnext/hr/doctype/attendance/attendance.json | 13 +++++- erpnext/hr/doctype/holiday/holiday.json | 11 +++-- .../employee_holiday_attendance/__init__.py | 0 .../employee_holiday_attendance.js | 8 ++++ .../employee_holiday_attendance.json | 18 ++++++++ .../employee_holiday_attendance.py | 43 +++++++++++++++++++ 7 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 erpnext/hr/report/employee_holiday_attendance/__init__.py create mode 100644 erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js create mode 100644 erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.json create mode 100644 erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py diff --git a/erpnext/config/hr.py b/erpnext/config/hr.py index 39427667775..4501be72d96 100644 --- a/erpnext/config/hr.py +++ b/erpnext/config/hr.py @@ -177,6 +177,12 @@ def get_data(): "name": "Employee Birthday", "doctype": "Employee" }, + { + "type": "report", + "is_query_report": True, + "name": "Employee Holiday Attendance", + "doctype": "Employee" + }, { "type": "report", "name": "Employee Information", @@ -194,6 +200,7 @@ def get_data(): "name": "Monthly Attendance Sheet", "doctype": "Attendance" }, + ] }, { diff --git a/erpnext/hr/doctype/attendance/attendance.json b/erpnext/hr/doctype/attendance/attendance.json index 78391c8d5a0..de32328c1e0 100644 --- a/erpnext/hr/doctype/attendance/attendance.json +++ b/erpnext/hr/doctype/attendance/attendance.json @@ -26,6 +26,7 @@ "options": "Simple", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -51,6 +52,7 @@ "options": "ATT-", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -76,6 +78,7 @@ "options": "Employee", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -100,6 +103,7 @@ "oldfieldtype": "Data", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -126,6 +130,7 @@ "options": "\nPresent\nAbsent\nHalf Day", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -151,6 +156,7 @@ "options": "Leave Type", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 1, "reqd": 0, @@ -173,6 +179,7 @@ "oldfieldtype": "Column Break", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 0, @@ -198,6 +205,7 @@ "oldfieldtype": "Date", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -223,6 +231,7 @@ "options": "Fiscal Year", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -248,6 +257,7 @@ "options": "Company", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, "reqd": 1, @@ -271,6 +281,7 @@ "options": "Attendance", "permlevel": 0, "print_hide": 1, + "print_hide_if_no_value": 0, "read_only": 1, "report_hide": 0, "reqd": 0, @@ -289,7 +300,7 @@ "issingle": 0, "istable": 0, "max_attachments": 0, - "modified": "2015-11-16 06:29:42.089225", + "modified": "2016-01-25 15:36:36.252173", "modified_by": "Administrator", "module": "HR", "name": "Attendance", diff --git a/erpnext/hr/doctype/holiday/holiday.json b/erpnext/hr/doctype/holiday/holiday.json index a7fc6a7c039..091dd13ef1e 100644 --- a/erpnext/hr/doctype/holiday/holiday.json +++ b/erpnext/hr/doctype/holiday/holiday.json @@ -22,10 +22,11 @@ "no_copy": 0, "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "print_width": "300px", "read_only": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0, @@ -48,9 +49,10 @@ "oldfieldtype": "Date", "permlevel": 0, "print_hide": 0, + "print_hide_if_no_value": 0, "read_only": 0, "report_hide": 0, - "reqd": 0, + "reqd": 1, "search_index": 0, "set_only_once": 0, "unique": 0 @@ -65,12 +67,13 @@ "issingle": 0, "istable": 1, "max_attachments": 0, - "modified": "2015-11-16 06:29:47.483435", + "modified": "2016-01-27 11:52:46.864792", "modified_by": "Administrator", "module": "HR", "name": "Holiday", "owner": "Administrator", "permissions": [], "read_only": 0, - "read_only_onload": 0 + "read_only_onload": 0, + "sort_order": "ASC" } \ No newline at end of file diff --git a/erpnext/hr/report/employee_holiday_attendance/__init__.py b/erpnext/hr/report/employee_holiday_attendance/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js new file mode 100644 index 00000000000..f1037ff0586 --- /dev/null +++ b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.js @@ -0,0 +1,8 @@ +// Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors +// For license information, please see license.txt + +frappe.query_reports["Employee Holiday Attendance"] = { + "filters": [ + + ] +} diff --git a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.json b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.json new file mode 100644 index 00000000000..f538d30c241 --- /dev/null +++ b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.json @@ -0,0 +1,18 @@ +{ + "add_total_row": 0, + "apply_user_permissions": 1, + "creation": "2016-01-27 11:12:14.972452", + "disabled": 0, + "docstatus": 0, + "doctype": "Report", + "idx": 0, + "is_standard": "Yes", + "modified": "2016-01-27 11:12:14.972452", + "modified_by": "Administrator", + "module": "HR", + "name": "Employee Holiday Attendance", + "owner": "Administrator", + "ref_doctype": "Attendance", + "report_name": "Employee Holiday Attendance", + "report_type": "Script Report" +} \ No newline at end of file diff --git a/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py new file mode 100644 index 00000000000..ce8d5dd35d3 --- /dev/null +++ b/erpnext/hr/report/employee_holiday_attendance/employee_holiday_attendance.py @@ -0,0 +1,43 @@ +# Copyright (c) 2013, Frappe Technologies Pvt. Ltd. and contributors +# For license information, please see license.txt + +from __future__ import unicode_literals +import frappe +from frappe import _ + + +def execute(filters=None): + if not filters: + filters = {} + + columns = get_columns() + data = get_employees() + return columns, data + + +def get_columns(): + + return [ + _("Employee") + ":Link/Employee:120", _("Name") + ":Data:200", _("Date")+ ":Date:100", + _("Status") + ":Data:70",_("Holiday") + ":Data:200" + + ] + + +def get_employees(): + holidays = frappe.get_all("Holiday", fields=["holiday_date", "description"]) + holiday_names = {} + holidays_list = [] + + for holiday in holidays: + holidays_list.append("'" + holiday.holiday_date.strftime('%Y-%m-%d') + "'") + holiday_names[holiday.holiday_date] = holiday.description + + employee_list = frappe.db.sql( + "select employee, employee_name, att_date, status from tabAttendance where att_date in (" + + ', '.join(holidays_list) + ")", + as_list=True) + + for employee_data in employee_list: + employee_data.append(holiday_names[employee_data[2]]) + return employee_list