cit model commit.

This commit is contained in:
2025-12-01 12:04:07 +05:30
parent 0d6c873515
commit aa063b7a80
8 changed files with 456 additions and 95 deletions

View File

@@ -24,7 +24,7 @@ class AOHandler:
def get_ao_by_id(self, id):
# Call stored procedure
self.cursor.callproc('GetAORById', [id])
self.cursor.callproc('GetAOById', [id])
# Fetch result
records = []

74
AppCode/CITHandler.py Normal file
View File

@@ -0,0 +1,74 @@
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()
# UPDATE CIT RECORD
# 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"
# ]
# set_clause = ", ".join([f"{col}=%s" for col in columns])
# query = f"UPDATE cit SET {set_clause} WHERE id=%s"
# values = [data.get(col, 0) for col in columns]
# values.append(id)
# self.cursor.execute(query, tuple(values))
# self.conn.commit()
# 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()

67
AppCode/ITATHandler.py Normal file
View File

@@ -0,0 +1,67 @@
# AppCode/ITATHandler.py
from AppCode.Config import DBConfig
class ITATHandler:
def __init__(self):
self.conn = DBConfig.get_db_connection()
self.cursor = self.conn.cursor(dictionary=True)
# GET ALL ITAT RECORDS (PROC)
def get_all_itat(self):
self.cursor.callproc("GetAllITAT")
records = []
for result in self.cursor.stored_results():
records = result.fetchall()
return records
# GET ITAT BY ID (PROC)
def get_itat_by_id(self, id):
self.cursor.callproc("GetITATById", [id])
records = []
for result in self.cursor.stored_results():
records = result.fetchall()
if records:
return records[0]
return None
# INSERT ITAT (PROC)
def add_itat(self, data):
values = [
data.get("cit_id"),
data.get("year"),
data.get("mat_tax_credit"),
data.get("surcharge"),
data.get("cess"),
data.get("total_credit")
]
self.cursor.callproc("InsertITAT", values)
self.conn.commit()
# UPDATE ITAT (PROC)
def update_itat(self, id, data):
values = [
id,
data.get("year"),
data.get("mat_tax_credit"),
data.get("surcharge"),
data.get("cess"),
data.get("total_credit")
]
self.cursor.callproc("UpdateITAT", values)
self.conn.commit()
# DELETE ITAT BY ID (PROC)
def delete_itat_by_id(self, id):
self.cursor.callproc("DeleteITATById", [id])
self.conn.commit()
# CLOSE CONNECTION
def close(self):
self.cursor.close()
self.conn.close()

Binary file not shown.

Binary file not shown.