<!-- #include file="../conn.asp" -->
<!-- #include file="../const.asp" -->
<%call chksunzom()
id=chk0(requestA("id"))

if instr(quanxs,"x7t")<=0 then call sunzomqx()
%>
<!-- #include file="../inc/md5.asp" -->
<html>
<head>
<title><%=dianming%> - 修改员工账号资料</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../images/sunzom.css" rel="stylesheet" type="text/css">

<script>
function CheckAll(form)  {
  for (var i=0;i<form.elements.length;i++)    {
    var e = form.elements[i];
    if (e.name != 'chkall')       e.checked = form.chkall.checked; 
   }
  }
</script>
<script src="../client.js"></script>
</HEAD>
<BODY>
<%if request("hid1")="" then%> 
<script language="javascript">
function check()
{
if (document.form1.username.value==""||document.form1.bianhao.value==""||document.form1.sfz.value=="")
{
alert("有*号的必须填写！");
return false;
}
}
</script>
<%
sql="select * from login where id="&request("id")
set rs=conn.execute(sql)
nowqx=rs("quanxian")
zuzw=rs("zuzw")
xsuser=rs("xsuser")
ygbhao=rs("bianhao")
userzt=rs("userzt")
sunkey=rs("sunkey")
%>
<form name="form1">
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#C4D8ED">
<tr>
<td><img src="../images/r_1.gif" alt="" /></td>
<td width="100%" background="../images/r_0.gif">
  <table cellpadding="0" cellspacing="0" width="100%">
    <tr>
      <td>&nbsp;员工/登陆账号资料修改(带*号的为必填项)</td>
	  <td align="right">　</td>
    </tr>
  </table>
</td>
<td><img src="../images/r_2.gif" alt="" /></td>
</tr>
<tr>
<td></td>
<td>
<table align="center" cellpadding="4" cellspacing="1" class="toptable grid" border="1">
      <tr>
        <td height="30" align="right">所属部门：</td>
        <td class="category">
<%=zuxuan(""&rs("id_zu")&"",zux1)%>    <input type="checkbox" name="userzt" value="1" <%if userzt=1 then%>checked<%end if%>>账号开启(离职请取消)
		</td>
      </tr>

	  <tr>
        <td height="30" align="right">姓名(登陆账号1)：</td>
        <td class="category"><input type="text" name="bianhao" value="<%=ygbhao%>" style="width:100px">
          &nbsp;*&nbsp; 编号(登陆账号2)：<input type="text" name="username" value="<%=rs("username")%>" style="width:100px" <%if rs("id")=1 then%> readonly="true"<%end if%>>
		  <input type="hidden" name="oldusername" value="<%=rs("username")%>">*&nbsp;  性别：<input type="radio" name="xinbie" value="女"<%if rs("xinbie")="女" then%> checked="checked"<%end if%>>女 <input type="radio" name="xinbie" value="男"<%if rs("xinbie")="男" then%> checked="checked"<%end if%>>男
		</td>
      </tr>
      <tr>
        <td align="right" height="30">登陆密码：</td>
        <td class="category">
		<input type="password" name="pwd" style="width:200px" size="10">&nbsp;&nbsp;(不修改请默认)&nbsp; 身份证号：<input type="text" name="sfz" value="<%=rs("sfz")%>">&nbsp;&nbsp;<font color="#ff0000">*</font></td>
      </tr><%if nowuserid=1 and  instr(allsx,"userkey")>0 then%>
	  <tr>
        <td height="30" align="right">绑定SUN盾ID：</td>
        <td class="category">
		<input type="text" name="sunkey" id="sunkey"  size="27" value="<%=sunkey%>"><INPUT type="button" value="获取SUN盾ID" id=button1 name=button1 onclick="javascript:SendKeyInfo1()" ></td>
      </tr><%end if%>
	  <tr>
        <td height="30" align="right">职务等级：</td>
        <td class="category"><%=zwxuan(zuzw,"zuzw","dan")%></td>
      </tr>
	  <tr>
        <td height="30" align="right">下属员工：</td>
        <td class="category"><%=userxuan(ygbhao,xsuser,"xsuser","duo")%></td>
      </tr> 	  
      <tr>
        <td align="right" height="30">手机号码：</td>
        <td class="category"><input type="text" name="tel" style="width:200px" value="<%=rs("tel")%>">　ＱＱ号码： <input type="text" name="qq" style="width:200px" value="<%=rs("qq")%>" onKeyUp="this.value=this.value.replace(/\D/g,'')"  onafterpaste="this.value=this.value.replace(/\D/g,'')"></td>
      </tr>
	  <tr>
        <td align="right" height="30">Email：</td>
        <td class="category"><input type="text" name="email" style="width:200px" value="<%=rs("email")%>">　家庭住址：<input type="text" name="address" style="width:300px" value="<%=rs("address")%>"></td>
      </tr>
      <tr>
        <td align="right" height="30">日常工作安排：</td>
        <td class="category"><textarea rows="4" name="rcwork" cols="74"><%=rs("rcwork")%></textarea></td>
      </tr>
