Last active
April 24, 2018 10:43
-
-
Save phnessu4/8a8e6b5589c9b2e94fb12b0a1baea134 to your computer and use it in GitHub Desktop.
房地产税计算公式
This file contains 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
按照2个人标准,最多四套房计算。 | |
var basePersonCount = 2; | |
var basePersonArea = 80; | |
var houses = [ | |
{area:160, money:30000}, | |
{area:90, money:30000}, | |
]; | |
var totalArea = (numOfHouse = 1)=>{ | |
var totalArea = 0; | |
houses.map((i, index)=>{ | |
if(index < numOfHouse){ | |
totalArea += i.area | |
} | |
}) | |
return totalArea; | |
} | |
var totalTax = 0; | |
var avagePrice = (numOfHouse = 1)=>{ | |
var totalArea = 0; | |
var totalMoney = 0; | |
houses.map((i, index)=>{ | |
if(index < numOfHouse){ | |
totalArea += i.area | |
totalMoney += i.area * i.money | |
} | |
}) | |
return (totalMoney / totalArea); | |
} | |
if(houses.length > 1 && totalArea(2) > basePersonArea*basePersonCount){ | |
totalTax += (totalArea(2) - basePersonArea * basePersonCount) * avagePrice(2) * 0.01 | |
} | |
if(houses.length > 2){ | |
totalTax += (totalArea(3) - totalArea(2)) * houses[2].money * 0.03 | |
} | |
if(houses.length > 3){ | |
totalTax += (totalArea(4) - totalArea(3)) * houses[3].money * 0.1 | |
} | |
console.log(totalTax) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment