changes of .env file

This commit is contained in:
2026-01-21 22:59:36 +05:30
parent 40fc148287
commit 7bdcee0656
18 changed files with 98 additions and 72 deletions

View File

@@ -4,8 +4,6 @@ import pandas as pd
import io
class AOHandler:
def __init__(self):
@@ -45,8 +43,7 @@ class AOHandler:
]
values = [data.get(f, 0) for f in fields]
print("---- values ---- ",values)
self.cursor.callproc("InsertAO", values)
self.conn.commit()
@@ -65,8 +62,6 @@ class AOHandler:
values = [id] + [data.get(f, 0) for f in fields]
print("AO update values:", values)
self.cursor.callproc("UpdateAOById", values)
self.conn.commit()

View File

@@ -3,10 +3,10 @@ import os
# Database Config
class DBConfig:
MYSQL_HOST = os.getenv("MYSQL_HOST", "127.0.0.1")
MYSQL_USER = os.getenv("MYSQL_USER", "root")
MYSQL_PASSWORD = os.getenv("MYSQL_PASSWORD", "root")
MYSQL_DB = os.getenv("MYSQL_DB", "test_income_taxdb")
MYSQL_HOST = os.getenv("DB_HOST")
MYSQL_USER = os.getenv("DB_USER")
MYSQL_PASSWORD = os.getenv("DB_PASSWORD")
MYSQL_DB = os.getenv("DB_NAME")
@staticmethod
def get_db_connection():

View File

@@ -24,8 +24,6 @@ class ITRHandler:
# GET ALL ITR RECORDS using stored procedure "GetAllItr"
def get_all_itr(self):
# self.cursor = conn.cursor(dictionary=True)
self.cursor.callproc("GetAllItr")
records = []
for result in self.cursor.stored_results():
@@ -80,9 +78,6 @@ class ITRHandler:
]
values = [id] + [data.get(col, 0) for col in columns]
print("Final values:", values)
self.cursor.callproc("UpdateITR", values)
self.conn.commit()
@@ -95,7 +90,6 @@ class ITRHandler:
# report download by year
def itr_report_download(self, selected_year):
try:
# Call stored procedure
self.cursor.callproc("GetITRByYear", [selected_year])
@@ -109,14 +103,10 @@ class ITRHandler:
# Convert SQL rows to DataFrame
df = pd.DataFrame(rows)
# Transpose
df_transposed = df.transpose()
df_transposed.insert(0, 'Field', df_transposed.index)
print("df-->",df_transposed)
record_cols = {
i: f"Record {i}"
for i in df_transposed.columns if isinstance(i, int)
@@ -139,7 +129,6 @@ class ITRHandler:
print("MySQL Error →", e)
return None
# CLOSE CONNECTION
def close(self):
self.cursor.close()

View File

@@ -1,8 +1,6 @@
from AppCode.Config import DBConfig
import mysql.connector
class MatCreditHandler:
def __init__(self):

View File

@@ -11,28 +11,31 @@ class YearGet:
def get_year_by_model(self, proc_name):
try:
self.cursor.callproc(proc_name)
years = []
for result in self.cursor.stored_results():
rows = result.fetchall()
years = [row["year"] for row in rows]
print("-- years get --",years)
return years
except mysql.connector.Error as e:
print("MySQL Error:", e)
return []
# def get_all_year_in_all_model(self):
# self.cursor.callproc("AllYearsInAllModel")
# years = []
# for result in self.cursor.stored_results():
# rows = result.fetchall()
# years = [row["year"] for row in rows]
# return years
def CheckYearExists(self, table_name, year):
try:
self.cursor.callproc('CheckYearExists', (table_name, year))
result = 0
for result_set in self.cursor.stored_results():
result = result_set.fetchone()[0]
return {"exists": result > 0}
except mysql.connector.Error as e:
print("MySQL Error:", e)
return {"exists": False, "error": str(e)}
def close(self):
self.cursor.close()
self.conn.close()