<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  <title>个人所得税申报_限售股转让所得明细数据</title>
  <style>
    button {
      padding:0px;
      height:18px;
    }
    body {
      margin:2px;
    }
    body,p,div,span,td,th,select,button,input {
      font-size:9pt;font-family:"宋体";
    }
    th {
      padding:1px 2px 0px 2px;
      font-weight:normal;
    }
    td{
      padding:0px 1px 0px 1px;
      font-weight:normal;
    }
    input {
      border:0px;
      padding:1px 1px 0px 1px;
      width:100%;
    }
    .aright {
      text-align:right;
    }
    .aright1 {
      text-align:right;
      background:#EEEEEE;
    }
    .bg1 {
      background:#EEEEEE;
    }
  </style>
</head>
<script>
function changeBodySize(obj) {
  document.body.style.zoom = obj.value;
}
function bto_scale(num, scale) {
  if(num.length == 0) return "";
  var n = parseFloat(num);
  if(n > 0) {
    n += 0.000001;
  } else {
    n -= 0.000001;
  }
  var str = bto_num2str(n);
  str = bto_movePoint(str,scale);
  n = Math.round(parseFloat(str));
  str = bto_movePoint(bto_num2str(n),scale * -1);
  
  if (str.indexOf(".") == -1) {
    str += "."
    for(var i=0;i<scale;i++) {
      str += "0";
    }
  }
  if(str.indexOf(".") == str.length -2) {
    str += "0";
  }
  return str;
}
function bto_num2str(num) {
  var str = "" + num;
  var p = str.indexOf("e");
  if(p != -1) {
    var s1 = str.substring(0,p);
    var s2 = str.substring(p+1,str.length);
    str = bto_movePoint(s1,s2);
  }
  return str;
}
function bto_movePoint(str,n) {
  str = "" + str;
  if(str.indexOf(".") == -1) {
    str = str + ".";
  }
  var flag = "";
  if(str.charAt(0) == "-") {
    flag = "-";
    str = str.substring(1,str.length);
  }
  str = "00000000000000000000000000000000000000000000000000" + str + "00000000000000000000000000000000000000000000000000";
  n = parseInt(n,10);
  var p = str.indexOf(".");
  var s1 = str.substring(0,p);
  var s2 = str.substring(p+1,str.length);
  str = "" + s1 + s2;
  p += n;
  str = str.substring(0,p) + "." + str.substring(p,str.length);
  while(str.substring(0,1) == "0" && str.substring(1,2) != ".") {
    str = str.substring(1,str.length);
  }
  while(str.substring(str.length-1,str.length) == "0") {
    str = str.substring(0,str.length-1);
  }
  if(str.substring(str.length-1,str.length) == ".") {
    str = str.substring(0,str.length-1);
  }
  return flag + str;
}
function validName(s) {
  var result = new Array();
  result[0] = "0";
  result[1] = "";

  if(s.length < 2) {
    result[0] = "2";
    result[1] += "长度小于二";
  }

  return result;
}
function validCode(s,t) {
  var result = new Array();
  result[0] = "0";
  result[1] = "";

  if(s.length == 0) {
    result[0] = "2";
    result[1] += "，长度为空";
  }

  if(t == "06") {
    if(s.length > 6) {
      var _same = true;
      for(var i=1;i<6;i++) {
        if(s.charAt(i) != s.charAt(0)) {
          _same = false;
          break;
        }
      }
      if(_same) {
        result[0] = "2";
        result[1] += "，身份证号码前5位重复";
      }
    }
    if(s.length == 18) {
      reg = /^\d+(\d|X)$/g;
      if(!reg.test(s)) {
        result[0] = "2";
        result[1] += "，身份证号码不正确";
      }
      var md = s.substring(10,14);
      if(!validMD(md)) {
        result[0] = "2";
        result[1] += "，身份证号码中日期错误";
      }
    }else {
      result[0] = "2";
      result[1] += "，身份证号码必须为18位";
    }
  }

  if(result[1].length > 1) {
    result[1] = result[1].substring(1,result[1].length);
  }

  return result;
}
function validMD(s) {
  if(s == "0230") return false;
  if(s == "0431") return false;
  if(s == "0631") return false;
  if(s == "0931") return false;
  if(s == "1131") return false;

  var m = s.substring(0,2);
  var d = s.substring(2,4);

  if(parseInt(m,10) < 1 || parseInt(m,10) > 12) {
    return false;
  }
  if(parseInt(d,10) < 1 || parseInt(d,10) > 31) {
    return false;
  }
  return true;
}
function valid(em_id) {
  var _status1 = 0;
  var _status2 = "";
  
  var row = em_id.split("_")[1];

  var _status = document.getElementById("status_" + row);
  var _statusC = document.getElementById("statusC_" + row);

  var _name = document.getElementById("name_" + row).value;
  
  if(_name == "") return;

  setDefault(document.getElementById(em_id));

  var _a = document.getElementById("A_" + row);
  var _b = document.getElementById("B_" + row);
  var _c = document.getElementById("C_" + row);
  var _d = document.getElementById("D_" + row);
  var _e = document.getElementById("E_" + row);
  var _f = document.getElementById("F_" + row);
  var _g = document.getElementById("G_" + row);
  var _h = document.getElementById("H_" + row);
  var _i = document.getElementById("I_" + row);
  var _j = document.getElementById("J_" + row);
  var _k = document.getElementById("K_" + row);
  var _l = document.getElementById("L_" + row);
  var _m = document.getElementById("M_" + row);
  var _n = document.getElementById("N_" + row);
  var _remark = document.getElementById("remark_" + row);
  
  if(_a.value != "01"
  && _a.value != "02"
  && _a.value != "03"
  && _a.value != "04"
  && _a.value != "05"
  && _a.value != "06"
  && _a.value != "07"
  && _a.value != "90") {
    _status1 = 2;
    _status2 += "；证件类型填写错误：错误代码";
  }

  var res;

  res = validName(_name);
  if(res[0] != "0") {
    _status1 = 2;
    _status2 += "；姓名填写错误：" + res[1];
  }

  res = validCode(_b.value,_a.value);
  if(res[0] != "0") {
    _status1 = 2;
    _status2 += "；证件号码填写错误：" + res[1];
  }
  
  _m.value = "0.20";

  var reg = /^\d+(\.\d{1,2}|\d*)$/;
  
  if(!reg.test(_f.value)) {
    _status1 = 2;
    _status2 += "；每股计税价格格式错误";
  }else if(parseInt(_g.value,10) != _g.value) {
    _status1 = 2;
    _status2 += "；转让股数格式错误";
  }else {
    _h.value = bto_scale(parseFloat(_f.value) * parseFloat(_g.value),2);
    if(!reg.test(_j.value)) {
      _status1 = 2;
      _status2 += "；原值格式错误";
    }else if(!reg.test(_k.value)) {
      _status1 = 2;
      _status2 += "；合理税费格式错误";
    } else {
      _i.value = bto_scale(parseFloat(_j.value) + parseFloat(_k.value),2);
      _l.value = bto_scale(parseFloat(_h.value) - parseFloat(_i.value),2);
      if(_l.value < 0) _l.value = "0.00";
      _n.value = bto_scale(parseFloat(_l.value) * parseFloat(_m.value),2);
      if(_n.value < 1) _n.value = "0.00";
    }
  }

  if(_status2.length > 1) {
    _status2 = _status2.substring(1,_status2.length);
  }
  _status.value = _status2;

  if(_status1 == 2) {
    _status.style.color = "red";
    document.getElementById("name_" + row).style.color = "red";
  } else if(_status1 == 1) {
    _status.style.color = "blue";
  } else {
     _status.style.color = "black";
     _status.value = "通过";    
     document.getElementById("name_" + row).style.color = "black";
  }
  _statusC.value = _status1;
}
function del_new(em) {
  var row = em.id.split("_")[1];
  var s = document.getElementById("statusC_" + row);
  if(s.value == "") return;
  
  var flag;
  if(s.value.substring(0,1) == "-") {
    s.value = s.value.substring(1,s.value.length);
    flag = false;
    document.getElementById("del_" + row).innerText = "删除";
  } else {
    s.value = "-" + s.value;
    flag = true;
    document.getElementById("del_" + row).innerText = "恢复";
  }
  var ips = em.parentElement.parentElement.all.tags("input");
  for(var i=1;i<ips.length;i++) {
    ips[i].disabled = flag;
  }
}
function del(em) {
  var ips = em.parentElement.parentElement.all.tags("input");
  for(var i=1;i<ips.length;i++) {
    ips[i].value = "";
  }
}
function _del() {
  if(document.getElementById("flag3").value != "0") {
    var d = document.getElementById("del_" + document.getElementById("flag3").value);
    var r = document.getElementById("row_" + document.getElementById("flag3").value);
    r.value = "";
    del(d);
  }
}
function _valid() {
  for(var j=1;j<=20;j++) {
    var isEmpty = true;
    var elm = document.getElementById("name_" + j);
    var ips = elm.parentElement.parentElement.all.tags("input");
    for(var i=1;i<ips.length;i++) {
      if(ips[i].value != "") {
        isEmpty= false;
      }
    }
    if(!isEmpty) {
      valid("name_" + j);
    }
  }
}
function __valid() {
  if(document.getElementById("flag2").value != "0") {
    var ips = document.all.tags("input");
    for(var i=1;i<ips.length;i++) {
      if(ips[i].disabled) {
        ips[i].disabled = false;
      }
    }
    ips = document.all.tags("button");
    for(var i=1;i<ips.length;i++) {
      if(ips[i].innerText == "恢复") {
        ips[i].innerText = "删除"
      }
    }
    for(var i=1;i<=20;i++){
      var s = document.getElementById("statusC_"+i);
      if(s.value != "" && s.value != "0"){         
        document.getElementById("status_"+i).style.color = "red";
        document.getElementById("name_" + i).style.color = "red";
      }else{
        document.getElementById("name_" + i).style.color = "black";
      }
    }
  }
}
function setDefault(em) {
  if(em.value != "") return;

  var _id = em.id.split("_")[0];

  if(_id == "name") return;

  if(_id == "A") {
    em.value = "06";
  }
}
function help(em) {
  var _id = em.id.split("_")[0];
  var oHelp = document.all._help;

  if(_id == "name"){ 
    oHelp.innerHTML = "纳税人身份证件上面的名称，请如实填写";
  } else if(_id == "A") {
    oHelp.innerHTML = "[01-护照] [02-通行证] [03-回乡证] [04-台胞证] [05-旅行证] [06-身份证] [07-军官证] [90-其他]";
  } else if(_id == "B"){
     oHelp.innerHTML = "纳税人身份证件上面的名称，请如实填写";
  } else if(_id == "C"){
    oHelp.innerHTML = "请如实填写";  
  } else if(_id == "D"){
    oHelp.innerHTML = "请如实填写";  
  } else if(_id == "E"){
    oHelp.innerHTML = "请如实填写";  
  } else if(_id == "F"){
    oHelp.innerHTML = "请如实填写";  
  } else if(_id == "G"){
    oHelp.innerHTML = "请如实填写";  
  } else if(_id == "H"){
    oHelp.innerHTML = "该字段由系统自动计算";  
  } else if(_id == "I"){
    oHelp.innerHTML = "该字段由系统自动计算";  
  } else if(_id == "J"){
    oHelp.innerHTML = "请如实填写";  
  } else if(_id == "K"){
    oHelp.innerHTML = "请如实填写";  
  } else if(_id == "L"){
    oHelp.innerHTML = "该字段由系统自动计算";  
  } else if(_id == "M"){
    oHelp.innerHTML = "该字段由系统自动计算";  
  } else if(_id == "N"){
    oHelp.innerHTML = "该字段由系统自动计算";  
  }
}
</script>
<body>
<input type="hidden" id="flag2" value="0" onpropertychange="__valid()">
<input type="hidden" id="flag3" value="0" onpropertychange="_del()">
<input type="hidden" id="title" value="限售股转让所得明细数据">
<div style="border:1px solid gray;padding:2px">
<div align="center"><b>个 人 所 得 税 申 报 （ 限 售 股 转 让 所 得 明 细 数 据 ）</b></div>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
    <td>
    <button onclick="WebBrowser.ExecWB(6,1)">打 印</button>&nbsp;
    <button onclick="WebBrowser.ExecWB(7,1)">打印预览</button>&nbsp;
    <button onclick="WebBrowser.ExecWB(8,1)">打印设置</button>&nbsp;
    <span>
    缩放比例：
    <select id="bodySize" onchange="changeBodySize(this)">
      <option value="1.00">100%</option>
      <option value="0.80">80%</option>
      <option value="0.70">70%</option>
      <option value="0.50">50%</option>
      <option value="0.40">40%</option>
      <option value="0.35">35%</option>
      <option value="0.30">30%</option>
    </select>
    </span>
    </td>
    <td align="left">编制单位：<input id="cname" style="width:320px;text-align:left" readonly></td>
    <td align="right">金额单位：元（列至角分）</td>
  </tr>
