testing code and modify commit.

This commit is contained in:
2025-12-03 10:49:31 +05:30
parent 3cf258ba0d
commit 21eb55d4b4
7 changed files with 95 additions and 53 deletions

View File

@@ -58,6 +58,7 @@ class AOHandler:
] ]
values = [data.get(f, 0) for f in fields] values = [data.get(f, 0) for f in fields]
print("---- values ---- ",values)
self.cursor.callproc("InsertAO", values) self.cursor.callproc("InsertAO", values)
self.conn.commit() self.conn.commit()

80
main.py
View File

@@ -84,8 +84,6 @@ def uploaded_file(filename):
# @app.route('/itr', methods=['GET', 'POST']) # @app.route('/itr', methods=['GET', 'POST'])
# def itr_form(): # def itr_form():
# if request.method == 'POST': # if request.method == 'POST':
@@ -639,11 +637,9 @@ def add_itat():
# return redirect(url_for('display_itat')) # return redirect(url_for('display_itat'))
# -------------------- i dont use -------------------------
# (You will also need to add update_itat and delete_itat functions later) # @app.route('/cit', methods=['GET', 'POST'])
# def cit_form():
@app.route('/cit', methods=['GET', 'POST'])
def cit_form():
if request.method == 'POST': if request.method == 'POST':
data = {key: request.form.get(key, 0) for key in request.form} data = {key: request.form.get(key, 0) for key in request.form}
conn = mysql.connector.connect(**db_config) conn = mysql.connector.connect(**db_config)
@@ -689,31 +685,31 @@ def cit_form():
return render_template('cit_form.html') return render_template('cit_form.html')
# -------------------- i dont use -------------------------
@app.route('/itat', methods=['GET', 'POST']) # @app.route('/itat', methods=['GET', 'POST'])
def itat_form(): # def itat_form():
if request.method == 'POST': # if request.method == 'POST':
mat_tax_credit = request.form['mat_tax_credit'] # mat_tax_credit = request.form['mat_tax_credit']
surcharge = request.form['surcharge'] # surcharge = request.form['surcharge']
cess = request.form['cess'] # cess = request.form['cess']
total_credit = request.form['total_credit'] # total_credit = request.form['total_credit']
year=request.form['year'] # year=request.form['year']
conn = mysql.connector.connect(**db_config) # conn = mysql.connector.connect(**db_config)
cursor = conn.cursor() # cursor = conn.cursor()
cursor.execute(""" # cursor.execute("""
INSERT INTO itat (year, mat_tax_credit, surcharge, cess, total_credit) # INSERT INTO itat (year, mat_tax_credit, surcharge, cess, total_credit)
VALUES (%s,%s, %s, %s, %s) # VALUES (%s,%s, %s, %s, %s)
""", (year,mat_tax_credit, surcharge, cess, total_credit)) # """, (year,mat_tax_credit, surcharge, cess, total_credit))
conn.commit() # conn.commit()
cursor.close() # cursor.close()
conn.close() # conn.close()
return redirect(url_for('index')) # return redirect(url_for('index'))
return render_template('itat_form.html') # return render_template('itat_form.html')
def get_db_connection(): # def get_db_connection():
connection = mysql.connector.connect(**db_config) # connection = mysql.connector.connect(**db_config)
return connection # return connection
@app.route('/reports') @app.route('/reports')
def reports(): def reports():
@@ -1000,21 +996,21 @@ def itat_report():
# finally: # finally:
# connection.close() # connection.close()
# -------------------- i dont use -------------------------
# @app.route('/download/<int:doc_id>')
# def download_report(doc_id):
# conn = get_db_connection()
# cursor = conn.cursor(dictionary=True)
@app.route('/download/<int:doc_id>') # cursor.execute("SELECT * FROM documents WHERE id = %s", (doc_id,))
def download_report(doc_id): # document = cursor.fetchone()
conn = get_db_connection() # conn.close()
cursor = conn.cursor(dictionary=True)
cursor.execute("SELECT * FROM documents WHERE id = %s", (doc_id,)) # if not document:
document = cursor.fetchone() # return "Document not found", 404
conn.close()
if not document: # file_path = os.path.join('static', 'uploads', document['filename']) # adjust as per your storage
return "Document not found", 404 # return send_from_directory(directory='static/uploads', path=document['filename'], as_attachment=True)
file_path = os.path.join('static', 'uploads', document['filename']) # adjust as per your storage
return send_from_directory(directory='static/uploads', path=document['filename'], as_attachment=True)
# @app.route('/summary_report', methods=['GET']) # @app.route('/summary_report', methods=['GET'])

View File

@@ -1,19 +1,63 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Update CIT Record</title> <title>Update CIT Record</title>
<link rel="stylesheet" href="{{ url_for('static', filename='index.css') }}"> <link rel="stylesheet" href="{{ url_for('static', filename='index.css') }}">
<style> <style>
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: #f8f9fa; padding: 20px; color: #333; } body {
.container { max-width: 700px; margin: auto; background: white; padding: 30px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); } font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
h2 { text-align: center; margin-bottom: 20px; } background-color: #f8f9fa;
label { display: block; margin-top: 15px; font-weight: bold; } padding: 20px;
input[type="number"] { width: 100%; padding: 10px; margin-top: 5px; border: 1px solid #ccc; border-radius: 5px; } color: #333;
button[type="submit"] { margin-top: 20px; padding: 12px 20px; background-color: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; } }
button[type="submit"]:hover { background-color: #0056b3; }
.container {
max-width: 700px;
margin: auto;
background: white;
padding: 30px;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
h2 {
text-align: center;
margin-bottom: 20px;
}
label {
display: block;
margin-top: 15px;
font-weight: bold;
}
input[type="number"] {
width: 100%;
padding: 10px;
margin-top: 5px;
border: 1px solid #ccc;
border-radius: 5px;
}
button[type="submit"] {
margin-top: 20px;
padding: 12px 20px;
background-color: #007bff;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
button[type="submit"]:hover {
background-color: #0056b3;
}
</style> </style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h2>Update CIT Record for Year {{ record.year }}</h2> <h2>Update CIT Record for Year {{ record.year }}</h2>
@@ -26,4 +70,5 @@
</form> </form>
</div> </div>
</body> </body>
</html> </html>