<%@page import="com.zky.para.Para"%>
<%@include file="/auth.jsp"%>
<%@page import="java.util.Date"%>
<%@page language="java" pageEncoding="utf-8" %>
<jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara"/>
<%
HashFmlBuf recoverBuf=(HashFmlBuf)request.getAttribute("recoverBuf");
String secret="";
String useid=(String)request.getAttribute("useid");
String useid1=Common.convertNull(request.getParameter("useid"));
String schoolid=(String)request.getAttribute("schoolid");
String areaid1=Common.convertNull(request.getParameter("areaid"));
// String deptid1 = Common.convertNull(request.getParameter("deptid"));
String frameworkid1=Common.convertNull(request.getParameter("frameworkid"));
String schoolid1=Common.convertNull(request.getParameter("schoolid"));
String useempid=(String)request.getAttribute("useempid");
String useempid1=Common.convertNull(request.getParameter("useempid"));
String filevalidity=(String)request.getAttribute("filevalidity");
String fileTitle=(String)request.getAttribute("fileTitle");
String fileCode=(String)request.getAttribute("fileCode");
String fileName=(String)request.getAttribute("fileName");
String fileDescribe=(String)request.getAttribute("fileDescribe");
String purpose=(String)request.getAttribute("purpose");
String remark=(String)request.getAttribute("remark");
String propertyType=(String)request.getAttribute("propertyType");
String propertyType1=Common.convertNull(request.getParameter("propertyType"));
HashFmlBuf bufs=(HashFmlBuf)request.getAttribute("bufEmployee");	//读取学生编号
HashFmlBuf bufschool=(HashFmlBuf)request.getAttribute("writeDepartment");	//通过区县读取学校
HashFmlBuf useBuf=(HashFmlBuf)request.getAttribute("useBuf");
HashFmlBuf receiveBuf=(HashFmlBuf)request.getAttribute("receiveBuf");
String areaid=(String)request.getAttribute("areaid");
String studentid=(String)request.getAttribute("studentid");	
%>
<html>
<head>
<title>设备回收管理</title>
<link href="../../../css/font.css" rel="stylesheet" type="text/css">
<script src="../../../js/date.js"></script>
<script src="../../../js/check.js"></script>
<script>
function setValue()
{
	<%
		if(!Common.isNull(frameworkid1))
		{
			out.println("form1.frameworkid.value='" + frameworkid1 + "';");
		}
		if(!Common.isNull(areaid1))
		{
			out.println("form1.areaid.value='" + areaid1 + "';");
		}
		if(!Common.isNull(schoolid1))
		{
			out.println("form1.schoolid.value='" + schoolid1 + "';");
		}
		if(!Common.isNull(useempid1))
		{
			out.println("form1.useempid.value='" + useempid1+ "';");
		}
		
		if(!Common.isNull(propertyType1))
		{
			out.println("form1.propertyType.value='"+propertyType1+"';");
		}
		if(!Common.isNull(useid1))
		{
			out.println("form1.useid.value='"+useid1+"';");
		}
	%>	
}
function checkNumber()
{
	if(parseInt(form1.indentureId.value))
	{	
		return true;
	}
	else
	{
		alert("维修商编号只能输入数字");
		form1.indentureId.focus();
		return false;
	}	
}
function check(operate) {
	form1.operate.value = operate;
	if(form1.operate.value="addPropertyRecover"){
	
	if(form1.schoolid.value=="")
	{
		alert("请选择回收单位");
		form1.schoolid.focus();
		return false;
	}
	if(form1.useempid.value=="")
	{
		alert("请选择回收人员");
		form1.useempid.focus();
		return false;
	}
	if(form1.confirmDept.value=="")
	{
		alert("请选择提交单位");
		form1.confirmDept.focus();
		return false;
	}
	if(form1.confirmStaff.value=="")
	{
		alert("请选择提交人员");
		form1.confirmStaff.focus();
		return false;
	}
	if(form1.recoverCause.value=="")
	{
		alert("请输入回收事由");
		form1.recoverCause.focus();
		return false;
	}
	if(form1.recoverType.value=="")
	{
		alert("请选择回收类型");
		form1.recoverType.focus();
		return false;
	}
}  
	form1.button1.disabled=true;
	//form1.button2.disabled=true;
	form1.submit();
}
function getClass(parasm){	
var optiontext="";
for (i = 1; i < document.getElementById(parasm).length; i++) {
    if (document.getElementById(parasm).options[i].selected == true) {
       optiontext = document.getElementById(parasm).options[i].value;
    }
}

if(optiontext!=""){
     //通过区县读取学校
     var useId=form1.useId.value;
     if(parasm=="areaid"){
       	location="/servlet/PropertyRecoverManage?operate=readAridSchool&areaid="+optiontext+"&useId="+useId;
     }
     if(parasm=="schoolid"){	   
       			location="/servlet/PropertyRecoverManage?operate=readEmployeeByDepartment&schoolid="+optiontext+"&areaid=<%=areaid%>"+"&useId="+useId;
     }
     
     if(parasm=="useid")
     {
    	 location="/servlet/PropertyRecoverManage?operate=queryReceiveInfoByUseId&useid="+optiontext+"+&areaid=<%=areaid%>&schoolid=<%=schoolid%>&useempid=<%=useempid%>";
     }
     if (parasm=="typeInfo") {
       	 if (
       			document.getElementById(parasm).value=="2" || document.getElementById(parasm).value=="3" || document.getElementById(parasm).value=="5"||
       			document.getElementById(parasm).value=="6"||document.getElementById(parasm).value=="7" || document.getElementById(parasm).value=="8" || 
       			document.getElementById(parasm).value=="9") {
       		 //document.getElementById("termInfo").disabled=true;
       	 }else {
           	 //document.getElementById("termInfo").disabled=false;
            }
       	 
        }
}

}
function checklength(el,size){
    if(el.value.length > size){ 
        alert("字数超过限制");
    }
 el.value = el.value.substring(0,size);
}