</table>
<table cellspacing="0" cellpadding="0" style="border-collapse:collapse" border="1" bordercolor="gray" id="main">
  <tr class="bg1">
    <th nowrap rowspan="3">&nbsp;序号&nbsp;</th>
    <th nowrap rowspan="2">纳税人<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;姓名&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
    <th nowrap colspan="2">纳税人有效身份证照</th>
    <th nowrap rowspan="2">证券<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;账户号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
    <th nowrap rowspan="2">股票代码</th>
    <th nowrap rowspan="2">&nbsp;&nbsp;&nbsp;&nbsp;股票名称&nbsp;&nbsp;&nbsp;&nbsp;</th>
    <th nowrap rowspan="2">每股计税<br>价格<br>(元/股)</th>
    <th nowrap rowspan="2">&nbsp;转让股数&nbsp;<br>(股)</th>
    <th nowrap rowspan="2">&nbsp;&nbsp;转让收入额&nbsp;&nbsp;</th>
    <th nowrap colspan="3">限售股原值及合理税费</th>
    <th nowrap rowspan="2">&nbsp;&nbsp;&nbsp;&nbsp;应纳税&nbsp;&nbsp;&nbsp;&nbsp;<br>所得额</th>
    <th nowrap rowspan="2">税率</th>
    <th nowrap rowspan="2">扣缴<br>税额</th>
    <th nowrap rowspan="3"><span style="width:320px">审核状态</span><a name="_valid_"></a></th>
    <th nowrap rowspan="3">操作</th>
  </tr>
  <tr class="bg1">
    <th nowrap>证照<br>类型</th>
    <th nowrap>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;证照号码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>
    <th nowrap>小计</th>
    <th nowrap>&nbsp;&nbsp;&nbsp;&nbsp;原值&nbsp;&nbsp;&nbsp;&nbsp;</th>
    <th nowrap>&nbsp;&nbsp;&nbsp;&nbsp;合理&nbsp;&nbsp;&nbsp;&nbsp;<br>税费</th>
  </tr>
  <tr class="bg1">
    <th nowrap>(1)</th>
    <th nowrap>(2)</th>
    <th nowrap>(3)</th>
    <th nowrap>(4)</th>
    <th nowrap>(5)</th>
    <th nowrap>(6)</th>
    <th nowrap>(7)</th>
    <th nowrap>(8)</th>
    <th nowrap>(9)=(7)×(8)</th>
    <th nowrap>(10)=(11)+(12)</th>
    <th nowrap>(11)</th>
    <th nowrap>(12)</th>
    <th nowrap>(13)=(9)-(10)</th>
    <th nowrap>(14)</th>
    <th nowrap>(15)=(13)×(14)</th>
  </tr>
  <script>
    for(var i=1;i<=20;i++) {
      document.write("<tr>");
      document.write("<td><input             id='row_" + i +"'     value='" + i +"' style='text-align:center' readonly></td>");
      document.write("<td><input             id='name_" + i +"'    onblur='valid(this.id)' maxlength='32' onfocus='help(this)'></td>");
      document.write("<td><input             id='A_" + i +"'       onblur='valid(this.id)' maxlength='2' onfocus='help(this)' style='text-align:center'></td>");
      document.write("<td><input             id='B_" + i +"'       onblur='valid(this.id)' maxlength='18' onfocus='help(this)'></td>");
      document.write("<td><input             id='C_" + i +"'       onblur='valid(this.id)' maxlength='20' onfocus='help(this)'></td>");
      document.write("<td><input             id='D_" + i +"'       onblur='valid(this.id)' maxlength='6' onfocus='help(this)' style='text-align:center'></td>");
      document.write("<td><input             id='E_" + i +"'       onblur='valid(this.id)' maxlength='8' onfocus='help(this)'></td>");
      document.write("<td><input             id='F_" + i +"'       onblur='valid(this.id)' maxlength='7' onfocus='help(this)' class='aright'></td>");
      document.write("<td><input             id='G_" + i +"'       onblur='valid(this.id)' maxlength='10' onfocus='help(this)' class='aright'></td>");
      document.write("<td class='bg1'><input id='H_" + i +"'       class='aright1' readonly onfocus='help(this)'></td>");
      document.write("<td class='bg1'><input id='I_" + i +"'       class='aright1' readonly onfocus='help(this)'></td>");
      document.write("<td><input             id='J_" + i +"'       onblur='valid(this.id)' maxlength='12' onfocus='help(this)' class='aright'></td>");
      document.write("<td><input             id='K_" + i +"'       onblur='valid(this.id)' maxlength='12' onfocus='help(this)' class='aright'></td>");
      document.write("<td class='bg1'><input id='L_" + i +"'       class='aright1' readonly onfocus='help(this)'></td>");
      document.write("<td class='bg1'><input id='M_" + i +"'       class='aright1' readonly onfocus='help(this)'></td>");
      document.write("<td class='bg1'><input id='N_" + i +"'       class='aright1' readonly onfocus='help(this)'></td>");
      document.write("<td class='bg1'><input id='status_" + i +"'  class='bg1' readonly>");
      document.write("                <input id='statusC_" + i +"' type='hidden'></td>");
      document.write("<td class='bg1'><button            id='del_" + i +"'     onclick='del_new(this)'>删除</button></td>");
      document.write("</tr>");
    }
  </script>
