fix: Consider any kind of exemptions only if tax exemptions are allowed on tax slab (#21474)
This commit is contained in:
parent
078c95c438
commit
691f69c731
@ -93,13 +93,15 @@
|
|||||||
],
|
],
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-24 12:28:36.805904",
|
"modified": "2020-04-27 20:10:42.755762",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Income Tax Slab",
|
"name": "Income Tax Slab",
|
||||||
"owner": "Administrator",
|
"owner": "Administrator",
|
||||||
"permissions": [
|
"permissions": [
|
||||||
{
|
{
|
||||||
|
"amend": 1,
|
||||||
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
"email": 1,
|
"email": 1,
|
||||||
@ -109,9 +111,11 @@
|
|||||||
"report": 1,
|
"report": 1,
|
||||||
"role": "System Manager",
|
"role": "System Manager",
|
||||||
"share": 1,
|
"share": 1,
|
||||||
|
"submit": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"amend": 1,
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
@ -126,6 +130,7 @@
|
|||||||
"write": 1
|
"write": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"amend": 1,
|
||||||
"cancel": 1,
|
"cancel": 1,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"delete": 1,
|
"delete": 1,
|
||||||
@ -138,20 +143,6 @@
|
|||||||
"share": 1,
|
"share": 1,
|
||||||
"submit": 1,
|
"submit": 1,
|
||||||
"write": 1
|
"write": 1
|
||||||
},
|
|
||||||
{
|
|
||||||
"cancel": 1,
|
|
||||||
"create": 1,
|
|
||||||
"delete": 1,
|
|
||||||
"email": 1,
|
|
||||||
"export": 1,
|
|
||||||
"print": 1,
|
|
||||||
"read": 1,
|
|
||||||
"report": 1,
|
|
||||||
"role": "Administrator",
|
|
||||||
"share": 1,
|
|
||||||
"submit": 1,
|
|
||||||
"write": 1
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
|
@ -227,7 +227,7 @@
|
|||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
"depends_on": "eval:doc.type == \"Deduction\" && !doc.variable_based_on_taxable_salary",
|
"depends_on": "eval:doc.type == \"Deduction\" && !doc.variable_based_on_taxable_salary",
|
||||||
"description": "If checked, the full amount will be deducted from taxable income before calculating income tax. Otherwise, it can be exempted via Employee Tax Exemption Declaration.",
|
"description": "If checked, the full amount will be deducted from taxable income before calculating income tax without any declaration or proof submission.",
|
||||||
"fieldname": "exempted_from_income_tax",
|
"fieldname": "exempted_from_income_tax",
|
||||||
"fieldtype": "Check",
|
"fieldtype": "Check",
|
||||||
"label": "Exempted from Income Tax"
|
"label": "Exempted from Income Tax"
|
||||||
@ -235,7 +235,7 @@
|
|||||||
],
|
],
|
||||||
"icon": "fa fa-flag",
|
"icon": "fa fa-flag",
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2020-04-24 14:50:28.994054",
|
"modified": "2020-04-28 15:46:45.252945",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Salary Component",
|
"name": "Salary Component",
|
||||||
|
@ -549,15 +549,16 @@ class SalarySlip(TransactionBase):
|
|||||||
remaining_sub_periods = get_period_factor(self.employee,
|
remaining_sub_periods = get_period_factor(self.employee,
|
||||||
self.start_date, self.end_date, self.payroll_frequency, payroll_period)[1]
|
self.start_date, self.end_date, self.payroll_frequency, payroll_period)[1]
|
||||||
# get taxable_earnings, paid_taxes for previous period
|
# get taxable_earnings, paid_taxes for previous period
|
||||||
previous_taxable_earnings = self.get_taxable_earnings_for_prev_period(payroll_period.start_date, self.start_date)
|
previous_taxable_earnings = self.get_taxable_earnings_for_prev_period(payroll_period.start_date,
|
||||||
|
self.start_date, tax_slab.allow_tax_exemption)
|
||||||
previous_total_paid_taxes = self.get_tax_paid_in_period(payroll_period.start_date, self.start_date, tax_component)
|
previous_total_paid_taxes = self.get_tax_paid_in_period(payroll_period.start_date, self.start_date, tax_component)
|
||||||
|
|
||||||
# get taxable_earnings for current period (all days)
|
# get taxable_earnings for current period (all days)
|
||||||
current_taxable_earnings = self.get_taxable_earnings()
|
current_taxable_earnings = self.get_taxable_earnings(tax_slab.allow_tax_exemption)
|
||||||
future_structured_taxable_earnings = current_taxable_earnings.taxable_earnings * (math.ceil(remaining_sub_periods) - 1)
|
future_structured_taxable_earnings = current_taxable_earnings.taxable_earnings * (math.ceil(remaining_sub_periods) - 1)
|
||||||
|
|
||||||
# get taxable_earnings, addition_earnings for current actual payment days
|
# get taxable_earnings, addition_earnings for current actual payment days
|
||||||
current_taxable_earnings_for_payment_days = self.get_taxable_earnings(based_on_payment_days=1)
|
current_taxable_earnings_for_payment_days = self.get_taxable_earnings(tax_slab.allow_tax_exemption, based_on_payment_days=1)
|
||||||
current_structured_taxable_earnings = current_taxable_earnings_for_payment_days.taxable_earnings
|
current_structured_taxable_earnings = current_taxable_earnings_for_payment_days.taxable_earnings
|
||||||
current_additional_earnings = current_taxable_earnings_for_payment_days.additional_income
|
current_additional_earnings = current_taxable_earnings_for_payment_days.additional_income
|
||||||
current_additional_earnings_with_full_tax = current_taxable_earnings_for_payment_days.additional_income_with_full_tax
|
current_additional_earnings_with_full_tax = current_taxable_earnings_for_payment_days.additional_income_with_full_tax
|
||||||
@ -616,7 +617,7 @@ class SalarySlip(TransactionBase):
|
|||||||
return income_tax_slab_doc
|
return income_tax_slab_doc
|
||||||
|
|
||||||
|
|
||||||
def get_taxable_earnings_for_prev_period(self, start_date, end_date):
|
def get_taxable_earnings_for_prev_period(self, start_date, end_date, allow_tax_exemption=False):
|
||||||
taxable_earnings = frappe.db.sql("""
|
taxable_earnings = frappe.db.sql("""
|
||||||
select sum(sd.amount)
|
select sum(sd.amount)
|
||||||
from
|
from
|
||||||
@ -636,6 +637,8 @@ class SalarySlip(TransactionBase):
|
|||||||
})
|
})
|
||||||
taxable_earnings = flt(taxable_earnings[0][0]) if taxable_earnings else 0
|
taxable_earnings = flt(taxable_earnings[0][0]) if taxable_earnings else 0
|
||||||
|
|
||||||
|
exempted_amount = 0
|
||||||
|
if allow_tax_exemption:
|
||||||
exempted_amount = frappe.db.sql("""
|
exempted_amount = frappe.db.sql("""
|
||||||
select sum(sd.amount)
|
select sum(sd.amount)
|
||||||
from
|
from
|
||||||
@ -681,7 +684,7 @@ class SalarySlip(TransactionBase):
|
|||||||
|
|
||||||
return total_tax_paid
|
return total_tax_paid
|
||||||
|
|
||||||
def get_taxable_earnings(self, based_on_payment_days=0):
|
def get_taxable_earnings(self, allow_tax_exemption=False, based_on_payment_days=0):
|
||||||
joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee,
|
joining_date, relieving_date = frappe.get_cached_value("Employee", self.employee,
|
||||||
["date_of_joining", "relieving_date"])
|
["date_of_joining", "relieving_date"])
|
||||||
|
|
||||||
@ -715,6 +718,7 @@ class SalarySlip(TransactionBase):
|
|||||||
else:
|
else:
|
||||||
taxable_earnings += amount
|
taxable_earnings += amount
|
||||||
|
|
||||||
|
if allow_tax_exemption:
|
||||||
for ded in self.deductions:
|
for ded in self.deductions:
|
||||||
if ded.exempted_from_income_tax:
|
if ded.exempted_from_income_tax:
|
||||||
amount = ded.amount
|
amount = ded.amount
|
||||||
|
Loading…
x
Reference in New Issue
Block a user