Files
IncomeTaxSystem/static/js/cit_calc.js

75 lines
2.3 KiB
JavaScript

document.addEventListener("DOMContentLoaded", function () {
function getVal(id) {
var el = document.getElementsByName(id)[0];
return el ? parseFloat(el.value) || 0 : 0;
}
function setVal(id, value) {
var el = document.getElementsByName(id)[0];
if (el) el.value = Number(value).toFixed(2);
}
// MAIN CALC FUNCTION
window.calculate = function () {
// BASIC VALUES
var gross_total_income = getVal("gross_total_income");
var disallowance_14a = getVal("disallowance_14a");
var disallowance_37 = getVal("disallowance_37");
var d80_business = getVal("deduction_80ia_business");
var deduction_sec37 = getVal("deduction_sec37_disallowance");
var deduction_80g = getVal("deduction_80g");
// NET TAXABLE INCOME
var net_taxable_income =
(gross_total_income + disallowance_14a + disallowance_37)
- (d80_business + deduction_sec37)
- deduction_80g;
setVal("net_taxable_income", net_taxable_income);
// TAX @ 30%
var tax_30_percent = net_taxable_income * 0.30;
setVal("tax_30_percent", tax_30_percent);
// TAX PAYABLE = 18.5% BOOK PROFIT (user enters)
var tax_payable = getVal("tax_book_profit_18_5");
setVal("tax_payable", tax_payable);
// SURCHARGE
var surcharge_12 = tax_payable * 0.12;
setVal("surcharge_12", surcharge_12);
// CESS
var edu_cess_3 = (tax_payable + surcharge_12) * 0.03;
setVal("edu_cess_3", edu_cess_3);
// TOTAL TAX PAYABLE
var total_tax_payable = tax_payable + surcharge_12 + edu_cess_3;
setVal("total_tax_payable", total_tax_payable);
// OTHER VALUES
var mat_credit = getVal("mat_credit");
var interest_234c = getVal("interest_234c");
// FINAL TAX
var total_tax = total_tax_payable + mat_credit + interest_234c;
setVal("total_tax", total_tax);
// PAYMENTS
var advance_tax = getVal("advance_tax");
var tds = getVal("tds");
var tcs = getVal("tcs");
var tax_on_assessment = advance_tax + tds + tcs;
setVal("tax_on_assessment", tax_on_assessment);
// REFUND
var refund = total_tax - tax_on_assessment;
setVal("refund", refund);
};
});