<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="cm" uri="/commons-tags" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>员工合管理</title>
<link href="../resources/style/base.css" rel="stylesheet" type="text/css"/>
<s:include value="../common/head.jsp" />
<script language="javascript" src="../code/vm/ExtCodeJs.htm"></script>
<script language="javascript" src="../resources/js/calendar/calendar.js"></script>
<script type="text/javascript">

function emplAdd(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择您要添加合同的员工。");
		return;
	}
	iframeWindow("<s:url namespace='/employe' action='emplContractOperate'/>?oper=add&contract.emplInfo.id="+getCheckedValue("sid"),550,550,"新增人事合同",refreshWindow);	
}

function emplEdit(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择您要修改合同的员工。");
		return;
	}
	var conId=gi("contract_id_"+getCheckedValue("sid")).value;
	if(conId==""){
		msgAlert("您选择的员工没有可以修改的合同。");
		return;
	}
	iframeWindow("<s:url namespace='/employe' action='emplContractOperate'/>?oper=edit&contract.id="+conId,550,550,"修改当前人事合同",refreshWindow);	
}

function emplDelete(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择您要删除合同的员工。");
		return;
	}
	var conId=gi("contract_id_"+getCheckedValue("sid")).value;
	if(conId==""){
		msgAlert("您选择的员工没有可以删除的合同。");
		return;
	}
	msgConfirm("您确认要删除该当前的人事合同记录吗？",function(){
	iframeWindow("<s:url namespace='/employe' action='emplContractDelete'/>?contract.id="+conId,400,200,'删除当前人事合同',refreshWindow);
	});
}
</script>
</head>

<body>
<div class="body_list">
  <s:include value="../common/body.jsp" />
  <s:form action="emplContractList" id="queryForm" onsubmit="return checkForm(this)">
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_line">
      <tr class="form_title">
        <td colspan="6">查询条件</td>
      </tr>
      <tr class="form_item">
        <td width="19%">合同编号：
          <s:textfield name="contract.contractNo" cssStyle="width:100px;"/></td>
        <td width="20%">合同状态：
          <s:select cssStyle="width:100px;" name="contract.status.id" list='#request.SysCodeFinder.find("EMPL_CONTRACT_STATUS")' headerKey="" headerValue="" listKey="id" listValue="codeName"/></td>
        <td colspan="2"> 开始日期：
          <s:textfield name="contract.beginDate" onClick="showDate(this)" readonly="true" cssClass="date_input" cssStyle="width:85px;">
            <s:param name="value">
              <s:date name="contract.beginDate" format="yyyy-MM-dd"/>
            </s:param>
          </s:textfield>
          至
          <s:textfield name="contract.endDate" onClick="showDate(this)" readonly="true" cssClass="date_input" cssStyle="width:85px;">
            <s:param name="value">
              <s:date name="contract.endDate" format="yyyy-MM-dd"/>
            </s:param>
          </s:textfield></td>
        <td width="16%">工号：
          <s:textfield name="contract.emplInfo.emplNo" title="工号必须为数字。"  cssStyle="width:100px;"/></td>
        <td width="17%">部门：
          <s:textfield name="contract.emplInfo.emplOrg.name" readonly="true" cssClass="find_input" onClick="codeTree('emplOrgTree',gi('eimpOrgId'),this)" cssStyle="width:100px;"/>
          <s:hidden name="contract.emplInfo.emplOrg.id" id="eimpOrgId"/></td>
      </tr>
      <tr class="form_item1">
        <td>合同类型：
          <s:select cssStyle="width:100px;" name="contract.contractType.id" list='#request.SysCodeFinder.find("EMPL_CONTRACT_TYPE")' headerKey="" headerValue="" listKey="id" listValue="codeName"/></td>
        <td>签定状态：
          <s:select cssStyle="width:100px;" name="signed" list="#{'true':'已签','false':'未签'}" headerKey="" headerValue=""/></td>
        <td colspan="2">结束日期：
          <s:textfield name="endDate1" onClick="showDate(this)" readonly="true" cssClass="date_input" cssStyle="width:85px;">
            <s:param name="value">
              <s:date name="endDate1" format="yyyy-MM-dd"/>
            </s:param>
          </s:textfield>
          至
          <s:textfield name="endDate2" onClick="showDate(this)" readonly="true" cssClass="date_input" cssStyle="width:85px;">
            <s:param name="value">
              <s:date name="endDate2" format="yyyy-MM-dd"/>
            </s:param>
          </s:textfield></td>
        <td>姓名：
          <s:textfield name="contract.emplInfo.name" cssStyle="width:100px;"/></td>
        <td align="center"><input name="q" value="查 询" onclick="query()" type="button" /></td>
      </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"  style="margin:15px 0 5px 0;" >
      <tr>
        <td><input type="button" name="add" onclick="emplAdd()" value="新增合同"/>
          <input type="button" name="edit" onclick="emplEdit()" value="修改当前合同"/>
          <input type="button" name="delete" onclick="emplDelete()" value="删除当前合同"/></td>
      </tr>
    </table>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table_line">
      <tr class="list_title">
        <td width="3%" align="center"><input type="radio" name="array" onclick="checkedAll(this)" value="checkbox" /></td>
        <td width="8%">工号</td>
        <td width="5%">姓名</td>
        <td width="16%">部门</td>
        <td width="7%">状态</td>
        <td width="9%">合同编号</td>
        <td width="10%">合同类型</td>
        <td width="11%">合同状态</td>
        <td width="11%"> 开始日期</td>
        <td width="10%"> 结束日期</td>
        <td width="10%">附件</td>
      </tr>
      <s:iterator value="emplContractList" status="st">
        <s:set name="row_cls" value=""/>
        <s:if test="#st.Even">
          <s:set name="row_cls" value="%{'row_a'}"/>
        </s:if>
        <tr class="list_data center <s:property value='#row_cls'/>">
          <td align="center"><input type="radio" name="array" value="<s:property value='top[0].id'/>" lang="sid"/>
		  <input id="contract_id_<s:property value='top[0].id'/>" type="hidden" value="<s:property value='top[1].id'/>" />		  </td>
          <td><s:property value="top[0].emplNo"/></td>
          <td><s:property value="top[0].name"/></td>
          <td><s:property value="top[0].emplOrg.name"/></td>
          <td>
		  	<s:if test="top[1]==null">未签</s:if>
			<s:else>已签</s:else>
		  </td>
          <td><s:property value="top[1].contractNo"/></td>
          <td class="center"><s:property value="top[1].contractType.codeName"/></td>
          <td class="center"><s:property value="top[1].status.codeName"/></td>
          <td class="center"><s:date name="top[1].beginDate" format="yyyy-MM-dd" /></td>
          <td class="center"><s:date name="top[1].endDate" format="yyyy-MM-dd" /></td>
          <td class="center"><s:if test="top[1].attach!=null&&top[1].attach.id!=null&&top[1].attach.id!=''"> &nbsp; <a href="<s:url namespace='/system' action='sysFileItemGet'/>?id=<s:property value='top[1].attach.id'/>" 
                    target="_blank" title="<s:property value='top[1].attach.name'/>"><img border="0" src="../resources/style/images/attach.gif" width="16" height="16" /></a> </s:if>
            &nbsp; </td>
        </tr>
      </s:iterator>
    </table>
    <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="list_page">
      <tr>
        <td><cm:pager/></td>
      </tr>
    </table>
  </s:form>
</div>
</body>
</html>