modification ui changes base pages,login, manus and from chnages and adding filds. V2 commit
This commit is contained in:
@@ -1,69 +1,81 @@
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
|
||||
function getVal(id) {
|
||||
return parseFloat(document.getElementsByName(id)[0].value) || 0;
|
||||
function getValue(id) {
|
||||
var el = document.getElementsByName(id)[0];
|
||||
return el ? parseFloat(el.value) || 0 : 0;
|
||||
}
|
||||
|
||||
function setVal(id, value) {
|
||||
document.getElementsByName(id)[0].value = Number(value).toFixed(2);
|
||||
function setValue(id, val) {
|
||||
var el = document.getElementsByName(id)[0];
|
||||
if (el) el.value = Number(val).toFixed(2);
|
||||
}
|
||||
|
||||
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");
|
||||
// // Auto-calculations (your logic)
|
||||
// setValue("gross_total_income", disallowance_37 + gross_total_income);
|
||||
// setValue("disallowance_37", disallowance_14a + disallowance_37);
|
||||
|
||||
// Total Deduction
|
||||
let total_deductions = d80_business + deduction_sec37;
|
||||
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)
|
||||
- total_deductions
|
||||
- deduction_80g;
|
||||
// --- DEDUCTIONS ---
|
||||
var d80_business = getValue("deduction_80ia_business");
|
||||
var d80_misc = getValue("deduction_80ia_misc");
|
||||
var d80_other = getValue("deduction_80ia_other");
|
||||
|
||||
setVal("net_taxable_income", net_taxable_income);
|
||||
var deduction_sec37 = d80_business + d80_misc + d80_other;
|
||||
setValue("deduction_sec37_disallowance", deduction_sec37);
|
||||
|
||||
// Tax @ 30%
|
||||
let tax_30_percent = net_taxable_income * 0.30;
|
||||
setVal("tax_30_percent", tax_30_percent);
|
||||
var deduction_80g = getValue("deduction_80g");
|
||||
|
||||
// Surcharge @ 12%
|
||||
let surcharge_12 = tax_30_percent * 0.12;
|
||||
setVal("surcharge_12", surcharge_12);
|
||||
// --- NET TAXABLE INCOME ---
|
||||
var net_taxable_income = gross_total - deduction_sec37 - deduction_80g;
|
||||
setValue("net_taxable_income", net_taxable_income);
|
||||
|
||||
// Education Cess @ 3%
|
||||
let edu_cess_3 = (tax_30_percent + surcharge_12) * 0.03;
|
||||
setVal("edu_cess_3", edu_cess_3);
|
||||
// --- TAX 30% ---
|
||||
var tax30 = net_taxable_income * 0.30;
|
||||
setValue("tax_30_percent", tax30);
|
||||
|
||||
// Total Tax Payable
|
||||
let total_tax_payable = tax_30_percent + surcharge_12 + edu_cess_3;
|
||||
setVal("total_tax_payable", total_tax_payable);
|
||||
// --- TAX PAYABLE (18.5%) ---
|
||||
var tax185 = getValue("tax_book_profit_18_5");
|
||||
|
||||
// MAT, Interest
|
||||
let mat_credit = getVal("mat_credit");
|
||||
let interest_234c = getVal("interest_234c");
|
||||
var tax_payable = (tax30 > tax185) ? tax30 : tax185;
|
||||
setValue("tax_payable", tax_payable);
|
||||
|
||||
let total_tax = total_tax_payable + mat_credit + interest_234c;
|
||||
setVal("total_tax", total_tax);
|
||||
// --- SURCHARGE ---
|
||||
var percent = getValue("persentage");
|
||||
var surcharge = tax_payable * (percent / 100);
|
||||
setValue("surcharge_12", surcharge);
|
||||
|
||||
// Advance, TDS, TCS
|
||||
let advance_tax = getVal("advance_tax");
|
||||
let tds = getVal("tds");
|
||||
let tcs = getVal("tcs");
|
||||
var edu_cess = (tax_payable + surcharge) * 0.03;
|
||||
setValue("edu_cess_3", edu_cess);
|
||||
|
||||
let tax_on_assessment = advance_tax + tds + tcs;
|
||||
setVal("tax_on_assessment", tax_on_assessment);
|
||||
// --- total tax payable ---
|
||||
var total_tax_payable = tax_payable + surcharge + edu_cess;
|
||||
setValue("total_tax_payable", total_tax_payable);
|
||||
|
||||
// Refund / Payablesss
|
||||
let refund = total_tax - tax_on_assessment;
|
||||
setVal("refund", refund);
|
||||
// --- FINAL TAX ---
|
||||
var mat_credit = getValue("mat_credit");
|
||||
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_assessment = adv_tax + tds + tcs;
|
||||
setValue("tax_on_assessment", tax_on_assessment);
|
||||
|
||||
var refund = total_tax - tax_on_assessment;
|
||||
setValue("refund", refund);
|
||||
};
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user