diff --git a/hrms/hr/doctype/leave_encashment/leave_encashment.py b/hrms/hr/doctype/leave_encashment/leave_encashment.py index b32f9ebd67..faa3408fca 100644 --- a/hrms/hr/doctype/leave_encashment/leave_encashment.py +++ b/hrms/hr/doctype/leave_encashment/leave_encashment.py @@ -162,7 +162,14 @@ def set_encashment_amount(self): self.set_salary_structure() per_day_encashment = frappe.db.get_value( - "Salary Structure", self._salary_structure, "leave_encashment_amount_per_day" + "Salary Structure Assignment", + { + "employee": self.employee, + "docstatus": 1, + "from_date": ("<=", self.encashment_date) + }, + "leave_encashment_amount_per_day", + order_by="from_date desc" ) self.encashment_amount = self.encashment_days * per_day_encashment if per_day_encashment > 0 else 0 diff --git a/hrms/payroll/doctype/salary_structure_assignment/salary_structure_assignment.json b/hrms/payroll/doctype/salary_structure_assignment/salary_structure_assignment.json index 58bd882e12..2dca4b59b6 100644 --- a/hrms/payroll/doctype/salary_structure_assignment/salary_structure_assignment.json +++ b/hrms/payroll/doctype/salary_structure_assignment/salary_structure_assignment.json @@ -1,265 +1,273 @@ { - "actions": [], - "allow_import": 1, - "autoname": "HR-SSA-.YY.-.MM.-.#####", - "creation": "2018-04-13 16:38:41.769237", - "doctype": "DocType", - "editable_grid": 1, - "engine": "InnoDB", - "field_order": [ - "employee", - "employee_name", - "department", - "designation", - "grade", - "column_break_6", - "salary_structure", - "from_date", - "income_tax_slab", - "column_break_11", - "company", - "payroll_payable_account", - "currency", - "section_break_7", - "base", - "column_break_9", - "variable", - "amended_from", - "earnings_and_taxation_section", - "taxable_earnings_till_date", - "column_break_20", - "tax_deducted_till_date", - "section_break_17", - "payroll_cost_centers" - ], - "fields": [ - { - "fieldname": "employee", - "fieldtype": "Link", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Employee", - "options": "Employee", - "reqd": 1, - "search_index": 1 - }, - { - "fetch_from": "employee.employee_name", - "fieldname": "employee_name", - "fieldtype": "Data", - "label": "Employee Name", - "read_only": 1 - }, - { - "fetch_from": "employee.department", - "fieldname": "department", - "fieldtype": "Link", - "in_standard_filter": 1, - "label": "Department", - "options": "Department", - "read_only": 1 - }, - { - "fetch_from": "employee.designation", - "fieldname": "designation", - "fieldtype": "Link", - "in_standard_filter": 1, - "label": "Designation", - "options": "Designation", - "read_only": 1 - }, - { - "fieldname": "column_break_6", - "fieldtype": "Column Break" - }, - { - "fetch_from": "grade.default_salary_structure", - "fetch_if_empty": 1, - "fieldname": "salary_structure", - "fieldtype": "Link", - "in_list_view": 1, - "in_standard_filter": 1, - "label": "Salary Structure", - "options": "Salary Structure", - "reqd": 1, - "search_index": 1 - }, - { - "fieldname": "from_date", - "fieldtype": "Date", - "label": "From Date", - "reqd": 1 - }, - { - "fetch_from": "employee.company", - "fieldname": "company", - "fieldtype": "Link", - "label": "Company", - "options": "Company", - "reqd": 1 - }, - { - "fieldname": "section_break_7", - "fieldtype": "Section Break", - "label": "Base & Variable" - }, - { - "fetch_from": "grade.default_base_pay", - "fetch_if_empty": 1, - "fieldname": "base", - "fieldtype": "Currency", - "label": "Base", - "options": "currency" - }, - { - "fieldname": "column_break_9", - "fieldtype": "Column Break" - }, - { - "fieldname": "variable", - "fieldtype": "Currency", - "label": "Variable", - "options": "currency" - }, - { - "fieldname": "amended_from", - "fieldtype": "Link", - "label": "Amended From", - "no_copy": 1, - "options": "Salary Structure Assignment", - "print_hide": 1, - "read_only": 1 - }, - { - "depends_on": "salary_structure", - "fieldname": "income_tax_slab", - "fieldtype": "Link", - "label": "Income Tax Slab", - "options": "Income Tax Slab" - }, - { - "depends_on": "eval:(doc.docstatus==1 || doc.salary_structure)", - "fetch_from": "salary_structure.currency", - "fieldname": "currency", - "fieldtype": "Link", - "label": "Currency", - "options": "Currency", - "print_hide": 1, - "read_only": 1, - "reqd": 1 - }, - { - "depends_on": "employee", - "fieldname": "payroll_payable_account", - "fieldtype": "Link", - "label": "Payroll Payable Account", - "options": "Account" - }, - { - "collapsible": 1, - "depends_on": "employee", - "fieldname": "section_break_17", - "fieldtype": "Section Break", - "label": "Payroll Cost Centers" - }, - { - "allow_on_submit": 1, - "fieldname": "payroll_cost_centers", - "fieldtype": "Table", - "label": "Cost Centers", - "options": "Employee Cost Center" - }, - { - "fetch_from": "employee.grade", - "fieldname": "grade", - "fieldtype": "Link", - "label": "Grade", - "options": "Employee Grade", - "read_only": 1 - }, - { - "fieldname": "column_break_11", - "fieldtype": "Column Break" - }, - { - "allow_on_submit": 1, - "fieldname": "tax_deducted_till_date", - "fieldtype": "Currency", - "label": "Tax Deducted Till Date", - "options": "currency" - }, - { - "fieldname": "column_break_20", - "fieldtype": "Column Break" - }, - { - "collapsible_depends_on": "eval:doc.taxable_earnings_till_date && doc.tax_deducted_till_date", - "fieldname": "earnings_and_taxation_section", - "fieldtype": "Section Break", - "hidden": 1, - "label": "Earnings and Taxation " - }, - { - "allow_on_submit": 1, - "fieldname": "taxable_earnings_till_date", - "fieldtype": "Currency", - "label": "Taxable Earnings Till Date", - "options": "currency" - } - ], - "is_submittable": 1, - "links": [], - "modified": "2024-03-27 13:10:35.183102", - "modified_by": "Administrator", - "module": "Payroll", - "name": "Salary Structure Assignment", - "naming_rule": "Expression (old style)", - "owner": "Administrator", - "permissions": [ - { - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "System Manager", - "share": 1, - "write": 1 - }, - { - "amend": 1, - "cancel": 1, - "create": 1, - "delete": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "HR Manager", - "share": 1, - "submit": 1, - "write": 1 - }, - { - "create": 1, - "email": 1, - "export": 1, - "print": 1, - "read": 1, - "report": 1, - "role": "HR User", - "share": 1, - "submit": 1, - "write": 1 - } - ], - "search_fields": "employee_name, salary_structure", - "sort_field": "creation", - "sort_order": "DESC", - "states": [], - "title_field": "employee_name", - "track_changes": 1 -} \ No newline at end of file + "actions": [], + "allow_import": 1, + "autoname": "HR-SSA-.YY.-.MM.-.#####", + "creation": "2018-04-13 16:38:41.769237", + "doctype": "DocType", + "editable_grid": 1, + "engine": "InnoDB", + "field_order": [ + "employee", + "employee_name", + "department", + "designation", + "grade", + "column_break_6", + "salary_structure", + "from_date", + "income_tax_slab", + "column_break_11", + "company", + "payroll_payable_account", + "currency", + "section_break_7", + "base", + "leave_encashment_amount_per_day", + "column_break_9", + "variable", + "amended_from", + "earnings_and_taxation_section", + "taxable_earnings_till_date", + "column_break_20", + "tax_deducted_till_date", + "section_break_17", + "payroll_cost_centers" + ], + "fields": [ + { + "fieldname": "employee", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Employee", + "options": "Employee", + "reqd": 1, + "search_index": 1 + }, + { + "fetch_from": "employee.employee_name", + "fieldname": "employee_name", + "fieldtype": "Data", + "label": "Employee Name", + "read_only": 1 + }, + { + "fetch_from": "employee.department", + "fieldname": "department", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Department", + "options": "Department", + "read_only": 1 + }, + { + "fetch_from": "employee.designation", + "fieldname": "designation", + "fieldtype": "Link", + "in_standard_filter": 1, + "label": "Designation", + "options": "Designation", + "read_only": 1 + }, + { + "fieldname": "column_break_6", + "fieldtype": "Column Break" + }, + { + "fetch_from": "grade.default_salary_structure", + "fetch_if_empty": 1, + "fieldname": "salary_structure", + "fieldtype": "Link", + "in_list_view": 1, + "in_standard_filter": 1, + "label": "Salary Structure", + "options": "Salary Structure", + "reqd": 1, + "search_index": 1 + }, + { + "fieldname": "from_date", + "fieldtype": "Date", + "label": "From Date", + "reqd": 1 + }, + { + "fetch_from": "employee.company", + "fieldname": "company", + "fieldtype": "Link", + "label": "Company", + "options": "Company", + "reqd": 1 + }, + { + "fieldname": "section_break_7", + "fieldtype": "Section Break", + "label": "Base & Variable" + }, + { + "fetch_from": "grade.default_base_pay", + "fetch_if_empty": 1, + "fieldname": "base", + "fieldtype": "Currency", + "label": "Base", + "options": "currency" + }, + { + "fieldname": "column_break_9", + "fieldtype": "Column Break" + }, + { + "fieldname": "variable", + "fieldtype": "Currency", + "label": "Variable", + "options": "currency" + }, + { + "fieldname": "amended_from", + "fieldtype": "Link", + "label": "Amended From", + "no_copy": 1, + "options": "Salary Structure Assignment", + "print_hide": 1, + "read_only": 1 + }, + { + "depends_on": "salary_structure", + "fieldname": "income_tax_slab", + "fieldtype": "Link", + "label": "Income Tax Slab", + "options": "Income Tax Slab" + }, + { + "depends_on": "eval:(doc.docstatus==1 || doc.salary_structure)", + "fetch_from": "salary_structure.currency", + "fieldname": "currency", + "fieldtype": "Link", + "label": "Currency", + "options": "Currency", + "print_hide": 1, + "read_only": 1, + "reqd": 1 + }, + { + "depends_on": "employee", + "fieldname": "payroll_payable_account", + "fieldtype": "Link", + "label": "Payroll Payable Account", + "options": "Account" + }, + { + "collapsible": 1, + "depends_on": "employee", + "fieldname": "section_break_17", + "fieldtype": "Section Break", + "label": "Payroll Cost Centers" + }, + { + "allow_on_submit": 1, + "fieldname": "payroll_cost_centers", + "fieldtype": "Table", + "label": "Cost Centers", + "options": "Employee Cost Center" + }, + { + "fetch_from": "employee.grade", + "fieldname": "grade", + "fieldtype": "Link", + "label": "Grade", + "options": "Employee Grade", + "read_only": 1 + }, + { + "fieldname": "column_break_11", + "fieldtype": "Column Break" + }, + { + "allow_on_submit": 1, + "fieldname": "tax_deducted_till_date", + "fieldtype": "Currency", + "label": "Tax Deducted Till Date", + "options": "currency" + }, + { + "fieldname": "column_break_20", + "fieldtype": "Column Break" + }, + { + "collapsible_depends_on": "eval:doc.taxable_earnings_till_date && doc.tax_deducted_till_date", + "fieldname": "earnings_and_taxation_section", + "fieldtype": "Section Break", + "hidden": 1, + "label": "Earnings and Taxation " + }, + { + "allow_on_submit": 1, + "fieldname": "taxable_earnings_till_date", + "fieldtype": "Currency", + "label": "Taxable Earnings Till Date", + "options": "currency" + }, + { + "fetch_from": "salary_structure.leave_encashment_amount_per_day", + "fetch_if_empty": 1, + "fieldname": "leave_encashment_amount_per_day", + "fieldtype": "Currency", + "label": "Leave Encashment Amount Per Day" + } + ], + "is_submittable": 1, + "links": [], + "modified": "2024-10-06 11:33:38.418311", + "modified_by": "Administrator", + "module": "Payroll", + "name": "Salary Structure Assignment", + "naming_rule": "Expression (old style)", + "owner": "Administrator", + "permissions": [ + { + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "System Manager", + "share": 1, + "write": 1 + }, + { + "amend": 1, + "cancel": 1, + "create": 1, + "delete": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR Manager", + "share": 1, + "submit": 1, + "write": 1 + }, + { + "create": 1, + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "HR User", + "share": 1, + "submit": 1, + "write": 1 + } + ], + "search_fields": "employee_name, salary_structure", + "sort_field": "creation", + "sort_order": "DESC", + "states": [], + "title_field": "employee_name", + "track_changes": 1 + } \ No newline at end of file