diff --git a/AppCode/AOHandler.py b/AppCode/AOHandler.py index 4d36c10..a103f9a 100644 --- a/AppCode/AOHandler.py +++ b/AppCode/AOHandler.py @@ -36,24 +36,13 @@ class AOHandler: return None - """ variable of AO model - year, gross_total_income, disallowance_14a, disallowance_37, - deduction_80ia_business, deduction_sec37_disallowance, deduction_80g, - net_taxable_income, tax_30_percent, tax_book_profit_18_5, - surcharge_12, edu_cess_3, total_tax_payable, mat_credit, - interest_234c, total_tax, advance_tax, tds, tcs, - tax_on_assessment, refund - - """ - - def add_ao(self, data): fields = [ "year","gross_total_income", "disallowance_14a", "disallowance_37", "deduction_80ia_business", "deduction_sec37_disallowance", "deduction_80g", "net_taxable_income", "tax_30_percent", "tax_book_profit_18_5", "surcharge_12", "edu_cess_3", "total_tax_payable", "mat_credit", - "interest_234c", "total_tax", "advance_tax", "tds", "tcs", + "interest_234c", "total_tax", "advance_tax", "tds", "tcs","sat", "tax_on_assessment", "refund","Remarks" ] @@ -72,7 +61,7 @@ class AOHandler: "deduction_80ia_business", "deduction_sec37_disallowance", "deduction_80g", "net_taxable_income", "tax_30_percent", "tax_book_profit_18_5", "surcharge_12", "edu_cess_3", "total_tax_payable", "mat_credit", - "interest_234c", "total_tax", "advance_tax", "tds", "tcs", + "interest_234c", "total_tax", "advance_tax", "tds", "tcs","sat", "tax_on_assessment", "refund","Remarks" ] diff --git a/AppCode/CITHandler.py b/AppCode/CITHandler.py index 2839853..1612d8a 100644 --- a/AppCode/CITHandler.py +++ b/AppCode/CITHandler.py @@ -38,10 +38,12 @@ class CITHandler: # INSERT CIT RECORD def add_cit(self, data): columns = [ - "year", "gross_total_income", "deduction_80ia_business", "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","Remarks" + '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','sat', 'tax_on_assessment', 'refund', 'Remarks' ] values = [data.get(col, 0) for col in columns] @@ -54,13 +56,12 @@ class CITHandler: # UPDATE CIT RECORD def update_cit(self, id, data): columns = [ - "year", "gross_total_income", "deduction_80ia_business", - "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","Remarks" + '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','sat', 'tax_on_assessment', 'refund', 'Remarks' ] values = [id] + [data.get(col, 0) for col in columns] diff --git a/AppCode/ITATHandler.py b/AppCode/ITATHandler.py index f90f5a4..14a66e6 100644 --- a/AppCode/ITATHandler.py +++ b/AppCode/ITATHandler.py @@ -32,26 +32,31 @@ class ITATHandler: # INSERT ITAT (PROC) def add_itat(self, data): - values = [ - data.get("mat_tax_credit", 0), - data.get("surcharge", 0), - data.get("cess", 0), - data.get("total_credit", 0), - data.get("year", 0) - ] - self.cursor.callproc("InsertITAT", values) - self.conn.commit() + 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','sat', 'tax_on_assessment', 'refund', 'Remarks' + ] + values = [data.get(col, 0) for col in columns] + + self.cursor.callproc("InsertITAT", values) + self.conn.commit() # UPDATE ITAT (PROC) def update_itat(self, id, data): - values = [ - id, - data.get("year"), - data.get("mat_tax_credit"), - data.get("surcharge"), - data.get("cess"), - data.get("total_credit") + 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', 'sat','tax_on_assessment', 'refund','Remarks' ] + values = [id] + [data.get(col, 0) for col in columns] + self.cursor.callproc("UpdateITAT", values) self.conn.commit() @@ -66,7 +71,6 @@ class ITATHandler: try: # Call stored procedure self.cursor.callproc("GetITATByYear", [selected_year]) - rows = [] for result in self.cursor.stored_results(): rows = result.fetchall() diff --git a/AppCode/ITRHandler.py b/AppCode/ITRHandler.py index 4891506..93665e7 100644 --- a/AppCode/ITRHandler.py +++ b/AppCode/ITRHandler.py @@ -28,7 +28,6 @@ class ITRHandler: self.cursor.callproc("GetAllItr") records = [] - for result in self.cursor.stored_results(): records = result.fetchall() @@ -62,7 +61,7 @@ class ITRHandler: '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', 'Remarks' + 'total_tax', 'advance_tax', 'tds', 'tcs','sat', 'tax_on_assessment', 'refund', 'Remarks' ] values = [data.get(col, 0) for col in columns] @@ -79,7 +78,7 @@ class ITRHandler: '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','Remarks' + 'total_tax', 'advance_tax', 'tds', 'tcs', 'sat','tax_on_assessment', 'refund','Remarks' ] values = [id] + [data.get(col, 0) for col in columns] diff --git a/AppCode/YearGet.py b/AppCode/YearGet.py index 19c998b..4aca65a 100644 --- a/AppCode/YearGet.py +++ b/AppCode/YearGet.py @@ -33,7 +33,6 @@ class YearGet: # return years - def close(self): self.cursor.close() self.conn.close() diff --git a/AppCode/__pycache__/AOHandler.cpython-313.pyc b/AppCode/__pycache__/AOHandler.cpython-313.pyc index 509b185..c5761ff 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 b2f7999..cabdc72 100644 Binary files a/AppCode/__pycache__/CITHandler.cpython-313.pyc and b/AppCode/__pycache__/CITHandler.cpython-313.pyc differ diff --git a/AppCode/__pycache__/ITATHandler.cpython-313.pyc b/AppCode/__pycache__/ITATHandler.cpython-313.pyc index fc282aa..b2302ac 100644 Binary files a/AppCode/__pycache__/ITATHandler.cpython-313.pyc and b/AppCode/__pycache__/ITATHandler.cpython-313.pyc differ diff --git a/AppCode/__pycache__/ITRHandler.cpython-313.pyc b/AppCode/__pycache__/ITRHandler.cpython-313.pyc index 6b0dc3b..ddfb03f 100644 Binary files a/AppCode/__pycache__/ITRHandler.cpython-313.pyc and b/AppCode/__pycache__/ITRHandler.cpython-313.pyc differ diff --git a/main.py b/main.py index 33b96c9..f57112a 100644 --- a/main.py +++ b/main.py @@ -261,16 +261,14 @@ def display_itat(): # 2.Add new ITAT records @app.route('/itat/add', methods=['GET', 'POST']) def add_itat(): - itat = ITATHandler() - if request.method == 'POST': - data = {k: request.form.get(k, 0) for k in request.form} - itat.add_itat(data) + itat = ITATHandler() + # data = {k: request.form.get(k, 0) for k in request.form} + itat.add_itat(request.form) itat.close() flash("ITAT record added successfully!", "success") return redirect(url_for('display_itat')) - itat.close() return render_template('add_itat.html') # 3.Update ITAT records by id @@ -284,15 +282,7 @@ def update_itat(id): return redirect(url_for('display_itat')) if request.method == 'POST': - data = { - "year": request.form.get("year"), - "mat_tax_credit": request.form.get("mat_tax_credit"), - "surcharge": request.form.get("surcharge"), - "cess": request.form.get("cess"), - "total_credit": request.form.get("total_credit") - } - - itat.update_itat(id, data) + itat.update_itat(id, request.form) itat.close() flash("ITAT Record Updated!", "success") return redirect(url_for('display_itat')) @@ -310,8 +300,6 @@ def delete_itat(id): return redirect(url_for('display_itat')) - - ## ======================================================= ## All Report Routes ## ======================================================= @@ -457,5 +445,4 @@ def check_year(): # run if __name__ == '__main__': - app.run(host='0.0.0.0', port=5003, debug=True) - \ No newline at end of file + app.run(host='0.0.0.0', port=5003, debug=True) \ No newline at end of file diff --git a/static/js/ao_calc.js b/static/js/ao_calc.js index 04ade9c..241182f 100644 --- a/static/js/ao_calc.js +++ b/static/js/ao_calc.js @@ -17,10 +17,7 @@ document.addEventListener("DOMContentLoaded", function () { var disallowance_14a = getValue("disallowance_14a"); var disallowance_37 = getValue("disallowance_37"); - // // Auto-calculations (your logic) - // setValue("gross_total_income", disallowance_37 + gross_total_income); - // setValue("disallowance_37", disallowance_14a + disallowance_37); - + // -- total gross income --- var gross_total = gross_total_income + disallowance_37 + disallowance_14a console.log("gross_total income:: " + gross_total) @@ -71,11 +68,11 @@ document.addEventListener("DOMContentLoaded", function () { var adv_tax = getValue("advance_tax"); var tds = getValue("tds"); var tcs = getValue("tcs"); + var tax_on_regular_assessment = getValue("tax_on_assessment"); - var tax_on_assessment = adv_tax + tds + tcs; - setValue("tax_on_assessment", tax_on_assessment); + var all_tax = adv_tax + tds + tcs + tax_on_regular_assessment; - var refund = total_tax - tax_on_assessment; + var refund = total_tax - all_tax; setValue("refund", refund); }; }); diff --git a/static/js/cit_calc.js b/static/js/cit_calc.js index b18503e..cc1b530 100644 --- a/static/js/cit_calc.js +++ b/static/js/cit_calc.js @@ -1,89 +1,78 @@ document.addEventListener("DOMContentLoaded", function () { - const fields = [ - "gross_total_income", "disallowance_14a", "disallowance_37", - "deduction_80ia_business", "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" - ]; - - function getVal(id) { - let el = document.getElementsByName(id)[0]; + function getValue(id) { + var el = document.getElementsByName(id)[0]; return el ? parseFloat(el.value) || 0 : 0; } - function setVal(id, value) { - let el = document.getElementsByName(id)[0]; - if (el) el.value = Number(value).toFixed(2); + function setValue(id, val) { + var el = document.getElementsByName(id)[0]; + if (el) el.value = Number(val).toFixed(2); } - function calculate() { + window.calculate = function () { - // Base values - let gross_total_income = getVal("gross_total_income"); - let disallowance_14a = getVal("disallowance_14a"); - let disallowance_37 = getVal("disallowance_37"); + // --- BASIC INPUTS --- + var gross_total_income = getValue("gross_total_income"); + var disallowance_14a = getValue("disallowance_14a"); + var disallowance_37 = getValue("disallowance_37"); - // Deductions - let d80_business = getVal("deduction_80ia_business"); - let deduction_sec37 = getVal("deduction_sec37_disallowance"); - let deduction_80g = getVal("deduction_80g"); + // -- total gross income -- + var gross_total = gross_total_income + disallowance_37 + disallowance_14a + console.log("gross_total income:: " + gross_total) - // Net Taxable Income - let net_taxable_income = - (gross_total_income + disallowance_14a + disallowance_37) - - (d80_business + deduction_sec37) - - deduction_80g; + // --- DEDUCTIONS --- + var d80_business = getValue("deduction_80ia_business"); + var d80_misc = getValue("deduction_80ia_misc"); + var d80_other = getValue("deduction_80ia_other"); + var d80_sec37 = getValue("deduction_sec37_disallowance"); - setVal("net_taxable_income", net_taxable_income); + var deduction = d80_business + d80_misc + d80_other + d80_sec37; - // 30% tax - let tax_30_percent = net_taxable_income * 0.30; - setVal("tax_30_percent", tax_30_percent); + var deduction_80g = getValue("deduction_80g"); - // Book profit tax (user input) - let tax_payable = getVal("tax_book_profit_18_5"); - setVal("tax_payable", tax_payable); + // --- NET TAXABLE INCOME --- + var net_taxable_income = gross_total - deduction - deduction_80g; + setValue("net_taxable_income", net_taxable_income); - // Surcharge 12% - let surcharge_12 = tax_payable * 0.12; - setVal("surcharge_12", surcharge_12); + // --- TAX 30% --- + var tax30 = net_taxable_income * 0.30; + setValue("tax_30_percent", tax30); - // Education Cess 3% - let edu_cess_3 = (tax_payable + surcharge_12) * 0.03; - setVal("edu_cess_3", edu_cess_3); + // --- TAX PAYABLE (18.5%) --- + var tax185 = getValue("tax_book_profit_18_5"); - // Total Tax Payable - let total_tax_payable = tax_payable + surcharge_12 + edu_cess_3; - setVal("total_tax_payable", total_tax_payable); + var tax_payable = (tax30 > tax185) ? tax30 : tax185; + setValue("tax_payable", tax_payable); - // MAT + Interest - let mat_credit = getVal("mat_credit"); - let interest_234c = getVal("interest_234c"); + // --- SURCHARGE --- + var percent = getValue("persentage"); + var surcharge = tax_payable * (percent / 100); + setValue("surcharge_12", surcharge); - // Total Tax - let total_tax = total_tax_payable + mat_credit + interest_234c; - setVal("total_tax", total_tax); + var edu_cess = (tax_payable + surcharge) * 0.03; + setValue("edu_cess_3", edu_cess); - // Assessment → Advance Tax + TDS + TCS - let advance_tax = getVal("advance_tax"); - let tds = getVal("tds"); - let tcs = getVal("tcs"); + // --- total tax payable --- + var total_tax_payable = tax_payable + surcharge + edu_cess; + setValue("total_tax_payable", total_tax_payable); - let tax_on_assessment = advance_tax + tds + tcs; - setVal("tax_on_assessment", tax_on_assessment); + // --- FINAL TAX --- + var mat_credit = getValue("mat_credit"); + var interest_234c = getValue("interest_234c"); - // Refund (or payable) - let refund = total_tax - tax_on_assessment; - setVal("refund", refund); - } + var total_tax = total_tax_payable + mat_credit + interest_234c; + setValue("total_tax", total_tax); - // Attach listeners - fields.forEach(id => { - let el = document.getElementsByName(id)[0]; - if (el) el.addEventListener("input", calculate); - }); + // --- ASSESSMENT --- + var adv_tax = getValue("advance_tax"); + var tds = getValue("tds"); + var tcs = getValue("tcs"); + var tax_on_regular_assessment = getValue("tax_on_assessment"); + var all_tax = adv_tax + tds + tcs + tax_on_regular_assessment; + + var refund = total_tax - all_tax; + setValue("refund", refund); + }; }); diff --git a/static/js/itr_calc.js b/static/js/itr_calc.js index f603bd1..4e4e9b5 100644 --- a/static/js/itr_calc.js +++ b/static/js/itr_calc.js @@ -17,10 +17,7 @@ document.addEventListener("DOMContentLoaded", function () { var disallowance_14a = getValue("disallowance_14a"); var disallowance_37 = getValue("disallowance_37"); - // // Auto-calculations (your logic) - // setValue("gross_total_income", disallowance_37 + gross_total_income); - // setValue("disallowance_37", disallowance_14a + disallowance_37); - + // -- total gross income -- var gross_total = gross_total_income + disallowance_37 + disallowance_14a console.log("gross_total income:: " + gross_total) @@ -28,14 +25,14 @@ document.addEventListener("DOMContentLoaded", function () { var d80_business = getValue("deduction_80ia_business"); var d80_misc = getValue("deduction_80ia_misc"); var d80_other = getValue("deduction_80ia_other"); + var d80_sec37 = getValue("deduction_sec37_disallowance"); - var deduction_sec37 = d80_business + d80_misc + d80_other - 1.35; - setValue("deduction_sec37_disallowance", deduction_sec37); + var deduction = d80_business + d80_misc + d80_other + d80_sec37 - 1.35; var deduction_80g = getValue("deduction_80g"); // --- NET TAXABLE INCOME --- - var net_taxable_income = gross_total - deduction_sec37 - deduction_80g; + var net_taxable_income = gross_total - deduction - deduction_80g; setValue("net_taxable_income", net_taxable_income); // --- TAX 30% --- @@ -71,11 +68,11 @@ document.addEventListener("DOMContentLoaded", function () { var adv_tax = getValue("advance_tax"); var tds = getValue("tds"); var tcs = getValue("tcs"); + var tax_on_regular_assessment = getValue("tax_on_assessment"); - var tax_on_assessment = adv_tax + tds + tcs; - setValue("tax_on_assessment", tax_on_assessment); + var all_tax = adv_tax + tds + tcs + tax_on_regular_assessment; - var refund = total_tax - tax_on_assessment; + var refund = total_tax - all_tax; setValue("refund", refund); }; }); diff --git a/templates/add_ao.html b/templates/add_ao.html index 031aa53..cc71b75 100644 --- a/templates/add_ao.html +++ b/templates/add_ao.html @@ -11,15 +11,16 @@