modification of report, froms, models

This commit is contained in:
2026-02-17 16:54:43 +05:30
parent b8c289294d
commit 0ba78a0bd1
25 changed files with 92 additions and 404 deletions

View File

@@ -1,11 +1,8 @@
import mysql.connector
import pandas as pd
import io
from flask import send_file, render_template, request
from AppCode.Config import DBConfig
class ITRHandler:
def __init__(self):
@@ -25,16 +22,13 @@ class ITRHandler:
def get_itr_by_id(self, id):
# Call stored procedure
self.cursor.callproc('GetITRById', [id])
# Fetch result
records = []
for result in self.cursor.stored_results():
records = result.fetchall()
if records:
print(records[0])
return records[0] # return single record
return None
@@ -51,10 +45,10 @@ class ITRHandler:
]
values = [data.get(col, 0) for col in columns]
# Call your stored procedure
self.cursor.callproc("InsertITR", values)
self.conn.commit()
except Exception as e:
self.conn.rollback()
raise e
@@ -112,7 +106,7 @@ class ITRHandler:
"deduction_sec37_disallowance": "On Sec 37 Disallowance",
"deduction_80g": "Less: Deduction u/s 80G",
"net_taxable_income": "Net Taxable Income",
"-" : "-",
"--" : "-",
"per_tax_a" : "Per% Tax @(A)",
"tax_a_cal" : "Tax cal(A)",
"per_surcharge_a" : "Per% surcharge @(A)",
@@ -120,7 +114,7 @@ class ITRHandler:
"per_cess_a" : "Per% cess(A)",
"edu_cess_a_cal" : "Edu cess cal(A)",
"sum_of_a" : "Sum of tax_cal(A)",
"-" : "-",
"---" : "-",
"per_tax_b" : "Per% Tax @(B)",
"tax_b_cal" : "Tax cal(B)",
"per_surcharge_b" : "Per% surcharge @(B)",
@@ -145,7 +139,7 @@ class ITRHandler:
"interest_244a_per143" : "Add : Interest u/s 244A as per 143",
"refund_received" : "Less : Refund Received on",
"balance_receivable" : "Balance Receivable",
"Remarks" : "Remarks"
"remarks" : "Remarks"
}
# Convert to vertical structures
@@ -164,13 +158,8 @@ class ITRHandler:
writer.sheets["ITR Report"] = worksheet
# Formats
title_fmt = workbook.add_format({
"bold": True, "align": "center", "valign": "vcenter",
"font_size": 14
})
header_fmt = workbook.add_format({
"bold": True, "border": 1, "align": "center"
})
title_fmt = workbook.add_format({"bold": True, "align": "center", "valign": "vcenter","font_size": 14})
header_fmt = workbook.add_format({"bold": True, "border": 1, "align": "center"})
cell_fmt = workbook.add_format({"border": 1})
num_fmt = workbook.add_format({"border": 1, "num_format": "#,##0.00"})