2025-12-01 12:04:07 +05:30
|
|
|
from AppCode.Config import DBConfig
|
|
|
|
|
import mysql.connector
|
|
|
|
|
|
|
|
|
|
class CITHandler:
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
|
db = DBConfig()
|
|
|
|
|
self.conn = db.get_db_connection()
|
|
|
|
|
self.cursor = self.conn.cursor(dictionary=True)
|
|
|
|
|
|
|
|
|
|
# GET ALL CIT RECORDS
|
|
|
|
|
def get_all_cit(self):
|
|
|
|
|
self.cursor.callproc("GetAllCIT")
|
|
|
|
|
records = []
|
|
|
|
|
|
|
|
|
|
for result in self.cursor.stored_results():
|
|
|
|
|
records = result.fetchall()
|
|
|
|
|
|
|
|
|
|
return records
|
|
|
|
|
|
|
|
|
|
# GET CIT BY ID
|
|
|
|
|
def get_cit_by_id(self, id):
|
|
|
|
|
self.cursor.callproc("GetCITById", [id])
|
|
|
|
|
records = []
|
|
|
|
|
|
|
|
|
|
for result in self.cursor.stored_results():
|
|
|
|
|
records = result.fetchall()
|
|
|
|
|
|
|
|
|
|
if records:
|
|
|
|
|
return records[0]
|
|
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
# INSERT CIT RECORD
|
|
|
|
|
def add_cit(self, data):
|
|
|
|
|
columns = [
|
|
|
|
|
"year", "gross_total_income", "deduction_80ia_business", "deduction_sec37_disallowance",
|
|
|
|
|
"deduction_80g", "net_taxable_income", "tax_30_percent", "tax_book_profit_18_5",
|
|
|
|
|
"tax_payable", "surcharge_12", "edu_cess_3", "total_tax_payable", "mat_credit",
|
|
|
|
|
"interest_234c", "total_tax", "advance_tax", "tds", "tcs", "tax_on_assessment", "refund"
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
values = [data.get(col, 0) for col in columns]
|
|
|
|
|
|
|
|
|
|
self.cursor.callproc("InsertCIT", values)
|
|
|
|
|
self.conn.commit()
|
|
|
|
|
|
2025-12-01 17:45:16 +05:30
|
|
|
|
|
|
|
|
|
2025-12-01 12:04:07 +05:30
|
|
|
# UPDATE CIT RECORD
|
2025-12-01 17:45:16 +05:30
|
|
|
def update_cit(self, id, data):
|
|
|
|
|
columns = [
|
|
|
|
|
"year", "gross_total_income", "deduction_80ia_business",
|
|
|
|
|
"deduction_sec37_disallowance", "deduction_80g",
|
|
|
|
|
"net_taxable_income", "tax_30_percent", "tax_book_profit_18_5",
|
|
|
|
|
"tax_payable", "surcharge_12", "edu_cess_3",
|
|
|
|
|
"total_tax_payable", "mat_credit", "interest_234c",
|
|
|
|
|
"total_tax", "advance_tax", "tds", "tcs",
|
|
|
|
|
"tax_on_assessment", "refund"
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
values = [id] + [data.get(col, 0) for col in columns]
|
|
|
|
|
|
|
|
|
|
self.cursor.callproc("UpdateCITById", values)
|
|
|
|
|
self.conn.commit()
|
|
|
|
|
|
|
|
|
|
|
2025-12-01 12:04:07 +05:30
|
|
|
|
|
|
|
|
# DELETE CIT RECORD
|
|
|
|
|
def delete_cit(self, id):
|
|
|
|
|
self.cursor.callproc("DeleteCITById", [id])
|
|
|
|
|
self.conn.commit()
|
|
|
|
|
|
|
|
|
|
# CLOSE CONNECTION
|
|
|
|
|
def close(self):
|
|
|
|
|
self.cursor.close()
|
|
|
|
|
self.conn.close()
|