diff --git a/AppCode/AOHandler.py b/AppCode/AOHandler.py index 9e0979d..b5dd22d 100644 --- a/AppCode/AOHandler.py +++ b/AppCode/AOHandler.py @@ -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 diff --git a/AppCode/CITHandler.py b/AppCode/CITHandler.py index e214620..50d4c79 100644 --- a/AppCode/CITHandler.py +++ b/AppCode/CITHandler.py @@ -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) diff --git a/AppCode/DocumentHandler.py b/AppCode/DocumentHandler.py index 833cd35..b264735 100644 --- a/AppCode/DocumentHandler.py +++ b/AppCode/DocumentHandler.py @@ -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() \ No newline at end of file diff --git a/AppCode/ITATHandler.py b/AppCode/ITATHandler.py index 9b1ae3e..aef05d9 100644 --- a/AppCode/ITATHandler.py +++ b/AppCode/ITATHandler.py @@ -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(): diff --git a/AppCode/ITRHandler.py b/AppCode/ITRHandler.py index 0714ca1..3fc83fb 100644 --- a/AppCode/ITRHandler.py +++ b/AppCode/ITRHandler.py @@ -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) diff --git a/AppCode/LoginAuth.py b/AppCode/LoginAuth.py index caa85a2..39d8655 100644 --- a/AppCode/LoginAuth.py +++ b/AppCode/LoginAuth.py @@ -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: diff --git a/AppCode/__pycache__/AOHandler.cpython-313.pyc b/AppCode/__pycache__/AOHandler.cpython-313.pyc index 1f11a88..c54af7c 100644 Binary files a/AppCode/__pycache__/AOHandler.cpython-313.pyc and b/AppCode/__pycache__/AOHandler.cpython-313.pyc differ diff --git a/AppCode/__pycache__/CITHandler.cpython-313.pyc b/AppCode/__pycache__/CITHandler.cpython-313.pyc index 49a4ae8..465fe8b 100644 Binary files a/AppCode/__pycache__/CITHandler.cpython-313.pyc and b/AppCode/__pycache__/CITHandler.cpython-313.pyc differ diff --git a/AppCode/__pycache__/Config.cpython-313.pyc b/AppCode/__pycache__/Config.cpython-313.pyc index 6a4f56d..13fe2d2 100644 Binary files a/AppCode/__pycache__/Config.cpython-313.pyc and b/AppCode/__pycache__/Config.cpython-313.pyc differ diff --git a/AppCode/__pycache__/DocumentHandler.cpython-313.pyc b/AppCode/__pycache__/DocumentHandler.cpython-313.pyc index 883fb95..45d2df3 100644 Binary files a/AppCode/__pycache__/DocumentHandler.cpython-313.pyc and b/AppCode/__pycache__/DocumentHandler.cpython-313.pyc differ diff --git a/AppCode/__pycache__/ITRHandler.cpython-313.pyc b/AppCode/__pycache__/ITRHandler.cpython-313.pyc index d3fca2c..8791d42 100644 Binary files a/AppCode/__pycache__/ITRHandler.cpython-313.pyc and b/AppCode/__pycache__/ITRHandler.cpython-313.pyc differ diff --git a/AppCode/__pycache__/LoginAuth.cpython-313.pyc b/AppCode/__pycache__/LoginAuth.cpython-313.pyc index 9f22f7c..f0a43cc 100644 Binary files a/AppCode/__pycache__/LoginAuth.cpython-313.pyc and b/AppCode/__pycache__/LoginAuth.cpython-313.pyc differ diff --git a/static/js/ao_calc.js b/static/js/ao_calc.js index ced978d..5ed073e 100644 --- a/static/js/ao_calc.js +++ b/static/js/ao_calc.js @@ -18,7 +18,6 @@ document.addEventListener("DOMContentLoaded", function () { // -- total gross income -- var gross_total = gross_total_income + disallowance_37 + disallowance_14a; setValue("gti_as_per_ao", gross_total); - // console.log("gross_total income:: " + gross_total) // --- DEDUCTIONS --- var d80_business = getValue("deduction_80ia_business"); diff --git a/static/js/itr_calc.js b/static/js/itr_calc.js index f695d9a..7756341 100644 --- a/static/js/itr_calc.js +++ b/static/js/itr_calc.js @@ -13,11 +13,11 @@ document.addEventListener("DOMContentLoaded", function () { // ---- Track last edited field for Tax(A) ---- let lastEditedTaxA = null; - document.getElementsByName("per_a")[0].addEventListener("input", () => { + document.getElementsByName("per_tax_a")[0].addEventListener("input", () => { lastEditedTaxA = "percentage"; }); - document.getElementsByName("tax_30_percent")[0].addEventListener("input", () => { + document.getElementsByName("tax_a_cal")[0].addEventListener("input", () => { lastEditedTaxA = "amount"; }); @@ -44,47 +44,47 @@ document.addEventListener("DOMContentLoaded", function () { setValue("net_taxable_income", net_taxable_income); // ================= TAX (A) – TWO WAY ================= - var per_a = getValue("per_a"); - var tax30 = getValue("tax_30_percent"); + var per_tax_a = getValue("per_tax_a"); + var tax_a_cal = getValue("tax_a_cal"); if (net_taxable_income > 0) { if (lastEditedTaxA === "percentage") { - tax30 = net_taxable_income * (per_a / 100); - setValue("tax_30_percent", tax30); + tax_a_cal = net_taxable_income * (per_tax_a / 100); + setValue("tax_a_cal", tax_a_cal); } else if (lastEditedTaxA === "amount") { - per_a = (tax30 / net_taxable_income) * 100; - setValue("per_a", per_a); + per_tax_a = (tax_a_cal / net_taxable_income) * 100; + setValue("per_tax_a", per_tax_a); } } var per_surcharge_a = getValue("per_surcharge_a"); - var surcharge_a = tax30 * (per_surcharge_a / 100); - setValue("surcharge_a", surcharge_a); + var surcharge_a_cal = tax_a_cal * (per_surcharge_a / 100); + setValue("surcharge_a_cal", surcharge_a_cal); var per_cess_a = getValue("per_cess_a"); - var edu_cess_a = (tax30 + surcharge_a) * (per_cess_a / 100); - setValue("edu_cess_a", edu_cess_a); + var edu_cess_a_cal = (tax_a_cal + surcharge_a_cal) * (per_cess_a / 100); + setValue("edu_cess_a_cal", edu_cess_a_cal); - var sum_of_a = tax30 + surcharge_a + edu_cess_a; + var sum_of_a = tax_a_cal + surcharge_a_cal + edu_cess_a_cal; setValue("sum_of_a", sum_of_a); // ================= TAX (B) ================= - var tax185 = getValue("tax_book_profit_18_5"); + var tax_b_cal = getValue("tax_b_cal"); var per_surcharge_b = getValue("per_surcharge_b"); - var surcharge_b = tax185 * (per_surcharge_b / 100); - setValue("surcharge_b", surcharge_b); + var surcharge_b_cal = tax_b_cal * (per_surcharge_b / 100); + setValue("surcharge_b_cal", surcharge_b_cal); var per_cess_b = getValue("per_cess_b"); - var edu_cess_b = (tax185 + surcharge_b) * (per_cess_b / 100); - setValue("edu_cess_b", edu_cess_b); + var edu_cess_b_cal = (tax_b_cal + surcharge_b_cal) * (per_cess_b / 100); + setValue("edu_cess_b_cal", edu_cess_b_cal); - var sum_of_b = tax185 + surcharge_b + edu_cess_b; + var sum_of_b = tax_b_cal + surcharge_b_cal + edu_cess_b_cal; setValue("sum_of_b", sum_of_b); // ================= TAX PAYABLE ================= - var tax_payable = (sum_of_a > sum_of_b) ? tax30 : tax185; + var tax_payable = (sum_of_a > sum_of_b) ? tax_a_cal : tax_b_cal; setValue("tax_payable", tax_payable); var total_tax_payable = (sum_of_a > sum_of_b) ? sum_of_a : sum_of_b; diff --git a/templates/add_ao.html b/templates/add_ao.html index 4419879..79ea0a1 100644 --- a/templates/add_ao.html +++ b/templates/add_ao.html @@ -86,22 +86,20 @@