year check valid or not All form commit

This commit is contained in:
2025-12-08 13:40:33 +05:30
parent bd24fa5f4e
commit 425f213606
13 changed files with 175 additions and 193 deletions

View File

@@ -1,15 +1,5 @@
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) {
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);
}
function calculate() {
window.calculate = function () {
// 1 Base Values
// Base Values
let gross_total_income = getVal("gross_total_income");
let disallowance_14a = getVal("disallowance_14a");
let disallowance_37 = getVal("disallowance_37");
// 2 Deductions
// Deductions
let d80_business = getVal("deduction_80ia_business");
let deduction_sec37 = getVal("deduction_sec37_disallowance");
let deduction_80g = getVal("deduction_80g");
// 3 Formula: TOTAL DEDUCTION
// Total Deduction
let total_deductions = d80_business + deduction_sec37;
// (deduction_80ia_business + deduction_sec37_disallowance)
// 4 Net Taxable Income
// Net Taxable Income
let net_taxable_income =
(gross_total_income + disallowance_14a + disallowance_37)
- total_deductions
@@ -42,35 +31,30 @@ document.addEventListener("DOMContentLoaded", function () {
setVal("net_taxable_income", net_taxable_income);
// 5 Tax @ 30%
// Tax @ 30%
let tax_30_percent = net_taxable_income * 0.30;
setVal("tax_30_percent", tax_30_percent);
// 6 Book Profit Tax Payable
let tax_payable = getVal("tax_book_profit_18_5");
// (tax_payable = tax_book_profit_18_5)
// 7 Surcharge
// Surcharge @ 12%
let surcharge_12 = tax_30_percent * 0.12;
setVal("surcharge_12", surcharge_12);
// 8 Education Cess
// Education Cess @ 3%
let edu_cess_3 = (tax_30_percent + surcharge_12) * 0.03;
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;
setVal("total_tax_payable", total_tax_payable);
// MAT Credit & Interest
// MAT, Interest
let mat_credit = getVal("mat_credit");
let interest_234c = getVal("interest_234c");
// 11 Total Tax
let total_tax = total_tax_payable + mat_credit + interest_234c;
setVal("total_tax", total_tax);
// 12 Assessment side Advance Tax, TDS, TCS
// Advance, TDS, TCS
let advance_tax = getVal("advance_tax");
let tds = getVal("tds");
let tcs = getVal("tcs");
@@ -78,16 +62,8 @@ document.addEventListener("DOMContentLoaded", function () {
let tax_on_assessment = advance_tax + tds + tcs;
setVal("tax_on_assessment", tax_on_assessment);
// 13 Refund / Payable
// Refund / Payablesss
let refund = total_tax - tax_on_assessment;
setVal("refund", refund);
}
// Attach input listeners
fields.forEach(id => {
let input = document.getElementsByName(id)[0];
if (input) {
input.addEventListener("input", calculate);
}
});
};
});