</table>
<table border="0" width="100%">
  <tr>
    <td style="padding-top:4px">
      <span style="width:99px"><span id="ss1">共0条记录</span></span>
      <span style="width:50px">第<span id="ss2">1</span>页</span>
      <span style="width:50px">共<span id="ss3">1</span>页</span>
      &nbsp;<button id="b1">首页</button>
      &nbsp;<button id="b2">上页</button>
      &nbsp;<button id="b3">下页</button>
      &nbsp;<button id="b4">尾页</button>
      &nbsp;<button id="b6">转至</button>
      &nbsp;<input  id="ppp" style="width:40px;border:1px solid gray">&nbsp;页
      &nbsp;&nbsp;&nbsp;&nbsp;<button id="b11">分项汇总</button>
      &nbsp;&nbsp;&nbsp;&nbsp;<button id="b5">显示全部</button>
      &nbsp;&nbsp;&nbsp;&nbsp;<button onclick="_valid();document.body.scrollLeft=10000;">校验本页</button>
      &nbsp;&nbsp;&nbsp;&nbsp;<button id="b12">插入记录</button>
      &nbsp;&nbsp;&nbsp;&nbsp;<button onclick="help_html()">帮助</button>
      &nbsp;&nbsp;&nbsp;&nbsp;<button id="b9">设置单位</button>
      &nbsp;&nbsp;&nbsp;&nbsp;<button id="b10">模糊查询</button>
    </td>
  </tr>
