fix: Rounded tax amount in salary slip
This commit is contained in:
parent
77b82894ff
commit
24b4a8722e
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"allow_copy": 0,
|
"allow_copy": 0,
|
||||||
|
"allow_events_in_timeline": 0,
|
||||||
"allow_guest_to_view": 0,
|
"allow_guest_to_view": 0,
|
||||||
"allow_import": 1,
|
"allow_import": 1,
|
||||||
"allow_rename": 1,
|
"allow_rename": 1,
|
||||||
@ -20,6 +21,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "employee",
|
"fieldname": "employee",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -54,6 +56,7 @@
|
|||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fetch_from": "employee.company",
|
"fetch_from": "employee.company",
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "company",
|
"fieldname": "company",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -87,6 +90,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "column_break_2",
|
"fieldname": "column_break_2",
|
||||||
"fieldtype": "Column Break",
|
"fieldtype": "Column Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -118,6 +122,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "payroll_period",
|
"fieldname": "payroll_period",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -151,6 +156,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "total_exemption_amount",
|
"fieldname": "total_exemption_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -184,6 +190,7 @@
|
|||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
"fetch_from": "employee.department",
|
"fetch_from": "employee.department",
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "department",
|
"fieldname": "department",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -217,6 +224,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "amended_from",
|
"fieldname": "amended_from",
|
||||||
"fieldtype": "Link",
|
"fieldtype": "Link",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -249,6 +257,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "section_break_8",
|
"fieldname": "section_break_8",
|
||||||
"fieldtype": "Section Break",
|
"fieldtype": "Section Break",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -280,6 +289,7 @@
|
|||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"columns": 0,
|
"columns": 0,
|
||||||
|
"fetch_if_empty": 0,
|
||||||
"fieldname": "declarations",
|
"fieldname": "declarations",
|
||||||
"fieldtype": "Table",
|
"fieldtype": "Table",
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
@ -300,7 +310,7 @@
|
|||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"remember_last_selected_value": 0,
|
"remember_last_selected_value": 0,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 1,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"translatable": 0,
|
"translatable": 0,
|
||||||
@ -317,7 +327,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2018-08-21 16:15:49.363307",
|
"modified": "2019-04-23 15:50:48.693555",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "HR",
|
"module": "HR",
|
||||||
"name": "Employee Tax Exemption Declaration",
|
"name": "Employee Tax Exemption Declaration",
|
||||||
|
|||||||
@ -167,7 +167,7 @@ class SalarySlip(TransactionBase):
|
|||||||
if d.amount_based_on_formula:
|
if d.amount_based_on_formula:
|
||||||
formula = d.formula.strip() if d.formula else None
|
formula = d.formula.strip() if d.formula else None
|
||||||
if formula:
|
if formula:
|
||||||
amount = frappe.safe_eval(formula, self.whitelisted_globals, data)
|
amount = rounded(frappe.safe_eval(formula, self.whitelisted_globals, data))
|
||||||
if amount:
|
if amount:
|
||||||
data[d.abbr] = amount
|
data[d.abbr] = amount
|
||||||
|
|
||||||
@ -739,22 +739,24 @@ class SalarySlip(TransactionBase):
|
|||||||
# less paid taxes
|
# less paid taxes
|
||||||
if args.get("pro_rata_tax_paid"):
|
if args.get("pro_rata_tax_paid"):
|
||||||
tax_amount -= args.get("pro_rata_tax_paid")
|
tax_amount -= args.get("pro_rata_tax_paid")
|
||||||
|
tax_amount = rounded(tax_amount)
|
||||||
struct_row = self.get_salary_slip_row(args.get("tax_component"))
|
struct_row = self.get_salary_slip_row(args.get("tax_component"))
|
||||||
return [struct_row, tax_amount, benefit_tax, additional_tax]
|
return [struct_row, tax_amount, benefit_tax, additional_tax]
|
||||||
|
|
||||||
def calculate_tax_by_tax_slab(self, payroll_period, annual_earning):
|
def calculate_tax_by_tax_slab(self, payroll_period, annual_taxable_earning):
|
||||||
payroll_period_obj = frappe.get_doc("Payroll Period", payroll_period)
|
payroll_period_obj = frappe.get_doc("Payroll Period", payroll_period)
|
||||||
data = self.get_data_for_eval()
|
data = self.get_data_for_eval()
|
||||||
|
data.update({"annual_taxable_earning": annual_taxable_earning})
|
||||||
taxable_amount = 0
|
taxable_amount = 0
|
||||||
for slab in payroll_period_obj.taxable_salary_slabs:
|
for slab in payroll_period_obj.taxable_salary_slabs:
|
||||||
if slab.condition and not self.eval_tax_slab_condition(slab.condition, data):
|
if slab.condition and not self.eval_tax_slab_condition(slab.condition, data):
|
||||||
continue
|
continue
|
||||||
if not slab.to_amount and annual_earning > slab.from_amount:
|
if not slab.to_amount and annual_taxable_earning > slab.from_amount:
|
||||||
taxable_amount += (annual_earning - slab.from_amount) * slab.percent_deduction *.01
|
taxable_amount += (annual_taxable_earning - slab.from_amount) * slab.percent_deduction *.01
|
||||||
continue
|
continue
|
||||||
if annual_earning > slab.from_amount and annual_earning < slab.to_amount:
|
if annual_taxable_earning > slab.from_amount and annual_taxable_earning < slab.to_amount:
|
||||||
taxable_amount += (annual_earning - slab.from_amount) * slab.percent_deduction *.01
|
taxable_amount += (annual_taxable_earning - slab.from_amount) * slab.percent_deduction *.01
|
||||||
elif annual_earning > slab.from_amount and annual_earning > slab.to_amount:
|
elif annual_taxable_earning > slab.from_amount and annual_taxable_earning > slab.to_amount:
|
||||||
taxable_amount += (slab.to_amount - slab.from_amount) * slab.percent_deduction * .01
|
taxable_amount += (slab.to_amount - slab.from_amount) * slab.percent_deduction * .01
|
||||||
return taxable_amount
|
return taxable_amount
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user