Skip to content

Commit

Permalink
revert(Salary Slip): calculate gross pay before deductions
Browse files Browse the repository at this point in the history
(cherry picked from commit 80ed620)
  • Loading branch information
krantheman authored and mergify[bot] committed Aug 28, 2024
1 parent 7b29fd6 commit acf6504
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions hrms/payroll/doctype/salary_slip/salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,9 @@ def set_salary_structure_assignment(self):
)

def calculate_net_pay(self):
if self.salary_structure:
self.calculate_component_amounts("earnings")

# get remaining numbers of sub-period (period for which one salary is processed)
if self.payroll_period:
self.remaining_sub_periods = get_period_factor(
Expand All @@ -778,8 +781,12 @@ def calculate_net_pay(self):
relieving_date=self.relieving_date,
)[1]

self.gross_pay = self.get_component_totals("earnings", depends_on_payment_days=1)
self.base_gross_pay = flt(
flt(self.gross_pay) * flt(self.exchange_rate), self.precision("base_gross_pay")
)

if self.salary_structure:
self.calculate_component_amounts("earnings")
self.calculate_component_amounts("deductions")

deductions_abbr = [d.abbr for d in self.deductions]
Expand All @@ -791,10 +798,6 @@ def calculate_net_pay(self):
self.add_structure_component(d, "earnings")
self.update_dependent_components_recursively("deductions", d.abbr)

self.gross_pay = self.get_component_totals("earnings", depends_on_payment_days=1)
self.base_gross_pay = flt(
flt(self.gross_pay) * flt(self.exchange_rate), self.precision("base_gross_pay")
)
set_loan_repayment(self)

self.set_precision_for_component_amounts()
Expand Down

0 comments on commit acf6504

Please sign in to comment.