modification ui changes base pages,login, manus and from chnages and adding filds. V2 commit

This commit is contained in:
2025-12-29 15:22:15 +05:30
parent 425f213606
commit 4da1e92a70
97 changed files with 4761 additions and 2307 deletions

View File

@@ -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);
};
});

View File

@@ -1,74 +1,89 @@
document.addEventListener("DOMContentLoaded", function () {
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",
"tax_payable", "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) {
var el = document.getElementsByName(id)[0];
let el = document.getElementsByName(id)[0];
return el ? parseFloat(el.value) || 0 : 0;
}
function setVal(id, value) {
var el = document.getElementsByName(id)[0];
let el = document.getElementsByName(id)[0];
if (el) el.value = Number(value).toFixed(2);
}
// MAIN CALC FUNCTION
window.calculate = function () {
function calculate() {
// BASIC VALUES
var gross_total_income = getVal("gross_total_income");
var disallowance_14a = getVal("disallowance_14a");
var disallowance_37 = getVal("disallowance_37");
// Base values
let gross_total_income = getVal("gross_total_income");
let disallowance_14a = getVal("disallowance_14a");
let 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");
// Deductions
let d80_business = getVal("deduction_80ia_business");
let deduction_sec37 = getVal("deduction_sec37_disallowance");
let deduction_80g = getVal("deduction_80g");
// NET TAXABLE INCOME
var net_taxable_income =
// Net Taxable Income
let 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;
// 30% tax
let 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");
// Book profit tax (user input)
let tax_payable = getVal("tax_book_profit_18_5");
setVal("tax_payable", tax_payable);
// SURCHARGE
var surcharge_12 = tax_payable * 0.12;
// Surcharge 12%
let surcharge_12 = tax_payable * 0.12;
setVal("surcharge_12", surcharge_12);
// CESS
var edu_cess_3 = (tax_payable + surcharge_12) * 0.03;
// Education Cess 3%
let 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;
// Total Tax Payable
let 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");
// MAT + Interest
let mat_credit = getVal("mat_credit");
let interest_234c = getVal("interest_234c");
// FINAL TAX
var total_tax = total_tax_payable + mat_credit + interest_234c;
// Total Tax
let 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");
// Assessment → Advance Tax + TDS + TCS
let advance_tax = getVal("advance_tax");
let tds = getVal("tds");
let tcs = getVal("tcs");
var tax_on_assessment = advance_tax + tds + tcs;
let tax_on_assessment = advance_tax + tds + tcs;
setVal("tax_on_assessment", tax_on_assessment);
// REFUND
var refund = total_tax - tax_on_assessment;
// Refund (or payable)
let refund = total_tax - tax_on_assessment;
setVal("refund", refund);
};
}
// Attach listeners
fields.forEach(id => {
let el = document.getElementsByName(id)[0];
if (el) el.addEventListener("input", calculate);
});
});

View File

@@ -18,8 +18,11 @@ document.addEventListener("DOMContentLoaded", function () {
var disallowance_37 = getValue("disallowance_37");
// // Auto-calculations (your logic)
setValue("gross_total_income", disallowance_37 + gross_total_income);
setValue("disallowance_37", disallowance_14a + disallowance_37);
// setValue("gross_total_income", disallowance_37 + gross_total_income);
// setValue("disallowance_37", disallowance_14a + disallowance_37);
var gross_total = gross_total_income + disallowance_37 + disallowance_14a
console.log("gross_total income:: " + gross_total)
// --- DEDUCTIONS ---
var d80_business = getValue("deduction_80ia_business");
@@ -32,23 +35,29 @@ document.addEventListener("DOMContentLoaded", function () {
var deduction_80g = getValue("deduction_80g");
// --- NET TAXABLE INCOME ---
var net_taxable_income = gross_total_income - deduction_sec37 - deduction_80g;
var net_taxable_income = gross_total - deduction_sec37 - deduction_80g;
setValue("net_taxable_income", net_taxable_income);
// --- TAX 30% ---
setValue("tax_30_percent", net_taxable_income * 0.30);
var tax30 = net_taxable_income * 0.30;
setValue("tax_30_percent", tax30);
// --- TAX PAYABLE (18.5%) ---
var tax_book = getValue("tax_book_profit_18_5");
setValue("tax_payable", tax_book);
var tax185 = getValue("tax_book_profit_18_5");
var surcharge = tax_book * 0.12;
var tax_payable = (tax30 > tax185) ? tax30 : tax185;
setValue("tax_payable", tax_payable);
// --- SURCHARGE ---
var percent = getValue("persentage");
var surcharge = tax_payable * (percent / 100);
setValue("surcharge_12", surcharge);
var edu_cess = (tax_book + surcharge) * 0.03;
var edu_cess = (tax_payable + surcharge) * 0.03;
setValue("edu_cess_3", edu_cess);
var total_tax_payable = tax_book + surcharge + edu_cess;
// --- total tax payable ---
var total_tax_payable = tax_payable + surcharge + edu_cess;
setValue("total_tax_payable", total_tax_payable);
// --- FINAL TAX ---

61
static/js/toggle.js Normal file
View File

@@ -0,0 +1,61 @@
const sidebar = document.getElementById("sidebar");
const main = document.getElementById("main");
// Track toggle manually
let isSidebarOpen = true;
// Toggle sidebar normally
function toggleSidebar() {
isSidebarOpen = !isSidebarOpen;
sidebar.classList.toggle("hide", !isSidebarOpen);
// Add temporary transition only during toggle
main.style.transition = "margin-left 0.3s ease";
sidebar.style.transition = "left 0.3s ease";
// Adjust main margin
main.style.marginLeft = isSidebarOpen ? "260px" : "20px";
// Remove transitions after animation to avoid disturbance
setTimeout(() => {
main.style.transition = "none";
sidebar.style.transition = "none";
}, 300);
}
// Toggle submenu — also force sidebar to open if it is hidden
function toggleMenu(id) {
const menu = document.getElementById(id);
if (!menu) return;
// 👉 If sidebar is collapsed, open it automatically
if (!isSidebarOpen) {
isSidebarOpen = true;
sidebar.classList.remove("hide");
main.style.marginLeft = "260px";
}
// Close all other submenus
document.querySelectorAll(".submenu").forEach(sm => {
if (sm !== menu) sm.style.display = "none";
});
// Toggle the clicked submenu instantly
menu.style.display = menu.style.display === "block" ? "none" : "block";
}
// Remove transition when clicking submenu links
document.querySelectorAll(".submenu a").forEach(link => {
link.addEventListener("click", () => {
main.style.transition = "none";
sidebar.style.transition = "none";
});
});
// Initialize sidebar as open when page loads
window.addEventListener("DOMContentLoaded", () => {
sidebar.classList.remove("hide");
main.style.marginLeft = "260px";
isSidebarOpen = true;
});

View File

@@ -38,7 +38,7 @@ document.addEventListener("DOMContentLoaded", function () {
.then(data => {
if (data.exists) {
errorDiv.style.display = "block";
errorDiv.innerText = `Year ${selectedYear} already exists!`;
errorDiv.innerText = `Year ${selectedYear}-${selectedYear + 1} already exists!`;
// Block submission
form.onsubmit = function () { return false; };
@@ -49,3 +49,4 @@ document.addEventListener("DOMContentLoaded", function () {
});
});
});