Files
IncomeTaxSystem/static/js/ao_calc.js

92 lines
3.2 KiB
JavaScript
Raw Normal View History

document.addEventListener("DOMContentLoaded", function () {
function getValue(id) {
var el = document.getElementsByName(id)[0];
return el ? parseFloat(el.value) || 0 : 0;
}
function setValue(id, val) {
var el = document.getElementsByName(id)[0];
if (el) el.value = Number(val).toFixed(2);
}
window.calculate = function () {
// --- BASIC INPUTS ---
var gross_total_income = getValue("gross_total_income");
var disallowance_14a = getValue("disallowance_14a");
var disallowance_37 = getValue("disallowance_37");
2026-01-29 18:19:49 +05:30
// -- total gross income --
var gross_total = gross_total_income + disallowance_37 + disallowance_14a
2026-01-29 18:19:49 +05:30
// console.log("gross_total income:: " + gross_total)
// --- DEDUCTIONS ---
var d80_business = getValue("deduction_80ia_business");
var d80_misc = getValue("deduction_80ia_misc");
var d80_other = getValue("deduction_80ia_other");
2026-01-29 18:19:49 +05:30
var d80_sec37 = getValue("deduction_sec37_disallowance");
2026-01-29 18:19:49 +05:30
var deduction = d80_business + d80_misc + d80_other + d80_sec37 - 1.35;
var deduction_80g = getValue("deduction_80g");
// --- NET TAXABLE INCOME ---
2026-01-29 18:19:49 +05:30
var net_taxable_income = gross_total - deduction - deduction_80g;
setValue("net_taxable_income", net_taxable_income);
// --- TAX 30% ---
var tax30 = net_taxable_income * 0.30;
setValue("tax_30_percent", tax30);
// --- TAX PAYABLE (18.5%) ---
var tax185 = getValue("tax_book_profit_18_5");
2026-01-29 18:19:49 +05:30
// --- Education Cess 3% ---
var tax_payable = (tax30 > tax185) ? tax30 : tax185;
setValue("tax_payable", tax_payable);
2026-01-29 18:19:49 +05:30
// // --- SURCHARGE ---
// var percent = getValue("persentage");
// var surcharge = tax_payable * (percent / 100);
// setValue("surcharge", surcharge);
// // --- edu_cess ---
// var per_cess = getValue("persentage_cess")
// var edu_cess = (tax_payable + surcharge) * (per_cess / 100);
// setValue("edu_cess", edu_cess);
// --- SURCHARGE ---
var percent = getValue("persentage");
var surcharge = tax_payable * (percent / 100);
2026-01-29 18:19:49 +05:30
setValue("surcharge", surcharge);
2026-01-29 18:19:49 +05:30
// --- EDUCATION CESS ---
var per_cess = getValue("persentage_cess");
var edu_cess = (tax_payable + surcharge) * (per_cess / 100);
setValue("edu_cess", edu_cess);
// --- total tax payable ---
var total_tax_payable = tax_payable + surcharge + edu_cess;
setValue("total_tax_payable", total_tax_payable);
// --- FINAL TAX ---
2026-01-29 18:19:49 +05:30
var mat_credit = getValue("mat_credit_utilized");
var interest_234c = getValue("interest_234c");
var total_tax = total_tax_payable + mat_credit + interest_234c;
setValue("total_tax", total_tax);
// --- 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);
};
});