ao model changes

This commit is contained in:
2026-02-08 13:23:32 +05:30
parent 64fc455f5c
commit 6e4efad834
2 changed files with 158 additions and 73 deletions

View File

@@ -1,5 +1,4 @@
document.addEventListener("DOMContentLoaded", function () {
function getValue(id) {
var el = document.getElementsByName(id)[0];
return el ? parseFloat(el.value) || 0 : 0;
@@ -11,14 +10,14 @@ document.addEventListener("DOMContentLoaded", function () {
}
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");
// -- total gross income --
var gross_total = gross_total_income + disallowance_37 + disallowance_14a
var gross_total = gross_total_income + disallowance_37 + disallowance_14a;
setValue("gti_as_per_ao", gross_total);
// console.log("gross_total income:: " + gross_total)
// --- DEDUCTIONS ---
@@ -27,6 +26,24 @@ document.addEventListener("DOMContentLoaded", function () {
var d80_other = getValue("deduction_80ia_other");
var d80_sec37 = getValue("deduction_sec37_disallowance");
// -- TAX A CALCULATIONS --
var per_a = getValue("per_a");
var tax_a = getValue("tax_a");
var per_surcharge_a = getValue("per_surcharge_a");
var surcharge_a = getValue("surcharge_a");
var per_cess_a = getValue("per_cess_a");
var edu_cess_a = getValue("edu_cess_a");
// -- TAX b CALCULATIONS --
var tax_book_profit = getValue("tax_book_profit");
console.log(tax_book_profit);
var per_surcharge_b = getValue("per_surcharge_b");
var surcharge_b = getValue("surcharge_b");
var per_cess_b = getValue("per_cess_b");
var edu_cess_b = getValue("edu_cess_b");
var deduction = d80_business + d80_misc + d80_other + d80_sec37 - 1.35;
var deduction_80g = getValue("deduction_80g");
@@ -35,15 +52,44 @@ document.addEventListener("DOMContentLoaded", function () {
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 (A)% AMOUNT ---
var tax_a = net_taxable_income * (per_a / 100);
setValue("tax_a", tax_a);
// --- SURCHARGE (A)% AMOUNT ---
var surcharge_a = tax_a * (per_surcharge_a / 100);
setValue("surcharge_a", surcharge_a);
// --- CESS (A)% AMOUNT ---
var edu_cess_a = (surcharge_a + tax_a) * (per_cess_a / 100);
setValue("edu_cess_a", edu_cess_a);
//SUM OF (A)%
var sum_of_a = tax_a + surcharge_a + edu_cess_a;
setValue("sum_of_a", sum_of_a);
//-----------------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------------
// --- SURCHARGE (B)% AMOUNT ---
var surcharge_b = tax_book_profit * (per_surcharge_b / 100);
setValue("surcharge_b", surcharge_b);
// --- CESS (B)% AMOUNT ---
var edu_cess_b = (surcharge_b + tax_book_profit) * (per_cess_b / 100);
setValue("edu_cess_b", edu_cess_b);
//SUM OF (B)%
var sum_of_b = tax_book_profit + surcharge_b + edu_cess_b;
setValue("sum_of_b", sum_of_b);
// --- TAX PAYABLE (18.5%) ---
var tax185 = getValue("tax_book_profit_18_5");
// --- Education Cess 3% ---
var tax_payable = (tax30 > tax185) ? tax30 : tax185;
var tax_payable = tax_a > tax_book_profit ? tax_a : tax_book_profit;
setValue("tax_payable", tax_payable);
// --- SURCHARGE ---
@@ -57,7 +103,7 @@ document.addEventListener("DOMContentLoaded", function () {
setValue("edu_cess", edu_cess);
// --- total tax payable ---
var total_tax_payable = tax_payable + surcharge + edu_cess;
var total_tax_payable = sum_of_a > sum_of_b ? sum_of_a : sum_of_b;
setValue("total_tax_payable", total_tax_payable);
// // --- mat_credit_created --- new
@@ -66,34 +112,28 @@ document.addEventListener("DOMContentLoaded", function () {
// setValue("mat_credit_utilized", Math.max(total_tax_payable - tax185, 0));
// --- MAT credit and utilized ---
var a = tax185
var b = total_tax_payable
var result = 0
if (a > b) {
result = a - b
console.log("mat_credit_created::tax 18.5 result:", result)
var a = sum_of_a;
var b = sum_of_b;
var result = 0;
var zero = 0;
if (b > a) {
result = a - b;
setValue("mat_credit_created", result);
}
else {
result = b - a
console.log("mat_credit_utilized::tax 30 result:", result)
setValue("mat_credit_utilized", result);
setValue("mat_credit_utilized", zero);
}
// if (b > a) {
// result = b - a
// setValue("mat_credit_created", result);
// }
// else {
// setValue("mat_credit_created", result);
// }s
if (a > b) {
result = b - a;
setValue("mat_credit_utilized", result);
setValue("mat_credit_created", zero);
}
// --- FINAL TAX ---
var mat_credit = getValue("mat_credit_utilized");
var mat_credit_uti = getValue("mat_credit_utilized");
var interest_234c = getValue("interest_234c");
// var total_tax = total_tax_payable + mat_credit + interest_234c;
var total_tax = total_tax_payable - mat_credit + interest_234c;
var total_tax = total_tax_payable + interest_234c - mat_credit_uti;
setValue("total_tax", total_tax);
// --- ASSESSMENT ---
@@ -107,4 +147,4 @@ document.addEventListener("DOMContentLoaded", function () {
var refund = total_tax - all_tax;
setValue("refund", refund);
};
});
});