year check valid or not All form commit
This commit is contained in:
@@ -1,18 +1,10 @@
|
||||
from AppCode.Config import DBConfig
|
||||
import mysql.connector
|
||||
from AppCode.YearGet import YearGet
|
||||
|
||||
import pandas as pd
|
||||
import pymysql
|
||||
import io
|
||||
|
||||
# new
|
||||
from AppCode.Config import DBConfig
|
||||
import mysql.connector
|
||||
import pandas as pd
|
||||
import io
|
||||
from flask import send_file, render_template, request
|
||||
|
||||
from AppCode.Config import DBConfig
|
||||
from AppCode.YearGet import YearGet
|
||||
|
||||
|
||||
class ITRHandler:
|
||||
@@ -44,18 +36,16 @@ class ITRHandler:
|
||||
for result in self.cursor.stored_results():
|
||||
records = result.fetchall()
|
||||
|
||||
# return single record
|
||||
if records:
|
||||
print(records[0])
|
||||
return records[0] # return single record
|
||||
return records[0]
|
||||
|
||||
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',
|
||||
@@ -72,23 +62,6 @@ class ITRHandler:
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
# UPDATE ITR RECORD by ITR id
|
||||
# def update(self, id, 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'
|
||||
# ]
|
||||
|
||||
# values = [data.get(col, 0) for col in columns]
|
||||
# values.insert(0, id) # first argument is ID
|
||||
|
||||
# print("values.insert(0, id)-->",values.insert(0, id))
|
||||
# self.cursor.callproc("UpdateITR", values)
|
||||
# self.conn.commit()
|
||||
|
||||
def update(self, id, data):
|
||||
columns = [
|
||||
@@ -115,7 +88,7 @@ class ITRHandler:
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
|
||||
# dowanload itr report by year
|
||||
def itr_report_download(self, selected_year):
|
||||
|
||||
try:
|
||||
@@ -131,14 +104,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)
|
||||
|
||||
@@ -11,13 +11,11 @@ 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:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user