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
}
.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
}
.linkRed A:link {
    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=document.form1.textfield.value;
    if (s.length<1)
    {
     s=1;
    }
    qzSum=document.form1.textfield3.value;
    InsuSum=document.form1.textfield2.value;
    yzSum=document.form1.textfield22.value;
    fySum=document.form1.textfield32.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
 
["textfield3"],str)) return false; //起征额
    }
     
    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:
         
 
document.form1.textfield4.value=Rate1(TSum);
        break;           
 
       
      case 2:
         
 
document.form1.textfield4.value=Rate2(srSum);
        break;
         
      case 3:
         
 
document.form1.textfield4.value=Rate2(srSum);
        break;
       
      case 4:
         
 
document.form1.textfield4.value=Rate3(srSum);
        break;
       
      case 5:
         
 
document.form1.textfield4.value=R4568(srSum)*70/100;
        break;
         
      case 6:
         
 
document.form1.textfield4.value=R4568(srSum);
        break;
         
      case 7:
         
 
document.form1.textfield4.value=srSum*20/100;
        break;
         
      case 8:
         
 
document.form1.textfield4.value=R4568(srSum);
        break;
         
      case 9:
        if (srSum-yzSum-fySum<0)
        {
         newAlert_Top("都亏了!不用交税了!");
          
 
document.form1.textfield4.value=0;
        }
        if (srSum-yzSum-fySum>0)
        {
        document.form1.textfield4.value=
 
(srSum-yzSum-fySum)*20/100;
        }
        break;
         
      case 10:
         
 
document.form1.textfield4.value=srSum*20/100;
        break;
       
      case 11:
         
 
document.form1.textfield4.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))
   {Rate=25;
   Balan=1375;
   }
  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=document.form1.textfield3.value;
 ff=document.all.checkbox.checked;
 if (ff)
 {
 document.form1.textfield3.value=4000;
 }
 if (!ff)
 {
 document.form1.textfield3.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;
  
 if (TSum<0)
 {
  TSum=0
 }
 return TSum
}
 
  
function CHan()
{
 if (document.form1.select.selectedIndex==0)
 {
  document.all.gongzi.style.display="block";
  document.all.fei.style.display="block";
 }
 if (document.form1.select.selectedIndex!=0)
 {
  document.all.gongzi.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('通知存款计算器','http://finance.sina.com.cn/283/2005/0704/2.html'),//<-- 此2项分别为“计算器名”,“链接”
      new Array('整存零取计算器','http://finance.sina.com.cn/283/2005/0711/24.html'),
      new Array('最佳存款组合','http://finance.sina.com.cn/283/2005/0711/30.html'),
      new Array('整(零)存整取计算器','http://finance.sina.com.cn/283/2005/0711/29.html'),
      new Array('活期储蓄计算器','http://finance.sina.com.cn/283/2005/0711/28.html')
       //<-- 依次向下罗列,最后一行“)”后没有“,”
    )
  ), //<-- 非结尾大类后有“,”
 
  new Array('银行类工具(贷款)',//<-- 另一个大类
    new Array(
      new Array('等额本息还款计算器','http://finance.sina.com.cn/283/2005/0704/3.html'),
      new Array('等额本金还款计算器','http://finance.sina.com.cn/283/2005/0704/1.html'),
      new Array('提前还贷计算器','http://finance.sina.com.cn/283/2005/0708/18.html'),
      new Array('公积金贷款额度年限计算器','http://finance.sina.com.cn/283/2005/0704/6.html')//<-- 最后一行“)”后没有“,”
    )
  ), //<-- 非结尾大类后有“,”
 
  new Array('保险类工具',//<-- 另一个大类
    new Array(
      new Array('基本养老保险计算器','http://finance.sina.com.cn/283/2005/0704/10.html'),
      new Array('基本医疗保险计算器','http://finance.sina.com.cn/283/2005/0708/11.html'),
      new Array('工伤保险计算器','http://finance.sina.com.cn/283/2005/0704/5.html'),
      new Array('失业保险','http://finance.sina.com.cn/283/2005/0708/16.html'),
      new Array('住房公积金计算器','http://finance.sina.com.cn/283/2005/0711/23.html'),
      new Array('退休时每月领取的养老保险金估算计算器','http://finance.sina.com.cn/283/2005/0708/20.html')
    )
  ),
 
  new Array('股票类工具',//<-- 另一个大类
    new Array(
      new Array('股票收益计算器 ','http://finance.sina.com.cn/283/2005/0704/8.html')
       
    )
  ),
 
  new Array('基金类工具',//<-- 另一个大类
    new Array(
      new Array('基金买卖计算器','http://finance.sina.com.cn/283/2005/0708/12.html')
    )
  ),
 
  new Array('期货类工具',//<-- 另一个大类
    new Array(
      new Array('期货理财计算器 ','http://finance.sina.com.cn/283/2005/0708/14.html')
    )
  ),
 
  new Array('债券类工具',//<-- 另一个大类
    new Array(
      new Array('债券收益率计算器','http://finance.sina.com.cn/283/2005/0711/25.html')
    )
  ),
 
  new Array('外汇',//<-- 另一个大类
    new Array(
      new Array('外汇储蓄计算器','http://finance.sina.com.cn/283/2005/0711/27.html'),
      new Array('外汇兑换计算器','http://finance.sina.com.cn/283/2005/0711/26.html')
    )
  ),
 
  new Array('税务类',//<-- 另一个大类
    new Array(
      new Array('买房税费计算器','http://finance.sina.com.cn/283/2005/0708/17.html'),
      new Array('个人所得税计算器','http://finance.sina.com.cn/283/2005/0704/4.html')
       
    )
  ),
 
  new Array('理财规划类',//<-- 另一个大类
    new Array(
      new Array('理财规划计算器','http://finance.sina.com.cn/283/2005/0708/13.html'),
      new Array('子女教育基金计算器','http://finance.sina.com.cn/283/2005/0711/21.html'),
      new Array('投资收益计算器','http://finance.sina.com.cn/283/2005/0708/19.html'),
      new Array('资产净值计算器','http://finance.sina.com.cn/283/2005/0711/22.html'),
      new Array('黄金理财计算器','http://finance.sina.com.cn/283/2005/0704/9.html')
    )
  ),
  new Array('买车计算',//<-- 另一个大类
    new Array(
      new Array('购车综合计算器','http://finance.sina.com.cn/283/2005/0708/15.html')
    )
  ),
 
  new Array('购房计算',//<-- 另一个大类
    new Array(
      new Array('购房能力评估计算器','http://finance.sina.com.cn/283/2005/0704/7.html'),
      new Array('提前还贷计算器','http://finance.sina.com.cn/283/2005/0708/18.html'),
      new Array('税费计算器','http://finance.sina.com.cn/283/2005/0708/17.html'),
      new Array('公基金贷款额度年限计算器','http://finance.sina.com.cn/283/2005/0704/6.html'),
      new Array('等额本金还款法计算器','http://finance.sina.com.cn/283/2005/0704/1.html'),
      new Array('等额本息还款法计算器','http://finance.sina.com.cn/283/2005/0704/3.html')
     
    )
  )
 
 
);
 
//--------------
 
var img0 =new Image();
img0.src="/UploadFiles/2021-04-02/cj_jsq_lj_010.gif">

以上所述就是本文的全部内容了,希望大家能够喜欢。

标签:
javascript,个人所得税,计算器

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
桃源资源网 Design By www.nqtax.com

评论“Javascript实现计算个人所得税”

暂无“Javascript实现计算个人所得税”评论...