Added Employee Report Attendance Report

Made Holiday details mandatory
This commit is contained in:
Valmik Jangla 2016-01-27 12:11:47 +05:30 committed by Anand Doshi
parent fd131a4210
commit 1890c794d7
7 changed files with 95 additions and 5 deletions

View File

@ -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"
},
]
},
{

View File

@ -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",

View File

@ -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"
}

View File

@ -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": [
]
}

View File

@ -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"
}

View File

@ -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