</script>
<style type="text/css">
.aselect
{
   width:156px;
}
</style>

<style type="text/css">
	
	.td1{
		width: 30%;
	}
table#csstable{
	border-top:#D8E9FE 1px solid;
	border-left:#D8E9FE 1px solid;
}
table#csstable td{
	border-bottom:#D8E9FE 1px solid;
	border-right:#D8E9FE 1px solid;
}

table#csstable #bottomcss td{

	border-bottom:#D8E9FE 0px solid;
}

</style>
</head>
<body onload="setValue();">
<br>
<table width="90%"  border="0" align="center" cellpadding="0" cellspacing="1" class="box">
  <tr>
    <td valign="top"><table width="100%" height="23"  border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="25%" background="../../../images/tab_search_01.jpg"><table width="80%" height="23" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="3%"><img src="../../../images/little_red.jpg" width="12" height="12"></td>
                <td width="97%" class="font12b">&nbsp;设备回收管理</td>
              </tr>
          </table></td>
          <td width="82%" background="../../../images/tab_search_03.jpg"><img src="../../../images/tab_search_02.jpg" width="12" height="23"></td>
        </tr>
      </table> 
                         
<form name="form1" method="post" action="/servlet/PropertyRecoverManage">
<input type="hidden" name="operate" value=""/>
<input type="hidden" name="useId" id="useId" value="<%=recoverBuf.fget("use_id",0)%>"/>
<input type="hidden" name="departid" id="departid" value="<%=recoverBuf.fget("use_departid",0)%>"/>
<input type="hidden" name="empid" id="empid" value="<%=recoverBuf.fget("use_staffid",0)%>"/>
<br>
			<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
        		<tr>
          			<td width="3%"><img src="/images/little.gif" width="12" height="12"></td>
          			<td width="97%" class="font12">详细信息填写</td>
        		</tr>
      		</table>	

   <table width="90%"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02">
		 	
		<tr bgcolor="#FFFFFF">
		<td class="cell1">回收单位</td>
		<td class="cell2">
			<select class='aselect' name="schoolid" id="schoolid" onchange="getClass('schoolid')">
		   			
		   		<%
		   		if(bufschool!=null && bufschool.getRowCount()>0){
		   			%><option value="">--请选择--</option>
		   			<%
		   			for(int i=0;i<bufschool.getRowCount();i++){
		   				%>
		   					<option value="<%=bufschool.fget("DEPARTID",i) %>" <%if(bufschool.fget("DEPARTID",i).equals(schoolid)){%> selected="selected" <%} %>><%=bufschool.fget("DEPARTNAME",i) %></option>	
		   				<%
		   			}
		   		}else{
					%>
					<option value="">无单位信息</ option>		
					<%
				}
		   			%>  					
			</select><font color="#ff0000">*</font>
		</td>		
		<td class="cell1">回收人员</td>
   				<td class="td1">
   				<select class='aselect' name="useempid" id="useempid">
   				<%
		   		if(bufs!=null && bufs.getRowCount()>0){
		   			%>
		   			<option value="" selected="selected">--请选择--</option>
		   			<%
		   			for(int i=0;i<bufs.getRowCount();i++){
		   				%>
		   					<option value="<%=bufs.fget("EMPID",i) %>" <%if(bufs.fget("EMPID",i).toString().trim().equals(useempid)){%> selected="selected" <%} %>><%=bufs.fget("EMPNAME",i) %></option>	
		   				<%
		   			}
		   		}else{	
					%>
					<option value="" selected="selected">无人员信息</option>	
					<%
				}
		   			%>  					
   				</select><font color="#ff0000">*</font>		
		</td>
		</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1">回收资产</td>
		<td class="cell2">
			<input type="text" readonly="readonly" id="propertyName" name="propertyName" value="<%=recoverBuf.fget("property_name",0)%>"/><font color="#ff0000">*</font>
		</td>
		<td class="cell1">回收类型</td>
		<td class="cell2">
			<select class='aselect' name="recoverType" id="recoverType">
		   		<%=Para.getProductState(getPara,"RECOVERTYPE")%>            					
			</select><font color="#ff0000">*</font>
		</td>
	</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1">提交单位</td>
		<td class="cell2">
		<select class='aselect' id="confirmDept" name="confirmDept">
			<option value="">--请选择--</option>
			<option selected="selected" value="<%=recoverBuf.fget("use_departid",0)%>"><%=recoverBuf.fget("departname",0)%></option>
		</select><font color="#ff0000">*</font>
		</td>
		<td class="cell1">提交人员</td>
		<td class="cell2">
		<select class='aselect' id="confirmStaff" name="confirmStaff">
			<option value="">--请选择--</option>
			<option selected="selected" value="<%=recoverBuf.fget("use_staffid",0)%>"><%=recoverBuf.fget("empname",0)%></option>
		</select><font color="#ff0000">*</font>
		</td>
	</tr>
	<tr bgcolor="#FFFFFF" class="tr2">
    			<td style="color: #41247B" colspan="4">
    				回收事由:
    			</td>
    		</tr>
    		<tr bgcolor="#FFFFFF" class="tr2">
    			<td colspan="4">
    				<textarea onblur="checklength(this,200)" maxlength="300" name="recoverCause" id="recoverCause" rows="3" cols="93"></textarea>
    				<font color="red">(注:限200字符内)</font><font color="#ff0000">*</font>
    			</td>
    		</tr>
	<tr bgcolor="#FFFFFF" class="tr2">
    			<td style="color: #41247B" colspan="4">
    				备注:
    			</td>
    		</tr>
    		<tr bgcolor="#FFFFFF" class="tr2">
    			<td colspan="4">
    				<textarea onblur="checklength(this,200)" maxlength="300" name="remark" id="remark" rows="3" cols="93"></textarea>
    				<font color="red">(注:限200字符内)</font>
    			</td>
    		</tr>
</table>
	<br>
	<table width="90%" align="center">
		<tr align="center">
		<td><input type="button" name="button1" value=" 提交 " class="box_button" onclick="check('addPropertyRecover');"/>
	&nbsp;&nbsp;
	<input type="button" name="button2" value=" 返回 " class="box_button" onclick="history.back();"/>
		</td>
		</tr>
	</table>	
</form>
			     
	 </td>
  </tr>
</table>
<%@include file="/foot.jsp"%>
</body>
</html>
<script>
function selectArea(frameworkid) {
	var url = "/servlet/SelectPara?select=area&frameworkid=" + frameworkid;
	var callback = changeArea;
	executeXhr(callback, url);
}

function changeArea() {

  if (req.readyState == 4) {

    if (req.status == 200) {
      document.getElementById("areaDiv").innerHTML = "<select class='aselect' name='areaid'>" + req.responseText + "</select> <font color='#FF0000'>*</font>";
    } else {
      alert("There was a problem retrieving the XML data:" +  req.statusText);
    }
  }
}
</script>
<script src="/js/ajaxUtils.js"></script>