fix: dashboard changes
This commit is contained in:
parent
36aea71fd7
commit
57bfee8ea9
@ -24,33 +24,36 @@ def get_human_resource_dashboard():
|
|||||||
"is_default": 1,
|
"is_default": 1,
|
||||||
"charts": [
|
"charts": [
|
||||||
{ "chart": "Gender Diversity Ratio", "width": "Half"},
|
{ "chart": "Gender Diversity Ratio", "width": "Half"},
|
||||||
{ "chart": "Employee Count", "width": "Half"},
|
{ "chart": "Job Application Status", "width": "Half"},
|
||||||
|
{ "chart": 'Designation Wise Employee Count', "width": "Half"},
|
||||||
|
{ "chart": 'Department Wise Employee Count', "width": "Half"},
|
||||||
|
{ "chart": 'Designation Wise Openings', "width": "Half"},
|
||||||
|
{ "chart": 'Department Wise Openings', "width": "Half"},
|
||||||
{ "chart": "Outgoing Salary", "width": "Full"},
|
{ "chart": "Outgoing Salary", "width": "Full"},
|
||||||
{ "chart": "Attendance Count", "width": "Full"}
|
{ "chart": "Attendance Count", "width": "Full"}
|
||||||
],
|
],
|
||||||
"cards": [
|
"cards": [
|
||||||
{"card": "Total Employees"},
|
{"card": "Total Employees"},
|
||||||
{"card": "New Joinees"},
|
{"card": "New Joinees"},
|
||||||
{'card': "Job Applicants"},
|
{'card': "Employees Left"},
|
||||||
{'card': "Employees Left"}
|
{'card': "Total Job Openings"},
|
||||||
|
{'card': "Total Applicants"},
|
||||||
|
{'card': "Short Listed Candidates"},
|
||||||
|
{'card': "Rejected Candidates"},
|
||||||
|
{'card': "Total Job Offered"},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_recruitment_dashboard():
|
def get_recruitment_dashboard():
|
||||||
pass
|
pass
|
||||||
# return {
|
|
||||||
# "name": "Human Resource",
|
|
||||||
# "dashboard_name": "Human Resource",
|
|
||||||
# "is_default": 1,
|
|
||||||
# "charts": [
|
|
||||||
# ],
|
|
||||||
# "cards": [
|
|
||||||
# ]
|
|
||||||
# }
|
|
||||||
|
|
||||||
|
|
||||||
def get_charts():
|
def get_charts():
|
||||||
company = erpnext.get_default_company()
|
company = erpnext.get_default_company()
|
||||||
|
date = frappe.utils.get_datetime()
|
||||||
|
|
||||||
|
month_map = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov","Dec"]
|
||||||
|
|
||||||
|
|
||||||
if not company:
|
if not company:
|
||||||
company = frappe.db.get_value("Company", {"is_group": 0}, "name")
|
company = frappe.db.get_value("Company", {"is_group": 0}, "name")
|
||||||
@ -60,24 +63,34 @@ def get_charts():
|
|||||||
]
|
]
|
||||||
|
|
||||||
dashboard_charts.append(
|
dashboard_charts.append(
|
||||||
get_dashboards_chart_doc('Outgoing salary', "Sum", "Line",document_type = "Salary Slip", group_by_type="Count", based_on="end_date", value_based_on = "rounded_total", time_interval = "Monthly", timeseries = 1 , filters_json = json.dumps([["Salary Slip","docstatus","=","1"]]))
|
get_dashboards_chart_doc('Job Application Status', "Group By", "Donut",document_type = "Job Applicant", group_by_type="Count", group_by_based_on="status", filters_json = json.dumps([["Job Applicant","creation","Previous","1 month"]]), time_interval = "Monthly")
|
||||||
)
|
)
|
||||||
|
|
||||||
custom_options = '''{"type": "bar", "axisOptions": {"shortenYAxisNumbers": 1}, "tooltipOptions": {}, "barOptions":{"stacked": 1}}'''
|
|
||||||
filters_json = json.dumps({"month":"May","year":"2020","company":company})
|
|
||||||
|
|
||||||
dashboard_charts.append(
|
dashboard_charts.append(
|
||||||
get_dashboards_chart_doc('Attendance Count', "Report", "Bar",report_name = "Monthly Attendance Sheet", is_custom =1,group_by_type="Count", timeseries = 1 , filters_json = filters_json, custom_options=custom_options)
|
get_dashboards_chart_doc('Outgoing Salary', "Sum", "Line",document_type = "Salary Slip", group_by_type="Count", based_on="end_date", value_based_on = "rounded_total", time_interval = "Monthly", timeseries = 1 , filters_json = json.dumps([["Salary Slip","docstatus","=","1"]]))
|
||||||
)
|
)
|
||||||
|
custom_options = '''{"type": "line", "lineOptions": {"dotSize": 6}, "axisOptions": {"shortenYAxisNumbers": 1}, "tooltipOptions": {}}'''
|
||||||
custom_options = """{"type": "donut", "axisOptions": {"shortenYAxisNumbers": 1}}"""
|
filters_json = json.dumps({"month": month_map[date.month - 1], "year": str(date.year), "company":company})
|
||||||
filters_json = json.dumps({"company":company ,"parameter":"Department"})
|
|
||||||
|
|
||||||
dashboard_charts.append(
|
dashboard_charts.append(
|
||||||
get_dashboards_chart_doc('Employee Count', "Report", "Donut",report_name = "Employee Analytics", is_custom =1, group_by_type="Count", timeseries = 1 , filters_json = filters_json, custom_options=custom_options)
|
get_dashboards_chart_doc('Attendance Count', "Report", "Line",report_name = "Monthly Attendance Sheet", is_custom =1,group_by_type="Count", filters_json = filters_json, custom_options=custom_options)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
dashboard_charts.append(
|
||||||
|
get_dashboards_chart_doc('Department Wise Employee Count', "Group By", "Donut",document_type = "Employee", group_by_type="Count", group_by_based_on="department", filters_json = json.dumps([["Employee","status","=","Active"]]), time_interval = "Monthly")
|
||||||
|
)
|
||||||
|
|
||||||
|
dashboard_charts.append(
|
||||||
|
get_dashboards_chart_doc('Designation Wise Employee Count', "Group By", "Donut",document_type = "Employee", group_by_type="Count", group_by_based_on="designation", filters_json = json.dumps([["Employee","status","=","Active"]]), time_interval = "Monthly")
|
||||||
|
)
|
||||||
|
|
||||||
|
dashboard_charts.append(
|
||||||
|
get_dashboards_chart_doc('Designation Wise Openings', "Group By", "Bar",document_type = "Job Opening", group_by_type="Sum", group_by_based_on="designation", time_interval = "Monthly", aggregate_function_based_on = "planned_vacancies")
|
||||||
|
)
|
||||||
|
dashboard_charts.append(
|
||||||
|
get_dashboards_chart_doc('Department Wise Openings', "Group By", "Bar",document_type = "Job Opening", group_by_type="Sum", group_by_based_on="department", time_interval = "Monthly", aggregate_function_based_on = "planned_vacancies")
|
||||||
|
)
|
||||||
|
return dashboard_charts
|
||||||
|
|
||||||
|
|
||||||
def get_number_cards():
|
def get_number_cards():
|
||||||
@ -89,26 +102,53 @@ def get_number_cards():
|
|||||||
])
|
])
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
number_cards.append(
|
number_cards.append(
|
||||||
get_number_cards_doc("Employee", "New Joinees", filters_json = json.dumps([
|
get_number_cards_doc("Employee", "New Joinees", filters_json = json.dumps([
|
||||||
["Employee","date_of_joining","Previous","6 months"],
|
["Employee","date_of_joining","Previous","1 year"],
|
||||||
["Employee","status","=","Active"]
|
["Employee","status","=","Active"]
|
||||||
]),
|
])
|
||||||
stats_time_interval = "Daily")
|
|
||||||
)
|
)
|
||||||
|
)
|
||||||
|
|
||||||
number_cards.append(
|
number_cards.append(
|
||||||
get_number_cards_doc("Employee", "Employees Left", filters_json = json.dumps([
|
get_number_cards_doc("Employee", "Employees Left", filters_json = json.dumps([
|
||||||
|
["Employee","modified","Previous","1 year"],
|
||||||
["Employee","status","=","Left"]
|
["Employee","status","=","Left"]
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
number_cards.append(
|
number_cards.append(
|
||||||
get_number_cards_doc("Job Applicant", "Job Applicants", filters_json = json.dumps([
|
get_number_cards_doc("Job Applicant", "Total Applicants", filters_json = json.dumps([
|
||||||
["Job Applicant","status","!=","Rejected"]
|
["Job Applicant","creation","Previous","1 month"]
|
||||||
])
|
])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
number_cards.append(
|
||||||
|
get_number_cards_doc("Job Opening", "Total Job Openings", func = "Sum",aggregate_function_based_on = "planned_vacancies", filters_json = json.dumps([["Job Opening","creation","Previous","1 month"]])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
number_cards.append(
|
||||||
|
get_number_cards_doc("Job Applicant", "Short Listed Candidates", filters_json = json.dumps([
|
||||||
|
["Job Applicant","status","=","Accepted"],
|
||||||
|
["Job Applicant","creation","Previous","1 month"]
|
||||||
|
])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
number_cards.append(
|
||||||
|
get_number_cards_doc("Job Applicant", "Rejected Candidates", filters_json = json.dumps([
|
||||||
|
["Job Applicant","status","=","Rejected"],
|
||||||
|
["Job Applicant","creation","Previous","1 month"]
|
||||||
|
])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
number_cards.append(
|
||||||
|
get_number_cards_doc("Job Offer", "Total Job Offered", filters_json = json.dumps([["Job Offer","creation","Previous","1 month"]])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
return number_cards
|
return number_cards
|
||||||
|
|
||||||
|
|
||||||
@ -125,6 +165,7 @@ def get_number_cards_doc(document_type, label, **args):
|
|||||||
"show_percentage_stats": args.show_percentage_stats or 1,
|
"show_percentage_stats": args.show_percentage_stats or 1,
|
||||||
"stats_time_interval": args.stats_time_interval or 'Monthly',
|
"stats_time_interval": args.stats_time_interval or 'Monthly',
|
||||||
"filters_json": args.filters_json or '[]',
|
"filters_json": args.filters_json or '[]',
|
||||||
|
"aggregate_function_based_on": args.aggregate_function_based_on or None
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_dashboards_chart_doc(name, chart_type, graph_type, **args):
|
def get_dashboards_chart_doc(name, chart_type, graph_type, **args):
|
||||||
@ -151,4 +192,5 @@ def get_dashboards_chart_doc(name, chart_type, graph_type, **args):
|
|||||||
"type": graph_type,
|
"type": graph_type,
|
||||||
"custom_options": args.custom_options or '',
|
"custom_options": args.custom_options or '',
|
||||||
"doctype": "Dashboard Chart",
|
"doctype": "Dashboard Chart",
|
||||||
|
"aggregate_function_based_on": args.aggregate_function_based_on or None
|
||||||
}
|
}
|
@ -77,21 +77,26 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"category": "Modules",
|
"category": "Modules",
|
||||||
"charts": [],
|
"charts": [
|
||||||
|
{
|
||||||
|
"chart_name": "Outgoing Salary",
|
||||||
|
"label": "Outgoing Salary"
|
||||||
|
}
|
||||||
|
],
|
||||||
"creation": "2020-03-02 15:48:58.322521",
|
"creation": "2020-03-02 15:48:58.322521",
|
||||||
"developer_mode_only": 0,
|
"developer_mode_only": 0,
|
||||||
"disable_user_customization": 0,
|
"disable_user_customization": 0,
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"doctype": "Desk Page",
|
"doctype": "Desk Page",
|
||||||
"extends_another_page": 0,
|
"extends_another_page": 0,
|
||||||
"icon": "",
|
|
||||||
"idx": 0,
|
"idx": 0,
|
||||||
"is_standard": 1,
|
"is_standard": 1,
|
||||||
"label": "HR",
|
"label": "HR",
|
||||||
"modified": "2020-04-29 20:29:22.114309",
|
"modified": "2020-05-14 12:14:21.682026",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "HR",
|
"name": "HR",
|
||||||
|
"onboarding": "Human Resource",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"pin_to_bottom": 0,
|
"pin_to_bottom": 0,
|
||||||
"pin_to_top": 0,
|
"pin_to_top": 0,
|
||||||
@ -104,10 +109,20 @@
|
|||||||
"type": "DocType"
|
"type": "DocType"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"format": "{} Unpaid",
|
"label": "Attendance",
|
||||||
"label": "Expense Claim",
|
"link_to": "Attendance",
|
||||||
"link_to": "Expense Claim",
|
"stats_filter": "",
|
||||||
"stats_filter": "{\"approval_status\":\"Draft\"}",
|
"type": "DocType"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Leave Application",
|
||||||
|
"link_to": "Leave Application",
|
||||||
|
"stats_filter": "{\"status\":\"Open\"}",
|
||||||
|
"type": "DocType"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"label": "Salary Structure",
|
||||||
|
"link_to": "Payroll Entry",
|
||||||
"type": "DocType"
|
"type": "DocType"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -117,19 +132,9 @@
|
|||||||
"stats_filter": "{\n \"status\": \"Open\"\n}",
|
"stats_filter": "{\n \"status\": \"Open\"\n}",
|
||||||
"type": "DocType"
|
"type": "DocType"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"label": "Salary Structure",
|
|
||||||
"link_to": "Salary Structure",
|
|
||||||
"type": "DocType"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"label": "Leave Application",
|
|
||||||
"link_to": "Leave Application",
|
|
||||||
"type": "DocType"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"label": "Salary Register",
|
"label": "Salary Register",
|
||||||
"link_to": "Salary Register",
|
"link_to": "Monthly Attendance Sheet",
|
||||||
"type": "Report"
|
"type": "Report"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -174,7 +174,8 @@
|
|||||||
"label": "Status",
|
"label": "Status",
|
||||||
"no_copy": 1,
|
"no_copy": 1,
|
||||||
"options": "Open\nApproved\nRejected\nCancelled",
|
"options": "Open\nApproved\nRejected\nCancelled",
|
||||||
"permlevel": 1
|
"permlevel": 1,
|
||||||
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "sb10",
|
"fieldname": "sb10",
|
||||||
@ -189,14 +190,14 @@
|
|||||||
"reqd": 1
|
"reqd": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"fetch_from": "employee.company",
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"label": "Company",
|
"label": "Company",
|
||||||
"options": "Company",
|
"options": "Company",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"remember_last_selected_value": 1,
|
"remember_last_selected_value": 1,
|
||||||
"reqd": 1,
|
"reqd": 1
|
||||||
"fetch_from": "employee.company"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 1,
|
"allow_on_submit": 1,
|
||||||
@ -249,7 +250,7 @@
|
|||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"max_attachments": 3,
|
"max_attachments": 3,
|
||||||
"modified": "2020-03-10 22:40:43.487721",
|
"modified": "2020-05-18 13:00:41.577327",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Leave Application",
|
"name": "Leave Application",
|
||||||
@ -334,4 +335,4 @@
|
|||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"timeline_field": "employee",
|
"timeline_field": "employee",
|
||||||
"title_field": "employee_name"
|
"title_field": "employee_name"
|
||||||
}
|
}
|
48
erpnext/hr/onboarding/human_resource/human_resource.json
Normal file
48
erpnext/hr/onboarding/human_resource/human_resource.json
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{
|
||||||
|
"allow_roles": [
|
||||||
|
{
|
||||||
|
"role": "HR Manager"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"role": "HR User"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"creation": "2020-05-14 11:51:45.050242",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Onboarding",
|
||||||
|
"documentation_url": "https://docs.erpnext.com/docs/user/manual/en/human-resources",
|
||||||
|
"idx": 0,
|
||||||
|
"is_complete": 0,
|
||||||
|
"modified": "2020-05-14 14:44:09.069921",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "HR",
|
||||||
|
"name": "Human Resource",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"step": "Create Department"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "Create Designation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "Create Holiday list"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "Create Employee"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "Create Leave Allocation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "Create Leave Application"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"step": "HR Settings"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"subtitle": "Employee, Recruitment, Payroll and more.",
|
||||||
|
"success_message": "The HR Module is all set up!",
|
||||||
|
"title": "Let's Setup the Human Resource Module. ",
|
||||||
|
"user_can_dismiss": 0
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"action": "Create Entry",
|
||||||
|
"creation": "2020-05-14 11:44:34.682115",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Onboarding Step",
|
||||||
|
"idx": 0,
|
||||||
|
"is_complete": 0,
|
||||||
|
"is_mandatory": 0,
|
||||||
|
"is_skipped": 0,
|
||||||
|
"modified": "2020-05-14 12:22:26.448420",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"name": "Create Department",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"reference_document": "Department",
|
||||||
|
"title": "Create Department"
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"action": "Create Entry",
|
||||||
|
"creation": "2020-05-14 11:45:07.514193",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Onboarding Step",
|
||||||
|
"idx": 0,
|
||||||
|
"is_complete": 0,
|
||||||
|
"is_mandatory": 0,
|
||||||
|
"is_skipped": 0,
|
||||||
|
"modified": "2020-05-14 12:22:41.500795",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"name": "Create Designation",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"reference_document": "Designation",
|
||||||
|
"title": "Create Designation"
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"action": "Create Entry",
|
||||||
|
"creation": "2020-05-14 11:43:25.561152",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Onboarding Step",
|
||||||
|
"idx": 0,
|
||||||
|
"is_complete": 0,
|
||||||
|
"is_mandatory": 1,
|
||||||
|
"is_skipped": 0,
|
||||||
|
"modified": "2020-05-14 12:26:28.629074",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"name": "Create Employee",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"reference_document": "Employee",
|
||||||
|
"title": "Create Employee"
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"action": "Create Entry",
|
||||||
|
"creation": "2020-05-14 11:47:34.700174",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Onboarding Step",
|
||||||
|
"idx": 0,
|
||||||
|
"is_complete": 0,
|
||||||
|
"is_mandatory": 1,
|
||||||
|
"is_skipped": 0,
|
||||||
|
"modified": "2020-05-14 12:25:38.068582",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"name": "Create Holiday list",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"reference_document": "Holiday List",
|
||||||
|
"title": "Create Holiday list"
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"action": "Create Entry",
|
||||||
|
"creation": "2020-05-14 11:48:56.123718",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Onboarding Step",
|
||||||
|
"idx": 0,
|
||||||
|
"is_complete": 0,
|
||||||
|
"is_mandatory": 1,
|
||||||
|
"is_skipped": 0,
|
||||||
|
"modified": "2020-05-14 11:48:56.123718",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"name": "Create Leave Allocation",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"reference_document": "Leave Allocation",
|
||||||
|
"title": "Create Leave Allocation"
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"action": "Create Entry",
|
||||||
|
"creation": "2020-05-14 11:49:45.400764",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Onboarding Step",
|
||||||
|
"idx": 0,
|
||||||
|
"is_complete": 0,
|
||||||
|
"is_mandatory": 1,
|
||||||
|
"is_skipped": 0,
|
||||||
|
"modified": "2020-05-14 11:49:45.400764",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"name": "Create Leave Application",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"reference_document": "Leave Application",
|
||||||
|
"title": "Create Leave Application"
|
||||||
|
}
|
16
erpnext/hr/onboarding_step/hr_settings/hr_settings.json
Normal file
16
erpnext/hr/onboarding_step/hr_settings/hr_settings.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"action": "Update Settings",
|
||||||
|
"creation": "2020-05-14 13:13:52.427711",
|
||||||
|
"docstatus": 0,
|
||||||
|
"doctype": "Onboarding Step",
|
||||||
|
"idx": 0,
|
||||||
|
"is_complete": 0,
|
||||||
|
"is_mandatory": 0,
|
||||||
|
"is_skipped": 0,
|
||||||
|
"modified": "2020-05-14 13:13:52.427711",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"name": "HR Settings",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"reference_document": "HR Settings",
|
||||||
|
"title": "HR settings"
|
||||||
|
}
|
@ -65,7 +65,7 @@ def get_chart_data(parameters,employees, filters):
|
|||||||
total_employee = frappe.db.count('Employee', {'status':'Active'})
|
total_employee = frappe.db.count('Employee', {'status':'Active'})
|
||||||
others = total_employee - sum(values)
|
others = total_employee - sum(values)
|
||||||
|
|
||||||
label.append(["Others"])
|
label.append(["Not Set"])
|
||||||
values.append(others)
|
values.append(others)
|
||||||
|
|
||||||
chart = {
|
chart = {
|
||||||
|
@ -30,6 +30,9 @@ day_abbr = [
|
|||||||
def execute(filters=None):
|
def execute(filters=None):
|
||||||
if not filters: filters = {}
|
if not filters: filters = {}
|
||||||
|
|
||||||
|
if filters.hide_year_field == 1:
|
||||||
|
filters.year = 2020
|
||||||
|
|
||||||
conditions, filters = get_conditions(filters)
|
conditions, filters = get_conditions(filters)
|
||||||
columns, days = get_columns(filters)
|
columns, days = get_columns(filters)
|
||||||
att_map = get_attendance_list(conditions, filters)
|
att_map = get_attendance_list(conditions, filters)
|
||||||
@ -75,14 +78,11 @@ def execute(filters=None):
|
|||||||
return columns, data, None, chart_data
|
return columns, data, None, chart_data
|
||||||
|
|
||||||
def get_chart_data(emp_att_map, days):
|
def get_chart_data(emp_att_map, days):
|
||||||
from pprint import pprint
|
|
||||||
pprint(emp_att_map)
|
|
||||||
labels = []
|
labels = []
|
||||||
datasets = [
|
datasets = [
|
||||||
{"name": "Absent", "values": []},
|
{"name": "Absent", "values": []},
|
||||||
{"name": "Present", "values": []},
|
{"name": "Present", "values": []},
|
||||||
{"name": "Leave", "values": []},
|
{"name": "Leave", "values": []},
|
||||||
{"name": "Unmarked", "values": []}
|
|
||||||
]
|
]
|
||||||
for idx, day in enumerate(days, start=0):
|
for idx, day in enumerate(days, start=0):
|
||||||
p = day.replace("::65", "")
|
p = day.replace("::65", "")
|
||||||
@ -91,7 +91,6 @@ def get_chart_data(emp_att_map, days):
|
|||||||
total_leave_on_day = 0
|
total_leave_on_day = 0
|
||||||
total_present_on_day = 0
|
total_present_on_day = 0
|
||||||
total_holiday = 0
|
total_holiday = 0
|
||||||
total_unmarked_on_day = 0
|
|
||||||
for emp in emp_att_map.keys():
|
for emp in emp_att_map.keys():
|
||||||
if emp_att_map[emp][idx]:
|
if emp_att_map[emp][idx]:
|
||||||
if emp_att_map[emp][idx] == "A":
|
if emp_att_map[emp][idx] == "A":
|
||||||
@ -104,12 +103,10 @@ def get_chart_data(emp_att_map, days):
|
|||||||
if emp_att_map[emp][idx] == "L":
|
if emp_att_map[emp][idx] == "L":
|
||||||
total_leave_on_day += 1
|
total_leave_on_day += 1
|
||||||
|
|
||||||
total_marked = total_absent_on_day + total_present_on_day + total_leave_on_day
|
|
||||||
|
|
||||||
datasets[0]["values"].append(total_absent_on_day)
|
datasets[0]["values"].append(total_absent_on_day)
|
||||||
datasets[1]["values"].append(total_present_on_day)
|
datasets[1]["values"].append(total_present_on_day)
|
||||||
datasets[2]["values"].append(total_leave_on_day)
|
datasets[2]["values"].append(total_leave_on_day)
|
||||||
datasets[3]["values"].append(frappe.db.count('Employee', {'status':'Active'}) - total_marked)
|
|
||||||
|
|
||||||
|
|
||||||
chart = {
|
chart = {
|
||||||
@ -119,10 +116,11 @@ def get_chart_data(emp_att_map, days):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chart["type"] = "bar"
|
chart["type"] = "line"
|
||||||
# chart["spaceRatio"] = 0.1
|
|
||||||
|
|
||||||
|
|
||||||
|
chart['lineOptions'] = {
|
||||||
|
"dotSize": 6
|
||||||
|
}
|
||||||
return chart
|
return chart
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user