Merge pull request #1879 from anandpdoshi/anand-wip
Fixed Employee Birthday Report
This commit is contained in:
commit
843cdbe690
@ -7,32 +7,32 @@ from frappe.utils import flt
|
|||||||
|
|
||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
if not filters: filters = {}
|
if not filters: filters = {}
|
||||||
|
|
||||||
columns = get_columns()
|
columns = get_columns()
|
||||||
data = get_employees(filters)
|
data = get_employees(filters)
|
||||||
|
|
||||||
return columns, data
|
return columns, data
|
||||||
|
|
||||||
def get_columns():
|
def get_columns():
|
||||||
return [
|
return [
|
||||||
"Employee:Link/Employee:120", "Date of Birth:Date:100", "Branch:Link/Branch:120",
|
"Employee:Link/Employee:120", "Date of Birth:Date:100", "Branch:Link/Branch:120",
|
||||||
"Department:Link/Department:120", "Designation:Link/Designation:120", "Gender::60",
|
"Department:Link/Department:120", "Designation:Link/Designation:120", "Gender::60",
|
||||||
"Company:Link/Company:120"
|
"Company:Link/Company:120"
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_employees(filters):
|
def get_employees(filters):
|
||||||
conditions = get_conditions(filters)
|
conditions = get_conditions(filters)
|
||||||
return frappe.db.sql("""select name, date_of_birth, branch, department, designation,
|
return frappe.db.sql("""select name, date_of_birth, branch, department, designation,
|
||||||
gender, company from tabEmployee where status = 'Active' %s""" % conditions, as_list=1)
|
gender, company from tabEmployee where status = 'Active' %s""" % conditions, as_list=1)
|
||||||
|
|
||||||
def get_conditions(filters):
|
def get_conditions(filters):
|
||||||
conditions = ""
|
conditions = ""
|
||||||
if filters.get("month"):
|
if filters.get("month"):
|
||||||
month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
|
||||||
"Dec"].index(filters["month"]) + 1
|
"Dec"].index(filters["month"]) + 1
|
||||||
conditions += " and month(date_of_birth) = '%s'" % month
|
conditions += " and month(date_of_birth) = '%s'" % month
|
||||||
|
|
||||||
if filters.get("company"): conditions += " and company = '%s'" % \
|
if filters.get("company"): conditions += " and company = '%s'" % \
|
||||||
filters["company"].repalce("'", "\'")
|
filters["company"].replace("'", "\\'")
|
||||||
|
|
||||||
return conditions
|
return conditions
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user