</table>
<table style="width:2000px">
  <tr>
    <td id="_help"  style="padding-left:3px;padding-top:3px;border-top:1px solid gray;color:red;width:1000px">&nbsp;<td>
  </tr>
</table>
</div>
<object id="WebBrowser" width="0" height="0" classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
</body>
<script>
function help_html() {
  var aw = screen.availWidth;
  var ah = screen.availHeight;
  
  var h = 600;
  var w = 800;
  
  var l = (aw - w)/2
  var t = (ah - h)/2
  
  window.open("../help/index.htm","_blank","top="+ t + ",left=" + l + ",width=" + w + ",height=" + h + ",resizable=1,scrollbars=1");
}
function getP(ee) {
  if(ee.tagName == "TR") {
    return ee;
  } else {
    return getP(ee.parentElement);
  }
}
var _focus = null;
function _onfocus() {
  document.all.main.style.borderBottom = "1px solid gray";
  if(_focus) {
    var cc = _focus.all.tags("TD");
    for(var i=0;i<cc.length;i++) {
      cc[i].style.borderTop = "1px solid gray";
      cc[i].style.borderBottom = "1px solid gray";
    }
  }
  _focus = getP(event.srcElement)
  var rr = _focus.all.tags("TD");
  for(var i=0;i<rr.length;i++) {
    rr[i].style.borderTop = "2px solid orange";
    rr[i].style.borderBottom = "2px solid orange";
  }
  if(_focus == document.all.main.rows[20]) {
    document.all.main.style.borderBottom = "2px solid orange";
  }
}
function _init() {
  var _rows = document.all.main.rows;
  for(var i=1;i<_rows.length;i++) {
    _rows[i].onclick = _onfocus;
  }
}
_init();
</script>
</html>
