mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 20:49:19 +00:00
added new language and filters in query reports
This commit is contained in:
11
hr/report/employee_leave_balance/employee_leave_balance.js
Normal file
11
hr/report/employee_leave_balance/employee_leave_balance.js
Normal file
@@ -0,0 +1,11 @@
|
||||
wn.query_reports["Employee Leave Balance"] = {
|
||||
"filters": [
|
||||
{
|
||||
"fieldname":"fiscal_year",
|
||||
"label": "Fiscal Year",
|
||||
"fieldtype": "Link",
|
||||
"options": "Fiscal Year",
|
||||
"default": wn.defaults.get_user_default("fiscal_year")
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -2,12 +2,19 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
from webnotes.widgets.reportview import execute as runreport
|
||||
|
||||
def execute():
|
||||
def execute(filters={}):
|
||||
employees = runreport(doctype="Employee", fields=["name", "employee_name", "department"])
|
||||
leave_types = webnotes.conn.sql_list("select name from `tabLeave Type`")
|
||||
fiscal_years = webnotes.conn.sql_list("select name from `tabFiscal Year` order by name desc")
|
||||
|
||||
if filters.get("fiscal_year"):
|
||||
fiscal_years = [filters["fiscal_year"]]
|
||||
else:
|
||||
fiscal_years = webnotes.conn.sql_list("select name from `tabFiscal Year` order by name desc")
|
||||
|
||||
employee_in = '", "'.join([e.name for e in employees])
|
||||
|
||||
|
||||
|
||||
allocations = webnotes.conn.sql("""select employee, fiscal_year, leave_type, total_leaves_allocated
|
||||
from `tabLeave Allocation`
|
||||
where docstatus=1 and employee in ("%s")""" % employee_in, as_dict=True)
|
||||
|
||||
Reference in New Issue
Block a user