Merge pull request #35267 from saurabh6790/fix-statistical-component-calculation

fix: update reference data for statistical component
This commit is contained in:
Saurabh
2023-05-15 11:09:50 +05:30
committed by GitHub

View File

@@ -653,15 +653,17 @@ class SalarySlip(TransactionBase):
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)