testing code and modify commit.
This commit is contained in:
@@ -58,6 +58,7 @@ class AOHandler:
|
||||
]
|
||||
|
||||
values = [data.get(f, 0) for f in fields]
|
||||
print("---- values ---- ",values)
|
||||
|
||||
self.cursor.callproc("InsertAO", values)
|
||||
self.conn.commit()
|
||||
|
||||
@@ -206,7 +206,7 @@ class DocumentHandler:
|
||||
worksheet.write(row, col, df.iloc[row - 1, col], cell)
|
||||
|
||||
output.seek(0)
|
||||
|
||||
|
||||
return send_file(
|
||||
output,
|
||||
download_name=f"Summary_Report_{year}.xlsx",
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
80
main.py
80
main.py
@@ -84,8 +84,6 @@ def uploaded_file(filename):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# @app.route('/itr', methods=['GET', 'POST'])
|
||||
# def itr_form():
|
||||
# if request.method == 'POST':
|
||||
@@ -639,11 +637,9 @@ def add_itat():
|
||||
# return redirect(url_for('display_itat'))
|
||||
|
||||
|
||||
|
||||
# (You will also need to add update_itat and delete_itat functions later)
|
||||
|
||||
@app.route('/cit', methods=['GET', 'POST'])
|
||||
def cit_form():
|
||||
# -------------------- i dont use -------------------------
|
||||
# @app.route('/cit', methods=['GET', 'POST'])
|
||||
# def cit_form():
|
||||
if request.method == 'POST':
|
||||
data = {key: request.form.get(key, 0) for key in request.form}
|
||||
conn = mysql.connector.connect(**db_config)
|
||||
@@ -689,31 +685,31 @@ def cit_form():
|
||||
|
||||
return render_template('cit_form.html')
|
||||
|
||||
|
||||
@app.route('/itat', methods=['GET', 'POST'])
|
||||
def itat_form():
|
||||
if request.method == 'POST':
|
||||
mat_tax_credit = request.form['mat_tax_credit']
|
||||
surcharge = request.form['surcharge']
|
||||
cess = request.form['cess']
|
||||
total_credit = request.form['total_credit']
|
||||
year=request.form['year']
|
||||
conn = mysql.connector.connect(**db_config)
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("""
|
||||
INSERT INTO itat (year, mat_tax_credit, surcharge, cess, total_credit)
|
||||
VALUES (%s,%s, %s, %s, %s)
|
||||
""", (year,mat_tax_credit, surcharge, cess, total_credit))
|
||||
conn.commit()
|
||||
cursor.close()
|
||||
conn.close()
|
||||
return redirect(url_for('index'))
|
||||
return render_template('itat_form.html')
|
||||
# -------------------- i dont use -------------------------
|
||||
# @app.route('/itat', methods=['GET', 'POST'])
|
||||
# def itat_form():
|
||||
# if request.method == 'POST':
|
||||
# mat_tax_credit = request.form['mat_tax_credit']
|
||||
# surcharge = request.form['surcharge']
|
||||
# cess = request.form['cess']
|
||||
# total_credit = request.form['total_credit']
|
||||
# year=request.form['year']
|
||||
# conn = mysql.connector.connect(**db_config)
|
||||
# cursor = conn.cursor()
|
||||
# cursor.execute("""
|
||||
# INSERT INTO itat (year, mat_tax_credit, surcharge, cess, total_credit)
|
||||
# VALUES (%s,%s, %s, %s, %s)
|
||||
# """, (year,mat_tax_credit, surcharge, cess, total_credit))
|
||||
# conn.commit()
|
||||
# cursor.close()
|
||||
# conn.close()
|
||||
# return redirect(url_for('index'))
|
||||
# return render_template('itat_form.html')
|
||||
|
||||
|
||||
def get_db_connection():
|
||||
connection = mysql.connector.connect(**db_config)
|
||||
return connection
|
||||
# def get_db_connection():
|
||||
# connection = mysql.connector.connect(**db_config)
|
||||
# return connection
|
||||
|
||||
@app.route('/reports')
|
||||
def reports():
|
||||
@@ -1000,21 +996,21 @@ def itat_report():
|
||||
# finally:
|
||||
# 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>')
|
||||
def download_report(doc_id):
|
||||
conn = get_db_connection()
|
||||
cursor = conn.cursor(dictionary=True)
|
||||
# cursor.execute("SELECT * FROM documents WHERE id = %s", (doc_id,))
|
||||
# document = cursor.fetchone()
|
||||
# conn.close()
|
||||
|
||||
cursor.execute("SELECT * FROM documents WHERE id = %s", (doc_id,))
|
||||
document = cursor.fetchone()
|
||||
conn.close()
|
||||
# if not document:
|
||||
# return "Document not found", 404
|
||||
|
||||
if not document:
|
||||
return "Document not found", 404
|
||||
|
||||
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)
|
||||
# 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'])
|
||||
|
||||
@@ -1,29 +1,74 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Update CIT Record</title>
|
||||
<link rel="stylesheet" href="{{ url_for('static', filename='index.css') }}">
|
||||
<style>
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background-color: #f8f9fa; padding: 20px; color: #333; }
|
||||
.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; }
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||||
background-color: #f8f9fa;
|
||||
padding: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.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>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h2>Update CIT Record for Year {{ record.year }}</h2>
|
||||
<form method="POST" action="{{ url_for('update_cit', id=record.id) }}">
|
||||
{% for field in record.keys() if field != 'id' %}
|
||||
<label>{{ field.replace("_", " ").title() }}:</label>
|
||||
<input type="number" name="{{ field }}" step="0.01" value="{{ record[field] }}" required>
|
||||
<label>{{ field.replace("_", " ").title() }}:</label>
|
||||
<input type="number" name="{{ field }}" step="0.01" value="{{ record[field] }}" required>
|
||||
{% endfor %}
|
||||
<button type="submit">Update Record</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user