最新个人所得税计算器源码(含新旧税法比较功能)

  <p><style type="text/css">
.tContent { background:#fff; border:1px solid #ccc; padding:15px; position:relative; text-align:left;width:520px; overflow:hidden;}
.tContent input{background:#fff; border:1px solid #dfdfdf; }
.tContent .tChange { right:0px; top:131px; width:150px; position:absolute; }
.tContent .tChange input { width:150px; border:0; }
input.cresult, input.moreTax, input.lessTax, input.stTax { font-family:Verdana, Geneva, sans-serif; font-size:30px; width:150px; }
.moreTax { color:#BA2636; }
.lessTax { color:#008000; }
.stTax { color:#C9C9C9; }
input.taxCount { width:110px; color:#000; font-weight:bold;}
input.buttoner{ background:url(http://img3.cache.netease.com/stock/2011/4/21/201104210004022697b.png) no-repeat; width:63px; height:21px; border:0; text-align:center; margin:5px 0; cursor:pointer;}
td{word-break: break-all;}
/*数据表格*/
.data{ width:550px;}
.header em{border-bottom:0; }
/*数据表格*/
.data em{ border-top:1px solid #DFDFDF; padding:4px 0px; display:inline-block; width:80px; margin:0; color:#626262 }
.data em.fr{ width:100px}
.data em.cust{ color:#464646; background:#fafafa;}
.theader td{ padding:5px 0; }</style><SCRIPT language="javascript">
 function round(v,e) //四舍五入取小数点后两位
  {  
    var t=1;  
    for(;e>0;t*=10,e--);  
    for(;e<0;t/=10,e++);  
    return Math.round(v*t)/t;  
  }
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 taxStartSum_9,taxStartSum_7,InsuSum,TSum_9,TSum_7,yzSum,fySum
    
    
    srSum=document.form1.inCome.value;//读取工薪数额
    
   taxStartSum_9=document.form1.taxSta_9.value;//9级税制下起征点
  taxStartSum_7=document.form1.taxSta_7.value;//7级税制下起征点
   InsuSum=document.form1.insuContent.value;//读取保险金额
   TSum_9=srSum-taxStartSum_9-InsuSum;//9级税制下最终征税主体
  TSum_7=srSum-taxStartSum_7-InsuSum;//7级税制下最终征税主体
  var finaltaxbody=srSum-InsuSum;
    
  if (form == null) return true;
  str = "请正确输入收入金额。";
   if (!CheckNumeric(form.elements
["inCome"],str)) return false;  //收入金额
   
   
 
    if  (!CheckNumeric(form.elements
["insuContent"], "请正确输入社会保险费。")) return false; //各项社会保险费
      
          
    if  (!CheckNumeric(form.elements
["taxSta_9"],"请正确输入起征额。")) return false; //起征额  
 
var diff_0=round(Rate_9(TSum_9)-Rate_7_0(TSum_7),2)
var diff_1=round(Rate_9(TSum_9)-Rate_7(TSum_7),2)
if(diff_0>0){diff_0="减少<span class='lessTax'>"+diff_0+"</span>"} else if(diff_0==0){diff_0="<span class='stTax'>无变化</span>"}else if(diff_0<0){diff_0=-diff_0;diff_0="增加<span class='moreTax'>" + diff_0+"</span>"}
if(diff_1>0){diff_1="减少<span class='lessTax'>"+diff_1+"</span>"} else if(diff_1==0){diff_1="<span class='stTax'>无变化</span>"}else if(diff_1<0){diff_1=-diff_1;diff_1="增加<span class='moreTax'>" +diff_1+"</span>"}
var diff=Rate_9(TSum_9)-Rate_7(TSum_7)
var dataTable=document.getElementById("dataTable")
var taxChange=round(Rate_7(TSum_7)-Rate_9(TSum_9),2);
dataTable.innerHTML="<em class='fr cust'>"+finaltaxbody+"</em><em class='cust'>"+round(Rate_9(TSum_9),2)+"</em><em class='cust'>"+round(Rate_7_0(TSum_7),2)+"</em><em class='cust'>"+diff_0+"</em><em class='cust'>"+round(Rate_7(TSum_7),2)+"</em><em class='cust'>"+diff_1+"</em><br>"+dataTable.innerHTML;
    
 }
//--------------------------------算法--------------
function Rate_9(XSum)//工资薪金
 {
 var Rate;
 var Balan;//数算扣除数
 var TSum_9;
 if (XSum<=500)
   {Rate=3;
   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_9=(XSum*Rate)/100-Balan
  if (TSum_9<0)
  {
    TSum_9=0
  }
   return TSum_9
 }
function Rate_7(XSum)//工资薪金
 {
 var Rate;
 var Balan;
 var TSum_7;
 if (XSum<=1500)
   {Rate=3;
   Balan=0;
   }
 if ((1500<XSum) && (XSum<=4500))
   {Rate=10;
   Balan=105;
   }
 if ((4500<XSum) && (XSum<=9000))
   {Rate=20;
   Balan=555;
   }
 if ((9000<XSum) && (XSum<=35000))
   {Rate=25;
   Balan=1005;
   }
 if ((35000<XSum) && (XSum<=55000))
   {Rate=30;
   Balan=2755;
   }
 if ((55000<XSum) && (XSum<=80000))
   {Rate=35;
   Balan=5505;
   }
 if (XSum>80000)
   {Rate=45;
   Balan=13505;
   }
   TSum_7=(XSum*Rate)/100-Balan
  if (TSum_7<0)
  {
    TSum_7=0
  }
   return TSum_7
 }
 
 function Rate_7_0(XSum)//工资薪金
 {
 var Rate;
 var Balan;
 var TSum_7;
 if (XSum<=1500)
   {Rate=5;
   Balan=0;
   }
 if ((1500<XSum) && (XSum<=4500))
   {Rate=10;
   Balan=75;
   }
 if ((4500<XSum) && (XSum<=9000))
   {Rate=20;
   Balan=525;
   }
 if ((9000<XSum) && (XSum<=35000))
   {Rate=25;
   Balan=975;
   }
 if ((35000<XSum) && (XSum<=55000))
   {Rate=30;
   Balan=2725;
   }
 if ((55000<XSum) && (XSum<=80000))
   {Rate=35;
   Balan=5475;
   }
 if (XSum>80000)
   {Rate=45;
   Balan=13475;
   }
   TSum_7=(XSum*Rate)/100-Balan
  if (TSum_7<0)
  {
    TSum_7=0
  }
   return TSum_7
 }
 
 
 
//-->
      </SCRIPT></p>
<div class="tContent">
<form id="form1" name="form1">
    <table border="0" cellspacing="0" width="550">
        <tbody>
            <tr>
                <td valign="top">薪金收入金额数:<input id="inCome" style="width: 130px" name="inCome" type="text" /> 元</td>
                <td valign="top">各项社会保险费:<input id="insuContent" style="width: 130px; margin-left: 7px" name="insuContent" value="0" type="text" /> 元</td>
            </tr>
            <tr>
            </tr>
            <tr>
                <td>现行起征额:<input id="taxSta_9" style="width: 130px; margin-left: 24px" name="taxSta_9" value="2000" type="text" /> 元</td>
                <td>调整后起征额:<input id="taxSta_7" style="width: 130px; margin-left: 19px" name="taxSta_7" value="3500" type="text" /> 元</td>
            </tr>
            <tr>
                <td colspan="2"><input class="buttoner" type="button" οnclick="validateFormInfo(this.form,1)" name="button" value="计算" /></td>
            </tr>
        </tbody>
    </table>
    <table border="0" cellspacing="0" cellpadding="0" width="550" style="background: url(http://img001.photo.21cn.com/photos/album/20110630/o/D25EF9F73742F6E14064BCFFAB0F4B21.jpg) no-repeat left center">
        <tbody>
            <tr class="theader">
                <td width="179">&nbsp;</td>
                <td width="160">初审</td>
                <td>二审</td>
            </tr>
        </tbody>
    </table>
    <table border="0" cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <td>
                <div class="data"><em class="fr">扣保险费后收入</em><em>调整前税额</em><em>调整后税额</em><em>税额变化</em><em>调整后税额</em><em>税额变化</em></div>
                <div id="dataTable" class="data">&nbsp;</div>
                </td>
            </tr>
        </tbody>
    </table>
</form>
<p>&nbsp;</p>
</div>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值