<%@ 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 type="text/javascript">

function typeHistory(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要查看薪资历史的员工记录。");
		return;
	}
	var confId=getConfId();
	if(confId==""){
		msgAlert("您选择的员工目前还没有薪资配置记录。");
		return;
	}
	iframeWindow("<s:url action='salaryConfHistory'/>?salaryConf.emplInfo.id="+getCheckedValue("sid"),
		650,500,gi("name_"+getCheckedValue("sid")).innerHTML+" 薪资历史");
}

function typeAdd(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要添加工资配置的员工记录。");
		return;
	}
	var confId=getConfId();
	if(confId!=""){
		msgAlert("您选择的员工已存在工资配置信息，不能进行添加操作。");
		return;
	}
	iframeWindow("<s:url action='salaryConfOperate'/>?oper=add&salaryConf.emplInfo.id="+getCheckedValue("sid"),
		550,500,"添加工资配置信息",refreshWindow);
}

function typeEdit(){
	if(getCheckedCount("sid")!=1){
		msgAlert("请选择一条您要修改的记录。");
		return;
	}
	var confId=getConfId();
	if(confId==""){
		msgAlert("您选择的员工不存在工资配置信息，请点击“添加”按钮配置员工的工资信息。");
		return;
	}	
	iframeWindow("<s:url action='salaryConfOperate'/>?oper=edit&salaryConf.id="+confId,550,500,"修改工资配置信息",refreshWindow);
}

function getConfId(){
	return 	gi("conf_id_"+getCheckedValue("sid")).value;
}

function adjustInsurBase(){
	iframeWindow("<s:url action='salaryConfInsurBaseAdjust'/>?oper=form",830,$(parent.window).height()-20,"调整社保基数",refreshWindow);
}

function salaryConfImport(){
	openUrl("<s:url action='salaryConfImport'/>","导入薪资配置");
}


</script>
</head>

<body>
<div class="body_list">
  <s:include value="../common/body.jsp" />
  <s:form action="salaryConfList" 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="5">查询条件</td>
      </tr>
      <tr class="form_item">
        <td width="22%">工号：
          <s:textfield name="salaryConf.emplInfo.emplNo" title="工号必须为数字。"  cssStyle="width:100px;"/></td>
        <td width="27%" align="left">部门：
          <s:textfield name="salaryConf.emplInfo.emplOrg.name" readonly="true" onClick="codeTree('emplOrgTree',gi('eimpOrgId'),this)" cssStyle="width:100px;" cssClass="find_input"/>
          <s:hidden name="salaryConf.emplInfo.emplOrg.id" id="eimpOrgId"/></td>
        <td width="28%" align="left">薪资级别：<s:select cssStyle="width:120px;" name="salaryConf.salaryLevel.id"  list='salaryLevelList' headerKey="" headerValue="" listKey="id" listValue="name"/></td>
        <td width="23%"><s:checkbox name="showOffJob" fieldValue="true"/> 显示离职员工</td>
      </tr>
      <tr class="form_item1">
        <td>姓名：
          <s:textfield name="salaryConf.emplInfo.name" cssStyle="width:100px;"/></td>
        <td align="left">状态：
        <s:select cssStyle="width:100px;" name="existFlag" list="#{'true':'已配置', 'false':'未配置'}" headerKey="" headerValue=""/>
        </td>
        <td align="left">薪资帐套：<s:select cssStyle="width:120px;" name="salaryConf.salaryAccount.id"  list='salaryAccountList'   headerKey="" headerValue="" listKey="id" listValue="name"/></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="typeAdd()" value="添 加"/>
          <input type="button" name="edit" onclick="typeEdit()" value="修 改"/>
          <input type="button" name="edit" onclick="typeHistory()" value="查看薪资历史"/>
		  <input type="button" name="edit" onclick="adjustInsurBase()" value="调整社保基数"/>
		  <input type="button" name="edit" onclick="salaryConfImport()" 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,'sid')" value="checkbox" /></td>
        <td width="8%">工号</td>
        <td width="7%">姓名</td>
        <td width="15%">部门</td>
        <td width="12%">薪资级别</td>
        <td width="13%">薪资帐套</td>
        <td width="34%">薪资固定项</td>
        <td width="8%">生效月份</td>
      </tr>
      <s:iterator value="emplConfList" 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 <s:property value='#row_cls'/>">
          <td align="center"><input type="radio" name="array" value="<s:property value='top[0].id'/>" lang="sid"/>
            <input id="conf_id_<s:property value='top[0].id'/>" type="hidden" value="<s:property value='top[1].id'/>" />
		  </td>
          <td class="center"><s:property value="top[0].emplNo"/></td>
          <td class="center" id="name_<s:property value='top[0].id'/>"><s:property value="top[0].name"/></td>
          <td><s:property value="top[0].emplOrg.fullName"/></td>
          <td class="center"><s:property value="top[1].salaryLevel.name"/></td>
          <td class="center"><s:property value="top[1].salaryAccount.name"/></td>
          <td><s:iterator value="top[1].detSet">
          	  <div style="float:left; margin-right:10px;" class="nowrap">
              <s:property value="accountItem.name"/>：<s:property value="confValue"/>
              </div>
              </s:iterator></td>
          <td class="center"><s:property value="top[1].beginMonth"/></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>