<%if instr(quanxs,"qxtx")>0 then%><tr>
        <td align="right" height="30" valign="top">账号权限<input name="chkall" type="checkbox" id="chkall" value="select" onClick="CheckAll(this.form)" style="border:0"> 全选
<br><input type="reset" value=" 恢复默认 " class="button"></td>
        <td class="category">
		<table cellpadding="3" cellspacing="0" width="100%" border="0">
		  <tr>
			<td style="background-color: #DDDDDD">
			<b>菜单权限</b>  
<input type="checkbox" name="quanxian" value="ccdk" <%if instr(nowqx,"ccdk")>0 then%>checked<%end if%>>查看
<input type="checkbox" name="quanxian" value="zcdj" <%if instr(nowqx,"zcdj")>0 then%>checked<%end if%>>增加 
<input type="checkbox" name="quanxian" value="scdc" <%if instr(nowqx,"scdc")>0 then%>checked<%end if%>>删除
<input type="checkbox" name="quanxian" value="xcdg" <%if instr(nowqx,"xcdg")>0 then%>checked<%end if%>>修改   <%if instr(nowqx,"admall")>0 or  nowuserid=1 then%><input type="checkbox" name="quanxian" value="admall" <%if instr(nowqx,"admall")>0 then%>checked<%end if%>><font color="#FF0000">查看全局数据<%end if%>  <%if instr(nowqx,"admall")>0 or  nowuserid=1 then%><input type="checkbox" name="quanxian" value="admxgall" <%if instr(nowqx,"admxgall")>0 then%>checked<%end if%>><font color="#FF0000">修改全局数据<%end if%>

<%if instr(nowqx,"pbkeys")>0   or  nowuserid=1 then%><input type="checkbox" name="quanxian" value="pbkeys" <%if instr(nowqx,"pbkeys")>0 then%>checked<%end if%>><font color="#FF0000">查看字段屏蔽的数据<%end if%>

			</font>
</td></tr>
<tr>
		    <td width="100%">
<%
sql="select * from sz_cd where cla1=0 order by cdpx desc,id asc"  
set rsc1 =server.createobject("ADODB.RecordSet")	
rsc1.open sql,conn,1,3
shu=rsc1.recordcount
if not rsc1.bof then
do while not rsc1.eof
id1=chk0(rsc1("id"))
Response.Write "<input type=""checkbox"" name=""quanxian"" value=""c"&id1&"d"""
if instr(nowqx,"c"&id1&"d")>0 then Response.Write "checked" 
Response.Write "><b>"&rsc1("cdname")&"</b>："

sql="select * from SZ_cd where cla1="&id1&" order by cdpx desc,id asc"
set rsc2=conn.execute(sql)
if not rsc2.bof then
do while not rsc2.eof
id2=chk0(rsc2("id"))
Response.Write "<input type=""checkbox"" name=""quanxian"" value=""c"&id2&"d"""
if instr(nowqx,"c"&id2&"d")>0 then Response.Write "checked" 
Response.Write ">"&rsc2("cdname")&"&nbsp;"
rsc2.movenext
loop
end if
rsc2.close:set rsc2=nothing

Response.Write "</ul></div>"
aa=ii
rsc1.movenext
loop
end if
rsc1.close:set rsc1=nothing
%>
</td>
		  </tr>	
<tr>
		    <td width="100%" style="background-color: #DDDDDD">
