changes of report and models
This commit is contained in:
@@ -34,17 +34,14 @@ class AOHandler:
|
||||
def add_ao(self, data):
|
||||
|
||||
try:
|
||||
fields = [
|
||||
'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', 'edu_cess',
|
||||
'total_tax_payable', 'mat_credit_created', 'mat_credit_utilized',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs',
|
||||
'sat', 'tax_on_assessment', 'refund', 'Remarks','created_at'
|
||||
]
|
||||
|
||||
fields= [ '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', 'per_tax_a', 'tax_a_cal', 'per_surcharge_a', 'surcharge_a_cal', 'per_cess_a', 'edu_cess_a_cal', 'sum_of_a',
|
||||
'per_tax_b', 'tax_b_cal', 'per_surcharge_b', 'surcharge_b_cal', 'per_cess_b', 'edu_cess_b_cal', 'sum_of_b',
|
||||
'tax_payable','total_tax_payable', 'opening_balance', 'mat_credit_created', 'mat_credit_utilized', 'closing_balance',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat', 'tax_on_assessment', 'refund',
|
||||
'interest_244a_per143', 'refund_received', 'balance_receivable', 'remarks', 'created_at'
|
||||
]
|
||||
values = [data.get(f, 0) for f in fields]
|
||||
self.cursor.callproc("InsertAO", values)
|
||||
self.conn.commit()
|
||||
@@ -57,15 +54,13 @@ class AOHandler:
|
||||
|
||||
# UPDATE AO RECORD by AO id
|
||||
def update_ao(self, id, data):
|
||||
fields = [
|
||||
'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', 'edu_cess',
|
||||
'total_tax_payable', 'mat_credit_created', 'mat_credit_utilized',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs',
|
||||
'sat', 'tax_on_assessment', 'refund', 'Remarks'
|
||||
fields= [ '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', 'per_tax_a', 'tax_a_cal', 'per_surcharge_a', 'surcharge_a_cal', 'per_cess_a', 'edu_cess_a_cal', 'sum_of_a',
|
||||
'per_tax_b', 'tax_b_cal', 'per_surcharge_b', 'surcharge_b_cal', 'per_cess_b', 'edu_cess_b_cal', 'sum_of_b',
|
||||
'tax_payable','total_tax_payable', 'opening_balance', 'mat_credit_created', 'mat_credit_utilized', 'closing_balance',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat', 'tax_on_assessment', 'refund',
|
||||
'interest_244a_per143', 'refund_received', 'balance_receivable', 'remarks', 'updated_at'
|
||||
]
|
||||
|
||||
values = [id] + [data.get(f, 0) for f in fields]
|
||||
@@ -106,20 +101,35 @@ class AOHandler:
|
||||
"gross_total_income": "Gross Total Income",
|
||||
"disallowance_14a": "Add: Disallowance u/s 14A",
|
||||
"disallowance_37": "Add: Disallowance u/s 37",
|
||||
"-" : "-",
|
||||
"deduction_80ia_business": "Less: Deduction u/s 80IA - On Business Income",
|
||||
"deduction_80ia_misc": "On Misc Receipts",
|
||||
"deduction_80ia_other": "On Other",
|
||||
"deduction_sec37_disallowance": "On Sec 37 Disallowance",
|
||||
"deduction_80g": "Less: Deduction u/s 80G",
|
||||
"net_taxable_income": "Net Taxable Income",
|
||||
"tax_30_percent": "Tax @ 30%",
|
||||
"tax_book_profit_18_5": "Tax @ 18.5% on Book Profit",
|
||||
"-" : "-",
|
||||
"per_tax_a" : "Per% Tax @(A)",
|
||||
"tax_a_cal" : "Tax cal(A)",
|
||||
"per_surcharge_a" : "Per% surcharge @(A)",
|
||||
"surcharge_a_cal" : "Surcharge cal (A)",
|
||||
"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)",
|
||||
"surcharge_b_cal" : "Surcharge cal (B)",
|
||||
"per_cess_b" : "Per% cess(B)",
|
||||
"edu_cess_b_cal" : "Edu cess cal(B)",
|
||||
"sum_of_b" : "Sum of tax_cal(B)",
|
||||
"tax_payable": "Tax Payable",
|
||||
"surcharge": "Surcharge",
|
||||
"edu_cess": "Education Cess",
|
||||
"total_tax_payable": "Total Tax Payable",
|
||||
"opening_balance": "Opening Balance",
|
||||
"mat_credit_created": "Add: MAT Credit Created",
|
||||
"mat_credit_utilized": "Less: MAT Credit Utilized",
|
||||
"closing_balance": "Closing Balance",
|
||||
"interest_234c": "Add: Interest u/s 234C",
|
||||
"total_tax": "Total Tax",
|
||||
"advance_tax": "Advance Tax",
|
||||
@@ -127,8 +137,11 @@ class AOHandler:
|
||||
"tcs": "TCS",
|
||||
"sat": "SAT",
|
||||
"tax_on_assessment": "Tax on Regular Assessment",
|
||||
"refund": "Refund",
|
||||
"Remarks": "Remarks"
|
||||
"refund" : "Refund",
|
||||
"interest_244a_per143" : "Add : Interest u/s 244A as per 143",
|
||||
"refund_received" : "Less : Refund Received on",
|
||||
"balance_receivable" : "Balance Receivable",
|
||||
"Remarks" : "Remarks"
|
||||
}
|
||||
|
||||
# Vertical AO structure
|
||||
|
||||
@@ -35,15 +35,13 @@ class CITHandler:
|
||||
|
||||
# INSERT CIT RECORD
|
||||
def add_cit(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', 'edu_cess',
|
||||
'total_tax_payable', 'mat_credit_created', 'mat_credit_utilized',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs',
|
||||
'sat', 'tax_on_assessment', 'refund', 'Remarks','created_at'
|
||||
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', 'per_tax_a', 'tax_a_cal', 'per_surcharge_a', 'surcharge_a_cal', 'per_cess_a', 'edu_cess_a_cal', 'sum_of_a',
|
||||
'per_tax_b', 'tax_b_cal', 'per_surcharge_b', 'surcharge_b_cal', 'per_cess_b', 'edu_cess_b_cal', 'sum_of_b',
|
||||
'tax_payable','total_tax_payable', 'opening_balance', 'mat_credit_created', 'mat_credit_utilized', 'closing_balance',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat', 'tax_on_assessment', 'refund',
|
||||
'interest_244a_per143', 'refund_received', 'balance_receivable', 'remarks', 'created_at'
|
||||
]
|
||||
|
||||
values = [data.get(col, 0) for col in columns]
|
||||
@@ -53,15 +51,13 @@ class CITHandler:
|
||||
|
||||
# UPDATE CIT RECORD
|
||||
def update_cit(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', 'edu_cess',
|
||||
'total_tax_payable', 'mat_credit_created', 'mat_credit_utilized',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs',
|
||||
'sat', 'tax_on_assessment', 'refund', 'Remarks'
|
||||
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', 'per_tax_a', 'tax_a_cal', 'per_surcharge_a', 'surcharge_a_cal', 'per_cess_a', 'edu_cess_a_cal', 'sum_of_a',
|
||||
'per_tax_b', 'tax_b_cal', 'per_surcharge_b', 'surcharge_b_cal', 'per_cess_b', 'edu_cess_b_cal', 'sum_of_b',
|
||||
'tax_payable','total_tax_payable', 'opening_balance', 'mat_credit_created', 'mat_credit_utilized', 'closing_balance',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat', 'tax_on_assessment', 'refund',
|
||||
'interest_244a_per143', 'refund_received', 'balance_receivable', 'remarks', 'updated_at'
|
||||
]
|
||||
|
||||
values = [id] + [data.get(col, 0) for col in columns]
|
||||
@@ -100,20 +96,35 @@ class CITHandler:
|
||||
"gross_total_income": "Gross Total Income",
|
||||
"disallowance_14a": "Add: Disallowance u/s 14A",
|
||||
"disallowance_37": "Add: Disallowance u/s 37",
|
||||
"-" : "-",
|
||||
"deduction_80ia_business": "Less: Deduction u/s 80IA - On Business Income",
|
||||
"deduction_80ia_misc": "On Misc Receipts",
|
||||
"deduction_80ia_other": "On Other",
|
||||
"deduction_sec37_disallowance": "On Sec 37 Disallowance",
|
||||
"deduction_80g": "Less: Deduction u/s 80G",
|
||||
"net_taxable_income": "Net Taxable Income",
|
||||
"tax_30_percent": "Tax @ 30%",
|
||||
"tax_book_profit_18_5": "Tax @ 18.5% on Book Profit",
|
||||
"-" : "-",
|
||||
"per_tax_a" : "Per% Tax @(A)",
|
||||
"tax_a_cal" : "Tax cal(A)",
|
||||
"per_surcharge_a" : "Per% surcharge @(A)",
|
||||
"surcharge_a_cal" : "Surcharge cal (A)",
|
||||
"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)",
|
||||
"surcharge_b_cal" : "Surcharge cal (B)",
|
||||
"per_cess_b" : "Per% cess(B)",
|
||||
"edu_cess_b_cal" : "Edu cess cal(B)",
|
||||
"sum_of_b" : "Sum of tax_cal(B)",
|
||||
"tax_payable": "Tax Payable",
|
||||
"surcharge": "Surcharge @ %",
|
||||
"edu_cess": "Education Cess @ %",
|
||||
"total_tax_payable": "Total Tax Payable",
|
||||
"opening_balance": "Opening Balance",
|
||||
"mat_credit_created": "Add: MAT Credit Created",
|
||||
"mat_credit_utilized": "Less: MAT Credit Utilized",
|
||||
"closing_balance": "Closing Balance",
|
||||
"interest_234c": "Add: Interest u/s 234C",
|
||||
"total_tax": "Total Tax",
|
||||
"advance_tax": "Advance Tax",
|
||||
@@ -121,8 +132,11 @@ class CITHandler:
|
||||
"tcs": "TCS",
|
||||
"sat": "SAT",
|
||||
"tax_on_assessment": "Tax on Regular Assessment",
|
||||
"refund": "Refund",
|
||||
"Remarks": "Remarks"
|
||||
"refund" : "Refund",
|
||||
"interest_244a_per143" : "Add : Interest u/s 244A as per 143",
|
||||
"refund_received" : "Less : Refund Received on",
|
||||
"balance_receivable" : "Balance Receivable",
|
||||
"Remarks" : "Remarks"
|
||||
}
|
||||
|
||||
# Vertical CIT structure (single record per year)
|
||||
|
||||
@@ -23,13 +23,6 @@ class DocumentHandler:
|
||||
# Utility: Parse Year
|
||||
# =========================
|
||||
def parse_year(self, year_value):
|
||||
"""
|
||||
Accepts:
|
||||
- '2026'
|
||||
- 'AY 2026-2027'
|
||||
Returns:
|
||||
- 2026 (int)
|
||||
"""
|
||||
if not year_value:
|
||||
return None
|
||||
|
||||
@@ -166,24 +159,46 @@ class DocumentHandler:
|
||||
|
||||
columns = [
|
||||
'gross_total_income', 'disallowance_14a',
|
||||
'disallowance_37', '-',
|
||||
'disallowance_37',
|
||||
'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',
|
||||
'edu_cess', 'total_tax_payable',
|
||||
'-',
|
||||
'per_tax_a',
|
||||
'tax_a_cal',
|
||||
'per_surcharge_a',
|
||||
'surcharge_a_cal',
|
||||
'per_cess_a',
|
||||
'edu_cess_a_cal',
|
||||
'sum_of_a',
|
||||
'-',
|
||||
'per_tax_b',
|
||||
'tax_b_cal',
|
||||
'per_surcharge_b',
|
||||
'surcharge_b_cal',
|
||||
'per_cess_b',
|
||||
'edu_cess_b_cal',
|
||||
'sum_of_b',
|
||||
'-',
|
||||
'tax_payable',
|
||||
'total_tax_payable',
|
||||
'opening_balance',
|
||||
'mat_credit_created',
|
||||
'mat_credit_utilized',
|
||||
'closing_balance',
|
||||
'interest_234c', 'total_tax',
|
||||
'-', 'advance_tax', 'tds',
|
||||
'tcs', 'sat',
|
||||
'tax_on_assessment',
|
||||
'refund', 'Remarks'
|
||||
'refund',
|
||||
'interest_244a_per143',
|
||||
'refund_received',
|
||||
'balance_receivable',
|
||||
'Remarks'
|
||||
]
|
||||
|
||||
particulars = [
|
||||
@@ -192,18 +207,36 @@ class DocumentHandler:
|
||||
"Less: Deduction u/s 80IA - On Business Income",
|
||||
"- On Misc Receipts", "- On Other",
|
||||
"- On Sec 37 Disallowance",
|
||||
"Less: Deduction u/s 80G", " ",
|
||||
"Net Taxable Income", "Tax @ 30%",
|
||||
"Tax @ 18.5% on Book Profit",
|
||||
"Tax Payable", "Surcharge @ %",
|
||||
"Education Cess @ %", "Total Tax Payable",
|
||||
"Less: Deduction u/s 80G", "-",
|
||||
"Net Taxable Income", "-",
|
||||
"Per% Tax @(A)",
|
||||
"Tax cal(A)",
|
||||
"Per% surcharge @(A)",
|
||||
"Surcharge cal (A)",
|
||||
"Per% cess(A)",
|
||||
"Edu cess cal(A)",
|
||||
"Sum of tax_cal(A)",
|
||||
"-",
|
||||
"Per% Tax @(B)",
|
||||
"Tax cal(B)",
|
||||
"Per% surcharge @(B)",
|
||||
"Surcharge cal (B)",
|
||||
"Per% cess(B)",
|
||||
"Edu cess cal(B)",
|
||||
"Sum of tax_cal(B)",
|
||||
"-",
|
||||
"Tax Payable",
|
||||
"Total Tax Payable",
|
||||
"Opening Balance:",
|
||||
"Add: MAT Credit Created",
|
||||
"Less: MAT Credit Utilized",
|
||||
"Closing Balance",
|
||||
"Add: Interest u/s 234C",
|
||||
"Total Tax", " ",
|
||||
"Total Tax", "-",
|
||||
"Advance Tax", "TDS", "TCS", "SAT",
|
||||
"Tax on Regular Assessment",
|
||||
"Refund", "Remarks"
|
||||
"Refund", "Add : Interest u/s 244A as per 143",
|
||||
"Less : Refund Received on:","Balance Receivable","Remarks"
|
||||
]
|
||||
|
||||
def safe_get(df, col):
|
||||
@@ -275,40 +308,80 @@ class DocumentHandler:
|
||||
"Less: Deduction u/s 80IA - On Business Income",
|
||||
"- On Misc Receipts", "- On Other",
|
||||
"- On Sec 37 Disallowance",
|
||||
"Less: Deduction u/s 80G", " ",
|
||||
"Net Taxable Income", "Tax @ 30%",
|
||||
"Tax @ 18.5% on Book Profit",
|
||||
"Tax Payable", "Surcharge @ %",
|
||||
"Education Cess @ %", "Total Tax Payable",
|
||||
"Less: Deduction u/s 80G", "-",
|
||||
"Net Taxable Income", "-",
|
||||
"Per% Tax @(A)",
|
||||
"Tax cal(A)",
|
||||
"Per% surcharge @(A)",
|
||||
"Surcharge cal (A)",
|
||||
"Per% cess(A)",
|
||||
"Edu cess cal(A)",
|
||||
"Sum of tax_cal(A)",
|
||||
"-",
|
||||
"Per% Tax @(B)",
|
||||
"Tax cal(B)",
|
||||
"Per% surcharge @(B)",
|
||||
"Surcharge cal (B)",
|
||||
"Per% cess(B)",
|
||||
"Edu cess cal(B)",
|
||||
"Sum of tax_cal(B)",
|
||||
"-",
|
||||
"Tax Payable",
|
||||
"Total Tax Payable",
|
||||
"Opening Balance",
|
||||
"Add: MAT Credit Created",
|
||||
"Less: MAT Credit Utilized",
|
||||
"Closing Balance",
|
||||
"Add: Interest u/s 234C",
|
||||
"Total Tax", " ",
|
||||
"Total Tax", "-",
|
||||
"Advance Tax", "TDS", "TCS", "SAT",
|
||||
"Tax on Regular Assessment",
|
||||
"Refund", "Remarks"
|
||||
"Refund", "Add : Interest u/s 244A as per 143",
|
||||
"Less : Refund Received on","Balance Receivable","Remarks"
|
||||
]
|
||||
|
||||
columns = [
|
||||
'gross_total_income', 'disallowance_14a',
|
||||
'disallowance_37', '-',
|
||||
'disallowance_37',
|
||||
'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',
|
||||
'edu_cess', 'total_tax_payable',
|
||||
'-',
|
||||
'per_tax_a',
|
||||
'tax_a_cal',
|
||||
'per_surcharge_a',
|
||||
'surcharge_a_cal',
|
||||
'per_cess_a',
|
||||
'edu_cess_a_cal',
|
||||
'sum_of_a',
|
||||
'-',
|
||||
'per_tax_b',
|
||||
'tax_b_cal',
|
||||
'per_surcharge_b',
|
||||
'surcharge_b_cal',
|
||||
'per_cess_b',
|
||||
'edu_cess_b_cal',
|
||||
'sum_of_b',
|
||||
'-',
|
||||
'tax_payable',
|
||||
'total_tax_payable',
|
||||
'opening_balance',
|
||||
'mat_credit_created',
|
||||
'mat_credit_utilized',
|
||||
'closing_balance',
|
||||
'interest_234c', 'total_tax',
|
||||
'-', 'advance_tax', 'tds',
|
||||
'tcs', 'sat',
|
||||
'tax_on_assessment',
|
||||
'refund', 'Remarks'
|
||||
'refund',
|
||||
'interest_244a_per143',
|
||||
'refund_received',
|
||||
'balance_receivable',
|
||||
'Remarks'
|
||||
]
|
||||
|
||||
data = {
|
||||
@@ -372,5 +445,4 @@ class DocumentHandler:
|
||||
)
|
||||
|
||||
finally:
|
||||
connection.close()
|
||||
|
||||
connection.close()
|
||||
@@ -31,16 +31,15 @@ class ITATHandler:
|
||||
|
||||
# INSERT ITAT (PROC)
|
||||
def add_itat(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', 'edu_cess',
|
||||
'total_tax_payable', 'mat_credit_created', 'mat_credit_utilized',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs',
|
||||
'sat', 'tax_on_assessment', 'refund', 'Remarks'
|
||||
]
|
||||
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', 'per_tax_a', 'tax_a_cal', 'per_surcharge_a', 'surcharge_a_cal', 'per_cess_a', 'edu_cess_a_cal', 'sum_of_a',
|
||||
'per_tax_b', 'tax_b_cal', 'per_surcharge_b', 'surcharge_b_cal', 'per_cess_b', 'edu_cess_b_cal', 'sum_of_b',
|
||||
'tax_payable','total_tax_payable', 'opening_balance', 'mat_credit_created', 'mat_credit_utilized', 'closing_balance',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat', 'tax_on_assessment', 'refund',
|
||||
'interest_244a_per143', 'refund_received', 'balance_receivable', 'remarks', 'created_at'
|
||||
]
|
||||
|
||||
values = [data.get(col, 0) for col in columns]
|
||||
|
||||
self.cursor.callproc("InsertITAT", values)
|
||||
@@ -48,16 +47,14 @@ class ITATHandler:
|
||||
|
||||
# UPDATE ITAT (PROC)
|
||||
def update_itat(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', 'edu_cess',
|
||||
'total_tax_payable', 'mat_credit_created', 'mat_credit_utilized',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs',
|
||||
'sat', 'tax_on_assessment', 'refund', 'Remarks'
|
||||
]
|
||||
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', 'per_tax_a', 'tax_a_cal', 'per_surcharge_a', 'surcharge_a_cal', 'per_cess_a', 'edu_cess_a_cal', 'sum_of_a',
|
||||
'per_tax_b', 'tax_b_cal', 'per_surcharge_b', 'surcharge_b_cal', 'per_cess_b', 'edu_cess_b_cal', 'sum_of_b',
|
||||
'tax_payable','total_tax_payable', 'opening_balance', 'mat_credit_created', 'mat_credit_utilized', 'closing_balance',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat', 'tax_on_assessment', 'refund',
|
||||
'interest_244a_per143', 'refund_received', 'balance_receivable', 'remarks', 'updated_at'
|
||||
]
|
||||
values = [id] + [data.get(col, 0) for col in columns]
|
||||
|
||||
self.cursor.callproc("UpdateITAT", values)
|
||||
@@ -94,20 +91,35 @@ class ITATHandler:
|
||||
"gross_total_income": "Gross Total Income",
|
||||
"disallowance_14a": "Add: Disallowance u/s 14A",
|
||||
"disallowance_37": "Add: Disallowance u/s 37",
|
||||
"-" : "-",
|
||||
"deduction_80ia_business": "Less: Deduction u/s 80IA - On Business Income",
|
||||
"deduction_80ia_misc": "On Misc Receipts",
|
||||
"deduction_80ia_other": "On Other",
|
||||
"deduction_sec37_disallowance": "On Sec 37 Disallowance",
|
||||
"deduction_80g": "Less: Deduction u/s 80G",
|
||||
"net_taxable_income": "Net Taxable Income",
|
||||
"tax_30_percent": "Tax @ 30%",
|
||||
"tax_book_profit_18_5": "Tax @ 18.5% on Book Profit",
|
||||
"-" : "-",
|
||||
"per_tax_a" : "Per% Tax @(A)",
|
||||
"tax_a_cal" : "Tax cal(A)",
|
||||
"per_surcharge_a" : "Per% surcharge @(A)",
|
||||
"surcharge_a_cal" : "Surcharge cal (A)",
|
||||
"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)",
|
||||
"surcharge_b_cal" : "Surcharge cal (B)",
|
||||
"per_cess_b" : "Per% cess(B)",
|
||||
"edu_cess_b_cal" : "Edu cess cal(B)",
|
||||
"sum_of_b" : "Sum of tax_cal(B)",
|
||||
"tax_payable": "Tax Payable",
|
||||
"surcharge": "Surcharge @ %",
|
||||
"edu_cess": "Education Cess @ %",
|
||||
"total_tax_payable": "Total Tax Payable",
|
||||
"mat_credit_created": "Add: MAT Credit created",
|
||||
"opening_balance": "Opening Balance",
|
||||
"mat_credit_created": "Add: MAT Credit Created",
|
||||
"mat_credit_utilized": "Less: MAT Credit Utilized",
|
||||
"closing_balance": "Closing Balance",
|
||||
"interest_234c": "Add: Interest u/s 234C",
|
||||
"total_tax": "Total Tax",
|
||||
"advance_tax": "Advance Tax",
|
||||
@@ -115,10 +127,13 @@ class ITATHandler:
|
||||
"tcs": "TCS",
|
||||
"sat": "SAT",
|
||||
"tax_on_assessment": "Tax on Regular Assessment",
|
||||
"refund": "Refund",
|
||||
"Remarks": "Remarks"
|
||||
"refund" : "Refund",
|
||||
"interest_244a_per143" : "Add : Interest u/s 244A as per 143",
|
||||
"refund_received" : "Less : Refund Received on",
|
||||
"balance_receivable" : "Balance Receivable",
|
||||
"Remarks" : "Remarks"
|
||||
}
|
||||
|
||||
|
||||
# Vertical ITAT structure
|
||||
data = []
|
||||
for key, label in field_mapping.items():
|
||||
|
||||
@@ -40,18 +40,16 @@ class ITRHandler:
|
||||
|
||||
# INSERT ITR RECORD using procedure "add_itr"
|
||||
def add_itr(self, data):
|
||||
|
||||
try:
|
||||
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', 'edu_cess',
|
||||
'total_tax_payable', 'mat_credit_created', 'mat_credit_utilized',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs',
|
||||
'sat', 'tax_on_assessment', 'refund', 'Remarks','created_at'
|
||||
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', 'per_tax_a', 'tax_a_cal', 'per_surcharge_a', 'surcharge_a_cal', 'per_cess_a', 'edu_cess_a_cal', 'sum_of_a',
|
||||
'per_tax_b', 'tax_b_cal', 'per_surcharge_b', 'surcharge_b_cal', 'per_cess_b', 'edu_cess_b_cal', 'sum_of_b',
|
||||
'tax_payable','total_tax_payable', 'opening_balance', 'mat_credit_created', 'mat_credit_utilized', 'closing_balance',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat', 'tax_on_assessment', 'refund',
|
||||
'interest_244a_per143', 'refund_received', 'balance_receivable', 'remarks', 'created_at'
|
||||
]
|
||||
|
||||
values = [data.get(col, 0) for col in columns]
|
||||
|
||||
# Call your stored procedure
|
||||
@@ -67,23 +65,21 @@ class ITRHandler:
|
||||
|
||||
# update itr by 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', 'edu_cess',
|
||||
'total_tax_payable', 'mat_credit_created', 'mat_credit_utilized',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs',
|
||||
'sat', 'tax_on_assessment', 'refund', 'Remarks'
|
||||
]
|
||||
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', 'per_tax_a', 'tax_a_cal', 'per_surcharge_a', 'surcharge_a_cal', 'per_cess_a', 'edu_cess_a_cal', 'sum_of_a',
|
||||
'per_tax_b', 'tax_b_cal', 'per_surcharge_b', 'surcharge_b_cal', 'per_cess_b', 'edu_cess_b_cal', 'sum_of_b',
|
||||
'tax_payable','total_tax_payable', 'opening_balance', 'mat_credit_created', 'mat_credit_utilized', 'closing_balance',
|
||||
'interest_234c', 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat', 'tax_on_assessment', 'refund',
|
||||
'interest_244a_per143', 'refund_received', 'balance_receivable', 'remarks', 'updated_at'
|
||||
]
|
||||
|
||||
values = [id] + [data.get(col, 0) for col in columns]
|
||||
self.cursor.callproc("UpdateITR", values)
|
||||
self.conn.commit()
|
||||
|
||||
|
||||
# DELETE RECORD by ITR id
|
||||
# DELETE RECORD by ITR id
|
||||
def delete_itr_by_id(self, id):
|
||||
self.cursor.callproc('DeleteITRById', [id])
|
||||
self.conn.commit()
|
||||
@@ -109,20 +105,35 @@ class ITRHandler:
|
||||
"gross_total_income": "Gross Total Income",
|
||||
"disallowance_14a": "Add: Disallowance u/s 14A",
|
||||
"disallowance_37": "Add: Disallowance u/s 37",
|
||||
"-" : "-",
|
||||
"deduction_80ia_business": "Less: Deduction u/s 80IA - On Business Income",
|
||||
"deduction_80ia_misc": "On Misc Receipts",
|
||||
"deduction_80ia_other": "On Other",
|
||||
"deduction_sec37_disallowance": "On Sec 37 Disallowance",
|
||||
"deduction_80g": "Less: Deduction u/s 80G",
|
||||
"net_taxable_income": "Net Taxable Income",
|
||||
"tax_30_percent": "Tax @ 30%",
|
||||
"tax_book_profit_18_5": "Tax @ 18.5% on Book Profit",
|
||||
"-" : "-",
|
||||
"per_tax_a" : "Per% Tax @(A)",
|
||||
"tax_a_cal" : "Tax cal(A)",
|
||||
"per_surcharge_a" : "Per% surcharge @(A)",
|
||||
"surcharge_a_cal" : "Surcharge cal (A)",
|
||||
"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)",
|
||||
"surcharge_b_cal" : "Surcharge cal (B)",
|
||||
"per_cess_b" : "Per% cess(B)",
|
||||
"edu_cess_b_cal" : "Edu cess cal(B)",
|
||||
"sum_of_b" : "Sum of tax_cal(B)",
|
||||
"tax_payable": "Tax Payable",
|
||||
"surcharge": "Surcharge @ %",
|
||||
"edu_cess": "Education Cess @ %",
|
||||
"total_tax_payable": "Total Tax Payable",
|
||||
"opening_balance": "Opening Balance",
|
||||
"mat_credit_created": "Add: MAT Credit Created",
|
||||
"mat_credit_utilized": "Less: MAT Credit Utilized",
|
||||
"closing_balance": "Closing Balance",
|
||||
"interest_234c": "Add: Interest u/s 234C",
|
||||
"total_tax": "Total Tax",
|
||||
"advance_tax": "Advance Tax",
|
||||
@@ -130,10 +141,14 @@ class ITRHandler:
|
||||
"tcs": "TCS",
|
||||
"sat": "SAT",
|
||||
"tax_on_assessment": "Tax on Regular Assessment",
|
||||
"refund": "Refund"
|
||||
"refund" : "Refund",
|
||||
"interest_244a_per143" : "Add : Interest u/s 244A as per 143",
|
||||
"refund_received" : "Less : Refund Received on",
|
||||
"balance_receivable" : "Balance Receivable",
|
||||
"Remarks" : "Remarks"
|
||||
}
|
||||
|
||||
# Convert to vertical structure
|
||||
# Convert to vertical structures
|
||||
data = []
|
||||
for key, label in field_mapping.items():
|
||||
value = rows[0].get(key, 0)
|
||||
|
||||
@@ -1,40 +1,71 @@
|
||||
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
|
||||
from ldap3 import Server, Connection, ALL
|
||||
from ldap3.core.exceptions import LDAPException
|
||||
|
||||
|
||||
class LoginAuth:
|
||||
def __init__(self):
|
||||
# Create Blueprint
|
||||
self.bp = Blueprint("auth", __name__)
|
||||
|
||||
# -------------------------------
|
||||
# LDAP CONFIGURATION
|
||||
# -------------------------------
|
||||
self.LDAP_SERVER = "ldap://localhost:389"
|
||||
|
||||
self.BASE_DN = "ou=users,dc=lcepl,dc=org" # LDAP Users DN
|
||||
|
||||
# -------------------------------
|
||||
# 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")
|
||||
if not username or not password:
|
||||
flash("Username and password are required!", "danger")
|
||||
return render_template("login.html")
|
||||
|
||||
user_dn = f"uid={username},{self.BASE_DN}"
|
||||
server = Server(self.LDAP_SERVER, get_info=ALL)
|
||||
|
||||
try:
|
||||
# Attempt LDAP bind
|
||||
conn = Connection(server, user=user_dn, password=password, auto_bind=True)
|
||||
if conn.bound:
|
||||
session['user'] = username
|
||||
flash(f"Login successful! Welcome {username}", "success")
|
||||
return redirect(url_for('welcome'))
|
||||
else:
|
||||
flash("Invalid username or password!", "danger")
|
||||
except LDAPException as e:
|
||||
flash(f"LDAP login failed: {str(e)}", "danger")
|
||||
finally:
|
||||
if 'conn' in locals():
|
||||
conn.unbind()
|
||||
|
||||
# GET request: show login form
|
||||
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
|
||||
|
||||
# ===================================================
|
||||
# LOGIN REQUIRED DECORATOR INSIDE CLASS
|
||||
# ===================================================
|
||||
def login_required(self, f):
|
||||
"""
|
||||
Protect routes: redirect to login if user not authenticated.
|
||||
"""
|
||||
@wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
if "user" not in session:
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user