Skip to content

Commit

Permalink
fix: update reference data for statistical component
Browse files Browse the repository at this point in the history
  • Loading branch information
saurabh6790 committed May 12, 2023
1 parent 8b3d6ee commit 77f548c
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions erpnext/payroll/doctype/salary_slip/salary_slip.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,15 +653,17 @@ def add_structure_components(self, component_type):
amount = self.eval_condition_and_formula(struct_row, data)

if struct_row.statistical_component:
default_data[struct_row.abbr] = amount

# update statitical component amount in reference data based on payment days
# since row for statistical component is not added to salary slip
if struct_row.depends_on_payment_days:
joining_date, relieving_date = self.get_joining_and_relieving_dates()
default_data[struct_row.abbr] = amount
data[struct_row.abbr] = flt(
(flt(amount) * flt(self.payment_days) / cint(self.total_working_days)),
struct_row.precision("amount"),
payment_days_amount = (
flt(amount) * flt(self.payment_days) / cint(self.total_working_days)
if self.total_working_days
else 0
)
data[struct_row.abbr] = payment_days_amount

elif amount or struct_row.amount_based_on_formula and amount is not None:
default_amount = self.eval_condition_and_formula(struct_row, default_data)
Expand Down

0 comments on commit 77f548c

Please sign in to comment.