Anurag Mishra
4 years ago
committed by
GitHub
25 changed files with 639 additions and 476 deletions
@ -0,0 +1,27 @@ |
|||
{ |
|||
"chart_name": "Attendance Count", |
|||
"chart_type": "Report", |
|||
"creation": "2020-07-22 11:56:32.730068", |
|||
"custom_options": "{\n\t\t\"type\": \"line\",\n\t\t\"axisOptions\": {\n\t\t\t\"shortenYAxisNumbers\": 1\n\t\t},\n\t\t\"tooltipOptions\": {}\n\t}", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"dynamic_filters_json": "{\"month\":\"frappe.datetime.str_to_obj(frappe.datetime.get_today()).getMonth() + 1\",\"year\":\"frappe.datetime.str_to_obj(frappe.datetime.get_today()).getFullYear();\",\"company\":\"frappe.defaults.get_user_default(\\\"Company\\\")\"}", |
|||
"filters_json": "{}", |
|||
"group_by_type": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"modified": "2020-07-22 14:32:40.334424", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Attendance Count", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"report_name": "Monthly Attendance Sheet", |
|||
"time_interval": "Yearly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Line", |
|||
"use_report_chart": 1, |
|||
"y_axis": [] |
|||
} |
@ -0,0 +1,29 @@ |
|||
{ |
|||
"chart_name": "Department Wise Employee Count", |
|||
"chart_type": "Group By", |
|||
"creation": "2020-07-22 11:56:32.760730", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Employee", |
|||
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Employee\",\"status\",\"=\",\"Active\",false]]", |
|||
"group_by_based_on": "department", |
|||
"group_by_type": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 14:27:40.574194", |
|||
"modified": "2020-07-22 14:33:38.036794", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Department Wise Employee Count", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Yearly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Donut", |
|||
"use_report_chart": 0, |
|||
"y_axis": [] |
|||
} |
@ -0,0 +1,29 @@ |
|||
{ |
|||
"aggregate_function_based_on": "planned_vacancies", |
|||
"chart_name": "Department Wise Openings", |
|||
"chart_type": "Group By", |
|||
"creation": "2020-07-22 11:56:32.849775", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Job Opening", |
|||
"filters_json": "[]", |
|||
"group_by_based_on": "department", |
|||
"group_by_type": "Sum", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 14:33:44.834801", |
|||
"modified": "2020-07-22 14:34:45.273591", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Department Wise Openings", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Monthly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Bar", |
|||
"use_report_chart": 0, |
|||
"y_axis": [] |
|||
} |
@ -0,0 +1,29 @@ |
|||
{ |
|||
"chart_name": "Designation Wise Employee Count", |
|||
"chart_type": "Group By", |
|||
"creation": "2020-07-22 11:56:32.790337", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Employee", |
|||
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Employee\",\"status\",\"=\",\"Active\",false]]", |
|||
"group_by_based_on": "designation", |
|||
"group_by_type": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 14:27:40.602783", |
|||
"modified": "2020-07-22 14:31:49.665555", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Designation Wise Employee Count", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Yearly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Donut", |
|||
"use_report_chart": 0, |
|||
"y_axis": [] |
|||
} |
@ -0,0 +1,30 @@ |
|||
{ |
|||
"aggregate_function_based_on": "planned_vacancies", |
|||
"chart_name": "Designation Wise Openings", |
|||
"chart_type": "Group By", |
|||
"creation": "2020-07-22 11:56:32.820217", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Job Opening", |
|||
"dynamic_filters_json": "", |
|||
"filters_json": "[]", |
|||
"group_by_based_on": "designation", |
|||
"group_by_type": "Sum", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 14:33:44.806626", |
|||
"modified": "2020-07-22 14:34:32.711881", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Designation Wise Openings", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Monthly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Bar", |
|||
"use_report_chart": 0, |
|||
"y_axis": [] |
|||
} |
@ -0,0 +1,29 @@ |
|||
{ |
|||
"chart_name": "Gender Diversity Ratio", |
|||
"chart_type": "Group By", |
|||
"creation": "2020-07-22 11:56:32.667291", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Employee", |
|||
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Employee\",\"status\",\"=\",\"Active\",false]]", |
|||
"group_by_based_on": "gender", |
|||
"group_by_type": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 14:27:40.143783", |
|||
"modified": "2020-07-22 14:32:50.962459", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Gender Diversity Ratio", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Yearly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Pie", |
|||
"use_report_chart": 0, |
|||
"y_axis": [] |
|||
} |
@ -0,0 +1,29 @@ |
|||
{ |
|||
"chart_name": "Job Application Status", |
|||
"chart_type": "Group By", |
|||
"creation": "2020-07-22 11:56:32.699696", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Job Applicant", |
|||
"dynamic_filters_json": "", |
|||
"filters_json": "[[\"Job Applicant\",\"creation\",\"Previous\",\"1 month\"]]", |
|||
"group_by_based_on": "status", |
|||
"group_by_type": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 14:27:40.118498", |
|||
"modified": "2020-07-22 14:33:00.404144", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Job Application Status", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Yearly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Pie", |
|||
"use_report_chart": 0, |
|||
"y_axis": [] |
|||
} |
@ -1,190 +0,0 @@ |
|||
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors |
|||
# License: GNU General Public License v3. See license.txt |
|||
|
|||
import frappe |
|||
import erpnext |
|||
import json |
|||
from frappe import _ |
|||
|
|||
def get_data(): |
|||
return frappe._dict({ |
|||
"dashboards": get_dashboards(), |
|||
"charts": get_charts(), |
|||
"number_cards": get_number_cards(), |
|||
}) |
|||
|
|||
def get_dashboards(): |
|||
dashboards = [] |
|||
dashboards.append(get_human_resource_dashboard()) |
|||
return dashboards |
|||
|
|||
def get_human_resource_dashboard(): |
|||
return { |
|||
"name": "Human Resource", |
|||
"dashboard_name": "Human Resource", |
|||
"is_default": 1, |
|||
"charts": [ |
|||
{ "chart": "Attendance Count", "width": "Full"}, |
|||
{ "chart": "Gender Diversity Ratio", "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"} |
|||
], |
|||
"cards": [ |
|||
{"card": "Total Employees"}, |
|||
{"card": "New Joinees (Last year)"}, |
|||
{'card': "Employees Left (Last year)"}, |
|||
{'card': "Total Applicants (Last month)"}, |
|||
] |
|||
} |
|||
|
|||
def get_recruitment_dashboard(): |
|||
pass |
|||
|
|||
|
|||
def get_charts(): |
|||
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: |
|||
company = frappe.db.get_value("Company", {"is_group": 0}, "name") |
|||
|
|||
dashboard_charts = [ |
|||
get_dashboards_chart_doc('Gender Diversity Ratio', "Group By", "Pie", |
|||
document_type = "Employee", group_by_type="Count", group_by_based_on="gender", |
|||
filters_json = json.dumps([["Employee", "status", "=", "Active"]])) |
|||
] |
|||
|
|||
dashboard_charts.append( |
|||
get_dashboards_chart_doc('Job Application Status', "Group By", "Pie", |
|||
document_type = "Job Applicant", group_by_type="Count", group_by_based_on="status", |
|||
filters_json = json.dumps([["Job Applicant", "creation", "Previous", "1 month"]])) |
|||
) |
|||
|
|||
custom_options = '''{ |
|||
"type": "line", |
|||
"axisOptions": { |
|||
"shortenYAxisNumbers": 1 |
|||
}, |
|||
"tooltipOptions": {} |
|||
}''' |
|||
|
|||
filters_json = json.dumps({ |
|||
"month": month_map[date.month - 1], |
|||
"year": str(date.year), |
|||
"company":company |
|||
}) |
|||
|
|||
dashboard_charts.append( |
|||
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"]])) |
|||
) |
|||
|
|||
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"]])) |
|||
) |
|||
|
|||
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(): |
|||
number_cards = [] |
|||
|
|||
number_cards = [ |
|||
get_number_cards_doc("Employee", "Total Employees", filters_json = json.dumps([ |
|||
["Employee","status","=","Active"] |
|||
]) |
|||
) |
|||
] |
|||
|
|||
number_cards.append( |
|||
get_number_cards_doc("Employee", "New Joinees (Last year)", filters_json = json.dumps([ |
|||
["Employee","date_of_joining","Timespan","last year"], |
|||
["Employee","status","=","Active"] |
|||
]) |
|||
) |
|||
) |
|||
|
|||
number_cards.append( |
|||
get_number_cards_doc("Employee", "Employees Left (Last year)", filters_json = json.dumps([ |
|||
["Employee", "relieving_date", "Timespan", "last year"], |
|||
["Employee", "status", "=", "Left"] |
|||
]) |
|||
) |
|||
) |
|||
|
|||
number_cards.append( |
|||
get_number_cards_doc("Job Applicant", "Total Applicants (Last month)", filters_json = json.dumps([ |
|||
["Job Applicant", "creation", "Timespan", "last month"] |
|||
]) |
|||
) |
|||
) |
|||
|
|||
return number_cards |
|||
|
|||
|
|||
def get_number_cards_doc(document_type, label, **args): |
|||
args = frappe._dict(args) |
|||
|
|||
return { |
|||
"doctype": "Number Card", |
|||
"document_type": document_type, |
|||
"function": args.func or "Count", |
|||
"is_public": args.is_public or 1, |
|||
"label": _(label), |
|||
"name": args.name or label, |
|||
"show_percentage_stats": args.show_percentage_stats or 1, |
|||
"stats_time_interval": args.stats_time_interval or 'Monthly', |
|||
"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): |
|||
args = frappe._dict(args) |
|||
|
|||
return { |
|||
"name": name, |
|||
"chart_name": _(args.chart_name or name), |
|||
"chart_type": chart_type, |
|||
"document_type": args.document_type or None, |
|||
"report_name": args.report_name or None, |
|||
"is_custom": args.is_custom or 0, |
|||
"group_by_type": args.group_by_type or None, |
|||
"group_by_based_on": args.group_by_based_on or None, |
|||
"based_on": args.based_on or None, |
|||
"value_based_on": args.value_based_on or None, |
|||
"number_of_groups": args.number_of_groups or 0, |
|||
"is_public": args.is_public or 1, |
|||
"timespan": args.timespan or "Last Year", |
|||
"time_interval": args.time_interval or "Yearly", |
|||
"timeseries": args.timeseries or 0, |
|||
"filters_json": args.filters_json or '[]', |
|||
"type": graph_type, |
|||
"custom_options": args.custom_options or '', |
|||
"doctype": "Dashboard Chart", |
|||
"aggregate_function_based_on": args.aggregate_function_based_on or None |
|||
} |
@ -0,0 +1,58 @@ |
|||
{ |
|||
"cards": [ |
|||
{ |
|||
"card": "Total Employees" |
|||
}, |
|||
{ |
|||
"card": "New Joinees (Last year)" |
|||
}, |
|||
{ |
|||
"card": "Employees Left (Last year)" |
|||
}, |
|||
{ |
|||
"card": "Total Applicants (Last month)" |
|||
} |
|||
], |
|||
"charts": [ |
|||
{ |
|||
"chart": "Attendance Count", |
|||
"width": "Full" |
|||
}, |
|||
{ |
|||
"chart": "Gender Diversity Ratio", |
|||
"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" |
|||
} |
|||
], |
|||
"creation": "2020-07-22 11:56:33.015888", |
|||
"dashboard_name": "Human Resource", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard", |
|||
"idx": 0, |
|||
"is_default": 0, |
|||
"is_standard": 1, |
|||
"modified": "2020-07-22 14:42:12.789249", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Human Resource", |
|||
"owner": "Administrator" |
|||
} |
@ -0,0 +1,21 @@ |
|||
{ |
|||
"creation": "2020-07-22 11:56:32.947790", |
|||
"docstatus": 0, |
|||
"doctype": "Number Card", |
|||
"document_type": "Employee", |
|||
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Employee\",\"relieving_date\",\"Timespan\",\"last year\",false]]", |
|||
"function": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"label": "Employees Left (Last year)", |
|||
"modified": "2020-07-23 12:03:26.747447", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Employees Left (Last year)", |
|||
"owner": "Administrator", |
|||
"show_percentage_stats": 1, |
|||
"stats_time_interval": "Monthly", |
|||
"type": "Document Type" |
|||
} |
@ -0,0 +1,21 @@ |
|||
{ |
|||
"creation": "2020-07-22 11:56:32.914057", |
|||
"docstatus": 0, |
|||
"doctype": "Number Card", |
|||
"document_type": "Employee", |
|||
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Employee\",\"date_of_joining\",\"Timespan\",\"last year\",false],[\"Employee\",\"status\",\"=\",\"Active\",false]]", |
|||
"function": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"label": "New Joinees (Last year)", |
|||
"modified": "2020-07-22 14:32:09.352301", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "New Joinees (Last year)", |
|||
"owner": "Administrator", |
|||
"show_percentage_stats": 1, |
|||
"stats_time_interval": "Monthly", |
|||
"type": "Document Type" |
|||
} |
@ -0,0 +1,21 @@ |
|||
{ |
|||
"creation": "2020-07-22 11:56:32.977716", |
|||
"docstatus": 0, |
|||
"doctype": "Number Card", |
|||
"document_type": "Job Applicant", |
|||
"dynamic_filters_json": "", |
|||
"filters_json": "[[\"Job Applicant\",\"creation\",\"Timespan\",\"last month\"]]", |
|||
"function": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"label": "Total Applicants (Last month)", |
|||
"modified": "2020-07-22 14:32:27.656855", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Total Applicants (Last month)", |
|||
"owner": "Administrator", |
|||
"show_percentage_stats": 1, |
|||
"stats_time_interval": "Monthly", |
|||
"type": "Document Type" |
|||
} |
@ -0,0 +1,21 @@ |
|||
{ |
|||
"creation": "2020-07-22 11:56:32.874849", |
|||
"docstatus": 0, |
|||
"doctype": "Number Card", |
|||
"document_type": "Employee", |
|||
"dynamic_filters_json": "[[\"Employee\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Employee\",\"status\",\"=\",\"Active\",false]]", |
|||
"function": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"label": "Total Employees", |
|||
"modified": "2020-07-22 14:31:59.118650", |
|||
"modified_by": "Administrator", |
|||
"module": "HR", |
|||
"name": "Total Employees", |
|||
"owner": "Administrator", |
|||
"show_percentage_stats": 1, |
|||
"stats_time_interval": "Monthly", |
|||
"type": "Document Type" |
|||
} |
@ -0,0 +1,30 @@ |
|||
{ |
|||
"aggregate_function_based_on": "rounded_total", |
|||
"chart_name": "Department Wise Salary(Last Month)", |
|||
"chart_type": "Group By", |
|||
"creation": "2020-07-22 11:56:34.511940", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Salary Slip", |
|||
"dynamic_filters_json": "[[\"Salary Slip\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Salary Slip\",\"docstatus\",\"=\",\"1\",false],[\"Salary Slip\",\"start_date\",\"Timespan\",\"last month\",false]]", |
|||
"group_by_based_on": "department", |
|||
"group_by_type": "Sum", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 12:46:05.272076", |
|||
"modified": "2020-07-22 12:48:12.080992", |
|||
"modified_by": "Administrator", |
|||
"module": "Payroll", |
|||
"name": "Department Wise Salary(Last Month)", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Monthly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Bar", |
|||
"use_report_chart": 0, |
|||
"y_axis": [] |
|||
} |
@ -0,0 +1,30 @@ |
|||
{ |
|||
"aggregate_function_based_on": "rounded_total", |
|||
"chart_name": "Designation Wise Salary(Last Month)", |
|||
"chart_type": "Group By", |
|||
"creation": "2020-07-22 11:56:34.550339", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Salary Slip", |
|||
"dynamic_filters_json": "[[\"Salary Slip\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Salary Slip\",\"docstatus\",\"=\",\"1\",false],[\"Salary Slip\",\"start_date\",\"Timespan\",\"last month\",false]]", |
|||
"group_by_based_on": "designation", |
|||
"group_by_type": "Sum", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 12:22:18.412822", |
|||
"modified": "2020-07-22 12:39:07.923382", |
|||
"modified_by": "Administrator", |
|||
"module": "Payroll", |
|||
"name": "Designation Wise Salary(Last Month)", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Monthly", |
|||
"timeseries": 0, |
|||
"timespan": "Last Year", |
|||
"type": "Bar", |
|||
"use_report_chart": 0, |
|||
"y_axis": [] |
|||
} |
@ -0,0 +1,29 @@ |
|||
{ |
|||
"based_on": "end_date", |
|||
"chart_name": "Outgoing Salary", |
|||
"chart_type": "Sum", |
|||
"creation": "2020-07-22 11:56:34.478848", |
|||
"custom_options": "", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard Chart", |
|||
"document_type": "Salary Slip", |
|||
"dynamic_filters_json": "[[\"Salary Slip\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Salary Slip\",\"docstatus\",\"=\",\"1\",false]]", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"last_synced_on": "2020-07-22 12:11:27.481231", |
|||
"modified": "2020-07-22 12:20:05.777715", |
|||
"modified_by": "Administrator", |
|||
"module": "Payroll", |
|||
"name": "Outgoing Salary", |
|||
"number_of_groups": 0, |
|||
"owner": "Administrator", |
|||
"time_interval": "Monthly", |
|||
"timeseries": 1, |
|||
"timespan": "Last Year", |
|||
"type": "Line", |
|||
"use_report_chart": 0, |
|||
"value_based_on": "rounded_total", |
|||
"y_axis": [] |
|||
} |
@ -1,100 +0,0 @@ |
|||
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors |
|||
# License: GNU General Public License v3. See license.txt |
|||
|
|||
import frappe |
|||
import erpnext |
|||
from erpnext.hr.dashboard_fixtures import get_dashboards_chart_doc, get_number_cards_doc |
|||
import json |
|||
from frappe import _ |
|||
|
|||
def get_data(): |
|||
return frappe._dict({ |
|||
"dashboards": get_dashboards(), |
|||
"charts": get_charts(), |
|||
"number_cards": get_number_cards(), |
|||
}) |
|||
|
|||
def get_dashboards(): |
|||
dashboards = [] |
|||
dashboards.append(get_payroll_dashboard()) |
|||
return dashboards |
|||
|
|||
def get_payroll_dashboard(): |
|||
return { |
|||
"name": "Payroll", |
|||
"dashboard_name": "Payroll", |
|||
"is_default": 1, |
|||
"charts": [ |
|||
{ "chart": "Outgoing Salary", "width": "Full"}, |
|||
{ "chart": "Designation Wise Salary(Last Month)", "width": "Half"}, |
|||
{ "chart": "Department Wise Salary(Last Month)", "width": "Half"}, |
|||
], |
|||
"cards": [ |
|||
{"card": "Total Declaration Submitted"}, |
|||
{"card": "Total Salary Structure"}, |
|||
{"card": "Total Incentive Given(Last month)"}, |
|||
{"card": "Total Outgoing Salary(Last month)"}, |
|||
] |
|||
} |
|||
|
|||
def get_charts(): |
|||
dashboard_charts= [ |
|||
get_dashboards_chart_doc('Outgoing Salary', "Sum", "Line", |
|||
document_type = "Salary Slip", based_on="end_date", |
|||
value_based_on = "rounded_total", time_interval = "Monthly", timeseries = 1, |
|||
filters_json = json.dumps([["Salary Slip", "docstatus", "=", 1]])) |
|||
] |
|||
|
|||
dashboard_charts.append( |
|||
get_dashboards_chart_doc('Department Wise Salary(Last Month)', "Group By", "Bar", |
|||
document_type = "Salary Slip", group_by_type="Sum", group_by_based_on="department", |
|||
time_interval = "Monthly", aggregate_function_based_on = "rounded_total", |
|||
filters_json = json.dumps([ |
|||
["Salary Slip", "docstatus", "=", 1], |
|||
["Salary Slip", "start_date", "Previous","1 month"] |
|||
]) |
|||
) |
|||
) |
|||
|
|||
dashboard_charts.append( |
|||
get_dashboards_chart_doc('Designation Wise Salary(Last Month)', "Group By", "Bar", |
|||
document_type = "Salary Slip", group_by_type="Sum", group_by_based_on="designation", |
|||
time_interval = "Monthly", aggregate_function_based_on = "rounded_total", |
|||
filters_json = json.dumps([ |
|||
["Salary Slip", "docstatus", "=", 1], |
|||
["Salary Slip", "start_date", "Previous","1 month"] |
|||
]) |
|||
) |
|||
) |
|||
|
|||
return dashboard_charts |
|||
|
|||
def get_number_cards(): |
|||
number_cards = [get_number_cards_doc("Employee Tax Exemption Declaration", "Total Declaration Submitted", filters_json = json.dumps([ |
|||
["Employee Tax Exemption Declaration", "docstatus", "=","1"], |
|||
["Employee Tax Exemption Declaration","creation","Previous","1 year"] |
|||
]) |
|||
)] |
|||
|
|||
number_cards.append(get_number_cards_doc("Employee Incentive", "Total Incentive Given(Last month)", |
|||
time_interval = "Monthly", func = "Sum", aggregate_function_based_on = "incentive_amount", |
|||
filters_json = json.dumps([ |
|||
["Employee Incentive", "docstatus", "=", 1], |
|||
["Employee Incentive","payroll_date","Previous","1 year"] |
|||
])) |
|||
) |
|||
|
|||
number_cards.append(get_number_cards_doc("Salary Slip", "Total Outgoing Salary(Last month)", |
|||
time_interval = "Monthly", time_span= "Monthly", func = "Sum", aggregate_function_based_on = "rounded_total", |
|||
filters_json = json.dumps([ |
|||
["Salary Slip", "docstatus", "=", 1], |
|||
["Salary Slip", "start_date","Previous","1 month"] |
|||
])) |
|||
) |
|||
number_cards.append(get_number_cards_doc("Salary Structure", "Total Salary Structure", |
|||
filters_json = json.dumps([ |
|||
["Salary Structure", "docstatus", "=", 1] |
|||
])) |
|||
) |
|||
|
|||
return number_cards |
@ -0,0 +1,21 @@ |
|||
{ |
|||
"creation": "2020-07-22 11:56:34.575627", |
|||
"docstatus": 0, |
|||
"doctype": "Number Card", |
|||
"document_type": "Employee Tax Exemption Declaration", |
|||
"dynamic_filters_json": "[[\"Employee Tax Exemption Declaration\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Employee Tax Exemption Declaration\",\"creation\",\"Timespan\",\"last year\",false],[\"Employee Tax Exemption Declaration\",\"docstatus\",\"=\",\"1\",false]]", |
|||
"function": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"label": "Total Declaration Submitted", |
|||
"modified": "2020-07-22 13:22:46.001099", |
|||
"modified_by": "Administrator", |
|||
"module": "Payroll", |
|||
"name": "Total Declaration Submitted", |
|||
"owner": "Administrator", |
|||
"show_percentage_stats": 1, |
|||
"stats_time_interval": "Monthly", |
|||
"type": "Document Type" |
|||
} |
@ -0,0 +1,22 @@ |
|||
{ |
|||
"aggregate_function_based_on": "incentive_amount", |
|||
"creation": "2020-07-22 11:56:34.599047", |
|||
"docstatus": 0, |
|||
"doctype": "Number Card", |
|||
"document_type": "Employee Incentive", |
|||
"dynamic_filters_json": "", |
|||
"filters_json": "[[\"Employee Incentive\",\"docstatus\",\"=\",\"1\",false],[\"Employee Incentive\",\"payroll_date\",\"Timespan\",\"last year\",false]]", |
|||
"function": "Sum", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"label": "Total Incentive Given(Last month)", |
|||
"modified": "2020-07-23 12:05:26.963616", |
|||
"modified_by": "Administrator", |
|||
"module": "Payroll", |
|||
"name": "Total Incentive Given(Last month)", |
|||
"owner": "Administrator", |
|||
"show_percentage_stats": 1, |
|||
"stats_time_interval": "Monthly", |
|||
"type": "Document Type" |
|||
} |
@ -0,0 +1,22 @@ |
|||
{ |
|||
"aggregate_function_based_on": "rounded_total", |
|||
"creation": "2020-07-22 11:56:34.626019", |
|||
"docstatus": 0, |
|||
"doctype": "Number Card", |
|||
"document_type": "Salary Slip", |
|||
"dynamic_filters_json": "[[\"Salary Slip\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Salary Slip\",\"docstatus\",\"=\",\"1\",false],[\"Salary Slip\",\"start_date\",\"Timespan\",\"last month\",false]]", |
|||
"function": "Sum", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"label": "Total Outgoing Salary(Last month)", |
|||
"modified": "2020-07-22 13:54:14.678954", |
|||
"modified_by": "Administrator", |
|||
"module": "Payroll", |
|||
"name": "Total Outgoing Salary(Last month)", |
|||
"owner": "Administrator", |
|||
"show_percentage_stats": 1, |
|||
"stats_time_interval": "Monthly", |
|||
"type": "Document Type" |
|||
} |
@ -0,0 +1,21 @@ |
|||
{ |
|||
"creation": "2020-07-22 11:56:34.688843", |
|||
"docstatus": 0, |
|||
"doctype": "Number Card", |
|||
"document_type": "Salary Structure", |
|||
"dynamic_filters_json": "[[\"Salary Structure\",\"company\",\"=\",\"frappe.defaults.get_user_default(\\\"Company\\\")\"]]", |
|||
"filters_json": "[[\"Salary Structure\",\"docstatus\",\"=\",\"1\",false]]", |
|||
"function": "Count", |
|||
"idx": 0, |
|||
"is_public": 1, |
|||
"is_standard": 1, |
|||
"label": "Total Salary Structure", |
|||
"modified": "2020-07-22 13:24:03.938846", |
|||
"modified_by": "Administrator", |
|||
"module": "Payroll", |
|||
"name": "Total Salary Structure", |
|||
"owner": "Administrator", |
|||
"show_percentage_stats": 1, |
|||
"stats_time_interval": "Monthly", |
|||
"type": "Document Type" |
|||
} |
@ -0,0 +1,42 @@ |
|||
{ |
|||
"cards": [ |
|||
{ |
|||
"card": "Total Declaration Submitted" |
|||
}, |
|||
{ |
|||
"card": "Total Salary Structure" |
|||
}, |
|||
{ |
|||
"card": "Total Incentive Given(Last month)" |
|||
}, |
|||
{ |
|||
"card": "Total Outgoing Salary(Last month)" |
|||
} |
|||
], |
|||
"charts": [ |
|||
{ |
|||
"chart": "Outgoing Salary", |
|||
"width": "Full" |
|||
}, |
|||
{ |
|||
"chart": "Designation Wise Salary(Last Month)", |
|||
"width": "Half" |
|||
}, |
|||
{ |
|||
"chart": "Department Wise Salary(Last Month)", |
|||
"width": "Half" |
|||
} |
|||
], |
|||
"creation": "2020-07-22 11:56:34.727185", |
|||
"dashboard_name": "Payroll", |
|||
"docstatus": 0, |
|||
"doctype": "Dashboard", |
|||
"idx": 0, |
|||
"is_default": 1, |
|||
"is_standard": 1, |
|||
"modified": "2020-07-22 13:20:18.608969", |
|||
"modified_by": "Administrator", |
|||
"module": "Payroll", |
|||
"name": "Payroll", |
|||
"owner": "Administrator" |
|||
} |
Loading…
Reference in new issue