modification ui changes base pages,login, manus and from chnages and adding filds. V2 commit
This commit is contained in:
@@ -54,7 +54,7 @@ class AOHandler:
|
||||
"net_taxable_income", "tax_30_percent", "tax_book_profit_18_5",
|
||||
"surcharge_12", "edu_cess_3", "total_tax_payable", "mat_credit",
|
||||
"interest_234c", "total_tax", "advance_tax", "tds", "tcs",
|
||||
"tax_on_assessment", "refund"
|
||||
"tax_on_assessment", "refund","Remarks"
|
||||
]
|
||||
|
||||
values = [data.get(f, 0) for f in fields]
|
||||
@@ -73,7 +73,7 @@ class AOHandler:
|
||||
"net_taxable_income", "tax_30_percent", "tax_book_profit_18_5",
|
||||
"surcharge_12", "edu_cess_3", "total_tax_payable", "mat_credit",
|
||||
"interest_234c", "total_tax", "advance_tax", "tds", "tcs",
|
||||
"tax_on_assessment", "refund"
|
||||
"tax_on_assessment", "refund","Remarks"
|
||||
]
|
||||
|
||||
values = [id] + [data.get(f, 0) for f in fields]
|
||||
|
||||
@@ -41,7 +41,7 @@ class CITHandler:
|
||||
"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"
|
||||
"interest_234c", "total_tax", "advance_tax", "tds", "tcs", "tax_on_assessment", "refund","Remarks"
|
||||
]
|
||||
|
||||
values = [data.get(col, 0) for col in columns]
|
||||
@@ -60,7 +60,7 @@ class CITHandler:
|
||||
"tax_payable", "surcharge_12", "edu_cess_3",
|
||||
"total_tax_payable", "mat_credit", "interest_234c",
|
||||
"total_tax", "advance_tax", "tds", "tcs",
|
||||
"tax_on_assessment", "refund"
|
||||
"tax_on_assessment", "refund","Remarks"
|
||||
]
|
||||
|
||||
values = [id] + [data.get(col, 0) for col in columns]
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import mysql.connector
|
||||
import os
|
||||
|
||||
# Database Config
|
||||
class DBConfig:
|
||||
# Database credentials (can also be read from environment variables)
|
||||
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", "income_tax")
|
||||
MYSQL_DB = os.getenv("MYSQL_DB", "test_income_taxdb")
|
||||
|
||||
@staticmethod
|
||||
def get_db_connection():
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
from AppCode.Config import DBConfig
|
||||
import mysql.connector
|
||||
from AppCode.YearGet import YearGet
|
||||
|
||||
import pandas as pd
|
||||
import pymysql
|
||||
import io
|
||||
from flask import send_file, render_template, request
|
||||
|
||||
# new
|
||||
from AppCode.Config import DBConfig
|
||||
from AppCode.YearGet import YearGet
|
||||
import mysql.connector
|
||||
import pandas as pd
|
||||
import io
|
||||
from flask import send_file, render_template, request
|
||||
|
||||
|
||||
|
||||
class ITRHandler:
|
||||
@@ -36,23 +44,25 @@ class ITRHandler:
|
||||
for result in self.cursor.stored_results():
|
||||
records = result.fetchall()
|
||||
|
||||
# return single record
|
||||
if records:
|
||||
print(records[0])
|
||||
return records[0]
|
||||
return records[0] # return single record
|
||||
|
||||
return None
|
||||
|
||||
|
||||
|
||||
|
||||
# INSERT ITR RECORD using procedure "add_itr"
|
||||
def add_itr(self, data):
|
||||
|
||||
columns = [
|
||||
'year', 'gross_total_income', 'disallowance_14a', 'disallowance_37',
|
||||
'deduction_80ia_business', 'deduction_80ia_misc', 'deduction_80ia_other',
|
||||
'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'
|
||||
'total_tax', 'advance_tax', 'tds', 'tcs', 'tax_on_assessment', 'refund', 'Remarks'
|
||||
]
|
||||
|
||||
values = [data.get(col, 0) for col in columns]
|
||||
@@ -62,7 +72,6 @@ class ITRHandler:
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
|
||||
def update(self, id, data):
|
||||
columns = [
|
||||
'year', 'gross_total_income', 'disallowance_14a', 'disallowance_37',
|
||||
@@ -70,7 +79,7 @@ class ITRHandler:
|
||||
'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'
|
||||
'total_tax', 'advance_tax', 'tds', 'tcs', 'tax_on_assessment', 'refund','Remarks'
|
||||
]
|
||||
|
||||
values = [id] + [data.get(col, 0) for col in columns]
|
||||
@@ -88,7 +97,7 @@ class ITRHandler:
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
# dowanload itr report by year
|
||||
|
||||
def itr_report_download(self, selected_year):
|
||||
|
||||
try:
|
||||
@@ -104,10 +113,14 @@ 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)
|
||||
|
||||
1
AppCode/Login.py
Normal file
1
AppCode/Login.py
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
44
AppCode/LoginAuth.py
Normal file
44
AppCode/LoginAuth.py
Normal file
@@ -0,0 +1,44 @@
|
||||
from flask import Blueprint, render_template, request, redirect, url_for, flash, session
|
||||
from flask import flash,redirect,url_for
|
||||
from functools import wraps
|
||||
from flask import session
|
||||
|
||||
class LoginAuth:
|
||||
def __init__(self):
|
||||
self.bp = Blueprint("auth", __name__)
|
||||
|
||||
# LOGIN ROUTE
|
||||
@self.bp.route('/login', methods=['GET', 'POST'])
|
||||
def login():
|
||||
if request.method == 'POST':
|
||||
username = request.form.get("username")
|
||||
password = request.form.get("password")
|
||||
|
||||
# Dummy validation — REPLACE with DB check later
|
||||
if username == "admin" and password == "admin123":
|
||||
session['user'] = username
|
||||
flash("Login successful!", "success")
|
||||
return redirect(url_for('welcome'))
|
||||
else:
|
||||
flash("Invalid username or password!", "danger")
|
||||
|
||||
return render_template("login.html")
|
||||
|
||||
# LOGOUT ROUTE
|
||||
@self.bp.route('/logout')
|
||||
def logout():
|
||||
session.clear()
|
||||
flash("Logged out successfully!", "success")
|
||||
return redirect(url_for('auth.login'))
|
||||
|
||||
# ===================================================
|
||||
# LOGIN REQUIRED DECORATOR INSIDE CLASS
|
||||
# ===================================================
|
||||
def login_required(self, f):
|
||||
@wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
if "user" not in session:
|
||||
flash("Please login first!", "danger")
|
||||
return redirect(url_for("auth.login"))
|
||||
return f(*args, **kwargs)
|
||||
return wrapper
|
||||
@@ -11,11 +11,13 @@ 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:
|
||||
|
||||
BIN
AppCode/__pycache__/AOHandler.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/AOHandler.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/AOHandler.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/AOHandler.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
AppCode/__pycache__/CITHandler.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/CITHandler.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/CITHandler.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/CITHandler.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
AppCode/__pycache__/Config.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/Config.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/Config.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/Config.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
AppCode/__pycache__/DocumentHandler.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/DocumentHandler.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/DocumentHandler.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/DocumentHandler.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
AppCode/__pycache__/FileHandler.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/FileHandler.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/FileHandler.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/FileHandler.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
AppCode/__pycache__/ITATHandler.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/ITATHandler.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/ITATHandler.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/ITATHandler.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
AppCode/__pycache__/ITRHandler.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/ITRHandler.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/ITRHandler.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/ITRHandler.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
AppCode/__pycache__/LoginAuth.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/LoginAuth.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/LoginAuth.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/LoginAuth.cpython-312.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/LoginAuth.cpython-313.pyc
Normal file
BIN
AppCode/__pycache__/LoginAuth.cpython-313.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/YearGet.cpython-311.pyc
Normal file
BIN
AppCode/__pycache__/YearGet.cpython-311.pyc
Normal file
Binary file not shown.
BIN
AppCode/__pycache__/YearGet.cpython-312.pyc
Normal file
BIN
AppCode/__pycache__/YearGet.cpython-312.pyc
Normal file
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user