<%@page import="com.zky.para.Para"%>
<%@include file="/auth.jsp"%>
<%@page language="java" contentType="text/html;charset=utf-8"%>
<jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara"/>
<%
String fileState="";
String secret="";
String writeDate="";
String year[]=null;
String sj = Common.convertNull(request.getParameter("sj"));
String qj = Common.convertNull(request.getParameter("qj"));
String school = Common.convertNull(request.getParameter("school"));
HashFmlBuf bufs=(HashFmlBuf)request.getAttribute("bufEmployee");	//读取学生编号
String provideState=""; 
String areaid=(String)request.getAttribute("areaid");
HashFmlBuf bufschool=(HashFmlBuf)request.getAttribute("writeDepartment");	//通过区县读取学校
String optrid = login_obj.optrid;
String optrjob = getPara.getDesc("TAB_EMPLOYEE","EMPID","EMPJOB",optrid);
Login login = (Login) request.getSession().getAttribute("login");
%>
<html>
<head>
<title>资产销毁管理</title>
<link rel="stylesheet" type="text/css" href="../../../css/font.css">
<script src="/js/check.js"></script>

<link rel="stylesheet" type="text/css" href="../../../js/2k3Grid.css">
<link rel="stylesheet" type="text/css" href="../../../js/2k3Menu.css">
<link rel="stylesheet" type="text/css" href="../../../js/2k3Dialog.css">
<style type="text/css">
select
{
   width:155px;
}
</style>
<script>
function setValue() {
<%
if(!Common.isNull(sj))
{
	out.println("form1.sj.value='" + sj + "';");
}
if(!Common.isNull(qj))
{
	out.println("form1.qj.value='" + qj + "';");
}
if(!Common.isNull(school))
{
	out.println("form1.school.value='" + school+ "';");
}
%>	
}
function check(operate,useId) {
	form1.operate.value=operate;
	if (operate == "DestoryPropertyId") {
		if (form1.destoryType.value=='') {
			alert("请选择销毁方式");
			form1.destoryType.focus();
			return false;
		}
		var destoryType=document.getElementById("destoryType");
		var selecvalue=destoryType.options[destoryType.selectedIndex].text; 
		if (!confirm("确定要销毁这件资产吗?")) {
			return false;
		}
		alert(selecvalue);
		if(selecvalue=="保密局销毁"){
		    <%
			 if(optrjob.equals("管理员岗位")){
			%>
			         form1.action = "/servlet/PropertyDestoryManage?operate=DestoryPropertyId&useId=" + useId;
			<%
			}else if(optrjob.equals("销毁人员岗位")){
			 %>
				form1.action = "/servlet/PropertyDestoryManage?operate=DestoryPropertyId&useId=" + useId;
			 <%
		         }else{
			  %>
			             alert("没有销毁的权限");
			  <%
			      }
		      %>
		}else if(selecvalue=="自行销毁"){
			form1.action = "/servlet/PropertyDestoryManage?operate=DestoryPropertyId&useId=" + useId;
		}else{
			alert("没有权限销毁");
		}
	}
	if (operate == "queryPropertyDestoryPage"){
		if (form1.sj.value=='') {
			alert("请选择地市!");
			form1.sj.focus();
			return false;
		}
		
		if (form1.qj.value == "") {
		alert("请选择区县!");
		form1.qj.focus();
		return false;
		}
	}
	form1.button1.disabled=true;
	form1.submit();
}
function selectChange(i)
{
	form1.action = "/zhyw/smsb/sbxh/propertyDestoryManage.jsp";
	form1.submit();
}
</script>
</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/PropertyDestoryManage">
<input type="hidden" name="operate" value=""/>
			<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="sj" setValue="<%=sj%>" onChange="selectChange(1);">
		   		<%=Para.getSj(getPara)%>            					
			</select><font color="#ff0000">*</font>
		</td>		
		<td class="cell1">所属区县</td>
		<td class="cell2">
			<select class='aselect' name="qj" setValue="<%=qj%>"  onChange="selectChange(1);">
		   		<%=Para.getQj(getPara,sj)%>            					
			</select><font color="#ff0000">*</font>
			</td>
	    </tr>
	<tr bgcolor="#FFFFFF">
		<td class="cell1">销毁单位</td>
		<td class="cell2">
			<select class='aselect' name="school" setValue="<%=school%>">
		   		<%=Para.getXx(getPara,login_obj,qj)%>            					
			</select>
		</td>		
   		<td class="cell1">销毁方式</td>
   		<td class="td1">
   		<select class='aselect' name="destoryType" id="destoryType" >
		   		<%
			if (secret.equals("")){
			out.println(Para.getStatic(getPara,"DESTORYTYPE"));
			%>
			<script>
			form1.destoryState.value='<%=provideState%>';
			</script>
			<%	
			}else{
			out.println(getPara.getSParaFilter("td_s_static","data_code","dataname","type_code","DESTORYTYPE","data_code",provideState));
			}
			%>          					
			</select>	
		</td>
		</tr>
		<tr bgcolor="#FFFFFF">
		<td class="cell1">销毁状态</td>
		<td class="cell2">
			<select class='aselect' name="destoryState" id="destoryState" >
		   		<%
			if (secret.equals("")){
			out.println(Para.getStatic(getPara,"DESTORYSTATE"));
			%>
			<script>
			form1.destoryState.value='<%=provideState%>';
			</script>
			<%	
			}else{
			out.println(getPara.getSParaFilter("td_s_static","data_code","dataname","type_code","DESTORYSTATE","data_code",provideState));
			}
			%>          					
			</select>
		</td>		
		<td class="cell1"></td>
   		<td class="td1">
		</td>
		</tr>