<b>模型权限</b>
<input type="checkbox" name="quanxian" value="cmxk" <%if instr(nowqx,"cmxk")>0 then%>checked<%end if%>>查看
<input type="checkbox" name="quanxian" value="zmxj" <%if instr(nowqx,"zmxj")>0 then%>checked<%end if%>>增加 
<input type="checkbox" name="quanxian" value="smxc" <%if instr(nowqx,"smxc")>0 then%>checked<%end if%>>删除
<input type="checkbox" name="quanxian" value="xmxg" <%if instr(nowqx,"xmxg")>0 then%>checked<%end if%>>修改
<input type="checkbox" name="quanxian" value="smxh" <%if instr(nowqx,"smxh")>0 then%>checked<%end if%>>审核
</td></tr>	
<tr>
<td width="100%"><%
sql="select * from sz_mx where bid=0 order by mxpx desc,id asc"  
set rsc1 =server.createobject("ADODB.RecordSet")	
rsc1.open sql,conn,1,3
shu=rsc1.recordcount
if not rsc1.bof then
do while not rsc1.eof
Response.Write "<input type=""checkbox"" name=""quanxian"" value=""m"&rsc1("id")&"x"""
if instr(nowqx,"m"&rsc1("id")&"x")>0 then Response.Write "checked" 
Response.Write "><b>"&rsc1("mxname")&"</b>："

sql="select * from SZ_mx where bid="&rsc1("id")&" order by mxpx desc,id asc"
set rsc2=conn.execute(sql)
if not rsc2.bof then
do while not rsc2.eof
Response.Write "<input type=""checkbox"" name=""quanxian"" value=""m"&chk0(rsc2("id"))&"x"""
if instr(nowqx,"m"&rsc2("id")&"x")>0 then Response.Write "checked" 
Response.Write ">"&rsc2("mxname")&"&nbsp;"

sql="select * from SZ_mx where bid="&rsc2("id")&" order by mxpx desc,id asc"
set rsc3=conn.execute(sql)
if not rsc3.bof then
do while not rsc3.eof
Response.Write "<input type=""checkbox"" name=""quanxian"" value=""m"&chk0(rsc3("id"))&"x"""
if instr(nowqx,"m"&rsc3("id")&"x")>0 then Response.Write "checked" 
Response.Write ">"&rsc3("mxname")&"&nbsp;"
rsc3.movenext
loop
end if
rsc3.close:set rsc3=nothing

rsc2.movenext
loop
end if
rsc2.close:set rsc2=nothing

Response.Write "</ul></div>"
aa=ii
rsc1.movenext
loop
end if
rsc1.close:set rsc1=nothing
%></td>
		  </tr>	
		  <tr><td bgcolor="#DDDDDD">
			<input type="checkbox" name="quanxian" value="x0t" <%if instr(nowqx,"x0t")>0 then%>checked<%end if%>><b>系统设置</b>
			
<input type="checkbox" name="quanxian" value="cxtk" <%if instr(nowqx,"cxtk")>0 then%>checked<%end if%>>查看
<input type="checkbox" name="quanxian" value="zxtj" <%if instr(nowqx,"zxtj")>0 then%>checked<%end if%>>增加 
<input type="checkbox" name="quanxian" value="sxtc" <%if instr(nowqx,"sxtc")>0 then%>checked<%end if%>>删除
<input type="checkbox" name="quanxian" value="xxtg" <%if instr(nowqx,"xxtg")>0 then%>checked<%end if%>>修改
<input type="checkbox" name="quanxian" value="sxth" <%if instr(nowqx,"sxth")>0 then%>checked<%end if%>>审核
</td></tr>
		  <tr>
		    <td>
<input type="checkbox" name="quanxian" value="x1t" <%if instr(nowqx,"x1t")>0 then%>checked<%end if%>>基本信息设置
<%if nowuserid=1 then%><input type="checkbox" name="quanxian" value="x2t" <%if instr(nowqx,"x2t")>0 then%>checked<%end if%>>模型管理
<input type="checkbox" name="quanxian" value="x3t" <%if instr(nowqx,"x3t")>0 then%>checked<%end if%>>报表管理 
<input type="checkbox" name="quanxian" value="x4t" <%if instr(nowqx,"x4t")>0 then%>checked<%end if%>>菜单管理<%end if%>
<input type="checkbox" name="quanxian" value="smstx" <%if instr(nowqx,"smstx")>0 then%>checked<%end if%>>短信/邮件提醒
<p><input type="checkbox" name="quanxian" value="x5t" <%if instr(nowqx,"x5t")>0 then%>checked<%end if%>>部门管理 
<input type="checkbox" name="quanxian" value="x6t" <%if instr(nowqx,"x6t")>0 then%>checked<%end if%>>职位管理 
<input type="checkbox" name="quanxian" value="x7t" <%if instr(nowqx,"x7t")>0 then%>checked<%end if%>>员工管理（<input type="checkbox" name="quanxian" value="qxtx" <%if instr(nowqx,"qxtx")>0 then%>checked<%end if%>>权限设置） 
<input type="checkbox" name="quanxian" value="x8t" <%if instr(nowqx,"x8t")>0 then%>checked<%end if%>>数据管理
<input type="checkbox" name="quanxian" value="x9t" <%if instr(nowqx,"x9t")>0 then%>checked<%end if%>>登陆日志

