# 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()