Skip to content

Commit

Permalink
include all tax applicable deductions under Total Tax Deducted
Browse files Browse the repository at this point in the history
  • Loading branch information
AyshaHakeem committed Jan 9, 2025
1 parent 0841752 commit d1d8d78
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ def get_data_for_eval(self, emp: str, emp_details: dict) -> tuple:
return salary_slip.whitelisted_globals, eval_locals

def get_total_deducted_tax(self):
tax_components = frappe.get_all(
"Salary Component", filters={"is_income_tax_component": 1}, pluck="name"
)
if not tax_components:
return []

self.add_column("Total Tax Deducted")

ss = frappe.qb.DocType("Salary Slip")
Expand All @@ -468,8 +474,8 @@ def get_total_deducted_tax(self):
.select(ss.employee, Sum(ss_ded.amount).as_("amount"))
.where(ss.docstatus == 1)
.where(ss.employee.isin(list(self.employees.keys())))
.where(ss_ded.salary_component.isin(tax_components))
.where(ss_ded.parentfield == "deductions")
.where(ss_ded.variable_based_on_taxable_salary == 1)
.where(ss.start_date >= self.payroll_period_start_date)
.where(ss.end_date <= self.payroll_period_end_date)
.groupby(ss.employee)
Expand Down

0 comments on commit d1d8d78

Please sign in to comment.