</p></td>
		  </tr>
		</table>		</td>
      </tr><%end if%>	
      <tr>
	    <td height="30">　</td>
        <td class="category">
		  <input type="submit" value=" 确认修改 " onClick="return check()" class="button">&nbsp;&nbsp;&nbsp;&nbsp;
		  <input type="hidden" name="hid1" value="ok">
		  <input type="hidden" name="id" value="<%=request("id")%>">
		  <input type="reset" value=" 重置 " class="button">
		  <input type="button" value=" 放弃修改返回 " onClick="window.history.go(-1)" class="button">
		  </td>
      </tr>	    
</table>
</td>
<td></td>
</tr>
<tr>
<td><img src="../images/r_4.gif" alt="" /></td>
<td></td>
<td><img src="../images/r_3.gif" alt="" /></td>
</tr>
</table>
</form>
<%
else
nowbianhao=requestA("bianhao")
nowqq=requestA("qq")
nowemail=requestA("email")
nowid_zu=requestA("zuid")
nowusername=requestA("username")
nowoldusername=requestA("oldusername")
nowpwd=requestA("pwd")
nowuserzt=chk0(requestA("userzt"))
nowxinbie=requestA("xinbie")
nowtel=requestA("tel")
nowaddress=requestA("address")
nowsfz=requestA("sfz")
nowquanxian=replace(requestA("quanxian")," ","")
nowzuzw=requestA("zuzw")
nowquanxian=replace(requestA("quanxian")," ","")
nowxsuser=replace(requestA("xsuser")," ","")&","
nowsunkey=requestA("sunkey")
nowrcwork=requestA("rcwork")

sql="select * from login where bianhao='"&nowbianhao&"' and id<>"&request("id")
set rs=conn.execute(sql)
if rs.eof=false then
Response.Write "<script language='javascript'>alert('您输入的编号已经存在,请重新输入！');history.back();</script>":Response.end
end if

sql="select * from login where username='"&nowusername&"' and id<>"&request("id")
set rs=conn.execute(sql)
if rs.eof=false then
Response.Write "<script language='javascript'>alert('您输入的姓名已经存在，如果有同名员工，请加以区分！');history.back();</script>":Response.end
end if
qxxxs=" bianhao='"&nowbianhao&"',username='"&nowusername&"',userzt="&nowuserzt&",xinbie='"&nowxinbie&"',tel='"&nowtel&"',address='"&nowaddress&"',sfz='"&nowsfz&"',qq='"&nowqq&"',email='"&nowemail&"',id_zu="&nowid_zu&",zuzw='"&nowzuzw&"',xsuser='"&nowxsuser&"',rcwork='"&nowrcwork&"' "

if len(nowquanxian)>10 then qxxxs=qxxxs&",quanxian='"&nowquanxian&"'"

if nowuserid=1 and instr(allsx,"userkey")>0 then  qxxxs=qxxxs&",sunkey='"&nowsunkey&"'"

if nowpwd="" then
  sql="update login set "&qxxxs&" where id="&request("id")
else
  sql="update login set pwd='"&md5(nowpwd)&"',"&qxxxs&" where id="&request("id")
end if
conn.execute(sql)
if nowoldusername=request.Cookies("sunzom_username") then
  Response.Cookies("sunzom_username")=nowusername
end if
conn.execute("insert into rizi(username,class,address,rznr) values('"&nowuser&"|"&nowuserhao&"','修改用户数据','"&userip&"','"&nowbianhao&"-"&nowusername&"')")

Response.Write ("<Script> if (confirm('修改成功,继续修改吗?')) { location.href='user_modi.asp?id="&id&"';} else{location.href='user.asp';}</script>")
end if
%>
</body>
</html>