fixes Benefit Application, Additional Salary (#14971)

* fix - add Additional Salary if multiple in one slip

* fix - Benefit Appication, None comparison
This commit is contained in:
Ranjith Kurungadam 2018-07-23 11:32:58 +05:30 committed by Nabin Hait
parent 68abe25371
commit 1e90dafef8
2 changed files with 10 additions and 3 deletions

View File

@ -55,11 +55,18 @@ def get_additional_salary_component(employee, start_date, end_date):
if additional_components:
additional_components_array = []
for additional_component in additional_components:
struct_row = {}
additional_components_dict = {}
additional_component_obj = frappe.get_doc("Additional Salary", additional_component[0])
amount = additional_component_obj.get_amount(start_date, end_date)
salary_component = frappe.get_doc("Salary Component", additional_component_obj.salary_component)
added = False
for added_component in additional_components_array:
if added_component["struct_row"]["salary_component"] == salary_component.name:
added_component["amount"] += amount
added = True
if added:
continue
struct_row = {}
additional_components_dict = {}
struct_row['depends_on_lwp'] = salary_component.depends_on_lwp
struct_row['salary_component'] = salary_component.name
struct_row['abbr'] = salary_component.salary_component_abbr

View File

@ -200,7 +200,7 @@ def get_benefit_component_amount(employee, start_date, end_date, struct_row, sal
# TODO: Check if there is benefit claim for employee then pro-rata divide the rest of amount (Late Benefit Application)
else:
component_max = frappe.db.get_value("Salary Component", struct_row.salary_component, "max_benefit_amount")
if component_max > 0:
if component_max:
benefit_amount = get_benefit_pro_rata_ratio_amount(sal_struct, component_max)
return get_amount(period_factor, benefit_amount, period_length)
return False