</table>
<br>
<table width="90%" align="center">
	<tr align="center">
		<td>
		<input type="button" name="button1" value=" 查询 " class="box_button" onclick="check('queryPropertyDestoryPage');"/>&nbsp;&nbsp;&nbsp;&nbsp;
		
		</td>
	</tr>
</table>
<br>
</td>
</tr>
</table> 
<br>
	<%
	HashFmlBuf buf = (HashFmlBuf) request.getAttribute("useBuf");
	if (buf != null) {
		int rowcount = buf.getRowCount();
    %>
	<center>
			<div style="width:90%; height:280px;overflow: auto;">
  				<div id="myGrid" class="2k3Grid" borderWidth="0" contextMenu="mnuGridContextMenu" altRowColor="oldLace">
    				<div class="gridHead">
    				 <!--div align="left"><span width="5%">共检索到<%=rowcount%>条记录</span></div-->
          				<div class="gridRow">
		<span width="5px" style="text-align: center;">序号</span>
		<span width="10px" >操作</span>
		<span width="15px">资产编号</span>
		<span>销毁状态</span>
		<span>销毁单位</span>
		<span>销毁人员</span>
		<span width="15px">销毁时间</span>
		<span>销毁类型</span>
	    <span>资产名称</span>
		<span>资产型号</span>
		</div>
    </div>
		<div class="gridBody"> 
<%	
		for (int i=0; i<rowcount; i++) {
			String tempDeptid = buf.fget("id",i);
			String tempstate = buf.fget("property_brand",i);
			String destroystate=buf.fget("DESTORY_STATE",i);
			String destroytype=buf.fget("DESTORY_TYPE", i);
			String tempFrameworkid = buf.fget("property_no",i);
			if (destroystate.equals("1")) {
				destroystate = "已销毁";
			   } 
		  else{
			  destroystate = "未销毁";
			} 
			if (destroytype.equals("1")) {
				destroytype = "保密局销毁";
			   } 
		  else if(destroytype.equals("0")){
			  destroytype = "自行销毁";
			} else{
				destroytype="";
			}
%>	
        <div class="gridRow">
		<span width="5px" style="text-align: center;"><%=i+1%></span>
			<span><input type="button"  name="button3" value="销毁" onclick="check('DestoryPropertyId','<%=buf.fget("id",i)%>')"
		  <%
	      if(buf.fget("DESTORY_STATE",i).equals("1"))
	      { %>
	      class="nobox_button"  disabled=disabled;
	      <%}else { %>
	      class="box_button" 
	      <%} %>
		 /></span>
		<span width="15px"><%=tempDeptid%></span>
		<span>
		<%
	   if(destroystate.equals("已销毁")){
		%>
		     <%=destroystate %>
		<%   
	   }else{
	   %>
	   <font color="#ff0000"><%=destroystate %></font>
	   <%
	   }
	     %>
		</span>
		<span><%=buf.fget("departname",i)%></span>
		<span><%=buf.fget("empname",i)%></span>
		<span width="15px"><%=buf.fget("DESTORY_DATE",i)%></span>
		<span><%=destroytype%></span>
		<span><%=buf.fget("property_brand",i) %></span>
		<span><%=buf.fget("property_no",i) %></span>
		</div>
      <%
		}
       %>	
	                 </div>
					<!-- gridBody end -->
				</div>
				<!-- myGrid end -->
    		</div>
    <tag:PageLinkTag operate="queryPropertyReceivePage"  scope="request" width="90%" align="center"/>
	</form>	
	<table width="90%" align="center">
		<tr align="center">
		<td></td>
		</tr>
	</table>
<%	
	}
%>	
<%@include file="/foot.jsp"%>
</body>
</html>