From b752684876de044fe715053d6f08f36bb49ac9a5 Mon Sep 17 00:00:00 2001 From: Saurabh Date: Thu, 29 Dec 2022 14:57:00 +0530 Subject: [PATCH] feat: show tax breakup on salary slip --- .../doctype/salary_slip/salary_slip.json | 75 +++++++++++++++++++ .../doctype/salary_slip/salary_slip.py | 16 +++- 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/hrms/payroll/doctype/salary_slip/salary_slip.json b/hrms/payroll/doctype/salary_slip/salary_slip.json index 925f972296..9e0c58d2eb 100644 --- a/hrms/payroll/doctype/salary_slip/salary_slip.json +++ b/hrms/payroll/doctype/salary_slip/salary_slip.json @@ -81,6 +81,17 @@ "total_in_words", "column_break_69", "base_total_in_words", + "income_tax_calculation_breakup_section", + "ctc", + "income_from_other_sources", + "total_earnings", + "non_taxable_earnings", + "column_break_0rsw", + "deductions_before_tax_calculation", + "tax_exemption_declaration", + "standard_tax_exemption_amount", + "annual_taxable_amount", + "income_tax_deducted_till_date", "section_break_75", "journal_entry", "amended_from", @@ -645,7 +656,71 @@ }, { "fieldname": "column_break_ghjr", + "fieldtype": "Column Break", + }, + { + "collapsible": 1, + "fieldname": "income_tax_calculation_breakup_section", + "fieldtype": "Section Break", + "label": "Income Tax Breakup" + }, + { + "fieldname": "ctc", + "fieldtype": "Currency", + "label": "CTC", + "read_only": 1 + }, + { + "fieldname": "income_from_other_sources", + "fieldtype": "Currency", + "label": "Income from Other Sources", + "read_only": 1 + }, + { + "fieldname": "total_earnings", + "fieldtype": "Currency", + "label": "Total Earnings", + "read_only": 1 + }, + { + "fieldname": "non_taxable_earnings", + "fieldtype": "Currency", + "label": "Non Taxable Earnings", + "read_only": 1 + }, + { + "fieldname": "column_break_0rsw", "fieldtype": "Column Break" + }, + { + "fieldname": "deductions_before_tax_calculation", + "fieldtype": "Currency", + "label": "Deductions before tax calculation", + "read_only": 1 + }, + { + "fieldname": "tax_exemption_declaration", + "fieldtype": "Currency", + "label": "Tax Exemption Declaration", + "read_only": 1 + }, + { + "fieldname": "standard_tax_exemption_amount", + "fieldtype": "Currency", + "label": "Standard Tax Exemption Amount", + "read_only": 1 + }, + { + "fieldname": "annual_taxable_amount", + "fieldtype": "Currency", + "label": "Annual Taxable Amount", + "read_only": 1 + }, + { + "fieldname": "income_tax_deducted_till_date", + "fieldtype": "Currency", + "label": "Income Tax Deducted Till Date", + "read_only": 1 } ], "icon": "fa fa-file-text", diff --git a/hrms/payroll/doctype/salary_slip/salary_slip.py b/hrms/payroll/doctype/salary_slip/salary_slip.py index b19f034727..cf678baeec 100644 --- a/hrms/payroll/doctype/salary_slip/salary_slip.py +++ b/hrms/payroll/doctype/salary_slip/salary_slip.py @@ -1,9 +1,9 @@ # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt -import math -from datetime import date, timedelta +import math +from datetime import datetime, timedelta import frappe from frappe import _, msgprint from frappe.model.naming import make_autoname @@ -609,6 +609,18 @@ def set_net_pay(self): flt(self.hour_rate) * flt(self.exchange_rate), self.precision("base_hour_rate") ) self.set_net_total_in_words() + self.set_income_tax_breakup() + + def set_income_tax_breakup(self): + self.ctc = self.base_gross_pay * 12 + self.income_from_other_sources = self.income_from_other_sources + self.total_earnings = self.ctc + self.income_from_other_sources + self.non_taxable_earnings = 0 + self.deductions_before_tax_calculation = 0 + self.tax_exemption_declaration = 0 + self.standard_tax_exemption_amount = 0 + self.annual_taxable_amount = 0 + self.income_tax_deducted_till_date = 0 def calculate_component_amounts(self, component_type): if not getattr(self, "_salary_structure_doc", None):