Skip to content

Commit

Permalink
Fix pay uplift to be accumulated
Browse files Browse the repository at this point in the history
  • Loading branch information
CaitBarnard committed Jan 29, 2025
1 parent 9bb16e0 commit 0eed7d2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion payroll/services/payroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def payroll_forecast_report(

pay_uplift = np.array(pay_uplift_obj.periods) if pay_uplift_obj else np.ones(12)
attrition = np.array(attrition_obj.periods) if attrition_obj else np.ones(12)
pay_uplift_accumulate = np.array(list(accumulate(pay_uplift, operator.mul)))
attrition_accumulate = np.array(list(accumulate(attrition, operator.mul)))

for employee in employee_qs.iterator():
Expand All @@ -102,7 +103,7 @@ def payroll_forecast_report(

prog_report = report[employee.programme_code_id]
prog_report[settings.PAYROLL.BASIC_PAY_NAC] += (
periods * employee.basic_pay * pay_uplift * attrition_accumulate
periods * employee.basic_pay * pay_uplift_accumulate * attrition_accumulate
)
prog_report[settings.PAYROLL.PENSION_NAC] += periods * employee.pension
prog_report[settings.PAYROLL.ERNIC_NAC] += periods * employee.ernic
Expand Down
12 changes: 11 additions & 1 deletion payroll/tests/services/test_payroll.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ def test_one_employee_with_pay_uplift(db):
financial_year=financial_year,
aug=1.02,
)
modifier = pay_uplift.aug

report = payroll_forecast_report(cost_centre, financial_year)

Expand All @@ -173,7 +174,16 @@ def test_one_employee_with_pay_uplift(db):
e1s,
e1p,
e1e,
modifiers={"aug": pay_uplift.aug},
modifiers={
"aug": modifier,
"sep": modifier,
"oct": modifier,
"nov": modifier,
"dec": modifier,
"jan": modifier,
"feb": modifier,
"mar": modifier,
},
)


Expand Down

0 comments on commit 0eed7d2

Please sign in to comment.