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
|
import mysql.connector
|
||||||
from AppCode.YearGet import YearGet
|
|
||||||
|
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import pymysql
|
import pymysql
|
||||||
import io
|
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 flask import send_file, render_template, request
|
||||||
|
from AppCode.Config import DBConfig
|
||||||
|
from AppCode.YearGet import YearGet
|
||||||
|
|
||||||
|
|
||||||
class ITRHandler:
|
class ITRHandler:
|
||||||
@@ -44,18 +36,16 @@ class ITRHandler:
|
|||||||
for result in self.cursor.stored_results():
|
for result in self.cursor.stored_results():
|
||||||
records = result.fetchall()
|
records = result.fetchall()
|
||||||
|
|
||||||
|
# return single record
|
||||||
if records:
|
if records:
|
||||||
print(records[0])
|
print(records[0])
|
||||||
return records[0] # return single record
|
return records[0]
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# INSERT ITR RECORD using procedure "add_itr"
|
# INSERT ITR RECORD using procedure "add_itr"
|
||||||
def add_itr(self, data):
|
def add_itr(self, data):
|
||||||
|
|
||||||
columns = [
|
columns = [
|
||||||
'year', 'gross_total_income', 'disallowance_14a', 'disallowance_37',
|
'year', 'gross_total_income', 'disallowance_14a', 'disallowance_37',
|
||||||
'deduction_80ia_business', 'deduction_80ia_misc', 'deduction_80ia_other',
|
'deduction_80ia_business', 'deduction_80ia_misc', 'deduction_80ia_other',
|
||||||
@@ -72,23 +62,6 @@ class ITRHandler:
|
|||||||
self.conn.commit()
|
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):
|
def update(self, id, data):
|
||||||
columns = [
|
columns = [
|
||||||
@@ -115,7 +88,7 @@ class ITRHandler:
|
|||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
|
|
||||||
|
|
||||||
|
# dowanload itr report by year
|
||||||
def itr_report_download(self, selected_year):
|
def itr_report_download(self, selected_year):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -131,14 +104,10 @@ class ITRHandler:
|
|||||||
|
|
||||||
# Convert SQL rows to DataFrame
|
# Convert SQL rows to DataFrame
|
||||||
df = pd.DataFrame(rows)
|
df = pd.DataFrame(rows)
|
||||||
|
|
||||||
# Transpose
|
# Transpose
|
||||||
df_transposed = df.transpose()
|
df_transposed = df.transpose()
|
||||||
df_transposed.insert(0, 'Field', df_transposed.index)
|
df_transposed.insert(0, 'Field', df_transposed.index)
|
||||||
|
|
||||||
print("df-->",df_transposed)
|
|
||||||
|
|
||||||
|
|
||||||
record_cols = {
|
record_cols = {
|
||||||
i: f"Record {i}"
|
i: f"Record {i}"
|
||||||
for i in df_transposed.columns if isinstance(i, int)
|
for i in df_transposed.columns if isinstance(i, int)
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ class YearGet:
|
|||||||
def get_year_by_model(self, proc_name):
|
def get_year_by_model(self, proc_name):
|
||||||
try:
|
try:
|
||||||
self.cursor.callproc(proc_name)
|
self.cursor.callproc(proc_name)
|
||||||
|
|
||||||
years = []
|
years = []
|
||||||
for result in self.cursor.stored_results():
|
for result in self.cursor.stored_results():
|
||||||
rows = result.fetchall()
|
rows = result.fetchall()
|
||||||
years = [row["year"] for row in rows]
|
years = [row["year"] for row in rows]
|
||||||
|
|
||||||
print("-- years get --",years)
|
|
||||||
return years
|
return years
|
||||||
|
|
||||||
except mysql.connector.Error as e:
|
except mysql.connector.Error as e:
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
18
main.py
18
main.py
@@ -6,7 +6,6 @@ import io
|
|||||||
import mysql.connector
|
import mysql.connector
|
||||||
from werkzeug.utils import secure_filename
|
from werkzeug.utils import secure_filename
|
||||||
|
|
||||||
from config import db_config
|
|
||||||
from AppCode.Config import DBConfig
|
from AppCode.Config import DBConfig
|
||||||
from AppCode.FileHandler import FileHandler
|
from AppCode.FileHandler import FileHandler
|
||||||
from AppCode.DocumentHandler import DocumentHandler
|
from AppCode.DocumentHandler import DocumentHandler
|
||||||
@@ -133,6 +132,23 @@ def update_itr(id):
|
|||||||
return render_template('update_itr.html', record=record)
|
return render_template('update_itr.html', record=record)
|
||||||
|
|
||||||
|
|
||||||
|
# new new -- check year in table existe or not by using ajax calling.
|
||||||
|
@app.route('/check_year', methods=['POST'])
|
||||||
|
def check_year():
|
||||||
|
table_name = request.json.get("table")
|
||||||
|
year = request.json.get("year")
|
||||||
|
|
||||||
|
conn = DBConfig.get_db_connection()
|
||||||
|
cursor = conn.cursor()
|
||||||
|
|
||||||
|
query = f"SELECT COUNT(*) FROM {table_name} WHERE year = %s"
|
||||||
|
cursor.execute(query, (year,))
|
||||||
|
result = cursor.fetchone()[0]
|
||||||
|
|
||||||
|
cursor.close()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
return {"exists": result > 0}
|
||||||
|
|
||||||
|
|
||||||
## ===============================================
|
## ===============================================
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
|
|
||||||
// All fields that must trigger calculation
|
|
||||||
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",
|
|
||||||
"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) {
|
function getVal(id) {
|
||||||
return parseFloat(document.getElementsByName(id)[0].value) || 0;
|
return parseFloat(document.getElementsByName(id)[0].value) || 0;
|
||||||
}
|
}
|
||||||
@@ -18,23 +8,22 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
document.getElementsByName(id)[0].value = Number(value).toFixed(2);
|
document.getElementsByName(id)[0].value = Number(value).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculate() {
|
window.calculate = function () {
|
||||||
|
|
||||||
// 1️ Base Values
|
// Base Values
|
||||||
let gross_total_income = getVal("gross_total_income");
|
let gross_total_income = getVal("gross_total_income");
|
||||||
let disallowance_14a = getVal("disallowance_14a");
|
let disallowance_14a = getVal("disallowance_14a");
|
||||||
let disallowance_37 = getVal("disallowance_37");
|
let disallowance_37 = getVal("disallowance_37");
|
||||||
|
|
||||||
// 2️ Deductions
|
// Deductions
|
||||||
let d80_business = getVal("deduction_80ia_business");
|
let d80_business = getVal("deduction_80ia_business");
|
||||||
let deduction_sec37 = getVal("deduction_sec37_disallowance");
|
let deduction_sec37 = getVal("deduction_sec37_disallowance");
|
||||||
let deduction_80g = getVal("deduction_80g");
|
let deduction_80g = getVal("deduction_80g");
|
||||||
|
|
||||||
// 3️ Formula: TOTAL DEDUCTION
|
// Total Deduction
|
||||||
let total_deductions = d80_business + deduction_sec37;
|
let total_deductions = d80_business + deduction_sec37;
|
||||||
// (deduction_80ia_business + deduction_sec37_disallowance)
|
|
||||||
|
|
||||||
// 4️ Net Taxable Income
|
// Net Taxable Income
|
||||||
let net_taxable_income =
|
let net_taxable_income =
|
||||||
(gross_total_income + disallowance_14a + disallowance_37)
|
(gross_total_income + disallowance_14a + disallowance_37)
|
||||||
- total_deductions
|
- total_deductions
|
||||||
@@ -42,35 +31,30 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
|
|
||||||
setVal("net_taxable_income", net_taxable_income);
|
setVal("net_taxable_income", net_taxable_income);
|
||||||
|
|
||||||
// 5️ Tax @ 30%
|
// Tax @ 30%
|
||||||
let tax_30_percent = net_taxable_income * 0.30;
|
let tax_30_percent = net_taxable_income * 0.30;
|
||||||
setVal("tax_30_percent", tax_30_percent);
|
setVal("tax_30_percent", tax_30_percent);
|
||||||
|
|
||||||
// 6️ Book Profit – Tax Payable
|
// Surcharge @ 12%
|
||||||
let tax_payable = getVal("tax_book_profit_18_5");
|
|
||||||
// (tax_payable = tax_book_profit_18_5)
|
|
||||||
|
|
||||||
// 7️ Surcharge
|
|
||||||
let surcharge_12 = tax_30_percent * 0.12;
|
let surcharge_12 = tax_30_percent * 0.12;
|
||||||
setVal("surcharge_12", surcharge_12);
|
setVal("surcharge_12", surcharge_12);
|
||||||
|
|
||||||
// 8️ Education Cess
|
// Education Cess @ 3%
|
||||||
let edu_cess_3 = (tax_30_percent + surcharge_12) * 0.03;
|
let edu_cess_3 = (tax_30_percent + surcharge_12) * 0.03;
|
||||||
setVal("edu_cess_3", edu_cess_3);
|
setVal("edu_cess_3", edu_cess_3);
|
||||||
|
|
||||||
// 9️ Total Tax Payable
|
// Total Tax Payable
|
||||||
let total_tax_payable = tax_30_percent + surcharge_12 + edu_cess_3;
|
let total_tax_payable = tax_30_percent + surcharge_12 + edu_cess_3;
|
||||||
setVal("total_tax_payable", total_tax_payable);
|
setVal("total_tax_payable", total_tax_payable);
|
||||||
|
|
||||||
// MAT Credit & Interest
|
// MAT, Interest
|
||||||
let mat_credit = getVal("mat_credit");
|
let mat_credit = getVal("mat_credit");
|
||||||
let interest_234c = getVal("interest_234c");
|
let interest_234c = getVal("interest_234c");
|
||||||
|
|
||||||
// 1️1️ Total Tax
|
|
||||||
let total_tax = total_tax_payable + mat_credit + interest_234c;
|
let total_tax = total_tax_payable + mat_credit + interest_234c;
|
||||||
setVal("total_tax", total_tax);
|
setVal("total_tax", total_tax);
|
||||||
|
|
||||||
// 1️2️ Assessment side – Advance Tax, TDS, TCS
|
// Advance, TDS, TCS
|
||||||
let advance_tax = getVal("advance_tax");
|
let advance_tax = getVal("advance_tax");
|
||||||
let tds = getVal("tds");
|
let tds = getVal("tds");
|
||||||
let tcs = getVal("tcs");
|
let tcs = getVal("tcs");
|
||||||
@@ -78,16 +62,8 @@ document.addEventListener("DOMContentLoaded", function () {
|
|||||||
let tax_on_assessment = advance_tax + tds + tcs;
|
let tax_on_assessment = advance_tax + tds + tcs;
|
||||||
setVal("tax_on_assessment", tax_on_assessment);
|
setVal("tax_on_assessment", tax_on_assessment);
|
||||||
|
|
||||||
// 1️3️ Refund / Payable
|
// Refund / Payablesss
|
||||||
let refund = total_tax - tax_on_assessment;
|
let refund = total_tax - tax_on_assessment;
|
||||||
setVal("refund", refund);
|
setVal("refund", refund);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Attach input listeners
|
|
||||||
fields.forEach(id => {
|
|
||||||
let input = document.getElementsByName(id)[0];
|
|
||||||
if (input) {
|
|
||||||
input.addEventListener("input", calculate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,89 +1,74 @@
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
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) {
|
function getVal(id) {
|
||||||
let el = document.getElementsByName(id)[0];
|
var el = document.getElementsByName(id)[0];
|
||||||
return el ? parseFloat(el.value) || 0 : 0;
|
return el ? parseFloat(el.value) || 0 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setVal(id, value) {
|
function setVal(id, value) {
|
||||||
let el = document.getElementsByName(id)[0];
|
var el = document.getElementsByName(id)[0];
|
||||||
if (el) el.value = Number(value).toFixed(2);
|
if (el) el.value = Number(value).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculate() {
|
// MAIN CALC FUNCTION
|
||||||
|
window.calculate = function () {
|
||||||
|
|
||||||
// Base values
|
// BASIC VALUES
|
||||||
let gross_total_income = getVal("gross_total_income");
|
var gross_total_income = getVal("gross_total_income");
|
||||||
let disallowance_14a = getVal("disallowance_14a");
|
var disallowance_14a = getVal("disallowance_14a");
|
||||||
let disallowance_37 = getVal("disallowance_37");
|
var disallowance_37 = getVal("disallowance_37");
|
||||||
|
|
||||||
// Deductions
|
var d80_business = getVal("deduction_80ia_business");
|
||||||
let d80_business = getVal("deduction_80ia_business");
|
var deduction_sec37 = getVal("deduction_sec37_disallowance");
|
||||||
let deduction_sec37 = getVal("deduction_sec37_disallowance");
|
var deduction_80g = getVal("deduction_80g");
|
||||||
let deduction_80g = getVal("deduction_80g");
|
|
||||||
|
|
||||||
// Net Taxable Income
|
// NET TAXABLE INCOME
|
||||||
let net_taxable_income =
|
var net_taxable_income =
|
||||||
(gross_total_income + disallowance_14a + disallowance_37)
|
(gross_total_income + disallowance_14a + disallowance_37)
|
||||||
- (d80_business + deduction_sec37)
|
- (d80_business + deduction_sec37)
|
||||||
- deduction_80g;
|
- deduction_80g;
|
||||||
|
|
||||||
setVal("net_taxable_income", net_taxable_income);
|
setVal("net_taxable_income", net_taxable_income);
|
||||||
|
|
||||||
// 30% tax
|
// TAX @ 30%
|
||||||
let tax_30_percent = net_taxable_income * 0.30;
|
var tax_30_percent = net_taxable_income * 0.30;
|
||||||
setVal("tax_30_percent", tax_30_percent);
|
setVal("tax_30_percent", tax_30_percent);
|
||||||
|
|
||||||
// Book profit tax (user input)
|
// TAX PAYABLE = 18.5% BOOK PROFIT (user enters)
|
||||||
let tax_payable = getVal("tax_book_profit_18_5");
|
var tax_payable = getVal("tax_book_profit_18_5");
|
||||||
setVal("tax_payable", tax_payable);
|
setVal("tax_payable", tax_payable);
|
||||||
|
|
||||||
// Surcharge 12%
|
// SURCHARGE
|
||||||
let surcharge_12 = tax_payable * 0.12;
|
var surcharge_12 = tax_payable * 0.12;
|
||||||
setVal("surcharge_12", surcharge_12);
|
setVal("surcharge_12", surcharge_12);
|
||||||
|
|
||||||
// Education Cess 3%
|
// CESS
|
||||||
let edu_cess_3 = (tax_payable + surcharge_12) * 0.03;
|
var edu_cess_3 = (tax_payable + surcharge_12) * 0.03;
|
||||||
setVal("edu_cess_3", edu_cess_3);
|
setVal("edu_cess_3", edu_cess_3);
|
||||||
|
|
||||||
// Total Tax Payable
|
// TOTAL TAX PAYABLE
|
||||||
let total_tax_payable = tax_payable + surcharge_12 + edu_cess_3;
|
var total_tax_payable = tax_payable + surcharge_12 + edu_cess_3;
|
||||||
setVal("total_tax_payable", total_tax_payable);
|
setVal("total_tax_payable", total_tax_payable);
|
||||||
|
|
||||||
// MAT + Interest
|
// OTHER VALUES
|
||||||
let mat_credit = getVal("mat_credit");
|
var mat_credit = getVal("mat_credit");
|
||||||
let interest_234c = getVal("interest_234c");
|
var interest_234c = getVal("interest_234c");
|
||||||
|
|
||||||
// Total Tax
|
// FINAL TAX
|
||||||
let total_tax = total_tax_payable + mat_credit + interest_234c;
|
var total_tax = total_tax_payable + mat_credit + interest_234c;
|
||||||
setVal("total_tax", total_tax);
|
setVal("total_tax", total_tax);
|
||||||
|
|
||||||
// Assessment → Advance Tax + TDS + TCS
|
// PAYMENTS
|
||||||
let advance_tax = getVal("advance_tax");
|
var advance_tax = getVal("advance_tax");
|
||||||
let tds = getVal("tds");
|
var tds = getVal("tds");
|
||||||
let tcs = getVal("tcs");
|
var tcs = getVal("tcs");
|
||||||
|
|
||||||
let tax_on_assessment = advance_tax + tds + tcs;
|
var tax_on_assessment = advance_tax + tds + tcs;
|
||||||
setVal("tax_on_assessment", tax_on_assessment);
|
setVal("tax_on_assessment", tax_on_assessment);
|
||||||
|
|
||||||
// Refund (or payable)
|
// REFUND
|
||||||
let refund = total_tax - tax_on_assessment;
|
var refund = total_tax - tax_on_assessment;
|
||||||
setVal("refund", refund);
|
setVal("refund", refund);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Attach listeners
|
|
||||||
fields.forEach(id => {
|
|
||||||
let el = document.getElementsByName(id)[0];
|
|
||||||
if (el) el.addEventListener("input", calculate);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,83 +1,72 @@
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const fields = [
|
|
||||||
"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"
|
|
||||||
];
|
|
||||||
|
|
||||||
function getValue(id) {
|
function getValue(id) {
|
||||||
return parseFloat(document.getElementsByName(id)[0].value) || 0;
|
var el = document.getElementsByName(id)[0];
|
||||||
|
return el ? parseFloat(el.value) || 0 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setValue(id, val) {
|
function setValue(id, val) {
|
||||||
document.getElementsByName(id)[0].value = val.toFixed(2);
|
var el = document.getElementsByName(id)[0];
|
||||||
|
if (el) el.value = Number(val).toFixed(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculate() {
|
window.calculate = function () {
|
||||||
|
|
||||||
let gross_total_income = getValue("gross_total_income");
|
// --- BASIC INPUTS ---
|
||||||
let disallowance_14a = getValue("disallowance_14a");
|
var gross_total_income = getValue("gross_total_income");
|
||||||
let disallowance_37 = getValue("disallowance_37");
|
var disallowance_14a = getValue("disallowance_14a");
|
||||||
|
var disallowance_37 = getValue("disallowance_37");
|
||||||
|
|
||||||
// FORMULAS
|
// // Auto-calculations (your logic)
|
||||||
setValue("gross_total_income", disallowance_37 + gross_total_income);
|
setValue("gross_total_income", disallowance_37 + gross_total_income);
|
||||||
setValue("disallowance_37", disallowance_14a + disallowance_37);
|
setValue("disallowance_37", disallowance_14a + disallowance_37);
|
||||||
|
|
||||||
// Deductions
|
// --- DEDUCTIONS ---
|
||||||
let d80_business = getValue("deduction_80ia_business");
|
var d80_business = getValue("deduction_80ia_business");
|
||||||
let d80_misc = getValue("deduction_80ia_misc");
|
var d80_misc = getValue("deduction_80ia_misc");
|
||||||
let d80_other = getValue("deduction_80ia_other");
|
var d80_other = getValue("deduction_80ia_other");
|
||||||
|
|
||||||
let deduction_sec37 = d80_business + d80_misc + d80_other - 1.35;
|
var deduction_sec37 = d80_business + d80_misc + d80_other - 1.35;
|
||||||
setValue("deduction_sec37_disallowance", deduction_sec37);
|
setValue("deduction_sec37_disallowance", deduction_sec37);
|
||||||
|
|
||||||
let deduction_80g = getValue("deduction_80g");
|
var deduction_80g = getValue("deduction_80g");
|
||||||
|
|
||||||
// Net taxable income
|
// --- NET TAXABLE INCOME ---
|
||||||
let net_taxable_income = gross_total_income - deduction_sec37 - deduction_80g;
|
var net_taxable_income = gross_total_income - deduction_sec37 - deduction_80g;
|
||||||
setValue("net_taxable_income", net_taxable_income);
|
setValue("net_taxable_income", net_taxable_income);
|
||||||
|
|
||||||
// Tax calculations
|
// --- TAX 30% ---
|
||||||
setValue("tax_30_percent", net_taxable_income * 0.30);
|
setValue("tax_30_percent", net_taxable_income * 0.30);
|
||||||
|
|
||||||
let tax_book_profit = getValue("tax_book_profit_18_5");
|
// --- TAX PAYABLE (18.5%) ---
|
||||||
setValue("tax_payable", tax_book_profit);
|
var tax_book = getValue("tax_book_profit_18_5");
|
||||||
|
setValue("tax_payable", tax_book);
|
||||||
|
|
||||||
let surcharge = tax_book_profit * 0.12;
|
var surcharge = tax_book * 0.12;
|
||||||
setValue("surcharge_12", surcharge);
|
setValue("surcharge_12", surcharge);
|
||||||
|
|
||||||
let edu_cess = (tax_book_profit + surcharge) * 0.03;
|
var edu_cess = (tax_book + surcharge) * 0.03;
|
||||||
setValue("edu_cess_3", edu_cess);
|
setValue("edu_cess_3", edu_cess);
|
||||||
|
|
||||||
let total_tax_payable = tax_book_profit + surcharge + edu_cess;
|
var total_tax_payable = tax_book + surcharge + edu_cess;
|
||||||
setValue("total_tax_payable", total_tax_payable);
|
setValue("total_tax_payable", total_tax_payable);
|
||||||
|
|
||||||
let mat_credit = getValue("mat_credit");
|
// --- FINAL TAX ---
|
||||||
let interest_234c = getValue("interest_234c");
|
var mat_credit = getValue("mat_credit");
|
||||||
|
var interest_234c = getValue("interest_234c");
|
||||||
|
|
||||||
let total_tax = total_tax_payable + mat_credit + interest_234c;
|
var total_tax = total_tax_payable + mat_credit + interest_234c;
|
||||||
setValue("total_tax", total_tax);
|
setValue("total_tax", total_tax);
|
||||||
|
|
||||||
// Assessment
|
// --- ASSESSMENT ---
|
||||||
let adv_tax = getValue("advance_tax");
|
var adv_tax = getValue("advance_tax");
|
||||||
let tds = getValue("tds");
|
var tds = getValue("tds");
|
||||||
let tcs = getValue("tcs");
|
var tcs = getValue("tcs");
|
||||||
|
|
||||||
let tax_on_assessment = adv_tax + tds + tcs;
|
var tax_on_assessment = adv_tax + tds + tcs;
|
||||||
setValue("tax_on_assessment", tax_on_assessment);
|
setValue("tax_on_assessment", tax_on_assessment);
|
||||||
|
|
||||||
let refund = total_tax - tax_on_assessment;
|
var refund = total_tax - tax_on_assessment;
|
||||||
setValue("refund", refund);
|
setValue("refund", refund);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Attach event listeners
|
|
||||||
fields.forEach(id => {
|
|
||||||
const element = document.getElementsByName(id)[0];
|
|
||||||
if (element) {
|
|
||||||
element.addEventListener("input", calculate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,23 +1,51 @@
|
|||||||
document.addEventListener("DOMContentLoaded", function () {
|
document.addEventListener("DOMContentLoaded", function () {
|
||||||
const yearDropdown = document.getElementById("year");
|
const yearDropdown = document.getElementById("year");
|
||||||
|
const errorDiv = document.getElementById("yearError");
|
||||||
|
|
||||||
|
// Get the form dynamically
|
||||||
|
const form = document.querySelector("form"); // get from id as table name
|
||||||
|
|
||||||
|
// Dynamic table name = form id
|
||||||
|
const tableName = form.id.toLowerCase();
|
||||||
|
|
||||||
const currentYear = new Date().getFullYear();
|
const currentYear = new Date().getFullYear();
|
||||||
const startYear = 1990;
|
const startYear = 1990;
|
||||||
|
|
||||||
|
// Fill Year dropdown
|
||||||
for (let y = currentYear; y >= startYear; y--) {
|
for (let y = currentYear; y >= startYear; y--) {
|
||||||
let nextYear = y + 1;
|
let nextYear = y + 1;
|
||||||
|
|
||||||
let option = document.createElement("option");
|
let option = document.createElement("option");
|
||||||
|
|
||||||
// Backend receives only first year (example 2024)
|
|
||||||
option.value = y;
|
option.value = y;
|
||||||
|
|
||||||
// User sees (example AY 2024–2025)
|
|
||||||
option.textContent = `AY ${y}-${nextYear}`;
|
option.textContent = `AY ${y}-${nextYear}`;
|
||||||
|
|
||||||
yearDropdown.appendChild(option);
|
yearDropdown.appendChild(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Validate selected year
|
||||||
|
yearDropdown.addEventListener("change", function () {
|
||||||
|
let selectedYear = parseInt(this.value);
|
||||||
|
|
||||||
|
fetch("/check_year", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body: JSON.stringify({
|
||||||
|
table: tableName, // dynamic table name
|
||||||
|
year: selectedYear
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.then(res => res.json())
|
||||||
|
.then(data => {
|
||||||
|
if (data.exists) {
|
||||||
|
errorDiv.style.display = "block";
|
||||||
|
errorDiv.innerText = `Year ${selectedYear} already exists!`;
|
||||||
|
|
||||||
|
// Block submission
|
||||||
|
form.onsubmit = function () { return false; };
|
||||||
|
} else {
|
||||||
|
errorDiv.style.display = "none";
|
||||||
|
form.onsubmit = null; // Allow submit
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,19 @@
|
|||||||
<a href="{{ url_for('index') }}" class="back-btn">← Back to Dashboard</a>
|
<a href="{{ url_for('index') }}" class="back-btn">← Back to Dashboard</a>
|
||||||
|
|
||||||
<h2>AO Form Entry</h2>
|
<h2>AO Form Entry</h2>
|
||||||
<form method="POST" onsubmit="return showSuccessMessage()">
|
<form id="ao" method="POST" onsubmit="return showSuccessMessage()">
|
||||||
<!-- <label>Year:</label>
|
<!-- <label>Year:</label>
|
||||||
<input type="number" name="year" required> -->
|
<input type="number" name="year" required> -->
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>Year:</label>
|
<label>Year:</label>
|
||||||
<select id="year" name="year" required></select>
|
<select id="year" name="year" required>
|
||||||
|
<option>---- Select Years ----</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div id="yearError" style="color:red; display:none; margin-bottom:10px;">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% for field in [
|
{% for field in [
|
||||||
@@ -33,7 +39,7 @@
|
|||||||
"tax_on_assessment", "refund"
|
"tax_on_assessment", "refund"
|
||||||
] %}
|
] %}
|
||||||
<label for="{{ field }}">{{ field.replace("_", " ").title() }}:</label>
|
<label for="{{ field }}">{{ field.replace("_", " ").title() }}:</label>
|
||||||
<input type="number" name="{{ field }}" step="0.01" required>
|
<input type="number" name="{{ field }}" step="0.01" oninput="calculate()" required>
|
||||||
<!-- <input type="number" name="{{ field }}" step="0.01" oninput="calculate()" required> -->
|
<!-- <input type="number" name="{{ field }}" step="0.01" oninput="calculate()" required> -->
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<button type="submit">Submit</button>
|
<button type="submit">Submit</button>
|
||||||
|
|||||||
@@ -15,14 +15,19 @@
|
|||||||
<a href="{{ url_for('index') }}" class="back-btn">← Back to Dashboard</a>
|
<a href="{{ url_for('index') }}" class="back-btn">← Back to Dashboard</a>
|
||||||
|
|
||||||
<h2>CIT Form Entry</h2>
|
<h2>CIT Form Entry</h2>
|
||||||
<form method="POST">
|
<form id="cit" method="POST">
|
||||||
<!-- <label>Year:</label>
|
<!-- <label>Year:</label>
|
||||||
<input type="number" name="year" required value="{{ record.year if record else '' }}"> -->
|
<input type="number" name="year" required value="{{ record.year if record else '' }}"> -->
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label> Year:</label>
|
<label> Year:</label>
|
||||||
<select id="year" name="year" required></select>
|
<select id="year" name="year" required>
|
||||||
|
<option>---- Select Years ----</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="yearError" style="color:red; display:none; margin-bottom:10px;">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
{% for field in [
|
{% for field in [
|
||||||
"gross_total_income", "deduction_80ia_business", "deduction_sec37_disallowance",
|
"gross_total_income", "deduction_80ia_business", "deduction_sec37_disallowance",
|
||||||
@@ -31,9 +36,9 @@
|
|||||||
"interest_234c", "total_tax", "advance_tax", "tds", "tcs", "tax_on_assessment", "refund"
|
"interest_234c", "total_tax", "advance_tax", "tds", "tcs", "tax_on_assessment", "refund"
|
||||||
] %}
|
] %}
|
||||||
<label for="{{ field }}">{{ field.replace("_", " ").title() }}:</label>
|
<label for="{{ field }}">{{ field.replace("_", " ").title() }}:</label>
|
||||||
<input type="number" name="{{ field }}" step="0.01" required value="{{ record[field] if record else '' }}">
|
<input type="number" name="{{ field }}" step="0.01" oninput="calculate()" required>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<button type="submit">{{ 'Update' if record else 'Submit' }}</button>
|
<button type="submit">Submit </button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -14,13 +14,18 @@
|
|||||||
<a href="{{ url_for('index') }}" class="back-btn">← Back to Dashboard</a>
|
<a href="{{ url_for('index') }}" class="back-btn">← Back to Dashboard</a>
|
||||||
|
|
||||||
<h2>ITAT Form Entry</h2>
|
<h2>ITAT Form Entry</h2>
|
||||||
<form method="POST" onsubmit="return showSuccessMessage()">
|
<form id="itat" method="POST" onsubmit="return showSuccessMessage()">
|
||||||
<!-- <label>Year:</label>
|
<!-- <label>Year:</label>
|
||||||
<input type="number" name="year" step="0.01" required> -->
|
<input type="number" name="year" step="0.01" required> -->
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label> Year:</label>
|
<label> Year:</label>
|
||||||
<select id="year" name="year" required></select>
|
<select id="year" name="year" required>
|
||||||
|
<option>---- Select Years ----</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="yearError" style="color:red; display:none; margin-bottom:10px;">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<label>MAT Tax Credit:</label>
|
<label>MAT Tax Credit:</label>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<h2>Add New Income Tax Return Record</h2>
|
<h2>Add New Income Tax Return Record</h2>
|
||||||
<form method="POST" action="{{ url_for('add_itr') }}">
|
<form id="itr" method="POST" action="{{ url_for('add_itr') }}">
|
||||||
<!-- <div class="form-group">
|
<!-- <div class="form-group">
|
||||||
<label>Year:</label>
|
<label>Year:</label>
|
||||||
<input type="number" name="year" required>
|
<input type="number" name="year" required>
|
||||||
@@ -26,8 +26,11 @@
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label> Year:</label>
|
<label> Year:</label>
|
||||||
<select id="year" name="year" required>
|
<select id="year" name="year" required>
|
||||||
|
<option>---- Select Years ----</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="yearError" style="color:red; display:none; margin-bottom:10px;">
|
||||||
|
</div>
|
||||||
|
|
||||||
{% for field in [
|
{% for field in [
|
||||||
"gross_total_income", "disallowance_14a", "disallowance_37",
|
"gross_total_income", "disallowance_14a", "disallowance_37",
|
||||||
@@ -37,9 +40,11 @@
|
|||||||
"edu_cess_3", "total_tax_payable", "mat_credit", "interest_234c",
|
"edu_cess_3", "total_tax_payable", "mat_credit", "interest_234c",
|
||||||
"total_tax", "advance_tax", "tds", "tcs", "tax_on_assessment", "refund"
|
"total_tax", "advance_tax", "tds", "tcs", "tax_on_assessment", "refund"
|
||||||
] %}
|
] %}
|
||||||
|
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{ field.replace("_", " ").title() }}:</label>
|
<label>{{ field.replace("_", " ").title() }}:</label>
|
||||||
<input type="number" name="{{ field }}" step="any" value="0.00" required>
|
<input type="number" name="{{ field }}" step="any" value="0.00" oninput="calculate()" required>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
@@ -48,4 +53,4 @@
|
|||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html
|
||||||
Reference in New Issue
Block a user