changes of report and models
This commit is contained in:
@@ -13,11 +13,11 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
// ---- Track last edited field for Tax(A) ----
|
||||
let lastEditedTaxA = null;
|
||||
|
||||
document.getElementsByName("per_a")[0].addEventListener("input", () => {
|
||||
document.getElementsByName("per_tax_a")[0].addEventListener("input", () => {
|
||||
lastEditedTaxA = "percentage";
|
||||
});
|
||||
|
||||
document.getElementsByName("tax_30_percent")[0].addEventListener("input", () => {
|
||||
document.getElementsByName("tax_a_cal")[0].addEventListener("input", () => {
|
||||
lastEditedTaxA = "amount";
|
||||
});
|
||||
|
||||
@@ -44,47 +44,47 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
setValue("net_taxable_income", net_taxable_income);
|
||||
|
||||
// ================= TAX (A) – TWO WAY =================
|
||||
var per_a = getValue("per_a");
|
||||
var tax30 = getValue("tax_30_percent");
|
||||
var per_tax_a = getValue("per_tax_a");
|
||||
var tax_a_cal = getValue("tax_a_cal");
|
||||
|
||||
if (net_taxable_income > 0) {
|
||||
if (lastEditedTaxA === "percentage") {
|
||||
tax30 = net_taxable_income * (per_a / 100);
|
||||
setValue("tax_30_percent", tax30);
|
||||
tax_a_cal = net_taxable_income * (per_tax_a / 100);
|
||||
setValue("tax_a_cal", tax_a_cal);
|
||||
}
|
||||
else if (lastEditedTaxA === "amount") {
|
||||
per_a = (tax30 / net_taxable_income) * 100;
|
||||
setValue("per_a", per_a);
|
||||
per_tax_a = (tax_a_cal / net_taxable_income) * 100;
|
||||
setValue("per_tax_a", per_tax_a);
|
||||
}
|
||||
}
|
||||
|
||||
var per_surcharge_a = getValue("per_surcharge_a");
|
||||
var surcharge_a = tax30 * (per_surcharge_a / 100);
|
||||
setValue("surcharge_a", surcharge_a);
|
||||
var surcharge_a_cal = tax_a_cal * (per_surcharge_a / 100);
|
||||
setValue("surcharge_a_cal", surcharge_a_cal);
|
||||
|
||||
var per_cess_a = getValue("per_cess_a");
|
||||
var edu_cess_a = (tax30 + surcharge_a) * (per_cess_a / 100);
|
||||
setValue("edu_cess_a", edu_cess_a);
|
||||
var edu_cess_a_cal = (tax_a_cal + surcharge_a_cal) * (per_cess_a / 100);
|
||||
setValue("edu_cess_a_cal", edu_cess_a_cal);
|
||||
|
||||
var sum_of_a = tax30 + surcharge_a + edu_cess_a;
|
||||
var sum_of_a = tax_a_cal + surcharge_a_cal + edu_cess_a_cal;
|
||||
setValue("sum_of_a", sum_of_a);
|
||||
|
||||
// ================= TAX (B) =================
|
||||
var tax185 = getValue("tax_book_profit_18_5");
|
||||
var tax_b_cal = getValue("tax_b_cal");
|
||||
|
||||
var per_surcharge_b = getValue("per_surcharge_b");
|
||||
var surcharge_b = tax185 * (per_surcharge_b / 100);
|
||||
setValue("surcharge_b", surcharge_b);
|
||||
var surcharge_b_cal = tax_b_cal * (per_surcharge_b / 100);
|
||||
setValue("surcharge_b_cal", surcharge_b_cal);
|
||||
|
||||
var per_cess_b = getValue("per_cess_b");
|
||||
var edu_cess_b = (tax185 + surcharge_b) * (per_cess_b / 100);
|
||||
setValue("edu_cess_b", edu_cess_b);
|
||||
var edu_cess_b_cal = (tax_b_cal + surcharge_b_cal) * (per_cess_b / 100);
|
||||
setValue("edu_cess_b_cal", edu_cess_b_cal);
|
||||
|
||||
var sum_of_b = tax185 + surcharge_b + edu_cess_b;
|
||||
var sum_of_b = tax_b_cal + surcharge_b_cal + edu_cess_b_cal;
|
||||
setValue("sum_of_b", sum_of_b);
|
||||
|
||||
// ================= TAX PAYABLE =================
|
||||
var tax_payable = (sum_of_a > sum_of_b) ? tax30 : tax185;
|
||||
var tax_payable = (sum_of_a > sum_of_b) ? tax_a_cal : tax_b_cal;
|
||||
setValue("tax_payable", tax_payable);
|
||||
|
||||
var total_tax_payable = (sum_of_a > sum_of_b) ? sum_of_a : sum_of_b;
|
||||
|
||||
Reference in New Issue
Block a user