[report] employee birthday
This commit is contained in:
parent
15697ed937
commit
35e7e8f58f
@ -169,6 +169,10 @@ wn.module_page["HR"] = [
|
||||
"label":wn._("Employee Leave Balance"),
|
||||
route: "query-report/Employee Leave Balance"
|
||||
},
|
||||
{
|
||||
"label":wn._("Employee Birthday"),
|
||||
route: "query-report/Employee Birthday"
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
0
hr/report/employee_birthday/__init__.py
Normal file
0
hr/report/employee_birthday/__init__.py
Normal file
19
hr/report/employee_birthday/employee_birthday.js
Normal file
19
hr/report/employee_birthday/employee_birthday.js
Normal file
@ -0,0 +1,19 @@
|
||||
wn.query_reports["Employee Birthday"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"month",
|
||||
"label": "Month",
|
||||
"fieldtype": "Select",
|
||||
"options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
|
||||
"default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
||||
"Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
|
||||
},
|
||||
{
|
||||
"fieldname":"company",
|
||||
"label": "Company",
|
||||
"fieldtype": "Link",
|
||||
"options": "Company",
|
||||
"default": wn.defaults.get_user_default("company")
|
||||
}
|
||||
]
|
||||
}
|
50
hr/report/employee_birthday/employee_birthday.py
Normal file
50
hr/report/employee_birthday/employee_birthday.py
Normal file
@ -0,0 +1,50 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.utils import flt
|
||||
|
||||
def execute(filters=None):
|
||||
if not filters: filters = {}
|
||||
|
||||
columns = get_columns()
|
||||
data = get_employees(filters)
|
||||
|
||||
return columns, data
|
||||
|
||||
def get_columns():
|
||||
return [
|
||||
"Employee:Link/Employee:120", "Date of Birth:Date:100", "Branch:Link/Branch:120",
|
||||
"Department:Link/Department:120", "Designation:Link/Designation:120", "Gender::60",
|
||||
"Company:Link/Company:120"
|
||||
]
|
||||
|
||||
def get_employees(filters):
|
||||
conditions = get_conditions(filters)
|
||||
return webnotes.conn.sql("""select name, date_of_birth, branch, department, designation,
|
||||
gender, company from tabEmployee where status = 'Active' %s""" % conditions, as_list=1)
|
||||
|
||||
def get_conditions(filters):
|
||||
conditions = ""
|
||||
if filters.get("month"):
|
||||
month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
||||
"Dec"].index(filters["month"]) + 1
|
||||
conditions += " and month(date_of_birth) = '%s'" % month
|
||||
|
||||
if filters.get("company"): conditions += " and company = '%s'" % filters["company"]
|
||||
|
||||
return conditions
|
21
hr/report/employee_birthday/employee_birthday.txt
Normal file
21
hr/report/employee_birthday/employee_birthday.txt
Normal file
@ -0,0 +1,21 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-05-06 17:56:03",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-06 17:56:03",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"is_standard": "Yes",
|
||||
"name": "__common__",
|
||||
"ref_doctype": "Employee",
|
||||
"report_name": "Employee Birthday",
|
||||
"report_type": "Script Report"
|
||||
},
|
||||
{
|
||||
"doctype": "Report",
|
||||
"name": "Employee Birthday"
|
||||
}
|
||||
]
|
Loading…
Reference in New Issue
Block a user