Javascript实现计算个⼈所得税
TABLE {
BORDER-RIGHT: medium none; PADDING-RIGHT: 0px; BORDER-TOP: medium none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: medium none; PADDING-TOP: 0px;
CSS:
BORDER-BOTTOM: medium none
}
TD {
BORDER-RIGHT: medium none; PADDING-RIGHT: 0px; BORDER-TOP: medium none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: medium none; PADDING-TOP: 0px;BORDER-BOTTOM: medium none }
IMG {
BORDER-RIGHT: medium none; PADDING-RIGHT: 0px; BORDER-TOP: medium none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: medium none; PADDING-TOP: 0px;BORDER-BOTTOM: medium none }
FORM {
BORDER-RIGHT: medium none; PADDING-RIGHT: 0px; BORDER-TOP: medium none; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; BORDER-LEFT: medium none; PADDING-TOP: 0px;BORDER-BOTTOM: medium none }
TD {
FONT-SIZE: 12px
}
P {
FONT-SIZE: 12px
}
LI {
FONT-SIZE: 12px
}
SELECT {
FONT-SIZE: 12px
}
INPUT {
FONT-SIZE: 12px
}
TEXTAREA {
FONT-SIZE: 12px
}
SELECT {
BORDER-RIGHT: #49b8e3 1px solid; BORDER-TOP: #49b8e3 1px solid; BORDER-LEFT: #49b8e3 1px solid; BORDER-BOTTOM: #49b8e3 1px solid; BACKGROUND-COLOR: #e2f4ff
}
INPUT {
BORDER-RIGHT: #49b8e3 1px solid; BORDER-TOP: #49b8e3 1px solid; BORDER-LEFT: #49b8e3 1px solid; BORDER-BOTTOM: #49b8e3 1px solid; BACKGROUND-COLOR: #e2f4ff
}
TEXTAREA {
BORDER-RIGHT: #49b8e3 1px solid; BORDER-TOP: #49b8e3 1px solid; BORDER-LEFT: #49b8e3 1px solid; BORDER-BOTTOM: #49b8e3 1px solid; BACKGROUND-COLOR: #e2f4ff
}
.f14 {
FONT-SIZE: 14px
}
.lh19 {
LINE-HEIGHT: 19px
}
A:hover {
COLOR: #ff0000
}
.b1 {
BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid
}
.b2 {
BORDER-BOTTOM: #ffffff 1px solid
}
.b3 {
BORDER-RIGHT: #cfe9f8 5px solid; BORDER-TOP: #cfe9f8 5px solid; BORDER-LEFT: #cfe9f8 5px solid; BORDER-BOTTOM: #cfe9f8 5px solid
}
margin rate.cRed {
COLOR: #cc0000
}
.cGary {
COLOR: #6c6c6c
}
.cBlue {
COLOR: #066cd2
}
.linkBlankUl A:link {
COLOR: #000; TEXT-DECORATION: underline
}
.linkBlankUl A:visited {
COLOR: #000; TEXT-DECORATION: underline
}
.linkBlankUl A:active {
COLOR: #f00; TEXT-DECORATION: underline
}
.
linkBlankUl A:hover {
COLOR: #f00; TEXT-DECORATION: underline
}
.linkBlank A:link {
COLOR: #000; TEXT-DECORATION: none
}
.linkBlank A:visited {
COLOR: #000; TEXT-DECORATION: none
}
.linkBlank A:active {
COLOR: #f00; TEXT-DECORATION: none
}
.linkBlank A:hover {
COLOR: #f00; TEXT-DECORATION: none
}
.linkRed {
COLOR: #7b0000
COLOR: #7b0000; text-: none
}
.linkRed A:visited {
COLOR: #7b0000; text-: none
}
.
linkRed A:active {
COLOR: #7b0000; text-: underline
}
.linkRed A:hover {
COLOR: #7b0000; text-: underline
}
.linkBlue A:link {
COLOR: #003399; TEXT-DECORATION: underline
}
.linkBlue A:visited {
COLOR: #003399; TEXT-DECORATION: underline
}
.linkBlue A:active {
COLOR: #0268ce; TEXT-DECORATION: underline
}
.linkBlue A:hover {
COLOR: #0268ce; TEXT-DECORATION: underline
}
HTML:
</STYLE>
<SCRIPT language=javascript>
<!--
function warnInvalid (theField, s)
{  newAlert(s);
theField.focus();
theField.select();
return false;
}
function isNumber(s)  //字符串是否由数字构成
{
var digits = "0123456789";
var i = 0;
var sLength = s.length;
while ((i < sLength))
{
var c = s.charAt(i);
if (digits.indexOf(c) == -1) return
false;
i++;
}
return true;
}
function CheckNumeric(theField,s) //整数或⼩数
{
var ret = true;
var i;
var str=theField.value;
var Temp = new Number(str);
if (str.length == 0)
{
return warnInvalid (theField, s);
ret=false;
}
if (ret)
{
if (Temp.valueOf() != Temp.valueOf
())
{
return warnInvalid
(theField, s);
}
}
return ret;
}
function validateFormInfo(form)
{
var str
var SumTo
var srSum
var qzSum,InsuSum,TSum,yzSum,fySum
s=document.form1.select.selectedIndex+1;
srSum=field.value;
if (s.length<1)
{
s=1;
}
qzSum=field3.value;
InsuSum=field2.value;
yzSum=field22.value;
fySum=field32.value;
TSum=srSum-qzSum-InsuSum;
/*newAlert_Top("sr="+srSum+"qz="+qzSum+"INsu="+InsuSum+"yz="+yzSum+"fy="+ fySum);*/
if (form == null) return true;
str = "请正确输⼊收⼊⾦额!";
if (!CheckNumeric(form.elements
["textfield"],str)) return false; //收⼊⾦额
if (document.all.select.selectedIndex==0)
{
str = "请正确输⼊社会保险费!";
if (!CheckNumeric(form.elements
["textfield2"],str)) return false; //各项社会保险费
str = "请正确输⼊起征额!";
if (!CheckNumeric(form.elements
if (document.all.select.selectedIndex==8)
{
str = "请正确输⼊财产原值!";
if (!CheckNumeric(form.elements
["textfield22"],str)) return false; //各项社会保险费
str = "请正确输⼊合理交易费⽤!";
if (!CheckNumeric(form.elements
["textfield32"],str)) return false; //起征额
}
switch (s)
{
case 1:
field4.value=Rate1(TSum);
break;
case 2:
field4.value=Rate2(srSum);
break;
case 3:
field4.value=Rate2(srSum);
break;
case 4:
field4.value=Rate3(srSum);
break;
case 5:
field4.value=R4568(srSum)*70/100;        break;
case 6:
field4.value=R4568(srSum);
break;
case 7:
field4.value=srSum*20/100;
break;
case 8:
field4.value=R4568(srSum);
break;
case 9:
if (srSum-yzSum-fySum<0)
{
newAlert_Top("都亏了!不⽤交税了!"); field4.value=0;
}
if (srSum-yzSum-fySum>0)
{
field4.value=
(srSum-yzSum-fySum)*20/100;
}
break;
case 10:
field4.value=srSum*20/100;
break;
case 11:
field4.value=srSum*20/100;
break;
}
}
//--------------------------------以下是算法--------------
//---------------------------------------
function Rate1(XSum)//⼯资薪⾦
{
var Rate;
var Balan;
var TSum;
if (XSum<=500)
{Rate=5;
Balan=0;
}
if ((500<XSum) && (XSum<=2000))
{Rate=10;
Balan=25;
}
if ((2000<XSum) && (XSum<=5000))
{Rate=15;
Balan=125;
}
if ((5000<XSum) && (XSum<=20000))
{Rate=20;
Balan=375;
}
if ((20000<XSum) && (XSum<=40000))
if ((40000<XSum) && (XSum<=60000))  {Rate=30;
Balan=3375;
}
if ((60000<XSum) && (XSum<=80000))  {Rate=35;
Balan=6375;
}
if ((80000<XSum) && (XSum<=100000))  {Rate=40;
Balan=10375;
}
if (XSum>100000)
{Rate=45;
Balan=15375;
}
TSum=(XSum*Rate)/100-Balan
if (TSum<0)
{
TSum=0
}
return TSum
}
function Rate2(XSum)
{
var Rate;
var Balan;
var TSum;
if (XSum<=5000)
{Rate=5;
Balan=0;
}
if ((5000<XSum) && (XSum<=10000))  {Rate=10;
Balan=250;
}
if ((10000<XSum) && (XSum<=30000))  {Rate=20;
Balan=1250;
}
if ((30000<XSum) && (XSum<=50000))  {Rate=30;
Balan=4250;
}
if (50000<XSum)
{Rate=35;
Balan=6750;
}
TSum=(XSum*Rate)/100-Balan;
if (TSum<0)
{
TSum=0
}
return TSum
}
function R4568(XSum)
{
var TSum
if (XSum<=4000)
{
TSum=(XSum-2000)*20/100;
}
if (XSum>4000)
{
TSum=(XSum-(XSum*20/100))*20/100  }
if (TSum<0)
{
TSum=0
}
return TSum
}
function gong()
{
var qznum
var ff
qznum=field3.value; ff=document.all.checkbox.checked;
if (ff)
{
field3.value=4000; }
if (!ff)
{
field3.value=2000; }
}
function Rate3(XSum)/*劳务报酬*/
{
var TSum
var Rate
var Balan
if (XSum<=20000)
{
Rate=20;
Balan=0;
}
if ((XSum>20000) && (XSum<=50000)) {
Rate=30;
Balan=2000;
}
if (XSum>50000)
{
Rate=40;
Balan=7000;
}
if (XSum<=4000)
{
XSum=XSum-800;
}
if (XSum>4000)
{
XSum=XSum-(XSum*20/100);
}
TSum=XSum*Rate/100-Balan;
TSum=0
}
return TSum
}
function CHan()
{
if (document.form1.select.selectedIndex==0)
{
i.style.display="block";
document.all.fei.style.display="block";
}
if (document.form1.select.selectedIndex!=0)
{
i.style.display="none";
document.all.fei.style.display="none";
}
if (document.form1.select.selectedIndex+1!=9)
{
document.all.fei1.style.display="none";
}
if (document.form1.select.selectedIndex+1==9)
{
document.all.fei1.style.display="block";
}
}
//-->
</SCRIPT>
<script type="text/javascript">
var item=new Array(
new Array('银⾏类⼯具(存款)',//<-- ⼤类名,下⾯⼏⾏则为此类下的所有计算器
new Array(
new Array('通知存款计算器','finance.sina/283/2005/0704/2.html'),//<-- 此2项分别为“计算器名”,“链接”      new Array('整存零取计算器','finance.sina/283/2005/0711/24.html'),
new Array('最佳存款组合','finance.sina/283/2005/0711/30.html'),
new Array('整(零)存整取计算器','finance.sina/283/2005/0711/29.html'),
new Array('活期储蓄计算器','finance.sina/283/2005/0711/28.html')
//<-- 依次向下罗列,最后⼀⾏“)”后没有“,”
)
), //<-- ⾮结尾⼤类后有“,”
new Array('银⾏类⼯具(贷款)',//<-- 另⼀个⼤类
new Array(
new Array('等额本息还款计算器','finance.sina/283/2005/0704/3.html'),
new Array('等额本⾦还款计算器','finance.sina/283/2005/0704/1.html'),
new Array('提前还贷计算器','finance.sina/283/2005/0708/18.html'),
new Array('公积⾦贷款额度年限计算器','finance.sina/283/2005/0704/6.html')//<-- 最后⼀⾏“)”后没有“,”    )
), //<-- ⾮结尾⼤类后有“,”
new Array('保险类⼯具',//<-- 另⼀个⼤类
new Array(
new Array('基本养⽼保险计算器','finance.sina/283/2005/0704/10.html'),
new Array('基本医疗保险计算器','finance.sina/283/2005/0708/11.html'),
new Array('⼯伤保险计算器','finance.sina/283/2005/0704/5.html'),
new Array('失业保险','finance.sina/283/2005/0708/16.html'),
new Array('住房公积⾦计算器','finance.sina/283/2005/0711/23.html'),
new Array('退休时每⽉领取的养⽼保险⾦估算计算器','finance.sina/283/2005/0708/20.html')
)
),
new Array('股票类⼯具',//<-- 另⼀个⼤类
new Array(
new Array('股票收益计算器 ','finance.sina/283/2005/0704/8.html')
)
),
new Array('基⾦类⼯具',//<-- 另⼀个⼤类
new Array(
new Array('基⾦买卖计算器','finance.sina/283/2005/0708/12.html')
)
),
new Array('期货类⼯具',//<-- 另⼀个⼤类
new Array(
new Array('期货理财计算器 ','finance.sina/283/2005/0708/14.html')
)
),
new Array('债券类⼯具',//<-- 另⼀个⼤类
new Array(
new Array('债券收益率计算器','finance.sina/283/2005/0711/25.html')
)
),
new Array('外汇',//<-- 另⼀个⼤类
new Array(
new Array('外汇储蓄计算器','finance.sina/283/2005/0711/27.html'),
new Array('外汇兑换计算器','finance.sina/283/2005/0711/26.html')
)
),
new Array('税务类',//<-- 另⼀个⼤类
new Array(
new Array('买房税费计算器','finance.sina/283/2005/0708/17.html'),
new Array('个⼈所得税计算器','finance.sina/283/2005/0704/4.html')
)
),
new Array('理财规划类',//<-- 另⼀个⼤类
new Array(
new Array('理财规划计算器','finance.sina/283/2005/0708/13.html'),
new Array('⼦⼥教育基⾦计算器','finance.sina/283/2005/0711/21.html'),
new Array('投资收益计算器','finance.sina/283/2005/0708/19.html'),
new Array('资产净值计算器','finance.sina/283/2005/0711/22.html'),
new Array('黄⾦理财计算器','finance.sina/283/2005/0704/9.html')
)
),
new Array('买车计算',//<-- 另⼀个⼤类
new Array(
new Array('购车综合计算器','finance.sina/283/2005/0708/15.html')
)

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。