Last active
June 3, 2019 07:00
-
-
Save AMEYCHAVAN/3b5dd212d184680e7687b2bed42f9084 to your computer and use it in GitHub Desktop.
Find optimal rent for best tax benefit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://jsbin.com/zukibezida/edit?output | |
// bs: Basic Salary payslip PerMonth ,hra : hra paid in payslip PerMonth | |
bs = 50000 | |
hra = 30000 | |
console.log("[50percent of Basic Salary,HRA received,Excess of Rent paid over 10 percent of salary ") | |
//console.log("if Rent paid>>",i,p,">>max allowd>>>." ,p.min()) | |
console.log(calc(bs, hra)) | |
function calc(bs, hra) { | |
arr = [] | |
Array.prototype.min = function() { | |
return Math.min.apply(null, this); | |
}; | |
for (i = 10000; i < bs * 1.3 / 2; i += 1000) { | |
fiftyOfbasic = bs / 2 | |
hrarecived = hra | |
excessof = i - (bs * 0.1) | |
let p = [fiftyOfbasic, hrarecived, excessof]; | |
arr.push({ | |
if_rent_paid: i, | |
fifty_Of_basic: fiftyOfbasic, | |
actual_hra_recived: hrarecived, | |
excess_of_10pc: excessof, | |
max_Tax_Deduction_Allowed: p.min() | |
}) | |
} | |
return arr | |
} | |
/* | |
if Rent paid>> 27000 [ 25000, 30000, 22000 ] >>max allowd>>>. 22000 | |
if u pay 27k ,max savings is 22k ie lease of 3 number in array | |
*/ | |
/*a | |
50% of Basic Salary Rs. 35,000 | |
HRA received Rs. 35,000 | |
Excess of Rent paid over 10% of salary Rs. 34,000 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment